Commit 008ef096 authored by David Sterba's avatar David Sterba

btrfs: drop lock parameter from update_ioctl_balance_args and rename

The parameter controls locking of the stats part but we can lock it
unconditionally, as this only happens once when balance starts. This is
not performance critical.

Add the prefix for an exported function.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent cf7d20f4
...@@ -3267,7 +3267,9 @@ int btrfs_is_empty_uuid(u8 *uuid); ...@@ -3267,7 +3267,9 @@ int btrfs_is_empty_uuid(u8 *uuid);
int btrfs_defrag_file(struct inode *inode, struct file *file, int btrfs_defrag_file(struct inode *inode, struct file *file,
struct btrfs_ioctl_defrag_range_args *range, struct btrfs_ioctl_defrag_range_args *range,
u64 newer_than, unsigned long max_pages); u64 newer_than, unsigned long max_pages);
void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock, void btrfs_get_block_group_info(struct list_head *groups_list,
struct btrfs_ioctl_space_info *space);
void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_balance_args *bargs); struct btrfs_ioctl_balance_args *bargs);
ssize_t btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen, ssize_t btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen,
struct file *dst_file, u64 dst_loff); struct file *dst_file, u64 dst_loff);
......
...@@ -4305,7 +4305,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info, ...@@ -4305,7 +4305,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
return ret; return ret;
} }
void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock, void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_balance_args *bargs) struct btrfs_ioctl_balance_args *bargs)
{ {
struct btrfs_balance_control *bctl = fs_info->balance_ctl; struct btrfs_balance_control *bctl = fs_info->balance_ctl;
...@@ -4323,13 +4323,9 @@ void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock, ...@@ -4323,13 +4323,9 @@ void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock,
memcpy(&bargs->meta, &bctl->meta, sizeof(bargs->meta)); memcpy(&bargs->meta, &bctl->meta, sizeof(bargs->meta));
memcpy(&bargs->sys, &bctl->sys, sizeof(bargs->sys)); memcpy(&bargs->sys, &bctl->sys, sizeof(bargs->sys));
if (lock) {
spin_lock(&fs_info->balance_lock); spin_lock(&fs_info->balance_lock);
memcpy(&bargs->stat, &bctl->stat, sizeof(bargs->stat)); memcpy(&bargs->stat, &bctl->stat, sizeof(bargs->stat));
spin_unlock(&fs_info->balance_lock); spin_unlock(&fs_info->balance_lock);
} else {
memcpy(&bargs->stat, &bctl->stat, sizeof(bargs->stat));
}
} }
static long btrfs_ioctl_balance(struct file *file, void __user *arg) static long btrfs_ioctl_balance(struct file *file, void __user *arg)
...@@ -4515,7 +4511,7 @@ static long btrfs_ioctl_balance_progress(struct btrfs_fs_info *fs_info, ...@@ -4515,7 +4511,7 @@ static long btrfs_ioctl_balance_progress(struct btrfs_fs_info *fs_info,
goto out; goto out;
} }
update_ioctl_balance_args(fs_info, 1, bargs); btrfs_update_ioctl_balance_args(fs_info, bargs);
if (copy_to_user(arg, bargs, sizeof(*bargs))) if (copy_to_user(arg, bargs, sizeof(*bargs)))
ret = -EFAULT; ret = -EFAULT;
......
...@@ -3918,7 +3918,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl, ...@@ -3918,7 +3918,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
if (bargs) { if (bargs) {
memset(bargs, 0, sizeof(*bargs)); memset(bargs, 0, sizeof(*bargs));
update_ioctl_balance_args(fs_info, 0, bargs); btrfs_update_ioctl_balance_args(fs_info, bargs);
} }
if ((ret && ret != -ECANCELED && ret != -ENOSPC) || if ((ret && ret != -ECANCELED && ret != -ENOSPC) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment