[v1] ubifs: support page statistics in vmstat
diff mbox series

Message ID 1563451437-15725-1-git-send-email-stanley.chu@mediatek.com
State New
Headers show
Series
  • [v1] ubifs: support page statistics in vmstat
Related show

Commit Message

Stanley Chu July 18, 2019, 12:03 p.m. UTC
Currently PGPGIN and PGPGOUT statistics in vmstat is only
hooked in submit_bio() for block device I/O path.

This patch adds this feature for ubifs as well.

Change-Id: I8505bd2a7aa9eadc6abcd68b7d8b870752e71339
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 fs/ubifs/file.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Richard Weinberger July 21, 2019, 8:15 p.m. UTC | #1
On Thu, Jul 18, 2019 at 2:04 PM Stanley Chu <stanley.chu@mediatek.com> wrote:
>
> Currently PGPGIN and PGPGOUT statistics in vmstat is only
> hooked in submit_bio() for block device I/O path.
>
> This patch adds this feature for ubifs as well.

While I think updating these counter for raw flash makes sense,
I wonder whether UBIFS is the right layer.
Why not directly in MTD or at least UBI?

Patch
diff mbox series

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 512e7d9c60cd..ffe7ce77f389 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -902,6 +902,8 @@  static int ubifs_bulk_read(struct page *page)
 
 static int ubifs_readpage(struct file *file, struct page *page)
 {
+	count_vm_events(PGPGIN, PAGE_CACHE_SIZE >> 9);
+
 	if (ubifs_bulk_read(page))
 		return 0;
 	do_readpage(page);
@@ -1032,6 +1034,8 @@  static int ubifs_writepage(struct page *page, struct writeback_control *wbc)
 		goto out_unlock;
 	}
 
+	count_vm_events(PGPGOUT, PAGE_CACHE_SIZE >> 9);
+
 	spin_lock(&ui->ui_lock);
 	synced_i_size = ui->synced_i_size;
 	spin_unlock(&ui->ui_lock);