Whamcloud - gitweb
LU-10565 osd: move ext4_tranfer_project to osd
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-projid-xfs-ioctls.patch
index 5e7939a..0af277b 100644 (file)
@@ -61,14 +61,6 @@ index ce3b85f..29db502 100644
  #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
  /*
   * ioctl commands in 32 bit emulation
-@@ -2347,6 +2392,7 @@ extern int ext4_ind_remove_space(handle_t *handle, struct inode *inode,
- /* ioctl.c */
- extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
- extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
-+extern int ext4_transfer_project(struct inode *inode, __u32 projid);
- /* migrate.c */
- extern int ext4_ext_migrate(struct inode *);
 diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
 index 70c66d3..276d33d 100644
 --- a/fs/ext4/ioctl.c
@@ -81,7 +73,7 @@ index 70c66d3..276d33d 100644
  #include "ext4_jbd2.h"
  #include "ext4.h"
  
-@@ -198,6 +199,294 @@ journal_err_out:
+@@ -198,6 +199,242 @@ journal_err_out:
        return err;
  }
  
@@ -270,58 +262,6 @@ index 70c66d3..276d33d 100644
 +
 +}
 +
-+int ext4_transfer_project(struct inode *inode, __u32 projid)
-+{
-+      struct super_block *sb = inode->i_sb;
-+      struct ext4_inode_info *ei = EXT4_I(inode);
-+      int err;
-+      kprojid_t kprojid;
-+      struct ext4_iloc iloc;
-+      struct ext4_inode *raw_inode;
-+      struct dquot *transfer_to[EXT4_MAXQUOTAS] = { };
-+
-+      if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
-+                      EXT4_FEATURE_RO_COMPAT_PROJECT)) {
-+              BUG_ON(__kprojid_val(EXT4_I(inode)->i_projid)
-+                     != EXT4_DEF_PROJID);
-+              if (projid != EXT4_DEF_PROJID)
-+                      return -EOPNOTSUPP;
-+              else
-+                      return 0;
-+      }
-+
-+      if (EXT4_INODE_SIZE(sb) <= EXT4_GOOD_OLD_INODE_SIZE)
-+              return -EOPNOTSUPP;
-+
-+      kprojid = make_kprojid(&init_user_ns, (projid_t)projid);
-+      if (projid_eq(kprojid, EXT4_I(inode)->i_projid))
-+              return 0;
-+
-+      err = ext4_get_inode_loc(inode, &iloc);
-+      if (err)
-+              return err;
-+
-+      raw_inode = ext4_raw_inode(&iloc);
-+      if (!EXT4_FITS_IN_INODE(raw_inode, ei, i_projid)) {
-+              err = -EOVERFLOW;
-+              brelse(iloc.bh);
-+              return err;
-+      }
-+      brelse(iloc.bh);
-+
-+      dquot_initialize(inode);
-+      transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
-+      if (transfer_to[PRJQUOTA]) {
-+              err = __dquot_transfer(inode, transfer_to);
-+              dqput(transfer_to[PRJQUOTA]);
-+              if (err)
-+                      return err;
-+      }
-+
-+      return err;
-+}
-+EXPORT_SYMBOL(ext4_transfer_project);
-+
 +#else
 +static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
 +{