Whamcloud - gitweb
LU-73 RHEL6 support.
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-back-dquot-to-rhel6.patch
1 Index: linux-stage/fs/ext4/super.c
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/super.c    2011-03-11 15:46:27.000000000 +0800
4 +++ linux-stage/fs/ext4/super.c 2011-03-11 15:53:05.016701579 +0800
5 @@ -1400,9 +1400,47 @@
6  static ssize_t ext4_quota_write(struct super_block *sb, int type,
7                                 const char *data, size_t len, loff_t off);
8  
9 +static int ext4_dquot_initialize(struct inode *inode, int type)
10 +{
11 +       handle_t *handle;
12 +       int ret, err;
13 +
14 +       /* We may create quota structure so we need to reserve enough blocks */
15 +       handle = ext4_journal_start(inode, 2*EXT4_QUOTA_INIT_BLOCKS(inode->i_sb));
16 +       if (IS_ERR(handle))
17 +               return PTR_ERR(handle);
18 +       ret = dquot_initialize(inode, type);
19 +       err = ext4_journal_stop(handle);
20 +       if (!ret)
21 +               ret = err;
22 +       return ret;
23 +}
24 +
25 +static int ext4_dquot_drop(struct inode *inode)
26 +{
27 +       handle_t *handle;
28 +       int ret, err;
29 +
30 +       /* We may delete quota structure so we need to reserve enough blocks */
31 +       handle = ext4_journal_start(inode, 2*EXT4_QUOTA_DEL_BLOCKS(inode->i_sb));
32 +       if (IS_ERR(handle)) {
33 +               /*
34 +                * We call dquot_drop() anyway to at least release references
35 +                * to quota structures so that umount does not hang.
36 +                */
37 +               dquot_drop(inode);
38 +               return PTR_ERR(handle);
39 +       }
40 +       ret = dquot_drop(inode);
41 +       err = ext4_journal_stop(handle);
42 +       if (!ret)
43 +               ret = err;
44 +       return ret;
45 +}
46 +
47  static const struct dquot_operations ext4_quota_operations = {
48 -       .initialize     = dquot_initialize,
49 -       .drop           = dquot_drop,
50 +       .initialize     = ext4_dquot_initialize,
51 +       .drop           = ext4_dquot_drop,
52         .alloc_space    = dquot_alloc_space,
53         .reserve_space  = dquot_reserve_space,
54         .claim_space    = dquot_claim_space,