aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 15:57:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 15:57:07 -0400
commit90e0c225968f0878e090c7ff3f88323973476cee (patch)
tree30fff5a5cb18b08d40e4d496489be6ce714a6cde /fs
parent938a73b959cf77aadc41bded3bf416b618aa20b3 (diff)
parent5f11e6a44059f728dddd8d0dbe5b4368ea93575b (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: ext3: Fix dirtying of journalled buffers in data=journal mode ext3: default to ordered mode quota: Use mark_inode_dirty_sync instead of mark_inode_dirty quota: Change quota error message to print out disk and function name MAINTAINERS: Update entries of ext2 and ext3 MAINTAINERS: Update address of Andreas Dilger ext3: Avoid filesystem corruption after a crash under heavy delete load ext3: remove vestiges of nobh support ext3: Fix set but unused variables quota: clean up quota active checks quota: Clean up the namespace in dqblk_xfs.h quota: check quota reservation on remove_dquot_ref
Diffstat (limited to 'fs')
-rw-r--r--fs/ext3/Kconfig1
-rw-r--r--fs/ext3/inode.c80
-rw-r--r--fs/ext3/namei.c3
-rw-r--r--fs/ext3/resize.c2
-rw-r--r--fs/ext3/super.c17
-rw-r--r--fs/gfs2/quota.c10
-rw-r--r--fs/jbd/journal.c7
-rw-r--r--fs/jbd/recovery.c11
-rw-r--r--fs/quota/dquot.c79
-rw-r--r--fs/quota/quota_tree.c85
-rw-r--r--fs/quota/quota_tree.h6
-rw-r--r--fs/quota/quota_v1.c3
-rw-r--r--fs/quota/quota_v2.c11
-rw-r--r--fs/xfs/linux-2.6/xfs_quotaops.c10
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c32
15 files changed, 181 insertions, 176 deletions
diff --git a/fs/ext3/Kconfig b/fs/ext3/Kconfig
index 522b15498f45..e8c6ba0e4a3e 100644
--- a/fs/ext3/Kconfig
+++ b/fs/ext3/Kconfig
@@ -31,6 +31,7 @@ config EXT3_FS
31config EXT3_DEFAULTS_TO_ORDERED 31config EXT3_DEFAULTS_TO_ORDERED
32 bool "Default to 'data=ordered' in ext3" 32 bool "Default to 'data=ordered' in ext3"
33 depends on EXT3_FS 33 depends on EXT3_FS
34 default y
34 help 35 help
35 The journal mode options for ext3 have different tradeoffs 36 The journal mode options for ext3 have different tradeoffs
36 between when data is guaranteed to be on disk and 37 between when data is guaranteed to be on disk and
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 735f0190ec2a..001eb0e2d48e 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1149,9 +1149,25 @@ static int walk_page_buffers( handle_t *handle,
1149static int do_journal_get_write_access(handle_t *handle, 1149static int do_journal_get_write_access(handle_t *handle,
1150 struct buffer_head *bh) 1150 struct buffer_head *bh)
1151{ 1151{
1152 int dirty = buffer_dirty(bh);
1153 int ret;
1154
1152 if (!buffer_mapped(bh) || buffer_freed(bh)) 1155 if (!buffer_mapped(bh) || buffer_freed(bh))
1153 return 0; 1156 return 0;
1154 return ext3_journal_get_write_access(handle, bh); 1157 /*
1158 * __block_prepare_write() could have dirtied some buffers. Clean
1159 * the dirty bit as jbd2_journal_get_write_access() could complain
1160 * otherwise about fs integrity issues. Setting of the dirty bit
1161 * by __block_prepare_write() isn't a real problem here as we clear
1162 * the bit before releasing a page lock and thus writeback cannot
1163 * ever write the buffer.
1164 */
1165 if (dirty)
1166 clear_buffer_dirty(bh);
1167 ret = ext3_journal_get_write_access(handle, bh);
1168 if (!ret && dirty)
1169 ret = ext3_journal_dirty_metadata(handle, bh);
1170 return ret;
1155} 1171}
1156 1172
1157/* 1173/*
@@ -1625,10 +1641,7 @@ static int ext3_writeback_writepage(struct page *page,
1625 goto out_fail; 1641 goto out_fail;
1626 } 1642 }
1627 1643
1628 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) 1644 ret = block_write_full_page(page, ext3_get_block, wbc);
1629 ret = nobh_writepage(page, ext3_get_block, wbc);
1630 else
1631 ret = block_write_full_page(page, ext3_get_block, wbc);
1632 1645
1633 err = ext3_journal_stop(handle); 1646 err = ext3_journal_stop(handle);
1634 if (!ret) 1647 if (!ret)
@@ -1922,17 +1935,6 @@ static int ext3_block_truncate_page(handle_t *handle, struct page *page,
1922 length = blocksize - (offset & (blocksize - 1)); 1935 length = blocksize - (offset & (blocksize - 1));
1923 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); 1936 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
1924 1937
1925 /*
1926 * For "nobh" option, we can only work if we don't need to
1927 * read-in the page - otherwise we create buffers to do the IO.
1928 */
1929 if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH) &&
1930 ext3_should_writeback_data(inode) && PageUptodate(page)) {
1931 zero_user(page, offset, length);
1932 set_page_dirty(page);
1933 goto unlock;
1934 }
1935
1936 if (!page_has_buffers(page)) 1938 if (!page_has_buffers(page))
1937 create_empty_buffers(page, blocksize, 0); 1939 create_empty_buffers(page, blocksize, 0);
1938 1940
@@ -2284,27 +2286,6 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
2284 depth); 2286 depth);
2285 2287
2286 /* 2288 /*
2287 * We've probably journalled the indirect block several
2288 * times during the truncate. But it's no longer
2289 * needed and we now drop it from the transaction via
2290 * journal_revoke().
2291 *
2292 * That's easy if it's exclusively part of this
2293 * transaction. But if it's part of the committing
2294 * transaction then journal_forget() will simply
2295 * brelse() it. That means that if the underlying
2296 * block is reallocated in ext3_get_block(),
2297 * unmap_underlying_metadata() will find this block
2298 * and will try to get rid of it. damn, damn.
2299 *
2300 * If this block has already been committed to the
2301 * journal, a revoke record will be written. And
2302 * revoke records must be emitted *before* clearing
2303 * this block's bit in the bitmaps.
2304 */
2305 ext3_forget(handle, 1, inode, bh, bh->b_blocknr);
2306
2307 /*
2308 * Everything below this this pointer has been 2289 * Everything below this this pointer has been
2309 * released. Now let this top-of-subtree go. 2290 * released. Now let this top-of-subtree go.
2310 * 2291 *
@@ -2327,6 +2308,31 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
2327 truncate_restart_transaction(handle, inode); 2308 truncate_restart_transaction(handle, inode);
2328 } 2309 }
2329 2310
2311 /*
2312 * We've probably journalled the indirect block several
2313 * times during the truncate. But it's no longer
2314 * needed and we now drop it from the transaction via
2315 * journal_revoke().
2316 *
2317 * That's easy if it's exclusively part of this
2318 * transaction. But if it's part of the committing
2319 * transaction then journal_forget() will simply
2320 * brelse() it. That means that if the underlying
2321 * block is reallocated in ext3_get_block(),
2322 * unmap_underlying_metadata() will find this block
2323 * and will try to get rid of it. damn, damn. Thus
2324 * we don't allow a block to be reallocated until
2325 * a transaction freeing it has fully committed.
2326 *
2327 * We also have to make sure journal replay after a
2328 * crash does not overwrite non-journaled data blocks
2329 * with old metadata when the block got reallocated for
2330 * data. Thus we have to store a revoke record for a
2331 * block in the same transaction in which we free the
2332 * block.
2333 */
2334 ext3_forget(handle, 1, inode, bh, bh->b_blocknr);
2335
2330 ext3_free_blocks(handle, inode, nr, 1); 2336 ext3_free_blocks(handle, inode, nr, 1);
2331 2337
2332 if (parent_bh) { 2338 if (parent_bh) {
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index ee184084ca42..2b35ddb70d65 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1447,7 +1447,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1447 struct inode *inode) 1447 struct inode *inode)
1448{ 1448{
1449 struct inode *dir = dentry->d_parent->d_inode; 1449 struct inode *dir = dentry->d_parent->d_inode;
1450 unsigned long offset;
1451 struct buffer_head * bh; 1450 struct buffer_head * bh;
1452 struct ext3_dir_entry_2 *de; 1451 struct ext3_dir_entry_2 *de;
1453 struct super_block * sb; 1452 struct super_block * sb;
@@ -1469,7 +1468,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1469 ext3_mark_inode_dirty(handle, dir); 1468 ext3_mark_inode_dirty(handle, dir);
1470 } 1469 }
1471 blocks = dir->i_size >> sb->s_blocksize_bits; 1470 blocks = dir->i_size >> sb->s_blocksize_bits;
1472 for (block = 0, offset = 0; block < blocks; block++) { 1471 for (block = 0; block < blocks; block++) {
1473 bh = ext3_bread(handle, dir, block, 0, &retval); 1472 bh = ext3_bread(handle, dir, block, 0, &retval);
1474 if(!bh) 1473 if(!bh)
1475 return retval; 1474 return retval;
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 54351ac7cef9..0ccd7b12b73c 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -964,7 +964,6 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
964 ext3_fsblk_t n_blocks_count) 964 ext3_fsblk_t n_blocks_count)
965{ 965{
966 ext3_fsblk_t o_blocks_count; 966 ext3_fsblk_t o_blocks_count;
967 unsigned long o_groups_count;
968 ext3_grpblk_t last; 967 ext3_grpblk_t last;
969 ext3_grpblk_t add; 968 ext3_grpblk_t add;
970 struct buffer_head * bh; 969 struct buffer_head * bh;
@@ -976,7 +975,6 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
976 * yet: we're going to revalidate es->s_blocks_count after 975 * yet: we're going to revalidate es->s_blocks_count after
977 * taking the s_resize_lock below. */ 976 * taking the s_resize_lock below. */
978 o_blocks_count = le32_to_cpu(es->s_blocks_count); 977 o_blocks_count = le32_to_cpu(es->s_blocks_count);
979 o_groups_count = EXT3_SB(sb)->s_groups_count;
980 978
981 if (test_opt(sb, DEBUG)) 979 if (test_opt(sb, DEBUG))
982 printk(KERN_DEBUG "EXT3-fs: extending last group from "E3FSBLK" uto "E3FSBLK" blocks\n", 980 printk(KERN_DEBUG "EXT3-fs: extending last group from "E3FSBLK" uto "E3FSBLK" blocks\n",
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 6c953bb255e7..9650a956fd0e 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -661,9 +661,6 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
661 */ 661 */
662 seq_puts(seq, ",barrier="); 662 seq_puts(seq, ",barrier=");
663 seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); 663 seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0");
664 if (test_opt(sb, NOBH))
665 seq_puts(seq, ",nobh");
666
667 seq_printf(seq, ",data=%s", data_mode_string(test_opt(sb, DATA_FLAGS))); 664 seq_printf(seq, ",data=%s", data_mode_string(test_opt(sb, DATA_FLAGS)));
668 if (test_opt(sb, DATA_ERR_ABORT)) 665 if (test_opt(sb, DATA_ERR_ABORT))
669 seq_puts(seq, ",data_err=abort"); 666 seq_puts(seq, ",data_err=abort");
@@ -1255,10 +1252,12 @@ set_qf_format:
1255 *n_blocks_count = option; 1252 *n_blocks_count = option;
1256 break; 1253 break;
1257 case Opt_nobh: 1254 case Opt_nobh:
1258 set_opt(sbi->s_mount_opt, NOBH); 1255 ext3_msg(sb, KERN_WARNING,
1256 "warning: ignoring deprecated nobh option");
1259 break; 1257 break;
1260 case Opt_bh: 1258 case Opt_bh:
1261 clear_opt(sbi->s_mount_opt, NOBH); 1259 ext3_msg(sb, KERN_WARNING,
1260 "warning: ignoring deprecated bh option");
1262 break; 1261 break;
1263 default: 1262 default:
1264 ext3_msg(sb, KERN_ERR, 1263 ext3_msg(sb, KERN_ERR,
@@ -2001,14 +2000,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
2001 break; 2000 break;
2002 } 2001 }
2003 2002
2004 if (test_opt(sb, NOBH)) {
2005 if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) {
2006 ext3_msg(sb, KERN_WARNING,
2007 "warning: ignoring nobh option - "
2008 "it is supported only with writeback mode");
2009 clear_opt(sbi->s_mount_opt, NOBH);
2010 }
2011 }
2012 /* 2003 /*
2013 * The journal_load will have done any necessary log recovery, 2004 * The journal_load will have done any necessary log recovery,
2014 * so we can safely mount the rest of the filesystem now. 2005 * so we can safely mount the rest of the filesystem now.
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 8bb643cb2658..1bc6b5695e6d 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1449,10 +1449,10 @@ static int gfs2_quota_get_xstate(struct super_block *sb,
1449 1449
1450 switch (sdp->sd_args.ar_quota) { 1450 switch (sdp->sd_args.ar_quota) {
1451 case GFS2_QUOTA_ON: 1451 case GFS2_QUOTA_ON:
1452 fqs->qs_flags |= (XFS_QUOTA_UDQ_ENFD | XFS_QUOTA_GDQ_ENFD); 1452 fqs->qs_flags |= (FS_QUOTA_UDQ_ENFD | FS_QUOTA_GDQ_ENFD);
1453 /*FALLTHRU*/ 1453 /*FALLTHRU*/
1454 case GFS2_QUOTA_ACCOUNT: 1454 case GFS2_QUOTA_ACCOUNT:
1455 fqs->qs_flags |= (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_GDQ_ACCT); 1455 fqs->qs_flags |= (FS_QUOTA_UDQ_ACCT | FS_QUOTA_GDQ_ACCT);
1456 break; 1456 break;
1457 case GFS2_QUOTA_OFF: 1457 case GFS2_QUOTA_OFF:
1458 break; 1458 break;
@@ -1498,7 +1498,7 @@ static int gfs2_get_dqblk(struct super_block *sb, int type, qid_t id,
1498 1498
1499 qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb; 1499 qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb;
1500 fdq->d_version = FS_DQUOT_VERSION; 1500 fdq->d_version = FS_DQUOT_VERSION;
1501 fdq->d_flags = (type == QUOTA_USER) ? XFS_USER_QUOTA : XFS_GROUP_QUOTA; 1501 fdq->d_flags = (type == QUOTA_USER) ? FS_USER_QUOTA : FS_GROUP_QUOTA;
1502 fdq->d_id = id; 1502 fdq->d_id = id;
1503 fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit); 1503 fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit);
1504 fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn); 1504 fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn);
@@ -1533,12 +1533,12 @@ static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id,
1533 switch(type) { 1533 switch(type) {
1534 case USRQUOTA: 1534 case USRQUOTA:
1535 type = QUOTA_USER; 1535 type = QUOTA_USER;
1536 if (fdq->d_flags != XFS_USER_QUOTA) 1536 if (fdq->d_flags != FS_USER_QUOTA)
1537 return -EINVAL; 1537 return -EINVAL;
1538 break; 1538 break;
1539 case GRPQUOTA: 1539 case GRPQUOTA:
1540 type = QUOTA_GROUP; 1540 type = QUOTA_GROUP;
1541 if (fdq->d_flags != XFS_GROUP_QUOTA) 1541 if (fdq->d_flags != FS_GROUP_QUOTA)
1542 return -EINVAL; 1542 return -EINVAL;
1543 break; 1543 break;
1544 default: 1544 default:
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 93d1e47647bd..f19ce94693d8 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1281,13 +1281,9 @@ int journal_check_used_features (journal_t *journal, unsigned long compat,
1281int journal_check_available_features (journal_t *journal, unsigned long compat, 1281int journal_check_available_features (journal_t *journal, unsigned long compat,
1282 unsigned long ro, unsigned long incompat) 1282 unsigned long ro, unsigned long incompat)
1283{ 1283{
1284 journal_superblock_t *sb;
1285
1286 if (!compat && !ro && !incompat) 1284 if (!compat && !ro && !incompat)
1287 return 1; 1285 return 1;
1288 1286
1289 sb = journal->j_superblock;
1290
1291 /* We can support any known requested features iff the 1287 /* We can support any known requested features iff the
1292 * superblock is in version 2. Otherwise we fail to support any 1288 * superblock is in version 2. Otherwise we fail to support any
1293 * extended sb features. */ 1289 * extended sb features. */
@@ -1481,7 +1477,6 @@ int journal_flush(journal_t *journal)
1481 1477
1482int journal_wipe(journal_t *journal, int write) 1478int journal_wipe(journal_t *journal, int write)
1483{ 1479{
1484 journal_superblock_t *sb;
1485 int err = 0; 1480 int err = 0;
1486 1481
1487 J_ASSERT (!(journal->j_flags & JFS_LOADED)); 1482 J_ASSERT (!(journal->j_flags & JFS_LOADED));
@@ -1490,8 +1485,6 @@ int journal_wipe(journal_t *journal, int write)
1490 if (err) 1485 if (err)
1491 return err; 1486 return err;
1492 1487
1493 sb = journal->j_superblock;
1494
1495 if (!journal->j_tail) 1488 if (!journal->j_tail)
1496 goto no_recovery; 1489 goto no_recovery;
1497 1490
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c
index 54c9bc9e1b17..81051dafebf5 100644
--- a/fs/jbd/recovery.c
+++ b/fs/jbd/recovery.c
@@ -283,12 +283,9 @@ int journal_recover(journal_t *journal)
283int journal_skip_recovery(journal_t *journal) 283int journal_skip_recovery(journal_t *journal)
284{ 284{
285 int err; 285 int err;
286 journal_superblock_t * sb;
287
288 struct recovery_info info; 286 struct recovery_info info;
289 287
290 memset (&info, 0, sizeof(info)); 288 memset (&info, 0, sizeof(info));
291 sb = journal->j_superblock;
292 289
293 err = do_one_pass(journal, &info, PASS_SCAN); 290 err = do_one_pass(journal, &info, PASS_SCAN);
294 291
@@ -297,7 +294,8 @@ int journal_skip_recovery(journal_t *journal)
297 ++journal->j_transaction_sequence; 294 ++journal->j_transaction_sequence;
298 } else { 295 } else {
299#ifdef CONFIG_JBD_DEBUG 296#ifdef CONFIG_JBD_DEBUG
300 int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); 297 int dropped = info.end_transaction -
298 be32_to_cpu(journal->j_superblock->s_sequence);
301#endif 299#endif
302 jbd_debug(1, 300 jbd_debug(1,
303 "JBD: ignoring %d transaction%s from the journal.\n", 301 "JBD: ignoring %d transaction%s from the journal.\n",
@@ -321,11 +319,6 @@ static int do_one_pass(journal_t *journal,
321 unsigned int sequence; 319 unsigned int sequence;
322 int blocktype; 320 int blocktype;
323 321
324 /* Precompute the maximum metadata descriptors in a descriptor block */
325 int MAX_BLOCKS_PER_DESC;
326 MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t))
327 / sizeof(journal_block_tag_t));
328
329 /* 322 /*
330 * First thing is to establish what we expect to find in the log 323 * First thing is to establish what we expect to find in the log
331 * (in terms of transaction IDs), and where (in terms of log 324 * (in terms of transaction IDs), and where (in terms of log
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 437d2ca2de97..ef72b1699429 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -132,6 +132,22 @@ static __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_state_lock);
132__cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_data_lock); 132__cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_data_lock);
133EXPORT_SYMBOL(dq_data_lock); 133EXPORT_SYMBOL(dq_data_lock);
134 134
135void __quota_error(struct super_block *sb, const char *func,
136 const char *fmt, ...)
137{
138 va_list args;
139
140 if (printk_ratelimit()) {
141 va_start(args, fmt);
142 printk(KERN_ERR "Quota error (device %s): %s: ",
143 sb->s_id, func);
144 vprintk(fmt, args);
145 printk("\n");
146 va_end(args);
147 }
148}
149EXPORT_SYMBOL(__quota_error);
150
135#if defined(CONFIG_QUOTA_DEBUG) || defined(CONFIG_PRINT_QUOTA_WARNING) 151#if defined(CONFIG_QUOTA_DEBUG) || defined(CONFIG_PRINT_QUOTA_WARNING)
136static char *quotatypes[] = INITQFNAMES; 152static char *quotatypes[] = INITQFNAMES;
137#endif 153#endif
@@ -705,11 +721,8 @@ void dqput(struct dquot *dquot)
705 return; 721 return;
706#ifdef CONFIG_QUOTA_DEBUG 722#ifdef CONFIG_QUOTA_DEBUG
707 if (!atomic_read(&dquot->dq_count)) { 723 if (!atomic_read(&dquot->dq_count)) {
708 printk("VFS: dqput: trying to free free dquot\n"); 724 quota_error(dquot->dq_sb, "trying to free free dquot of %s %d",
709 printk("VFS: device %s, dquot of %s %d\n", 725 quotatypes[dquot->dq_type], dquot->dq_id);
710 dquot->dq_sb->s_id,
711 quotatypes[dquot->dq_type],
712 dquot->dq_id);
713 BUG(); 726 BUG();
714 } 727 }
715#endif 728#endif
@@ -732,9 +745,9 @@ we_slept:
732 /* Commit dquot before releasing */ 745 /* Commit dquot before releasing */
733 ret = dquot->dq_sb->dq_op->write_dquot(dquot); 746 ret = dquot->dq_sb->dq_op->write_dquot(dquot);
734 if (ret < 0) { 747 if (ret < 0) {
735 printk(KERN_ERR "VFS: cannot write quota structure on " 748 quota_error(dquot->dq_sb, "Can't write quota structure"
736 "device %s (error %d). Quota may get out of " 749 " (error %d). Quota may get out of sync!",
737 "sync!\n", dquot->dq_sb->s_id, ret); 750 ret);
738 /* 751 /*
739 * We clear dirty bit anyway, so that we avoid 752 * We clear dirty bit anyway, so that we avoid
740 * infinite loop here 753 * infinite loop here
@@ -914,9 +927,9 @@ static void add_dquot_ref(struct super_block *sb, int type)
914 927
915#ifdef CONFIG_QUOTA_DEBUG 928#ifdef CONFIG_QUOTA_DEBUG
916 if (reserved) { 929 if (reserved) {
917 printk(KERN_WARNING "VFS (%s): Writes happened before quota" 930 quota_error(sb, "Writes happened before quota was turned on "
918 " was turned on thus quota information is probably " 931 "thus quota information is probably inconsistent. "
919 "inconsistent. Please run quotacheck(8).\n", sb->s_id); 932 "Please run quotacheck(8)");
920 } 933 }
921#endif 934#endif
922} 935}
@@ -947,7 +960,9 @@ static int remove_inode_dquot_ref(struct inode *inode, int type,
947 if (dqput_blocks(dquot)) { 960 if (dqput_blocks(dquot)) {
948#ifdef CONFIG_QUOTA_DEBUG 961#ifdef CONFIG_QUOTA_DEBUG
949 if (atomic_read(&dquot->dq_count) != 1) 962 if (atomic_read(&dquot->dq_count) != 1)
950 printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count)); 963 quota_error(inode->i_sb, "Adding dquot with "
964 "dq_count %d to dispose list",
965 atomic_read(&dquot->dq_count));
951#endif 966#endif
952 spin_lock(&dq_list_lock); 967 spin_lock(&dq_list_lock);
953 /* As dquot must have currently users it can't be on 968 /* As dquot must have currently users it can't be on
@@ -986,6 +1001,7 @@ static void remove_dquot_ref(struct super_block *sb, int type,
986 struct list_head *tofree_head) 1001 struct list_head *tofree_head)
987{ 1002{
988 struct inode *inode; 1003 struct inode *inode;
1004 int reserved = 0;
989 1005
990 spin_lock(&inode_lock); 1006 spin_lock(&inode_lock);
991 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { 1007 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
@@ -995,10 +1011,20 @@ static void remove_dquot_ref(struct super_block *sb, int type,
995 * only quota pointers and these have separate locking 1011 * only quota pointers and these have separate locking
996 * (dqptr_sem). 1012 * (dqptr_sem).
997 */ 1013 */
998 if (!IS_NOQUOTA(inode)) 1014 if (!IS_NOQUOTA(inode)) {
1015 if (unlikely(inode_get_rsv_space(inode) > 0))
1016 reserved = 1;
999 remove_inode_dquot_ref(inode, type, tofree_head); 1017 remove_inode_dquot_ref(inode, type, tofree_head);
1018 }
1000 } 1019 }
1001 spin_unlock(&inode_lock); 1020 spin_unlock(&inode_lock);
1021#ifdef CONFIG_QUOTA_DEBUG
1022 if (reserved) {
1023 printk(KERN_WARNING "VFS (%s): Writes happened after quota"
1024 " was disabled thus quota information is probably "
1025 "inconsistent. Please run quotacheck(8).\n", sb->s_id);
1026 }
1027#endif
1002} 1028}
1003 1029
1004/* Gather all references from inodes and drop them */ 1030/* Gather all references from inodes and drop them */
@@ -1304,6 +1330,15 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)
1304 return QUOTA_NL_NOWARN; 1330 return QUOTA_NL_NOWARN;
1305} 1331}
1306 1332
1333static int dquot_active(const struct inode *inode)
1334{
1335 struct super_block *sb = inode->i_sb;
1336
1337 if (IS_NOQUOTA(inode))
1338 return 0;
1339 return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb);
1340}
1341
1307/* 1342/*
1308 * Initialize quota pointers in inode 1343 * Initialize quota pointers in inode
1309 * 1344 *
@@ -1323,7 +1358,7 @@ static void __dquot_initialize(struct inode *inode, int type)
1323 1358
1324 /* First test before acquiring mutex - solves deadlocks when we 1359 /* First test before acquiring mutex - solves deadlocks when we
1325 * re-enter the quota code and are already holding the mutex */ 1360 * re-enter the quota code and are already holding the mutex */
1326 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) 1361 if (!dquot_active(inode))
1327 return; 1362 return;
1328 1363
1329 /* First get references to structures we might need. */ 1364 /* First get references to structures we might need. */
@@ -1507,7 +1542,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
1507 * First test before acquiring mutex - solves deadlocks when we 1542 * First test before acquiring mutex - solves deadlocks when we
1508 * re-enter the quota code and are already holding the mutex 1543 * re-enter the quota code and are already holding the mutex
1509 */ 1544 */
1510 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { 1545 if (!dquot_active(inode)) {
1511 inode_incr_space(inode, number, reserve); 1546 inode_incr_space(inode, number, reserve);
1512 goto out; 1547 goto out;
1513 } 1548 }
@@ -1559,7 +1594,7 @@ int dquot_alloc_inode(const struct inode *inode)
1559 1594
1560 /* First test before acquiring mutex - solves deadlocks when we 1595 /* First test before acquiring mutex - solves deadlocks when we
1561 * re-enter the quota code and are already holding the mutex */ 1596 * re-enter the quota code and are already holding the mutex */
1562 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) 1597 if (!dquot_active(inode))
1563 return 0; 1598 return 0;
1564 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1599 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1565 warntype[cnt] = QUOTA_NL_NOWARN; 1600 warntype[cnt] = QUOTA_NL_NOWARN;
@@ -1596,7 +1631,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
1596{ 1631{
1597 int cnt; 1632 int cnt;
1598 1633
1599 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { 1634 if (!dquot_active(inode)) {
1600 inode_claim_rsv_space(inode, number); 1635 inode_claim_rsv_space(inode, number);
1601 return 0; 1636 return 0;
1602 } 1637 }
@@ -1629,7 +1664,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
1629 1664
1630 /* First test before acquiring mutex - solves deadlocks when we 1665 /* First test before acquiring mutex - solves deadlocks when we
1631 * re-enter the quota code and are already holding the mutex */ 1666 * re-enter the quota code and are already holding the mutex */
1632 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { 1667 if (!dquot_active(inode)) {
1633 inode_decr_space(inode, number, reserve); 1668 inode_decr_space(inode, number, reserve);
1634 return; 1669 return;
1635 } 1670 }
@@ -1667,7 +1702,7 @@ void dquot_free_inode(const struct inode *inode)
1667 1702
1668 /* First test before acquiring mutex - solves deadlocks when we 1703 /* First test before acquiring mutex - solves deadlocks when we
1669 * re-enter the quota code and are already holding the mutex */ 1704 * re-enter the quota code and are already holding the mutex */
1670 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) 1705 if (!dquot_active(inode))
1671 return; 1706 return;
1672 1707
1673 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1708 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -1790,7 +1825,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1790 struct super_block *sb = inode->i_sb; 1825 struct super_block *sb = inode->i_sb;
1791 int ret; 1826 int ret;
1792 1827
1793 if (!sb_any_quota_active(sb) || IS_NOQUOTA(inode)) 1828 if (!dquot_active(inode))
1794 return 0; 1829 return 0;
1795 1830
1796 if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) 1831 if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid)
@@ -1957,7 +1992,7 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags)
1957 truncate_inode_pages(&toputinode[cnt]->i_data, 1992 truncate_inode_pages(&toputinode[cnt]->i_data,
1958 0); 1993 0);
1959 mutex_unlock(&toputinode[cnt]->i_mutex); 1994 mutex_unlock(&toputinode[cnt]->i_mutex);
1960 mark_inode_dirty(toputinode[cnt]); 1995 mark_inode_dirty_sync(toputinode[cnt]);
1961 } 1996 }
1962 mutex_unlock(&dqopt->dqonoff_mutex); 1997 mutex_unlock(&dqopt->dqonoff_mutex);
1963 } 1998 }
@@ -2270,7 +2305,7 @@ static void do_get_dqblk(struct dquot *dquot, struct fs_disk_quota *di)
2270 memset(di, 0, sizeof(*di)); 2305 memset(di, 0, sizeof(*di));
2271 di->d_version = FS_DQUOT_VERSION; 2306 di->d_version = FS_DQUOT_VERSION;
2272 di->d_flags = dquot->dq_type == USRQUOTA ? 2307 di->d_flags = dquot->dq_type == USRQUOTA ?
2273 XFS_USER_QUOTA : XFS_GROUP_QUOTA; 2308 FS_USER_QUOTA : FS_GROUP_QUOTA;
2274 di->d_id = dquot->dq_id; 2309 di->d_id = dquot->dq_id;
2275 2310
2276 spin_lock(&dq_data_lock); 2311 spin_lock(&dq_data_lock);
diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c
index 24f03407eeb5..9e48874eabcc 100644
--- a/fs/quota/quota_tree.c
+++ b/fs/quota/quota_tree.c
@@ -65,8 +65,7 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)
65 ret = sb->s_op->quota_write(sb, info->dqi_type, buf, 65 ret = sb->s_op->quota_write(sb, info->dqi_type, buf,
66 info->dqi_usable_bs, blk << info->dqi_blocksize_bits); 66 info->dqi_usable_bs, blk << info->dqi_blocksize_bits);
67 if (ret != info->dqi_usable_bs) { 67 if (ret != info->dqi_usable_bs) {
68 q_warn(KERN_WARNING "VFS: dquota write failed on " 68 quota_error(sb, "dquota write failed");
69 "dev %s\n", sb->s_id);
70 if (ret >= 0) 69 if (ret >= 0)
71 ret = -EIO; 70 ret = -EIO;
72 } 71 }
@@ -160,9 +159,8 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
160 dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0); 159 dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0);
161 /* No matter whether write succeeds block is out of list */ 160 /* No matter whether write succeeds block is out of list */
162 if (write_blk(info, blk, buf) < 0) 161 if (write_blk(info, blk, buf) < 0)
163 q_warn(KERN_ERR 162 quota_error(info->dqi_sb, "Can't write block (%u) "
164 "VFS: Can't write block (%u) with free entries.\n", 163 "with free entries", blk);
165 blk);
166 return 0; 164 return 0;
167out_buf: 165out_buf:
168 kfree(tmpbuf); 166 kfree(tmpbuf);
@@ -252,9 +250,8 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
252 if (le16_to_cpu(dh->dqdh_entries) + 1 >= qtree_dqstr_in_blk(info)) { 250 if (le16_to_cpu(dh->dqdh_entries) + 1 >= qtree_dqstr_in_blk(info)) {
253 *err = remove_free_dqentry(info, buf, blk); 251 *err = remove_free_dqentry(info, buf, blk);
254 if (*err < 0) { 252 if (*err < 0) {
255 q_warn(KERN_ERR "VFS: find_free_dqentry(): Can't " 253 quota_error(dquot->dq_sb, "Can't remove block (%u) "
256 "remove block (%u) from entry free list.\n", 254 "from entry free list", blk);
257 blk);
258 goto out_buf; 255 goto out_buf;
259 } 256 }
260 } 257 }
@@ -268,16 +265,15 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
268 } 265 }
269#ifdef __QUOTA_QT_PARANOIA 266#ifdef __QUOTA_QT_PARANOIA
270 if (i == qtree_dqstr_in_blk(info)) { 267 if (i == qtree_dqstr_in_blk(info)) {
271 printk(KERN_ERR "VFS: find_free_dqentry(): Data block full " 268 quota_error(dquot->dq_sb, "Data block full but it shouldn't");
272 "but it shouldn't.\n");
273 *err = -EIO; 269 *err = -EIO;
274 goto out_buf; 270 goto out_buf;
275 } 271 }
276#endif 272#endif
277 *err = write_blk(info, blk, buf); 273 *err = write_blk(info, blk, buf);
278 if (*err < 0) { 274 if (*err < 0) {
279 q_warn(KERN_ERR "VFS: find_free_dqentry(): Can't write quota " 275 quota_error(dquot->dq_sb, "Can't write quota data block %u",
280 "data block %u.\n", blk); 276 blk);
281 goto out_buf; 277 goto out_buf;
282 } 278 }
283 dquot->dq_off = (blk << info->dqi_blocksize_bits) + 279 dquot->dq_off = (blk << info->dqi_blocksize_bits) +
@@ -311,8 +307,8 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
311 } else { 307 } else {
312 ret = read_blk(info, *treeblk, buf); 308 ret = read_blk(info, *treeblk, buf);
313 if (ret < 0) { 309 if (ret < 0) {
314 q_warn(KERN_ERR "VFS: Can't read tree quota block " 310 quota_error(dquot->dq_sb, "Can't read tree quota "
315 "%u.\n", *treeblk); 311 "block %u", *treeblk);
316 goto out_buf; 312 goto out_buf;
317 } 313 }
318 } 314 }
@@ -323,9 +319,9 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
323 if (depth == info->dqi_qtree_depth - 1) { 319 if (depth == info->dqi_qtree_depth - 1) {
324#ifdef __QUOTA_QT_PARANOIA 320#ifdef __QUOTA_QT_PARANOIA
325 if (newblk) { 321 if (newblk) {
326 printk(KERN_ERR "VFS: Inserting already present quota " 322 quota_error(dquot->dq_sb, "Inserting already present "
327 "entry (block %u).\n", 323 "quota entry (block %u)",
328 le32_to_cpu(ref[get_index(info, 324 le32_to_cpu(ref[get_index(info,
329 dquot->dq_id, depth)])); 325 dquot->dq_id, depth)]));
330 ret = -EIO; 326 ret = -EIO;
331 goto out_buf; 327 goto out_buf;
@@ -373,8 +369,8 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
373 if (!dquot->dq_off) { 369 if (!dquot->dq_off) {
374 ret = dq_insert_tree(info, dquot); 370 ret = dq_insert_tree(info, dquot);
375 if (ret < 0) { 371 if (ret < 0) {
376 q_warn(KERN_ERR "VFS: Error %zd occurred while " 372 quota_error(sb, "Error %zd occurred while creating "
377 "creating quota.\n", ret); 373 "quota", ret);
378 kfree(ddquot); 374 kfree(ddquot);
379 return ret; 375 return ret;
380 } 376 }
@@ -385,8 +381,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
385 ret = sb->s_op->quota_write(sb, type, ddquot, info->dqi_entry_size, 381 ret = sb->s_op->quota_write(sb, type, ddquot, info->dqi_entry_size,
386 dquot->dq_off); 382 dquot->dq_off);
387 if (ret != info->dqi_entry_size) { 383 if (ret != info->dqi_entry_size) {
388 q_warn(KERN_WARNING "VFS: dquota write failed on dev %s\n", 384 quota_error(sb, "dquota write failed");
389 sb->s_id);
390 if (ret >= 0) 385 if (ret >= 0)
391 ret = -ENOSPC; 386 ret = -ENOSPC;
392 } else { 387 } else {
@@ -410,14 +405,15 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
410 if (!buf) 405 if (!buf)
411 return -ENOMEM; 406 return -ENOMEM;
412 if (dquot->dq_off >> info->dqi_blocksize_bits != blk) { 407 if (dquot->dq_off >> info->dqi_blocksize_bits != blk) {
413 q_warn(KERN_ERR "VFS: Quota structure has offset to other " 408 quota_error(dquot->dq_sb, "Quota structure has offset to "
414 "block (%u) than it should (%u).\n", blk, 409 "other block (%u) than it should (%u)", blk,
415 (uint)(dquot->dq_off >> info->dqi_blocksize_bits)); 410 (uint)(dquot->dq_off >> info->dqi_blocksize_bits));
416 goto out_buf; 411 goto out_buf;
417 } 412 }
418 ret = read_blk(info, blk, buf); 413 ret = read_blk(info, blk, buf);
419 if (ret < 0) { 414 if (ret < 0) {
420 q_warn(KERN_ERR "VFS: Can't read quota data block %u\n", blk); 415 quota_error(dquot->dq_sb, "Can't read quota data block %u",
416 blk);
421 goto out_buf; 417 goto out_buf;
422 } 418 }
423 dh = (struct qt_disk_dqdbheader *)buf; 419 dh = (struct qt_disk_dqdbheader *)buf;
@@ -427,8 +423,8 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
427 if (ret >= 0) 423 if (ret >= 0)
428 ret = put_free_dqblk(info, buf, blk); 424 ret = put_free_dqblk(info, buf, blk);
429 if (ret < 0) { 425 if (ret < 0) {
430 q_warn(KERN_ERR "VFS: Can't move quota data block (%u) " 426 quota_error(dquot->dq_sb, "Can't move quota data block "
431 "to free list.\n", blk); 427 "(%u) to free list", blk);
432 goto out_buf; 428 goto out_buf;
433 } 429 }
434 } else { 430 } else {
@@ -440,15 +436,15 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
440 /* Insert will write block itself */ 436 /* Insert will write block itself */
441 ret = insert_free_dqentry(info, buf, blk); 437 ret = insert_free_dqentry(info, buf, blk);
442 if (ret < 0) { 438 if (ret < 0) {
443 q_warn(KERN_ERR "VFS: Can't insert quota data " 439 quota_error(dquot->dq_sb, "Can't insert quota "
444 "block (%u) to free entry list.\n", blk); 440 "data block (%u) to free entry list", blk);
445 goto out_buf; 441 goto out_buf;
446 } 442 }
447 } else { 443 } else {
448 ret = write_blk(info, blk, buf); 444 ret = write_blk(info, blk, buf);
449 if (ret < 0) { 445 if (ret < 0) {
450 q_warn(KERN_ERR "VFS: Can't write quota data " 446 quota_error(dquot->dq_sb, "Can't write quota "
451 "block %u\n", blk); 447 "data block %u", blk);
452 goto out_buf; 448 goto out_buf;
453 } 449 }
454 } 450 }
@@ -472,7 +468,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
472 return -ENOMEM; 468 return -ENOMEM;
473 ret = read_blk(info, *blk, buf); 469 ret = read_blk(info, *blk, buf);
474 if (ret < 0) { 470 if (ret < 0) {
475 q_warn(KERN_ERR "VFS: Can't read quota data block %u\n", *blk); 471 quota_error(dquot->dq_sb, "Can't read quota data "
472 "block %u", blk);
476 goto out_buf; 473 goto out_buf;
477 } 474 }
478 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); 475 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
@@ -496,8 +493,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
496 } else { 493 } else {
497 ret = write_blk(info, *blk, buf); 494 ret = write_blk(info, *blk, buf);
498 if (ret < 0) 495 if (ret < 0)
499 q_warn(KERN_ERR "VFS: Can't write quota tree " 496 quota_error(dquot->dq_sb, "Can't write quota "
500 "block %u.\n", *blk); 497 "tree block %u", blk);
501 } 498 }
502 } 499 }
503out_buf: 500out_buf:
@@ -529,7 +526,8 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
529 return -ENOMEM; 526 return -ENOMEM;
530 ret = read_blk(info, blk, buf); 527 ret = read_blk(info, blk, buf);
531 if (ret < 0) { 528 if (ret < 0) {
532 q_warn(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk); 529 quota_error(dquot->dq_sb, "Can't read quota tree "
530 "block %u", blk);
533 goto out_buf; 531 goto out_buf;
534 } 532 }
535 ddquot = buf + sizeof(struct qt_disk_dqdbheader); 533 ddquot = buf + sizeof(struct qt_disk_dqdbheader);
@@ -539,8 +537,8 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
539 ddquot += info->dqi_entry_size; 537 ddquot += info->dqi_entry_size;
540 } 538 }
541 if (i == qtree_dqstr_in_blk(info)) { 539 if (i == qtree_dqstr_in_blk(info)) {
542 q_warn(KERN_ERR "VFS: Quota for id %u referenced " 540 quota_error(dquot->dq_sb, "Quota for id %u referenced "
543 "but not present.\n", dquot->dq_id); 541 "but not present", dquot->dq_id);
544 ret = -EIO; 542 ret = -EIO;
545 goto out_buf; 543 goto out_buf;
546 } else { 544 } else {
@@ -564,7 +562,8 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
564 return -ENOMEM; 562 return -ENOMEM;
565 ret = read_blk(info, blk, buf); 563 ret = read_blk(info, blk, buf);
566 if (ret < 0) { 564 if (ret < 0) {
567 q_warn(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk); 565 quota_error(dquot->dq_sb, "Can't read quota tree block %u",
566 blk);
568 goto out_buf; 567 goto out_buf;
569 } 568 }
570 ret = 0; 569 ret = 0;
@@ -598,7 +597,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
598#ifdef __QUOTA_QT_PARANOIA 597#ifdef __QUOTA_QT_PARANOIA
599 /* Invalidated quota? */ 598 /* Invalidated quota? */
600 if (!sb_dqopt(dquot->dq_sb)->files[type]) { 599 if (!sb_dqopt(dquot->dq_sb)->files[type]) {
601 printk(KERN_ERR "VFS: Quota invalidated while reading!\n"); 600 quota_error(sb, "Quota invalidated while reading!");
602 return -EIO; 601 return -EIO;
603 } 602 }
604#endif 603#endif
@@ -607,8 +606,8 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
607 offset = find_dqentry(info, dquot); 606 offset = find_dqentry(info, dquot);
608 if (offset <= 0) { /* Entry not present? */ 607 if (offset <= 0) { /* Entry not present? */
609 if (offset < 0) 608 if (offset < 0)
610 q_warn(KERN_ERR "VFS: Can't read quota " 609 quota_error(sb, "Can't read quota structure "
611 "structure for id %u.\n", dquot->dq_id); 610 "for id %u", dquot->dq_id);
612 dquot->dq_off = 0; 611 dquot->dq_off = 0;
613 set_bit(DQ_FAKE_B, &dquot->dq_flags); 612 set_bit(DQ_FAKE_B, &dquot->dq_flags);
614 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); 613 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
@@ -625,8 +624,8 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
625 if (ret != info->dqi_entry_size) { 624 if (ret != info->dqi_entry_size) {
626 if (ret >= 0) 625 if (ret >= 0)
627 ret = -EIO; 626 ret = -EIO;
628 q_warn(KERN_ERR "VFS: Error while reading quota " 627 quota_error(sb, "Error while reading quota structure for id %u",
629 "structure for id %u.\n", dquot->dq_id); 628 dquot->dq_id);
630 set_bit(DQ_FAKE_B, &dquot->dq_flags); 629 set_bit(DQ_FAKE_B, &dquot->dq_flags);
631 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); 630 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
632 kfree(ddquot); 631 kfree(ddquot);
diff --git a/fs/quota/quota_tree.h b/fs/quota/quota_tree.h
index ccc3e71fb1d8..a1ab8db81a51 100644
--- a/fs/quota/quota_tree.h
+++ b/fs/quota/quota_tree.h
@@ -22,10 +22,4 @@ struct qt_disk_dqdbheader {
22 22
23#define QT_TREEOFF 1 /* Offset of tree in file in blocks */ 23#define QT_TREEOFF 1 /* Offset of tree in file in blocks */
24 24
25#define q_warn(fmt, args...) \
26do { \
27 if (printk_ratelimit()) \
28 printk(fmt, ## args); \
29} while(0)
30
31#endif /* _LINUX_QUOTAIO_TREE_H */ 25#endif /* _LINUX_QUOTAIO_TREE_H */
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index 4af344c5852a..34b37a67bb16 100644
--- a/fs/quota/quota_v1.c
+++ b/fs/quota/quota_v1.c
@@ -95,8 +95,7 @@ static int v1_commit_dqblk(struct dquot *dquot)
95 (char *)&dqblk, sizeof(struct v1_disk_dqblk), 95 (char *)&dqblk, sizeof(struct v1_disk_dqblk),
96 v1_dqoff(dquot->dq_id)); 96 v1_dqoff(dquot->dq_id));
97 if (ret != sizeof(struct v1_disk_dqblk)) { 97 if (ret != sizeof(struct v1_disk_dqblk)) {
98 printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", 98 quota_error(dquot->dq_sb, "dquota write failed");
99 dquot->dq_sb->s_id);
100 if (ret >= 0) 99 if (ret >= 0)
101 ret = -EIO; 100 ret = -EIO;
102 goto out; 101 goto out;
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index 135206af1458..65444d29406b 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -63,9 +63,8 @@ static int v2_read_header(struct super_block *sb, int type,
63 size = sb->s_op->quota_read(sb, type, (char *)dqhead, 63 size = sb->s_op->quota_read(sb, type, (char *)dqhead,
64 sizeof(struct v2_disk_dqheader), 0); 64 sizeof(struct v2_disk_dqheader), 0);
65 if (size != sizeof(struct v2_disk_dqheader)) { 65 if (size != sizeof(struct v2_disk_dqheader)) {
66 q_warn(KERN_WARNING "quota_v2: Failed header read:" 66 quota_error(sb, "Failed header read: expected=%zd got=%zd",
67 " expected=%zd got=%zd\n", 67 sizeof(struct v2_disk_dqheader), size);
68 sizeof(struct v2_disk_dqheader), size);
69 return 0; 68 return 0;
70 } 69 }
71 return 1; 70 return 1;
@@ -106,8 +105,7 @@ static int v2_read_file_info(struct super_block *sb, int type)
106 size = sb->s_op->quota_read(sb, type, (char *)&dinfo, 105 size = sb->s_op->quota_read(sb, type, (char *)&dinfo,
107 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); 106 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF);
108 if (size != sizeof(struct v2_disk_dqinfo)) { 107 if (size != sizeof(struct v2_disk_dqinfo)) {
109 q_warn(KERN_WARNING "quota_v2: Can't read info structure on device %s.\n", 108 quota_error(sb, "Can't read info structure");
110 sb->s_id);
111 return -1; 109 return -1;
112 } 110 }
113 info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS); 111 info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS);
@@ -167,8 +165,7 @@ static int v2_write_file_info(struct super_block *sb, int type)
167 size = sb->s_op->quota_write(sb, type, (char *)&dinfo, 165 size = sb->s_op->quota_write(sb, type, (char *)&dinfo,
168 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); 166 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF);
169 if (size != sizeof(struct v2_disk_dqinfo)) { 167 if (size != sizeof(struct v2_disk_dqinfo)) {
170 q_warn(KERN_WARNING "Can't write info structure on device %s.\n", 168 quota_error(sb, "Can't write info structure");
171 sb->s_id);
172 return -1; 169 return -1;
173 } 170 }
174 return 0; 171 return 0;
diff --git a/fs/xfs/linux-2.6/xfs_quotaops.c b/fs/xfs/linux-2.6/xfs_quotaops.c
index bfd5ac9d1f6f..29b9d642e93d 100644
--- a/fs/xfs/linux-2.6/xfs_quotaops.c
+++ b/fs/xfs/linux-2.6/xfs_quotaops.c
@@ -68,15 +68,15 @@ xfs_fs_set_xstate(
68 if (op != Q_XQUOTARM && !XFS_IS_QUOTA_RUNNING(mp)) 68 if (op != Q_XQUOTARM && !XFS_IS_QUOTA_RUNNING(mp))
69 return -ENOSYS; 69 return -ENOSYS;
70 70
71 if (uflags & XFS_QUOTA_UDQ_ACCT) 71 if (uflags & FS_QUOTA_UDQ_ACCT)
72 flags |= XFS_UQUOTA_ACCT; 72 flags |= XFS_UQUOTA_ACCT;
73 if (uflags & XFS_QUOTA_PDQ_ACCT) 73 if (uflags & FS_QUOTA_PDQ_ACCT)
74 flags |= XFS_PQUOTA_ACCT; 74 flags |= XFS_PQUOTA_ACCT;
75 if (uflags & XFS_QUOTA_GDQ_ACCT) 75 if (uflags & FS_QUOTA_GDQ_ACCT)
76 flags |= XFS_GQUOTA_ACCT; 76 flags |= XFS_GQUOTA_ACCT;
77 if (uflags & XFS_QUOTA_UDQ_ENFD) 77 if (uflags & FS_QUOTA_UDQ_ENFD)
78 flags |= XFS_UQUOTA_ENFD; 78 flags |= XFS_UQUOTA_ENFD;
79 if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD)) 79 if (uflags & (FS_QUOTA_PDQ_ENFD|FS_QUOTA_GDQ_ENFD))
80 flags |= XFS_OQUOTA_ENFD; 80 flags |= XFS_OQUOTA_ENFD;
81 81
82 switch (op) { 82 switch (op) {
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index d257eb8557c4..45e5849df238 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -810,9 +810,9 @@ xfs_qm_export_dquot(
810 } 810 }
811 811
812#ifdef DEBUG 812#ifdef DEBUG
813 if (((XFS_IS_UQUOTA_ENFORCED(mp) && dst->d_flags == XFS_USER_QUOTA) || 813 if (((XFS_IS_UQUOTA_ENFORCED(mp) && dst->d_flags == FS_USER_QUOTA) ||
814 (XFS_IS_OQUOTA_ENFORCED(mp) && 814 (XFS_IS_OQUOTA_ENFORCED(mp) &&
815 (dst->d_flags & (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA)))) && 815 (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) &&
816 dst->d_id != 0) { 816 dst->d_id != 0) {
817 if (((int) dst->d_bcount >= (int) dst->d_blk_softlimit) && 817 if (((int) dst->d_bcount >= (int) dst->d_blk_softlimit) &&
818 (dst->d_blk_softlimit > 0)) { 818 (dst->d_blk_softlimit > 0)) {
@@ -833,17 +833,17 @@ xfs_qm_export_qtype_flags(
833 /* 833 /*
834 * Can't be more than one, or none. 834 * Can't be more than one, or none.
835 */ 835 */
836 ASSERT((flags & (XFS_PROJ_QUOTA | XFS_USER_QUOTA)) != 836 ASSERT((flags & (FS_PROJ_QUOTA | FS_USER_QUOTA)) !=
837 (XFS_PROJ_QUOTA | XFS_USER_QUOTA)); 837 (FS_PROJ_QUOTA | FS_USER_QUOTA));
838 ASSERT((flags & (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA)) != 838 ASSERT((flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)) !=
839 (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA)); 839 (FS_PROJ_QUOTA | FS_GROUP_QUOTA));
840 ASSERT((flags & (XFS_USER_QUOTA | XFS_GROUP_QUOTA)) != 840 ASSERT((flags & (FS_USER_QUOTA | FS_GROUP_QUOTA)) !=
841 (XFS_USER_QUOTA | XFS_GROUP_QUOTA)); 841 (FS_USER_QUOTA | FS_GROUP_QUOTA));
842 ASSERT((flags & (XFS_PROJ_QUOTA|XFS_USER_QUOTA|XFS_GROUP_QUOTA)) != 0); 842 ASSERT((flags & (FS_PROJ_QUOTA|FS_USER_QUOTA|FS_GROUP_QUOTA)) != 0);
843 843
844 return (flags & XFS_DQ_USER) ? 844 return (flags & XFS_DQ_USER) ?
845 XFS_USER_QUOTA : (flags & XFS_DQ_PROJ) ? 845 FS_USER_QUOTA : (flags & XFS_DQ_PROJ) ?
846 XFS_PROJ_QUOTA : XFS_GROUP_QUOTA; 846 FS_PROJ_QUOTA : FS_GROUP_QUOTA;
847} 847}
848 848
849STATIC uint 849STATIC uint
@@ -854,16 +854,16 @@ xfs_qm_export_flags(
854 854
855 uflags = 0; 855 uflags = 0;
856 if (flags & XFS_UQUOTA_ACCT) 856 if (flags & XFS_UQUOTA_ACCT)
857 uflags |= XFS_QUOTA_UDQ_ACCT; 857 uflags |= FS_QUOTA_UDQ_ACCT;
858 if (flags & XFS_PQUOTA_ACCT) 858 if (flags & XFS_PQUOTA_ACCT)
859 uflags |= XFS_QUOTA_PDQ_ACCT; 859 uflags |= FS_QUOTA_PDQ_ACCT;
860 if (flags & XFS_GQUOTA_ACCT) 860 if (flags & XFS_GQUOTA_ACCT)
861 uflags |= XFS_QUOTA_GDQ_ACCT; 861 uflags |= FS_QUOTA_GDQ_ACCT;
862 if (flags & XFS_UQUOTA_ENFD) 862 if (flags & XFS_UQUOTA_ENFD)
863 uflags |= XFS_QUOTA_UDQ_ENFD; 863 uflags |= FS_QUOTA_UDQ_ENFD;
864 if (flags & (XFS_OQUOTA_ENFD)) { 864 if (flags & (XFS_OQUOTA_ENFD)) {
865 uflags |= (flags & XFS_GQUOTA_ACCT) ? 865 uflags |= (flags & XFS_GQUOTA_ACCT) ?
866 XFS_QUOTA_GDQ_ENFD : XFS_QUOTA_PDQ_ENFD; 866 FS_QUOTA_GDQ_ENFD : FS_QUOTA_PDQ_ENFD;
867 } 867 }
868 return (uflags); 868 return (uflags);
869} 869}