container quota patch queue v0.07
[ct-quota-pq.git] / ext3-journal-transaction-block-1.patch
blob32986be37ac4b54c33931da07d0570e00c3347b6
1 ext3: quota macros cleanup
3 Currently all quota block reservation macros contains hardcoded "2"
4 aka MAXQUOTAS value. This is no good because in some places it is not
5 obvious to understand what does this digit represent. Let's introduce
6 new macro with self descriptive name.
7 diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
8 index acf1b14..aa7f639 100644
9 --- a/fs/ext3/inode.c
10 +++ b/fs/ext3/inode.c
11 @@ -967,7 +967,7 @@ static int ext3_get_block(struct inode *inode, sector_t iblock,
12 if (max_blocks > DIO_MAX_BLOCKS)
13 max_blocks = DIO_MAX_BLOCKS;
14 handle = ext3_journal_start(inode, DIO_CREDITS +
15 - 2 * EXT3_QUOTA_TRANS_BLOCKS(inode->i_sb));
16 + EXT3_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb));
17 if (IS_ERR(handle)) {
18 ret = PTR_ERR(handle);
19 goto out;
20 @@ -3102,8 +3102,8 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
22 /* (user+group)*(old+new) structure, inode write (sb,
23 * inode block, ? - but truncate inode update has it) */
24 - handle = ext3_journal_start(inode, 2*(EXT3_QUOTA_INIT_BLOCKS(inode->i_sb)+
25 - EXT3_QUOTA_DEL_BLOCKS(inode->i_sb))+3);
26 + handle = ext3_journal_start(inode, EXT3_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)+
27 + EXT3_QUOTA_DEL_BLOCKS(inode->i_sb)+3);
28 if (IS_ERR(handle)) {
29 error = PTR_ERR(handle);
30 goto err_out;
31 @@ -3195,7 +3195,7 @@ static int ext3_writepage_trans_blocks(struct inode *inode)
32 #ifdef CONFIG_QUOTA
33 /* We know that structure was already allocated during vfs_dq_init so
34 * we will be updating only the data blocks + inodes */
35 - ret += 2*EXT3_QUOTA_TRANS_BLOCKS(inode->i_sb);
36 + ret += EXT3_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
37 #endif
39 return ret;
40 diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
41 index aad6400..5c1b676 100644
42 --- a/fs/ext3/namei.c
43 +++ b/fs/ext3/namei.c
44 @@ -1699,7 +1699,7 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode,
45 retry:
46 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
47 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
48 - 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb));
49 + EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
50 if (IS_ERR(handle))
51 return PTR_ERR(handle);
53 @@ -1733,7 +1733,7 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry,
54 retry:
55 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
56 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
57 - 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb));
58 + EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
59 if (IS_ERR(handle))
60 return PTR_ERR(handle);
62 @@ -1769,7 +1769,7 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
63 retry:
64 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
65 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
66 - 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb));
67 + EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
68 if (IS_ERR(handle))
69 return PTR_ERR(handle);
71 @@ -2175,7 +2175,7 @@ static int ext3_symlink (struct inode * dir,
72 retry:
73 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
74 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 +
75 - 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb));
76 + EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
77 if (IS_ERR(handle))
78 return PTR_ERR(handle);
80 diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
81 index cf82d51..40dd8bd 100644
82 --- a/include/linux/ext3_jbd.h
83 +++ b/include/linux/ext3_jbd.h
84 @@ -44,13 +44,13 @@
86 #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \
87 EXT3_XATTR_TRANS_BLOCKS - 2 + \
88 - 2*EXT3_QUOTA_TRANS_BLOCKS(sb))
89 + EXT3_MAXQUOTAS_TRANS_BLOCKS(sb))
91 /* Delete operations potentially hit one directory's namespace plus an
92 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
93 * generous. We can grow the delete transaction later if necessary. */
95 -#define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64)
96 +#define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64)
98 /* Define an arbitrary limit for the amount of data we will anticipate
99 * writing to any given transaction. For unbounded transactions such as
100 @@ -86,6 +86,9 @@
101 #define EXT3_QUOTA_INIT_BLOCKS(sb) 0
102 #define EXT3_QUOTA_DEL_BLOCKS(sb) 0
103 #endif
104 +#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb))
105 +#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb))
106 +#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb))
109 ext3_mark_iloc_dirty(handle_t *handle,