aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-09-09 03:10:25 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-09-11 03:20:26 -0400
commit500b067c5e6ceea49cf280a02597b1169320e08c (patch)
tree5e2e9bfd66f825f845fdf395b6303b884769ff6d
parentd993831fa7ffeb89e994f046f93eeb09ec91df08 (diff)
writeback: check for registered bdi in flusher add and inode dirty
Also a debugging aid. We want to catch dirty inodes being added to backing devices that don't do writeback. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--fs/fs-writeback.c8
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--mm/backing-dev.c7
3 files changed, 16 insertions, 0 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 2e601ce581c9..da86ef58e427 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1046,6 +1046,14 @@ void __mark_inode_dirty(struct inode *inode, int flags)
1046 */ 1046 */
1047 if (!was_dirty) { 1047 if (!was_dirty) {
1048 struct bdi_writeback *wb = &inode_to_bdi(inode)->wb; 1048 struct bdi_writeback *wb = &inode_to_bdi(inode)->wb;
1049 struct backing_dev_info *bdi = wb->bdi;
1050
1051 if (bdi_cap_writeback_dirty(bdi) &&
1052 !test_bit(BDI_registered, &bdi->state)) {
1053 WARN_ON(1);
1054 printk(KERN_ERR "bdi-%s not registered\n",
1055 bdi->name);
1056 }
1049 1057
1050 inode->dirtied_when = jiffies; 1058 inode->dirtied_when = jiffies;
1051 list_move(&inode->i_list, &wb->b_dirty); 1059 list_move(&inode->i_list, &wb->b_dirty);
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 2f218b7cb063..f169bcb90b58 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -29,6 +29,7 @@ enum bdi_state {
29 BDI_wb_alloc, /* Default embedded wb allocated */ 29 BDI_wb_alloc, /* Default embedded wb allocated */
30 BDI_async_congested, /* The async (write) queue is getting full */ 30 BDI_async_congested, /* The async (write) queue is getting full */
31 BDI_sync_congested, /* The sync queue is getting full */ 31 BDI_sync_congested, /* The sync queue is getting full */
32 BDI_registered, /* bdi_register() was done */
32 BDI_unused, /* Available bits start here */ 33 BDI_unused, /* Available bits start here */
33}; 34};
34 35
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 5cb32c5b93d8..d3ca0dac1111 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -465,6 +465,12 @@ void static bdi_add_default_flusher_task(struct backing_dev_info *bdi)
465 if (!bdi_cap_writeback_dirty(bdi)) 465 if (!bdi_cap_writeback_dirty(bdi))
466 return; 466 return;
467 467
468 if (WARN_ON(!test_bit(BDI_registered, &bdi->state))) {
469 printk(KERN_ERR "bdi %p/%s is not registered!\n",
470 bdi, bdi->name);
471 return;
472 }
473
468 /* 474 /*
469 * Check with the helper whether to proceed adding a task. Will only 475 * Check with the helper whether to proceed adding a task. Will only
470 * abort if we two or more simultanous calls to 476 * abort if we two or more simultanous calls to
@@ -528,6 +534,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
528 } 534 }
529 535
530 bdi_debug_register(bdi, dev_name(dev)); 536 bdi_debug_register(bdi, dev_name(dev));
537 set_bit(BDI_registered, &bdi->state);
531exit: 538exit:
532 return ret; 539 return ret;
533} 540}