diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2016-08-26 15:01:10 +0100 |
---|---|---|
committer | Dimitri John Ledkov <xnox@ubuntu.com> | 2016-08-26 15:01:10 +0100 |
commit | ca0dc13dd212ef8ca19fa6128115fe933b055437 (patch) | |
tree | 72ae182f3228d40e5323af2f3dbc6fd6afc9aec8 /inode.c | |
parent | f920a62c2727afb328f967a79bf2e58497007112 (diff) |
New upstream release.debian/4.7.1-1
Diffstat (limited to 'inode.c')
-rw-r--r-- | inode.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -472,6 +472,42 @@ int btrfs_new_inode(struct btrfs_trans_handle *trans, struct btrfs_root *root, } /* + * Change inode flags to given value + */ +int btrfs_change_inode_flags(struct btrfs_trans_handle *trans, + struct btrfs_root *root, u64 ino, u64 flags) +{ + struct btrfs_inode_item *item; + struct btrfs_path *path; + struct btrfs_key key; + int ret; + + path = btrfs_alloc_path(); + if (!path) + return -ENOMEM; + + key.objectid = ino; + key.type = BTRFS_INODE_ITEM_KEY; + key.offset = 0; + + ret = btrfs_search_slot(trans, root, &key, path, 0, 1); + if (ret > 0) { + ret = -ENOENT; + goto out; + } + if (ret < 0) + goto out; + + item = btrfs_item_ptr(path->nodes[0], path->slots[0], + struct btrfs_inode_item); + btrfs_set_inode_flags(path->nodes[0], item, flags); + btrfs_mark_buffer_dirty(path->nodes[0]); +out: + btrfs_free_path(path); + return ret; +} + +/* * Make a dir under the parent inode 'parent_ino' with 'name' * and 'mode', The owner will be root/root. */ |