From ca88c2c0d6dbbb32ba437e562ebdc31c1a13b088 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Tue, 26 Apr 2011 12:50:44 +0100 Subject: [PATCH] IO Accounting of page reads When CONFIG_TASK_IO_ACCOUNTING is used with Lustre, writes are accounted for but not reads. The accounting it normally done in the kernels page writeback and readahead functionality. Therefore as Lustre implements its own readahead, it must also maintain its own accounting on reads (but not writes). Signed-off-by: Mark Hills --- lustre/include/linux/lustre_compat25.h | 6 ++++++ lustre/llite/rw.c | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 0783b7b..19bbf5b 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -143,6 +143,12 @@ void groups_free(struct group_info *ginfo); #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) */ +#ifndef CONFIG_TASK_IO_ACCOUNTING +#define task_io_account_read(bytes) do {} while (0) +#else +#include +#endif + #ifndef page_private #define page_private(page) ((page)->private) #define set_page_private(page, v) ((page)->private = (v)) diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index e8f7761..58f11b5 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -1340,6 +1340,8 @@ static int ll_issue_page_read(struct obd_export *exp, if (rc) { LL_CDEBUG_PAGE(D_ERROR, page, "read queue failed: rc %d\n", rc); page_cache_release(page); + } else { + task_io_account_read(CFS_PAGE_SIZE); } RETURN(rc); } -- 1.7.1.1