Whamcloud - gitweb
b=20581 MDS returns full hash for readdir to decrease hash collision
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-back-dquot-to-rhel54.patch
1 diff -up a/fs/ext4/super.c b/s/ext4/super.c
2 --- a/fs/ext4/super.c
3 +++ b/fs/ext4/super.c
4 @@ -706,9 +767,47 @@ static inline struct inode *dquot_to_ino
5  static ssize_t ext4_quota_write(struct super_block *sb, int type,
6                                 const char *data, size_t len, loff_t off);
7
8 +static int ext4_dquot_initialize(struct inode *inode, int type)
9 +{
10 +       handle_t *handle;
11 +       int ret, err;
12 +
13 +       /* We may create quota structure so we need to reserve enough blocks */
14 +       handle = ext4_journal_start(inode, 2*EXT4_QUOTA_INIT_BLOCKS(inode->i_sb));
15 +       if (IS_ERR(handle))
16 +               return PTR_ERR(handle);
17 +       ret = dquot_initialize(inode, type);
18 +       err = ext4_journal_stop(handle);
19 +       if (!ret)
20 +               ret = err;
21 +       return ret;
22 +}
23 +
24 +static int ext4_dquot_drop(struct inode *inode)
25 +{
26 +       handle_t *handle;
27 +       int ret, err;
28 +
29 +       /* We may delete quota structure so we need to reserve enough blocks */
30 +       handle = ext4_journal_start(inode, 2*EXT4_QUOTA_DEL_BLOCKS(inode->i_sb));
31 +       if (IS_ERR(handle)) {
32 +               /*
33 +                * We call dquot_drop() anyway to at least release references
34 +                * to quota structures so that umount does not hang.
35 +                */
36 +               dquot_drop(inode);
37 +               return PTR_ERR(handle);
38 +       }
39 +       ret = dquot_drop(inode);
40 +       err = ext4_journal_stop(handle);
41 +       if (!ret)
42 +               ret = err;
43 +       return ret;
44 +}
45 +
46  static struct dquot_operations ext4_quota_operations = {
47 -       .initialize     = dquot_initialize,
48 -       .drop           = dquot_drop,
49 +       .initialize     = ext4_dquot_initialize,
50 +       .drop           = ext4_dquot_drop,
51         .alloc_space    = dquot_alloc_space,
52         .alloc_inode    = dquot_alloc_inode,
53         .free_space     = dquot_free_space,