lkml.org 
[lkml]   [2009]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 11/11] writeback: check for registered bdi in flusher add and inode dirty
    Date
    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>
    ---
    fs/fs-writeback.c | 7 +++++++
    include/linux/backing-dev.h | 1 +
    mm/backing-dev.c | 6 ++++++
    3 files changed, 14 insertions(+), 0 deletions(-)

    diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
    index 7e70f80..a287c09 100644
    --- a/fs/fs-writeback.c
    +++ b/fs/fs-writeback.c
    @@ -557,6 +557,13 @@ void __mark_inode_dirty(struct inode *inode, int flags)
    */
    if (!was_dirty) {
    struct bdi_writeback *wb = inode_get_wb(inode);
    + struct backing_dev_info *bdi = wb->bdi;
    +
    + if (bdi_cap_writeback_dirty(bdi) &&
    + !test_bit(BDI_registered, &bdi->state)) {
    + WARN_ON(1);
    + printk("bdi-%s not registered\n", bdi->name);
    + }

    inode->dirtied_when = jiffies;
    list_move(&inode->i_list, &wb->b_dirty);
    diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
    index 14fa7b1..7c2874f 100644
    --- a/include/linux/backing-dev.h
    +++ b/include/linux/backing-dev.h
    @@ -30,6 +30,7 @@ enum bdi_state {
    BDI_wblist_lock, /* bdi->wb_list now needs locking */
    BDI_async_congested, /* The async (write) 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 */
    };

    diff --git a/mm/backing-dev.c b/mm/backing-dev.c
    index 89a8385..d45251f 100644
    --- a/mm/backing-dev.c
    +++ b/mm/backing-dev.c
    @@ -514,6 +514,11 @@ static void bdi_add_one_flusher_task(struct backing_dev_info *bdi,
    if (!bdi_cap_writeback_dirty(bdi))
    return;

    + if (WARN_ON(!test_bit(BDI_registered, &bdi->state))) {
    + printk("bdi %p/%s is not registered!\n", bdi, bdi->name);
    + return;
    + }
    +
    /*
    * Check with the helper whether to proceed adding a task. Will only
    * abort if we two or more simultanous calls to
    @@ -617,6 +622,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,

    bdi->dev = dev;
    bdi_debug_register(bdi, dev_name(dev));
    + set_bit(BDI_registered, &bdi->state);

    exit:
    return ret;
    --
    1.6.3.rc0.1.gf800


    \
     
     \ /
      Last update: 2009-05-18 14:25    [W:0.025 / U:59.788 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site