Commit 83b7094ac141884880a1508aa17253b08583ac8b
Committed by
Greg Kroah-Hartman
1 parent
1e5c8725fc
quota: Store maximum space limit in bytes
commit b10a08194c2b615955dfab2300331a90ae9344c7 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 5 changed files with 15 additions and 25 deletions Side-by-side Diff
fs/ocfs2/quota_local.c
... | ... | @@ -701,8 +701,8 @@ |
701 | 701 | /* We don't need the lock and we have to acquire quota file locks |
702 | 702 | * which will later depend on this lock */ |
703 | 703 | mutex_unlock(&sb_dqopt(sb)->dqio_mutex); |
704 | - info->dqi_maxblimit = 0x7fffffffffffffffLL; | |
705 | - info->dqi_maxilimit = 0x7fffffffffffffffLL; | |
704 | + info->dqi_max_spc_limit = 0x7fffffffffffffffLL; | |
705 | + info->dqi_max_ino_limit = 0x7fffffffffffffffLL; | |
706 | 706 | oinfo = kmalloc(sizeof(struct ocfs2_mem_dqinfo), GFP_NOFS); |
707 | 707 | if (!oinfo) { |
708 | 708 | mlog(ML_ERROR, "failed to allocate memory for ocfs2 quota" |
fs/quota/dquot.c
... | ... | @@ -2380,16 +2380,6 @@ |
2380 | 2380 | } |
2381 | 2381 | EXPORT_SYMBOL(dquot_quota_on_mount); |
2382 | 2382 | |
2383 | -static inline qsize_t qbtos(qsize_t blocks) | |
2384 | -{ | |
2385 | - return blocks << QIF_DQBLKSIZE_BITS; | |
2386 | -} | |
2387 | - | |
2388 | -static inline qsize_t stoqb(qsize_t space) | |
2389 | -{ | |
2390 | - return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS; | |
2391 | -} | |
2392 | - | |
2393 | 2383 | /* Generic routine for getting common part of quota structure */ |
2394 | 2384 | static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di) |
2395 | 2385 | { |
2396 | 2386 | |
2397 | 2387 | |
2398 | 2388 | |
... | ... | @@ -2439,13 +2429,13 @@ |
2439 | 2429 | return -EINVAL; |
2440 | 2430 | |
2441 | 2431 | if (((di->d_fieldmask & QC_SPC_SOFT) && |
2442 | - stoqb(di->d_spc_softlimit) > dqi->dqi_maxblimit) || | |
2432 | + di->d_spc_softlimit > dqi->dqi_max_spc_limit) || | |
2443 | 2433 | ((di->d_fieldmask & QC_SPC_HARD) && |
2444 | - stoqb(di->d_spc_hardlimit) > dqi->dqi_maxblimit) || | |
2434 | + di->d_spc_hardlimit > dqi->dqi_max_spc_limit) || | |
2445 | 2435 | ((di->d_fieldmask & QC_INO_SOFT) && |
2446 | - (di->d_ino_softlimit > dqi->dqi_maxilimit)) || | |
2436 | + (di->d_ino_softlimit > dqi->dqi_max_ino_limit)) || | |
2447 | 2437 | ((di->d_fieldmask & QC_INO_HARD) && |
2448 | - (di->d_ino_hardlimit > dqi->dqi_maxilimit))) | |
2438 | + (di->d_ino_hardlimit > dqi->dqi_max_ino_limit))) | |
2449 | 2439 | return -ERANGE; |
2450 | 2440 | |
2451 | 2441 | spin_lock(&dq_data_lock); |
fs/quota/quota_v1.c
... | ... | @@ -169,8 +169,8 @@ |
169 | 169 | } |
170 | 170 | ret = 0; |
171 | 171 | /* limits are stored as unsigned 32-bit data */ |
172 | - dqopt->info[type].dqi_maxblimit = 0xffffffff; | |
173 | - dqopt->info[type].dqi_maxilimit = 0xffffffff; | |
172 | + dqopt->info[type].dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS; | |
173 | + dqopt->info[type].dqi_max_ino_limit = 0xffffffff; | |
174 | 174 | dqopt->info[type].dqi_igrace = |
175 | 175 | dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME; |
176 | 176 | dqopt->info[type].dqi_bgrace = |
fs/quota/quota_v2.c
... | ... | @@ -117,12 +117,12 @@ |
117 | 117 | qinfo = info->dqi_priv; |
118 | 118 | if (version == 0) { |
119 | 119 | /* limits are stored as unsigned 32-bit data */ |
120 | - info->dqi_maxblimit = 0xffffffff; | |
121 | - info->dqi_maxilimit = 0xffffffff; | |
120 | + info->dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS; | |
121 | + info->dqi_max_ino_limit = 0xffffffff; | |
122 | 122 | } else { |
123 | - /* used space is stored as unsigned 64-bit value */ | |
124 | - info->dqi_maxblimit = 0xffffffffffffffffULL; /* 2^64-1 */ | |
125 | - info->dqi_maxilimit = 0xffffffffffffffffULL; | |
123 | + /* used space is stored as unsigned 64-bit value in bytes */ | |
124 | + info->dqi_max_spc_limit = 0xffffffffffffffffULL; /* 2^64-1 */ | |
125 | + info->dqi_max_ino_limit = 0xffffffffffffffffULL; | |
126 | 126 | } |
127 | 127 | info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); |
128 | 128 | info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); |
include/linux/quota.h