[PATCH v2 4/8] ext4: Count data request of read operations in buffered io

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zheng Liu <wenqing.lz@xxxxxxxxxx>

Call ext4_ios_read*() and __ext4_io_stat() functions to count the data of
buffered io in ext4. In ext4_readpage() and ext4_readpages(), we call
__ext4_io_stat() directly because these functions don't use buffer_head.

Signed-off-by: Zheng Liu <wenqing.lz@xxxxxxxxxx>
Signed-off-by: Wang Shaoyan <wangshaoyan.pt@xxxxxxxxxx>
---
 fs/ext4/inode.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d4f9da3..5a1fca0 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2680,6 +2680,8 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
 static int ext4_readpage(struct file *file, struct page *page)
 {
 	trace_ext4_readpage(page);
+	__ext4_io_stat(READ, EXT4_IOS_REGULAR_DATA,
+		       ext4_blocks_per_page(page->mapping->host));
 	return mpage_readpage(page, ext4_get_block);
 }
 
@@ -2687,6 +2689,8 @@ static int
 ext4_readpages(struct file *file, struct address_space *mapping,
 		struct list_head *pages, unsigned nr_pages)
 {
+	__ext4_io_stat(READ, EXT4_IOS_REGULAR_DATA,
+		       nr_pages * ext4_blocks_per_page(mapping->host));
 	return mpage_readpages(mapping, pages, nr_pages, ext4_get_block);
 }
 
@@ -3305,6 +3309,8 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
 			err = -EIO;
 			ll_rw_block(READ, 1, &bh);
 			wait_on_buffer(bh);
+			ext4_ios_read(bh, EXT4_IOS_REGULAR_DATA,
+				      ext4_blocks_per_page(inode));
 			/* Uhhuh. Read error. Complain and punt.*/
 			if (!buffer_uptodate(bh))
 				goto next;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux