• Gu Zheng's avatar
    md: fix md io stats accounting broken · 74672d06
    Gu Zheng authored
    Simon reported the md io stats accounting issue:
    "
    I'm seeing "iostat -x -k 1" print this after a RAID1 rebuild on 4.0-rc5.
    It's not abnormal other than it's 3-disk, with one being SSD (sdc) and
    the other two being write-mostly:
    
    Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
    sda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
    sdb               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
    sdc               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
    md0               0.00     0.00    0.00    0.00     0.00     0.00     0.00   345.00    0.00    0.00    0.00   0.00 100.00
    md2               0.00     0.00    0.00    0.00     0.00     0.00     0.00 58779.00    0.00    0.00    0.00   0.00 100.00
    md1               0.00     0.00    0.00    0.00     0.00     0.00     0.00    12.00    0.00    0.00    0.00   0.00 100.00
    "
    The cause is commit "18c0b223" uses the
    generic_start_io_acct to account the disk stats rather than the open code,
    but it also introduced the increase to .in_flight[rw] which is needless to
    md. So we re-use the open code here to fix it.
    Reported-by: default avatarSimon Kirby <sim@hostway.ca>
    Cc: <stable@vger.kernel.org> 3.19
    Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    74672d06
md.c 226 KB