]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/btrfs/ioctl.c
btrfs: add and use helpers for reading and writing fs_info->generation
[thirdparty/linux.git] / fs / btrfs / ioctl.c
index 75ab766fe156550afef8135892dda7f3524aa948..7ab21283fae80a342bd99504f0a2d41f249811e1 100644 (file)
@@ -385,7 +385,7 @@ update_flags:
        btrfs_sync_inode_flags_to_i_flags(inode);
        inode_inc_iversion(inode);
        inode_set_ctime_current(inode);
-       ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
+       ret = btrfs_update_inode(trans, BTRFS_I(inode));
 
  out_end_trans:
        btrfs_end_transaction(trans);
@@ -652,18 +652,18 @@ static noinline int create_subvol(struct mnt_idmap *idmap,
        /* Tree log can't currently deal with an inode which is a new root. */
        btrfs_set_log_full_commit(trans);
 
-       ret = btrfs_qgroup_inherit(trans, 0, objectid, inherit);
+       ret = btrfs_qgroup_inherit(trans, 0, objectid, root->root_key.objectid, inherit);
        if (ret)
                goto out;
 
        leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0,
-                                     BTRFS_NESTING_NORMAL);
+                                     0, BTRFS_NESTING_NORMAL);
        if (IS_ERR(leaf)) {
                ret = PTR_ERR(leaf);
                goto out;
        }
 
-       btrfs_mark_buffer_dirty(leaf);
+       btrfs_mark_buffer_dirty(trans, leaf);
 
        inode_item = &root_item->inode;
        btrfs_set_stack_inode_generation(inode_item, 1);
@@ -2822,7 +2822,7 @@ static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info,
        }
 
        if (flags_in & BTRFS_FS_INFO_FLAG_GENERATION) {
-               fi_args->generation = fs_info->generation;
+               fi_args->generation = btrfs_get_fs_generation(fs_info);
                fi_args->flags |= BTRFS_FS_INFO_FLAG_GENERATION;
        }
 
@@ -2947,7 +2947,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 
        btrfs_cpu_key_to_disk(&disk_key, &new_root->root_key);
        btrfs_set_dir_item_key(path->nodes[0], di, &disk_key);
-       btrfs_mark_buffer_dirty(path->nodes[0]);
+       btrfs_mark_buffer_dirty(trans, path->nodes[0]);
        btrfs_release_path(path);
 
        btrfs_set_fs_incompat(fs_info, DEFAULT_SUBVOL);
@@ -2978,7 +2978,7 @@ static void get_block_group_info(struct list_head *groups_list,
 static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
                                   void __user *arg)
 {
-       struct btrfs_ioctl_space_args space_args;
+       struct btrfs_ioctl_space_args space_args = { 0 };
        struct btrfs_ioctl_space_info space;
        struct btrfs_ioctl_space_info *dest;
        struct btrfs_ioctl_space_info *dest_orig;
@@ -3697,7 +3697,8 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
 
        switch (sa->cmd) {
        case BTRFS_QUOTA_CTL_ENABLE:
-               ret = btrfs_quota_enable(fs_info);
+       case BTRFS_QUOTA_CTL_ENABLE_SIMPLE_QUOTA:
+               ret = btrfs_quota_enable(fs_info, sa);
                break;
        case BTRFS_QUOTA_CTL_DISABLE:
                ret = btrfs_quota_disable(fs_info);
@@ -4338,7 +4339,7 @@ static int _btrfs_ioctl_send(struct inode *inode, void __user *argp, bool compat
 
        if (compat) {
 #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
-               struct btrfs_ioctl_send_args_32 args32;
+               struct btrfs_ioctl_send_args_32 args32 = { 0 };
 
                ret = copy_from_user(&args32, argp, sizeof(args32));
                if (ret)