aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota_v1.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_v1.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_v1.c')
-rw-r--r--fs/quota_v1.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/fs/quota_v1.c b/fs/quota_v1.c
index 5ae15b13eeb0..3e078eee5644 100644
--- a/fs/quota_v1.c
+++ b/fs/quota_v1.c
@@ -14,14 +14,27 @@ MODULE_AUTHOR("Jan Kara");
14MODULE_DESCRIPTION("Old quota format support"); 14MODULE_DESCRIPTION("Old quota format support");
15MODULE_LICENSE("GPL"); 15MODULE_LICENSE("GPL");
16 16
17#define QUOTABLOCK_BITS 10
18#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
19
20static inline qsize_t v1_stoqb(qsize_t space)
21{
22 return (space + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS;
23}
24
25static inline qsize_t v1_qbtos(qsize_t blocks)
26{
27 return blocks << QUOTABLOCK_BITS;
28}
29
17static void v1_disk2mem_dqblk(struct mem_dqblk *m, struct v1_disk_dqblk *d) 30static void v1_disk2mem_dqblk(struct mem_dqblk *m, struct v1_disk_dqblk *d)
18{ 31{
19 m->dqb_ihardlimit = d->dqb_ihardlimit; 32 m->dqb_ihardlimit = d->dqb_ihardlimit;
20 m->dqb_isoftlimit = d->dqb_isoftlimit; 33 m->dqb_isoftlimit = d->dqb_isoftlimit;
21 m->dqb_curinodes = d->dqb_curinodes; 34 m->dqb_curinodes = d->dqb_curinodes;
22 m->dqb_bhardlimit = d->dqb_bhardlimit; 35 m->dqb_bhardlimit = v1_qbtos(d->dqb_bhardlimit);
23 m->dqb_bsoftlimit = d->dqb_bsoftlimit; 36 m->dqb_bsoftlimit = v1_qbtos(d->dqb_bsoftlimit);
24 m->dqb_curspace = ((qsize_t)d->dqb_curblocks) << QUOTABLOCK_BITS; 37 m->dqb_curspace = v1_qbtos(d->dqb_curblocks);
25 m->dqb_itime = d->dqb_itime; 38 m->dqb_itime = d->dqb_itime;
26 m->dqb_btime = d->dqb_btime; 39 m->dqb_btime = d->dqb_btime;
27} 40}
@@ -31,9 +44,9 @@ static void v1_mem2disk_dqblk(struct v1_disk_dqblk *d, struct mem_dqblk *m)
31 d->dqb_ihardlimit = m->dqb_ihardlimit; 44 d->dqb_ihardlimit = m->dqb_ihardlimit;
32 d->dqb_isoftlimit = m->dqb_isoftlimit; 45 d->dqb_isoftlimit = m->dqb_isoftlimit;
33 d->dqb_curinodes = m->dqb_curinodes; 46 d->dqb_curinodes = m->dqb_curinodes;
34 d->dqb_bhardlimit = m->dqb_bhardlimit; 47 d->dqb_bhardlimit = v1_stoqb(m->dqb_bhardlimit);
35 d->dqb_bsoftlimit = m->dqb_bsoftlimit; 48 d->dqb_bsoftlimit = v1_stoqb(m->dqb_bsoftlimit);
36 d->dqb_curblocks = toqb(m->dqb_curspace); 49 d->dqb_curblocks = v1_stoqb(m->dqb_curspace);
37 d->dqb_itime = m->dqb_itime; 50 d->dqb_itime = m->dqb_itime;
38 d->dqb_btime = m->dqb_btime; 51 d->dqb_btime = m->dqb_btime;
39} 52}