btrfs: use btrfs_inode_lock/btrfs_inode_unlock inode lock helpers
A few places we intermix btrfs_inode_lock with a inode_unlock, and some places we just use inode_lock/inode_unlock instead of btrfs_inode_lock. None of these places are using this incorrectly, but as we adjust some of these callers it would be nice to keep everything consistent, so convert everybody to use btrfs_inode_lock/btrfs_inode_unlock. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
8318ba79ee
commit
64708539cd
@@ -226,7 +226,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
inode_lock(inode);
|
||||
btrfs_inode_lock(inode, 0);
|
||||
fsflags = btrfs_mask_fsflags_for_type(inode, fsflags);
|
||||
old_fsflags = btrfs_inode_flags_to_fsflags(binode->flags);
|
||||
|
||||
@@ -353,7 +353,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
|
||||
out_end_trans:
|
||||
btrfs_end_transaction(trans);
|
||||
out_unlock:
|
||||
inode_unlock(inode);
|
||||
btrfs_inode_unlock(inode, 0);
|
||||
mnt_drop_write_file(file);
|
||||
return ret;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ static int btrfs_ioctl_fssetxattr(struct file *file, void __user *arg)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
inode_lock(inode);
|
||||
btrfs_inode_lock(inode, 0);
|
||||
|
||||
old_flags = binode->flags;
|
||||
old_i_flags = inode->i_flags;
|
||||
@@ -501,7 +501,7 @@ out_unlock:
|
||||
inode->i_flags = old_i_flags;
|
||||
}
|
||||
|
||||
inode_unlock(inode);
|
||||
btrfs_inode_unlock(inode, 0);
|
||||
mnt_drop_write_file(file);
|
||||
|
||||
return ret;
|
||||
@@ -1014,7 +1014,7 @@ out_up_read:
|
||||
out_dput:
|
||||
dput(dentry);
|
||||
out_unlock:
|
||||
inode_unlock(dir);
|
||||
btrfs_inode_unlock(dir, 0);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1612,7 +1612,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
|
||||
ra_index += cluster;
|
||||
}
|
||||
|
||||
inode_lock(inode);
|
||||
btrfs_inode_lock(inode, 0);
|
||||
if (IS_SWAPFILE(inode)) {
|
||||
ret = -ETXTBSY;
|
||||
} else {
|
||||
@@ -1621,13 +1621,13 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
|
||||
ret = cluster_pages_for_defrag(inode, pages, i, cluster);
|
||||
}
|
||||
if (ret < 0) {
|
||||
inode_unlock(inode);
|
||||
btrfs_inode_unlock(inode, 0);
|
||||
goto out_ra;
|
||||
}
|
||||
|
||||
defrag_count += ret;
|
||||
balance_dirty_pages_ratelimited(inode->i_mapping);
|
||||
inode_unlock(inode);
|
||||
btrfs_inode_unlock(inode, 0);
|
||||
|
||||
if (newer_than) {
|
||||
if (newer_off == (u64)-1)
|
||||
@@ -1675,9 +1675,9 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
|
||||
|
||||
out_ra:
|
||||
if (do_compress) {
|
||||
inode_lock(inode);
|
||||
btrfs_inode_lock(inode, 0);
|
||||
BTRFS_I(inode)->defrag_compress = BTRFS_COMPRESS_NONE;
|
||||
inode_unlock(inode);
|
||||
btrfs_inode_unlock(inode, 0);
|
||||
}
|
||||
if (!file)
|
||||
kfree(ra);
|
||||
@@ -3112,9 +3112,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
|
||||
goto out_dput;
|
||||
}
|
||||
|
||||
inode_lock(inode);
|
||||
btrfs_inode_lock(inode, 0);
|
||||
err = btrfs_delete_subvolume(dir, dentry);
|
||||
inode_unlock(inode);
|
||||
btrfs_inode_unlock(inode, 0);
|
||||
if (!err) {
|
||||
fsnotify_rmdir(dir, dentry);
|
||||
d_delete(dentry);
|
||||
@@ -3123,7 +3123,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
|
||||
out_dput:
|
||||
dput(dentry);
|
||||
out_unlock_dir:
|
||||
inode_unlock(dir);
|
||||
btrfs_inode_unlock(dir, 0);
|
||||
free_subvol_name:
|
||||
kfree(subvol_name_ptr);
|
||||
free_parent:
|
||||
|
||||
Reference in New Issue
Block a user