From: Andrew Morton Attempt to account for filesytem metadata reads. Doing it in ll_rw_block() is super-simple and is in fact pretty accurate (I think). For example, it accounts for those little reads which __block_prepare_write() needs to do to bring internal buffer_heads up to date. But if any filesystem uses ll_rw_block() for its main ->readpage[s]() or ->writepage[s]() implementation, we'll double-account like mad. Cc: Jay Lan Cc: Shailabh Nagar Cc: Balbir Singh Cc: Chris Sturtivant Cc: Tony Ernst Cc: Guillaume Thouvenin Signed-off-by: Andrew Morton --- fs/buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff -puN fs/buffer.c~io-accounting-metadata-read-accounting fs/buffer.c --- a/fs/buffer.c~io-accounting-metadata-read-accounting +++ a/fs/buffer.c @@ -2721,6 +2721,9 @@ void ll_rw_block(int rw, int nr, struct { int i; + if (likely(nr) && !(rw & WRITE)) + task_io_account_read(nr * bhs[0]->b_size); + for (i = 0; i < nr; i++) { struct buffer_head *bh = bhs[i]; _