lkml.org 
[lkml]   [2010]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 34/47] writeback: trace writeback_single_inode()
    It is valuable to know how the inodes are iterated and their IO size.

    Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
    ---
    fs/fs-writeback.c | 12 +++---
    include/trace/events/writeback.h | 52 +++++++++++++++++++++++++++++
    2 files changed, 59 insertions(+), 5 deletions(-)

    --- linux-next.orig/fs/fs-writeback.c 2010-12-09 22:15:49.000000000 +0800
    +++ linux-next/fs/fs-writeback.c 2010-12-09 22:15:50.000000000 +0800
    @@ -331,7 +331,7 @@ writeback_single_inode(struct inode *ino
    {
    struct address_space *mapping = inode->i_mapping;
    long per_file_limit = wbc->per_file_limit;
    - long uninitialized_var(nr_to_write);
    + long nr_to_write = wbc->nr_to_write;
    unsigned dirty;
    int ret;

    @@ -351,7 +351,8 @@ writeback_single_inode(struct inode *ino
    */
    if (wbc->sync_mode != WB_SYNC_ALL) {
    requeue_io(inode);
    - return 0;
    + ret = 0;
    + goto out;
    }

    /*
    @@ -367,10 +368,8 @@ writeback_single_inode(struct inode *ino
    inode->i_state &= ~I_DIRTY_PAGES;
    spin_unlock(&inode_lock);

    - if (per_file_limit) {
    - nr_to_write = wbc->nr_to_write;
    + if (per_file_limit)
    wbc->nr_to_write = per_file_limit;
    - }

    ret = do_writepages(mapping, wbc);

    @@ -446,6 +445,9 @@ writeback_single_inode(struct inode *ino
    }
    }
    inode_sync_complete(inode);
    +out:
    + trace_writeback_single_inode(inode, wbc,
    + nr_to_write - wbc->nr_to_write);
    return ret;
    }

    --- linux-next.orig/include/trace/events/writeback.h 2010-12-09 22:15:49.000000000 +0800
    +++ linux-next/include/trace/events/writeback.h 2010-12-09 22:21:41.000000000 +0800
    @@ -10,6 +10,19 @@

    struct wb_writeback_work;

    +#define show_inode_state(state) \
    + __print_flags(state, "|", \
    + {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
    + {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
    + {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
    + {I_NEW, "I_NEW"}, \
    + {I_WILL_FREE, "I_WILL_FREE"}, \
    + {I_FREEING, "I_FREEING"}, \
    + {I_CLEAR, "I_CLEAR"}, \
    + {I_SYNC, "I_SYNC"}, \
    + {I_REFERENCED, "I_REFERENCED"} \
    + )
    +
    DECLARE_EVENT_CLASS(writeback_work_class,
    TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
    TP_ARGS(bdi, work),
    @@ -149,6 +162,45 @@ DEFINE_WBC_EVENT(wbc_writeback_written);
    DEFINE_WBC_EVENT(wbc_writeback_wait);
    DEFINE_WBC_EVENT(wbc_writepage);

    +TRACE_EVENT(writeback_single_inode,
    +
    + TP_PROTO(struct inode *inode,
    + struct writeback_control *wbc,
    + unsigned long wrote
    + ),
    +
    + TP_ARGS(inode, wbc, wrote),
    +
    + TP_STRUCT__entry(
    + __array(char, name, 32)
    + __field(unsigned long, ino)
    + __field(unsigned long, state)
    + __field(unsigned long, age)
    + __field(unsigned long, wrote)
    + __field(long, nr_to_write)
    + ),
    +
    + TP_fast_assign(
    + strncpy(__entry->name,
    + dev_name(inode->i_mapping->backing_dev_info->dev), 32);
    + __entry->ino = inode->i_ino;
    + __entry->state = inode->i_state;
    + __entry->age = (jiffies - inode->dirtied_when) *
    + 1000 / HZ;
    + __entry->wrote = wrote;
    + __entry->nr_to_write = wbc->nr_to_write;
    + ),
    +
    + TP_printk("bdi %s: ino=%lu state=%s age=%lu wrote=%lu to_write=%ld",
    + __entry->name,
    + __entry->ino,
    + show_inode_state(__entry->state),
    + __entry->age,
    + __entry->wrote,
    + __entry->nr_to_write
    + )
    +);
    +
    TRACE_EVENT(balance_dirty_state,

    TP_PROTO(struct address_space *mapping,



    \
     
     \ /
      Last update: 2010-12-13 07:57    [W:0.027 / U:91.056 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site