diff options
author | Jan Kara <jack@suse.cz> | 2008-08-20 08:45:12 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:36:55 -0500 |
commit | 12095460f7f315f8ef67a55b2194195d325d48d7 (patch) | |
tree | 4e878139ccd29a2adeb2a9fa6fcd9c279e8ce6f4 | |
parent | 74f783af95c982aef6d3a1415275650dcf511666 (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>
-rw-r--r-- | fs/dquot.c | 50 | ||||
-rw-r--r-- | fs/quota_v1.c | 25 | ||||
-rw-r--r-- | fs/quota_v2.c | 21 | ||||
-rw-r--r-- | include/linux/quota.h | 28 | ||||
-rw-r--r-- | include/linux/quotaops.h | 4 |
5 files changed, 79 insertions, 49 deletions
diff --git a/fs/dquot.c b/fs/dquot.c index 1b5fc4b7fbeb..c02223b6aeb2 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -835,7 +835,7 @@ static void drop_dquot_ref(struct super_block *sb, int type) | |||
835 | } | 835 | } |
836 | } | 836 | } |
837 | 837 | ||
838 | static inline void dquot_incr_inodes(struct dquot *dquot, unsigned long number) | 838 | static inline void dquot_incr_inodes(struct dquot *dquot, qsize_t number) |
839 | { | 839 | { |
840 | dquot->dq_dqb.dqb_curinodes += number; | 840 | dquot->dq_dqb.dqb_curinodes += number; |
841 | } | 841 | } |
@@ -845,7 +845,7 @@ static inline void dquot_incr_space(struct dquot *dquot, qsize_t number) | |||
845 | dquot->dq_dqb.dqb_curspace += number; | 845 | dquot->dq_dqb.dqb_curspace += number; |
846 | } | 846 | } |
847 | 847 | ||
848 | static inline void dquot_decr_inodes(struct dquot *dquot, unsigned long number) | 848 | static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number) |
849 | { | 849 | { |
850 | if (dquot->dq_dqb.dqb_curinodes > number) | 850 | if (dquot->dq_dqb.dqb_curinodes > number) |
851 | dquot->dq_dqb.dqb_curinodes -= number; | 851 | dquot->dq_dqb.dqb_curinodes -= number; |
@@ -862,7 +862,7 @@ static inline void dquot_decr_space(struct dquot *dquot, qsize_t number) | |||
862 | dquot->dq_dqb.dqb_curspace -= number; | 862 | dquot->dq_dqb.dqb_curspace -= number; |
863 | else | 863 | else |
864 | dquot->dq_dqb.dqb_curspace = 0; | 864 | dquot->dq_dqb.dqb_curspace = 0; |
865 | if (toqb(dquot->dq_dqb.dqb_curspace) <= dquot->dq_dqb.dqb_bsoftlimit) | 865 | if (dquot->dq_dqb.dqb_curspace <= dquot->dq_dqb.dqb_bsoftlimit) |
866 | dquot->dq_dqb.dqb_btime = (time_t) 0; | 866 | dquot->dq_dqb.dqb_btime = (time_t) 0; |
867 | clear_bit(DQ_BLKS_B, &dquot->dq_flags); | 867 | clear_bit(DQ_BLKS_B, &dquot->dq_flags); |
868 | } | 868 | } |
@@ -1038,7 +1038,7 @@ static inline char ignore_hardlimit(struct dquot *dquot) | |||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | /* needs dq_data_lock */ | 1040 | /* needs dq_data_lock */ |
1041 | static int check_idq(struct dquot *dquot, ulong inodes, char *warntype) | 1041 | static int check_idq(struct dquot *dquot, qsize_t inodes, char *warntype) |
1042 | { | 1042 | { |
1043 | *warntype = QUOTA_NL_NOWARN; | 1043 | *warntype = QUOTA_NL_NOWARN; |
1044 | if (inodes <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags)) | 1044 | if (inodes <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags)) |
@@ -1077,7 +1077,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war | |||
1077 | return QUOTA_OK; | 1077 | return QUOTA_OK; |
1078 | 1078 | ||
1079 | if (dquot->dq_dqb.dqb_bhardlimit && | 1079 | if (dquot->dq_dqb.dqb_bhardlimit && |
1080 | toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bhardlimit && | 1080 | dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && |
1081 | !ignore_hardlimit(dquot)) { | 1081 | !ignore_hardlimit(dquot)) { |
1082 | if (!prealloc) | 1082 | if (!prealloc) |
1083 | *warntype = QUOTA_NL_BHARDWARN; | 1083 | *warntype = QUOTA_NL_BHARDWARN; |
@@ -1085,7 +1085,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war | |||
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | if (dquot->dq_dqb.dqb_bsoftlimit && | 1087 | if (dquot->dq_dqb.dqb_bsoftlimit && |
1088 | toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bsoftlimit && | 1088 | dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && |
1089 | dquot->dq_dqb.dqb_btime && get_seconds() >= dquot->dq_dqb.dqb_btime && | 1089 | dquot->dq_dqb.dqb_btime && get_seconds() >= dquot->dq_dqb.dqb_btime && |
1090 | !ignore_hardlimit(dquot)) { | 1090 | !ignore_hardlimit(dquot)) { |
1091 | if (!prealloc) | 1091 | if (!prealloc) |
@@ -1094,7 +1094,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war | |||
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | if (dquot->dq_dqb.dqb_bsoftlimit && | 1096 | if (dquot->dq_dqb.dqb_bsoftlimit && |
1097 | toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bsoftlimit && | 1097 | dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && |
1098 | dquot->dq_dqb.dqb_btime == 0) { | 1098 | dquot->dq_dqb.dqb_btime == 0) { |
1099 | if (!prealloc) { | 1099 | if (!prealloc) { |
1100 | *warntype = QUOTA_NL_BSOFTWARN; | 1100 | *warntype = QUOTA_NL_BSOFTWARN; |
@@ -1111,7 +1111,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war | |||
1111 | return QUOTA_OK; | 1111 | return QUOTA_OK; |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | static int info_idq_free(struct dquot *dquot, ulong inodes) | 1114 | static int info_idq_free(struct dquot *dquot, qsize_t inodes) |
1115 | { | 1115 | { |
1116 | if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || | 1116 | if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || |
1117 | dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit) | 1117 | dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit) |
@@ -1128,15 +1128,13 @@ static int info_idq_free(struct dquot *dquot, ulong inodes) | |||
1128 | static int info_bdq_free(struct dquot *dquot, qsize_t space) | 1128 | static int info_bdq_free(struct dquot *dquot, qsize_t space) |
1129 | { | 1129 | { |
1130 | if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || | 1130 | if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || |
1131 | toqb(dquot->dq_dqb.dqb_curspace) <= dquot->dq_dqb.dqb_bsoftlimit) | 1131 | dquot->dq_dqb.dqb_curspace <= dquot->dq_dqb.dqb_bsoftlimit) |
1132 | return QUOTA_NL_NOWARN; | 1132 | return QUOTA_NL_NOWARN; |
1133 | 1133 | ||
1134 | if (toqb(dquot->dq_dqb.dqb_curspace - space) <= | 1134 | if (dquot->dq_dqb.dqb_curspace - space <= dquot->dq_dqb.dqb_bsoftlimit) |
1135 | dquot->dq_dqb.dqb_bsoftlimit) | ||
1136 | return QUOTA_NL_BSOFTBELOW; | 1135 | return QUOTA_NL_BSOFTBELOW; |
1137 | if (toqb(dquot->dq_dqb.dqb_curspace) >= dquot->dq_dqb.dqb_bhardlimit && | 1136 | if (dquot->dq_dqb.dqb_curspace >= dquot->dq_dqb.dqb_bhardlimit && |
1138 | toqb(dquot->dq_dqb.dqb_curspace - space) < | 1137 | dquot->dq_dqb.dqb_curspace - space < dquot->dq_dqb.dqb_bhardlimit) |
1139 | dquot->dq_dqb.dqb_bhardlimit) | ||
1140 | return QUOTA_NL_BHARDBELOW; | 1138 | return QUOTA_NL_BHARDBELOW; |
1141 | return QUOTA_NL_NOWARN; | 1139 | return QUOTA_NL_NOWARN; |
1142 | } | 1140 | } |
@@ -1279,7 +1277,7 @@ warn_put_all: | |||
1279 | /* | 1277 | /* |
1280 | * This operation can block, but only after everything is updated | 1278 | * This operation can block, but only after everything is updated |
1281 | */ | 1279 | */ |
1282 | int dquot_alloc_inode(const struct inode *inode, unsigned long number) | 1280 | int dquot_alloc_inode(const struct inode *inode, qsize_t number) |
1283 | { | 1281 | { |
1284 | int cnt, ret = NO_QUOTA; | 1282 | int cnt, ret = NO_QUOTA; |
1285 | char warntype[MAXQUOTAS]; | 1283 | char warntype[MAXQUOTAS]; |
@@ -1364,7 +1362,7 @@ out_sub: | |||
1364 | /* | 1362 | /* |
1365 | * This operation can block, but only after everything is updated | 1363 | * This operation can block, but only after everything is updated |
1366 | */ | 1364 | */ |
1367 | int dquot_free_inode(const struct inode *inode, unsigned long number) | 1365 | int dquot_free_inode(const struct inode *inode, qsize_t number) |
1368 | { | 1366 | { |
1369 | unsigned int cnt; | 1367 | unsigned int cnt; |
1370 | char warntype[MAXQUOTAS]; | 1368 | char warntype[MAXQUOTAS]; |
@@ -1883,14 +1881,24 @@ int vfs_dq_quota_on_remount(struct super_block *sb) | |||
1883 | return ret; | 1881 | return ret; |
1884 | } | 1882 | } |
1885 | 1883 | ||
1884 | static inline qsize_t qbtos(qsize_t blocks) | ||
1885 | { | ||
1886 | return blocks << QIF_DQBLKSIZE_BITS; | ||
1887 | } | ||
1888 | |||
1889 | static inline qsize_t stoqb(qsize_t space) | ||
1890 | { | ||
1891 | return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS; | ||
1892 | } | ||
1893 | |||
1886 | /* Generic routine for getting common part of quota structure */ | 1894 | /* Generic routine for getting common part of quota structure */ |
1887 | static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di) | 1895 | static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di) |
1888 | { | 1896 | { |
1889 | struct mem_dqblk *dm = &dquot->dq_dqb; | 1897 | struct mem_dqblk *dm = &dquot->dq_dqb; |
1890 | 1898 | ||
1891 | spin_lock(&dq_data_lock); | 1899 | spin_lock(&dq_data_lock); |
1892 | di->dqb_bhardlimit = dm->dqb_bhardlimit; | 1900 | di->dqb_bhardlimit = stoqb(dm->dqb_bhardlimit); |
1893 | di->dqb_bsoftlimit = dm->dqb_bsoftlimit; | 1901 | di->dqb_bsoftlimit = stoqb(dm->dqb_bsoftlimit); |
1894 | di->dqb_curspace = dm->dqb_curspace; | 1902 | di->dqb_curspace = dm->dqb_curspace; |
1895 | di->dqb_ihardlimit = dm->dqb_ihardlimit; | 1903 | di->dqb_ihardlimit = dm->dqb_ihardlimit; |
1896 | di->dqb_isoftlimit = dm->dqb_isoftlimit; | 1904 | di->dqb_isoftlimit = dm->dqb_isoftlimit; |
@@ -1937,8 +1945,8 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
1937 | check_blim = 1; | 1945 | check_blim = 1; |
1938 | } | 1946 | } |
1939 | if (di->dqb_valid & QIF_BLIMITS) { | 1947 | if (di->dqb_valid & QIF_BLIMITS) { |
1940 | dm->dqb_bsoftlimit = di->dqb_bsoftlimit; | 1948 | dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit); |
1941 | dm->dqb_bhardlimit = di->dqb_bhardlimit; | 1949 | dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit); |
1942 | check_blim = 1; | 1950 | check_blim = 1; |
1943 | } | 1951 | } |
1944 | if (di->dqb_valid & QIF_INODES) { | 1952 | if (di->dqb_valid & QIF_INODES) { |
@@ -1956,7 +1964,7 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
1956 | dm->dqb_itime = di->dqb_itime; | 1964 | dm->dqb_itime = di->dqb_itime; |
1957 | 1965 | ||
1958 | if (check_blim) { | 1966 | if (check_blim) { |
1959 | if (!dm->dqb_bsoftlimit || toqb(dm->dqb_curspace) < dm->dqb_bsoftlimit) { | 1967 | if (!dm->dqb_bsoftlimit || dm->dqb_curspace < dm->dqb_bsoftlimit) { |
1960 | dm->dqb_btime = 0; | 1968 | dm->dqb_btime = 0; |
1961 | clear_bit(DQ_BLKS_B, &dquot->dq_flags); | 1969 | clear_bit(DQ_BLKS_B, &dquot->dq_flags); |
1962 | } | 1970 | } |
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"); | |||
14 | MODULE_DESCRIPTION("Old quota format support"); | 14 | MODULE_DESCRIPTION("Old quota format support"); |
15 | MODULE_LICENSE("GPL"); | 15 | MODULE_LICENSE("GPL"); |
16 | 16 | ||
17 | #define QUOTABLOCK_BITS 10 | ||
18 | #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) | ||
19 | |||
20 | static inline qsize_t v1_stoqb(qsize_t space) | ||
21 | { | ||
22 | return (space + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS; | ||
23 | } | ||
24 | |||
25 | static inline qsize_t v1_qbtos(qsize_t blocks) | ||
26 | { | ||
27 | return blocks << QUOTABLOCK_BITS; | ||
28 | } | ||
29 | |||
17 | static void v1_disk2mem_dqblk(struct mem_dqblk *m, struct v1_disk_dqblk *d) | 30 | static 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 | } |
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); |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 3ce708c2cb3c..9ea468363f9f 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -39,15 +39,6 @@ | |||
39 | #define __DQUOT_VERSION__ "dquot_6.5.1" | 39 | #define __DQUOT_VERSION__ "dquot_6.5.1" |
40 | #define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 | 40 | #define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 |
41 | 41 | ||
42 | /* Size of blocks in which are counted size limits */ | ||
43 | #define QUOTABLOCK_BITS 10 | ||
44 | #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) | ||
45 | |||
46 | /* Conversion routines from and to quota blocks */ | ||
47 | #define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10)) | ||
48 | #define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10)) | ||
49 | #define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) | ||
50 | |||
51 | #define MAXQUOTAS 2 | 42 | #define MAXQUOTAS 2 |
52 | #define USRQUOTA 0 /* element used for user quotas */ | 43 | #define USRQUOTA 0 /* element used for user quotas */ |
53 | #define GRPQUOTA 1 /* element used for group quotas */ | 44 | #define GRPQUOTA 1 /* element used for group quotas */ |
@@ -80,6 +71,11 @@ | |||
80 | #define Q_GETQUOTA 0x800007 /* get user quota structure */ | 71 | #define Q_GETQUOTA 0x800007 /* get user quota structure */ |
81 | #define Q_SETQUOTA 0x800008 /* set user quota structure */ | 72 | #define Q_SETQUOTA 0x800008 /* set user quota structure */ |
82 | 73 | ||
74 | /* Size of block in which space limits are passed through the quota | ||
75 | * interface */ | ||
76 | #define QIF_DQBLKSIZE_BITS 10 | ||
77 | #define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS) | ||
78 | |||
83 | /* | 79 | /* |
84 | * Quota structure used for communication with userspace via quotactl | 80 | * Quota structure used for communication with userspace via quotactl |
85 | * Following flags are used to specify which fields are valid | 81 | * Following flags are used to specify which fields are valid |
@@ -187,12 +183,12 @@ extern spinlock_t dq_data_lock; | |||
187 | * Data for one user/group kept in memory | 183 | * Data for one user/group kept in memory |
188 | */ | 184 | */ |
189 | struct mem_dqblk { | 185 | struct mem_dqblk { |
190 | __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */ | 186 | qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ |
191 | __u32 dqb_bsoftlimit; /* preferred limit on disk blks */ | 187 | qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */ |
192 | qsize_t dqb_curspace; /* current used space */ | 188 | qsize_t dqb_curspace; /* current used space */ |
193 | __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */ | 189 | qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */ |
194 | __u32 dqb_isoftlimit; /* preferred inode limit */ | 190 | qsize_t dqb_isoftlimit; /* preferred inode limit */ |
195 | __u32 dqb_curinodes; /* current # allocated inodes */ | 191 | qsize_t dqb_curinodes; /* current # allocated inodes */ |
196 | time_t dqb_btime; /* time limit for excessive disk use */ | 192 | time_t dqb_btime; /* time limit for excessive disk use */ |
197 | time_t dqb_itime; /* time limit for excessive inode use */ | 193 | time_t dqb_itime; /* time limit for excessive inode use */ |
198 | }; | 194 | }; |
@@ -287,9 +283,9 @@ struct dquot_operations { | |||
287 | int (*initialize) (struct inode *, int); | 283 | int (*initialize) (struct inode *, int); |
288 | int (*drop) (struct inode *); | 284 | int (*drop) (struct inode *); |
289 | int (*alloc_space) (struct inode *, qsize_t, int); | 285 | int (*alloc_space) (struct inode *, qsize_t, int); |
290 | int (*alloc_inode) (const struct inode *, unsigned long); | 286 | int (*alloc_inode) (const struct inode *, qsize_t); |
291 | int (*free_space) (struct inode *, qsize_t); | 287 | int (*free_space) (struct inode *, qsize_t); |
292 | int (*free_inode) (const struct inode *, unsigned long); | 288 | int (*free_inode) (const struct inode *, qsize_t); |
293 | int (*transfer) (struct inode *, struct iattr *); | 289 | int (*transfer) (struct inode *, struct iattr *); |
294 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ | 290 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ |
295 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ | 291 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index a558a4c1d35a..adcc7ba3accb 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -26,10 +26,10 @@ int dquot_initialize(struct inode *inode, int type); | |||
26 | int dquot_drop(struct inode *inode); | 26 | int dquot_drop(struct inode *inode); |
27 | 27 | ||
28 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 28 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); |
29 | int dquot_alloc_inode(const struct inode *inode, unsigned long number); | 29 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); |
30 | 30 | ||
31 | int dquot_free_space(struct inode *inode, qsize_t number); | 31 | int dquot_free_space(struct inode *inode, qsize_t number); |
32 | int dquot_free_inode(const struct inode *inode, unsigned long number); | 32 | int dquot_free_inode(const struct inode *inode, qsize_t number); |
33 | 33 | ||
34 | int dquot_transfer(struct inode *inode, struct iattr *iattr); | 34 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
35 | int dquot_commit(struct dquot *dquot); | 35 | int dquot_commit(struct dquot *dquot); |