Commit 500b067c authored by Jens Axboe's avatar Jens Axboe

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: default avatarJens Axboe <jens.axboe@oracle.com>
parent d993831f
...@@ -1046,6 +1046,14 @@ void __mark_inode_dirty(struct inode *inode, int flags) ...@@ -1046,6 +1046,14 @@ void __mark_inode_dirty(struct inode *inode, int flags)
*/ */
if (!was_dirty) { if (!was_dirty) {
struct bdi_writeback *wb = &inode_to_bdi(inode)->wb; struct bdi_writeback *wb = &inode_to_bdi(inode)->wb;
struct backing_dev_info *bdi = wb->bdi;
if (bdi_cap_writeback_dirty(bdi) &&
!test_bit(BDI_registered, &bdi->state)) {
WARN_ON(1);
printk(KERN_ERR "bdi-%s not registered\n",
bdi->name);
}
inode->dirtied_when = jiffies; inode->dirtied_when = jiffies;
list_move(&inode->i_list, &wb->b_dirty); list_move(&inode->i_list, &wb->b_dirty);
......
...@@ -29,6 +29,7 @@ enum bdi_state { ...@@ -29,6 +29,7 @@ enum bdi_state {
BDI_wb_alloc, /* Default embedded wb allocated */ BDI_wb_alloc, /* Default embedded wb allocated */
BDI_async_congested, /* The async (write) queue is getting full */ BDI_async_congested, /* The async (write) queue is getting full */
BDI_sync_congested, /* The sync queue is getting full */ BDI_sync_congested, /* The sync queue is getting full */
BDI_registered, /* bdi_register() was done */
BDI_unused, /* Available bits start here */ BDI_unused, /* Available bits start here */
}; };
......
...@@ -465,6 +465,12 @@ void static bdi_add_default_flusher_task(struct backing_dev_info *bdi) ...@@ -465,6 +465,12 @@ void static bdi_add_default_flusher_task(struct backing_dev_info *bdi)
if (!bdi_cap_writeback_dirty(bdi)) if (!bdi_cap_writeback_dirty(bdi))
return; return;
if (WARN_ON(!test_bit(BDI_registered, &bdi->state))) {
printk(KERN_ERR "bdi %p/%s is not registered!\n",
bdi, bdi->name);
return;
}
/* /*
* Check with the helper whether to proceed adding a task. Will only * Check with the helper whether to proceed adding a task. Will only
* abort if we two or more simultanous calls to * 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,6 +534,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
} }
bdi_debug_register(bdi, dev_name(dev)); bdi_debug_register(bdi, dev_name(dev));
set_bit(BDI_registered, &bdi->state);
exit: exit:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment