diff options
-rw-r--r-- | fs/quota/dquot.c | 39 | ||||
-rw-r--r-- | fs/quota/quota_tree.c | 85 | ||||
-rw-r--r-- | fs/quota/quota_tree.h | 6 | ||||
-rw-r--r-- | fs/quota/quota_v1.c | 3 | ||||
-rw-r--r-- | fs/quota/quota_v2.c | 11 | ||||
-rw-r--r-- | include/linux/quotaops.h | 6 |
6 files changed, 80 insertions, 70 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 2eebf72d07c8..b171221000fa 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); |
133 | EXPORT_SYMBOL(dq_data_lock); | 133 | EXPORT_SYMBOL(dq_data_lock); |
134 | 134 | ||
135 | void __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 | } | ||
149 | EXPORT_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) |
136 | static char *quotatypes[] = INITQFNAMES; | 152 | static 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 |
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; |
167 | out_buf: | 165 | out_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 | } |
503 | out_buf: | 500 | out_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...) \ | ||
26 | do { \ | ||
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/include/linux/quotaops.h b/include/linux/quotaops.h index 126193c1a5ce..4881b49b1a9a 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -28,6 +28,12 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) | |||
28 | 28 | ||
29 | #if defined(CONFIG_QUOTA) | 29 | #if defined(CONFIG_QUOTA) |
30 | 30 | ||
31 | #define quota_error(sb, fmt, args...) \ | ||
32 | __quota_error((sb), __func__, fmt , ## args) | ||
33 | |||
34 | extern void __quota_error(struct super_block *sb, const char *func, | ||
35 | const char *fmt, ...); | ||
36 | |||
31 | /* | 37 | /* |
32 | * declaration of quota_function calls in kernel. | 38 | * declaration of quota_function calls in kernel. |
33 | */ | 39 | */ |