No title Revision 613866383839 (Wed Oct 24 2018 at 12:47) - Diff Link to this snippet: https://friendpaste.com/6XrGXb5p0RSJGixUFYouHg Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.cindex 64ea749c1ba4..22616c060722 100644--- a/fs/btrfs/inode.c+++ b/fs/btrfs/inode.c@@ -3569,10 +3569,9 @@ static noinline int acls_after_inode_item(struct extent_buffer *leaf, * read an inode from the btree into the in-memory inode */ static int btrfs_read_locked_inode(struct inode *inode,- struct btrfs_path *in_path)+ struct btrfs_path *path) { struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);- struct btrfs_path *path = in_path; struct extent_buffer *leaf; struct btrfs_inode_item *inode_item; struct btrfs_root *root = BTRFS_I(inode)->root;@@ -3588,20 +3587,11 @@ static int btrfs_read_locked_inode(struct inode *inode, if (!ret) filled = true; - if (!path) {- path = btrfs_alloc_path();- if (!path)- return -ENOMEM;- }- memcpy(&location, &BTRFS_I(inode)->location, sizeof(location)); ret = btrfs_lookup_inode(NULL, root, path, &location, 0);- if (ret) {- if (path != in_path)- btrfs_free_path(path);+ if (ret) return ret;- } leaf = path->nodes[0]; @@ -3724,8 +3714,7 @@ static int btrfs_read_locked_inode(struct inode *inode, btrfs_ino(BTRFS_I(inode)), root->root_key.objectid, ret); }- if (path != in_path)- btrfs_free_path(path);+ btrfs_release_path(path); if (!maybe_acls) cache_no_acl(inode);@@ -5669,7 +5658,7 @@ static struct inode *btrfs_iget_locked(struct super_block *s, */ struct inode *btrfs_iget_path(struct super_block *s, struct btrfs_key *location, struct btrfs_root *root, int *new,- struct btrfs_path *path)+ struct btrfs_path *in_path) { struct inode *inode; @@ -5679,8 +5668,17 @@ struct inode *btrfs_iget_path(struct super_block *s, struct btrfs_key *location, if (inode->i_state & I_NEW) { int ret;+ struct btrfs_path *path = in_path;++ if (!path) {+ path = btrfs_alloc_path();+ if (!path)+ return ERR_PTR(-ENOMEM);+ } ret = btrfs_read_locked_inode(inode, path);+ if (path != in_path)+ btrfs_free_path(path); if (!ret) { inode_tree_add(inode); unlock_new_inode(inode);