• X
    alinux: jbd2: track slow handle which is preventing transaction committing · 83cd9d23
    Xiaoguang Wang 提交于
    While transaction is going to commit, it first sets its state to be
    T_LOCKED and waits all outstanding handles to complete, and the
    committing transaction will always be in locked state so long as it
    has outstanding handles, also the whole fs will be locked and all later
    fs modification operations will be stucked in wait_transaction_locked().
    
    It's hard to tell why handles are that slow, so here we add a new staic
    tracepoint to track such slow handle, and show io wait time and sched
    wait time, output likes below:
      fsstress-20347 [024] ....  1570.305454: jbd2_slow_handle_stats: dev 254,17
    tid 15853 type 4 line_no 3101 interval 126 sync 0 requested_blocks 24
    dirtied_blocks 0 trans_wait 122 space_wait 0 sched_wait 0 io_wait 126
    
    "trans_wait 122" means that this current committing transaction has been
    locked for 122ms, due to this handle is not completed quickly.
    
    From "io_wait 126", we can see that io is the major reason.
    
    In this patch, we also add a per fs control file used to determine
    whether a handle can be considered to be slow.
        /proc/fs/jbd2/vdb1-8/stall_thresh
    default value is 100ms, users can set new threshold by echoing new value
    to this file.
    
    Later I also plan to add a proc file fs per fs to record these info.
    Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
    Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
    83cd9d23
jbd2.h 47.3 KB