aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota_v2.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-08-20 08:45:12 -0400
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:36:55 -0500
commit12095460f7f315f8ef67a55b2194195d325d48d7 (patch)
tree4e878139ccd29a2adeb2a9fa6fcd9c279e8ce6f4 /fs/quota_v2.c
parent74f783af95c982aef6d3a1415275650dcf511666 (diff)
quota: Increase size of variables for limits and inode usage
So far quota was fine with quota block limits and inode limits/numbers in a 32-bit type. Now with rapid increase in storage sizes there are coming requests to be able to handle quota limits above 4TB / more that 2^32 inodes. So bump up sizes of types in mem_dqblk structure to 64-bits to be able to handle this. Also update inode allocation / checking functions to use qsize_t and make global structure keep quota limits in bytes so that things are consistent. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/quota_v2.c')
-rw-r--r--fs/quota_v2.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/quota_v2.c b/fs/quota_v2.c
index b53827dc02d..51c4717f7c6 100644
--- a/fs/quota_v2.c
+++ b/fs/quota_v2.c
@@ -26,6 +26,19 @@ typedef char *dqbuf_t;
26#define GETIDINDEX(id, depth) (((id) >> ((V2_DQTREEDEPTH-(depth)-1)*8)) & 0xff) 26#define GETIDINDEX(id, depth) (((id) >> ((V2_DQTREEDEPTH-(depth)-1)*8)) & 0xff)
27#define GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)buf)+sizeof(struct v2_disk_dqdbheader))) 27#define GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)buf)+sizeof(struct v2_disk_dqdbheader)))
28 28
29#define QUOTABLOCK_BITS 10
30#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
31
32static inline qsize_t v2_stoqb(qsize_t space)
33{
34 return (space + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS;
35}
36
37static inline qsize_t v2_qbtos(qsize_t blocks)
38{
39 return blocks << QUOTABLOCK_BITS;
40}
41
29/* Check whether given file is really vfsv0 quotafile */ 42/* Check whether given file is really vfsv0 quotafile */
30static int v2_check_quota_file(struct super_block *sb, int type) 43static int v2_check_quota_file(struct super_block *sb, int type)
31{ 44{
@@ -104,8 +117,8 @@ static void disk2memdqb(struct mem_dqblk *m, struct v2_disk_dqblk *d)
104 m->dqb_isoftlimit = le32_to_cpu(d->dqb_isoftlimit); 117 m->dqb_isoftlimit = le32_to_cpu(d->dqb_isoftlimit);
105 m->dqb_curinodes = le32_to_cpu(d->dqb_curinodes); 118 m->dqb_curinodes = le32_to_cpu(d->dqb_curinodes);
106 m->dqb_itime = le64_to_cpu(d->dqb_itime); 119 m->dqb_itime = le64_to_cpu(d->dqb_itime);
107 m->dqb_bhardlimit = le32_to_cpu(d->dqb_bhardlimit); 120 m->dqb_bhardlimit = v2_qbtos(le32_to_cpu(d->dqb_bhardlimit));
108 m->dqb_bsoftlimit = le32_to_cpu(d->dqb_bsoftlimit); 121 m->dqb_bsoftlimit = v2_qbtos(le32_to_cpu(d->dqb_bsoftlimit));
109 m->dqb_curspace = le64_to_cpu(d->dqb_curspace); 122 m->dqb_curspace = le64_to_cpu(d->dqb_curspace);
110 m->dqb_btime = le64_to_cpu(d->dqb_btime); 123 m->dqb_btime = le64_to_cpu(d->dqb_btime);
111} 124}
@@ -116,8 +129,8 @@ static void mem2diskdqb(struct v2_disk_dqblk *d, struct mem_dqblk *m, qid_t id)
116 d->dqb_isoftlimit = cpu_to_le32(m->dqb_isoftlimit); 129 d->dqb_isoftlimit = cpu_to_le32(m->dqb_isoftlimit);
117 d->dqb_curinodes = cpu_to_le32(m->dqb_curinodes); 130 d->dqb_curinodes = cpu_to_le32(m->dqb_curinodes);
118 d->dqb_itime = cpu_to_le64(m->dqb_itime); 131 d->dqb_itime = cpu_to_le64(m->dqb_itime);
119 d->dqb_bhardlimit = cpu_to_le32(m->dqb_bhardlimit); 132 d->dqb_bhardlimit = cpu_to_le32(v2_qbtos(m->dqb_bhardlimit));
120 d->dqb_bsoftlimit = cpu_to_le32(m->dqb_bsoftlimit); 133 d->dqb_bsoftlimit = cpu_to_le32(v2_qbtos(m->dqb_bsoftlimit));
121 d->dqb_curspace = cpu_to_le64(m->dqb_curspace); 134 d->dqb_curspace = cpu_to_le64(m->dqb_curspace);
122 d->dqb_btime = cpu_to_le64(m->dqb_btime); 135 d->dqb_btime = cpu_to_le64(m->dqb_btime);
123 d->dqb_id = cpu_to_le32(id); 136 d->dqb_id = cpu_to_le32(id);