btrfs: rename btrfs_mask_flags to reflect which flags it touches
[sfrench/cifs-2.6.git] / fs / btrfs / ioctl.c
index 397f026b1e4ceadcbf40254db4f98d97b2d947dd..f5b83b4cc6bf68e4e4b371f1d5cfaeaf3563fb39 100644 (file)
@@ -93,11 +93,12 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
                       int no_time_update);
 
 /* Mask out flags that are inappropriate for the given type of inode. */
-static unsigned int btrfs_mask_flags(umode_t mode, unsigned int flags)
+static unsigned int btrfs_mask_fsflags_for_type(struct inode *inode,
+               unsigned int flags)
 {
-       if (S_ISDIR(mode))
+       if (S_ISDIR(inode->i_mode))
                return flags;
-       else if (S_ISREG(mode))
+       else if (S_ISREG(inode->i_mode))
                return flags & ~FS_DIRSYNC_FL;
        else
                return flags & (FS_NODUMP_FL | FS_NOATIME_FL);
@@ -136,7 +137,7 @@ static unsigned int btrfs_flags_to_ioctl(unsigned int flags)
 /*
  * Update inode->i_flags based on the btrfs internal flags.
  */
-void btrfs_update_iflags(struct inode *inode)
+void btrfs_sync_inode_flags_to_i_flags(struct inode *inode)
 {
        struct btrfs_inode *ip = BTRFS_I(inode);
        unsigned int new_fl = 0;
@@ -218,7 +219,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
        i_oldflags = inode->i_flags;
        mode = inode->i_mode;
 
-       flags = btrfs_mask_flags(inode->i_mode, flags);
+       flags = btrfs_mask_fsflags_for_type(inode, flags);
        oldflags = btrfs_flags_to_ioctl(ip->flags);
        if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
                if (!capable(CAP_LINUX_IMMUTABLE)) {
@@ -317,7 +318,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
                goto out_drop;
        }
 
-       btrfs_update_iflags(inode);
+       btrfs_sync_inode_flags_to_i_flags(inode);
        inode_inc_iversion(inode);
        inode->i_ctime = current_time(inode);
        ret = btrfs_update_inode(trans, root, inode);
@@ -640,7 +641,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
        wait_event(root->subv_writers->wait,
                   percpu_counter_sum(&root->subv_writers->counter) == 0);
 
-       ret = btrfs_start_delalloc_inodes(root, 0);
+       ret = btrfs_start_delalloc_inodes(root);
        if (ret)
                goto dec_and_free;
 
@@ -4428,7 +4429,6 @@ locked:
                goto out_bargs;
        }
 
-       bctl->fs_info = fs_info;
        if (arg) {
                memcpy(&bctl->data, &bargs->data, sizeof(bctl->data));
                memcpy(&bctl->meta, &bargs->meta, sizeof(bctl->meta));
@@ -4454,7 +4454,7 @@ do_balance:
         */
        need_unlock = false;
 
-       ret = btrfs_balance(bctl, bargs);
+       ret = btrfs_balance(fs_info, bctl, bargs);
        bctl = NULL;
 
        if (arg) {
@@ -5307,7 +5307,7 @@ long btrfs_ioctl(struct file *file, unsigned int
        case BTRFS_IOC_SYNC: {
                int ret;
 
-               ret = btrfs_start_delalloc_roots(fs_info, 0, -1);
+               ret = btrfs_start_delalloc_roots(fs_info, -1);
                if (ret)
                        return ret;
                ret = btrfs_sync_fs(inode->i_sb, 1);