aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-10-09 10:54:13 -0400
committerJan Kara <jack@suse.cz>2015-01-30 06:51:21 -0500
commitb10a08194c2b615955dfab2300331a90ae9344c7 (patch)
tree0787871fa57144c011cf1a81a0b1e0502cd04bf3 /fs/quota
parentaaa3daed156ff3c6acb28c8b18028f8b57d6c91b (diff)
quota: Store maximum space limit in bytes
Currently maximum space limit quota format supports is in blocks however since we store space limits in bytes, this is somewhat confusing. So store the maximum limit in bytes as well. Also rename the field to match the new unit and related inode field to match the new naming scheme. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota')
-rw-r--r--fs/quota/dquot.c18
-rw-r--r--fs/quota/quota_v1.c4
-rw-r--r--fs/quota/quota_v2.c10
3 files changed, 11 insertions, 21 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index b47d0c17ea6f..0ccd4ba3a246 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2465,16 +2465,6 @@ out_err:
2465 return ret; 2465 return ret;
2466} 2466}
2467 2467
2468static inline qsize_t qbtos(qsize_t blocks)
2469{
2470 return blocks << QIF_DQBLKSIZE_BITS;
2471}
2472
2473static inline qsize_t stoqb(qsize_t space)
2474{
2475 return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS;
2476}
2477
2478/* Generic routine for getting common part of quota structure */ 2468/* Generic routine for getting common part of quota structure */
2479static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di) 2469static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di)
2480{ 2470{
@@ -2524,13 +2514,13 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di)
2524 return -EINVAL; 2514 return -EINVAL;
2525 2515
2526 if (((di->d_fieldmask & QC_SPC_SOFT) && 2516 if (((di->d_fieldmask & QC_SPC_SOFT) &&
2527 stoqb(di->d_spc_softlimit) > dqi->dqi_maxblimit) || 2517 di->d_spc_softlimit > dqi->dqi_max_spc_limit) ||
2528 ((di->d_fieldmask & QC_SPC_HARD) && 2518 ((di->d_fieldmask & QC_SPC_HARD) &&
2529 stoqb(di->d_spc_hardlimit) > dqi->dqi_maxblimit) || 2519 di->d_spc_hardlimit > dqi->dqi_max_spc_limit) ||
2530 ((di->d_fieldmask & QC_INO_SOFT) && 2520 ((di->d_fieldmask & QC_INO_SOFT) &&
2531 (di->d_ino_softlimit > dqi->dqi_maxilimit)) || 2521 (di->d_ino_softlimit > dqi->dqi_max_ino_limit)) ||
2532 ((di->d_fieldmask & QC_INO_HARD) && 2522 ((di->d_fieldmask & QC_INO_HARD) &&
2533 (di->d_ino_hardlimit > dqi->dqi_maxilimit))) 2523 (di->d_ino_hardlimit > dqi->dqi_max_ino_limit)))
2534 return -ERANGE; 2524 return -ERANGE;
2535 2525
2536 spin_lock(&dq_data_lock); 2526 spin_lock(&dq_data_lock);
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index 469c6848b322..8fe79beced5c 100644
--- a/fs/quota/quota_v1.c
+++ b/fs/quota/quota_v1.c
@@ -169,8 +169,8 @@ static int v1_read_file_info(struct super_block *sb, int type)
169 } 169 }
170 ret = 0; 170 ret = 0;
171 /* limits are stored as unsigned 32-bit data */ 171 /* limits are stored as unsigned 32-bit data */
172 dqopt->info[type].dqi_maxblimit = 0xffffffff; 172 dqopt->info[type].dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS;
173 dqopt->info[type].dqi_maxilimit = 0xffffffff; 173 dqopt->info[type].dqi_max_ino_limit = 0xffffffff;
174 dqopt->info[type].dqi_igrace = 174 dqopt->info[type].dqi_igrace =
175 dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME; 175 dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME;
176 dqopt->info[type].dqi_bgrace = 176 dqopt->info[type].dqi_bgrace =
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index 54cac436ac72..9cb10d7197f7 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -117,12 +117,12 @@ static int v2_read_file_info(struct super_block *sb, int type)
117 qinfo = info->dqi_priv; 117 qinfo = info->dqi_priv;
118 if (version == 0) { 118 if (version == 0) {
119 /* limits are stored as unsigned 32-bit data */ 119 /* limits are stored as unsigned 32-bit data */
120 info->dqi_maxblimit = 0xffffffff; 120 info->dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS;
121 info->dqi_maxilimit = 0xffffffff; 121 info->dqi_max_ino_limit = 0xffffffff;
122 } else { 122 } else {
123 /* used space is stored as unsigned 64-bit value */ 123 /* used space is stored as unsigned 64-bit value in bytes */
124 info->dqi_maxblimit = 0xffffffffffffffffULL; /* 2^64-1 */ 124 info->dqi_max_spc_limit = 0xffffffffffffffffULL; /* 2^64-1 */
125 info->dqi_maxilimit = 0xffffffffffffffffULL; 125 info->dqi_max_ino_limit = 0xffffffffffffffffULL;
126 } 126 }
127 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); 127 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
128 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); 128 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);