diff options
Diffstat (limited to 'fs/quota_v2.c')
-rw-r--r-- | fs/quota_v2.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/quota_v2.c b/fs/quota_v2.c index b53827dc02d9..51c4717f7c6a 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 | |||
32 | static inline qsize_t v2_stoqb(qsize_t space) | ||
33 | { | ||
34 | return (space + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS; | ||
35 | } | ||
36 | |||
37 | static 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 */ |
30 | static int v2_check_quota_file(struct super_block *sb, int type) | 43 | static 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); |