mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yangtao Li <frank.li@vivo.com>
To: jaegeuk@kernel.org, chao@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Yangtao Li <frank.li@vivo.com>
Subject: [PATCH 4/4] f2fs: rename rw_iostat to iostat_bytes
Date: Wed,  4 Jan 2023 19:21:58 +0800	[thread overview]
Message-ID: <20230104112158.15844-4-frank.li@vivo.com> (raw)
In-Reply-To: <20230104112158.15844-1-frank.li@vivo.com>

The contents stored in the rw_iostat and prev_rw_iostat arrays do not
quite match the meaning of the names. In fact, array storage is not
only read, write io, but also discard and flush. In addition, in order
to better distinguish it from the iostat_count array, it is more accurate
to say that io bytes are stored in it. Also, the FS_DISCARD and FS_FLUSH_IO
names are less harmonious than others. Let's change to new names.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/f2fs.h              |  8 ++++----
 fs/f2fs/iostat.c            | 20 ++++++++++----------
 fs/f2fs/segment.c           |  4 ++--
 include/trace/events/f2fs.h |  2 +-
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 0a24447472db..331c330ea31d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1191,8 +1191,8 @@ enum iostat_type {
 	FS_META_READ_IO,		/* meta read IOs */
 
 	/* other */
-	FS_DISCARD,			/* discard */
-	FS_FLUSH,			/* flush */
+	FS_DISCARD_IO,			/* discard */
+	FS_FLUSH_IO,			/* flush */
 	NR_IO_TYPE,
 };
 
@@ -1856,8 +1856,8 @@ struct f2fs_sb_info {
 	/* For app/fs IO statistics */
 	spinlock_t iostat_lock;
 	unsigned long long iostat_count[NR_IO_TYPE];
-	unsigned long long rw_iostat[NR_IO_TYPE];
-	unsigned long long prev_rw_iostat[NR_IO_TYPE];
+	unsigned long long iostat_bytes[NR_IO_TYPE];
+	unsigned long long prev_iostat_bytes[NR_IO_TYPE];
 	bool iostat_enable;
 	unsigned long iostat_next_period;
 	unsigned int iostat_period_ms;
diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 991605fcfe0b..59c72f92191a 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -21,13 +21,13 @@ static mempool_t *bio_iostat_ctx_pool;
 static inline unsigned long long iostat_get_avg_bytes(struct f2fs_sb_info *sbi,
 	enum iostat_type type)
 {
-	return sbi->iostat_count[type] ? div64_u64(sbi->rw_iostat[type],
+	return sbi->iostat_count[type] ? div64_u64(sbi->iostat_bytes[type],
 		sbi->iostat_count[type]) : 0;
 }
 
 #define IOSTAT_INFO_SHOW(name, type)					\
 	seq_printf(seq, "%-23s %-16llu %-16llu %-16llu\n",	\
-			name":", sbi->rw_iostat[type],				\
+			name":", sbi->iostat_bytes[type],			\
 			sbi->iostat_count[type],					\
 			iostat_get_avg_bytes(sbi, type))			\
 
@@ -79,8 +79,8 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
 
 	/* print other IOs */
 	seq_puts(seq, "[OTHER]\n");
-	IOSTAT_INFO_SHOW("fs discard", FS_DISCARD);
-	IOSTAT_INFO_SHOW("fs flush", FS_FLUSH);
+	IOSTAT_INFO_SHOW("fs discard", FS_DISCARD_IO);
+	IOSTAT_INFO_SHOW("fs flush", FS_FLUSH_IO);
 
 	return 0;
 }
@@ -129,9 +129,9 @@ static inline void f2fs_record_iostat(struct f2fs_sb_info *sbi)
 				msecs_to_jiffies(sbi->iostat_period_ms);
 
 	for (i = 0; i < NR_IO_TYPE; i++) {
-		iostat_diff[i] = sbi->rw_iostat[i] -
-				sbi->prev_rw_iostat[i];
-		sbi->prev_rw_iostat[i] = sbi->rw_iostat[i];
+		iostat_diff[i] = sbi->iostat_bytes[i] -
+				sbi->prev_iostat_bytes[i];
+		sbi->prev_iostat_bytes[i] = sbi->iostat_bytes[i];
 	}
 	spin_unlock_irqrestore(&sbi->iostat_lock, flags);
 
@@ -148,8 +148,8 @@ void f2fs_reset_iostat(struct f2fs_sb_info *sbi)
 	spin_lock_irq(&sbi->iostat_lock);
 	for (i = 0; i < NR_IO_TYPE; i++) {
 		sbi->iostat_count[i] = 0;
-		sbi->rw_iostat[i] = 0;
-		sbi->prev_rw_iostat[i] = 0;
+		sbi->iostat_bytes[i] = 0;
+		sbi->prev_iostat_bytes[i] = 0;
 	}
 	spin_unlock_irq(&sbi->iostat_lock);
 
@@ -161,7 +161,7 @@ void f2fs_reset_iostat(struct f2fs_sb_info *sbi)
 static inline void __f2fs_update_iostat(struct f2fs_sb_info *sbi,
 			enum iostat_type type, unsigned long long io_bytes)
 {
-	sbi->rw_iostat[type] += io_bytes;
+	sbi->iostat_bytes[type] += io_bytes;
 	sbi->iostat_count[type]++;
 }
 
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 34e9dc4df5bb..38bae9107a3b 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -504,7 +504,7 @@ static int __submit_flush_wait(struct f2fs_sb_info *sbi,
 {
 	int ret = blkdev_issue_flush(bdev);
 	if (!ret)
-		f2fs_update_iostat(sbi, NULL, FS_FLUSH, 0);
+		f2fs_update_iostat(sbi, NULL, FS_FLUSH_IO, 0);
 
 	trace_f2fs_issue_flush(bdev, test_opt(sbi, NOBARRIER),
 				test_opt(sbi, FLUSH_MERGE), ret);
@@ -1184,7 +1184,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
 
 		atomic_inc(&dcc->issued_discard);
 
-		f2fs_update_iostat(sbi, NULL, FS_DISCARD, len * F2FS_BLKSIZE);
+		f2fs_update_iostat(sbi, NULL, FS_DISCARD_IO, len * F2FS_BLKSIZE);
 
 		lstart += len;
 		start += len;
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 9183a0a11e26..3852085198fb 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -1972,7 +1972,7 @@ TRACE_EVENT(f2fs_iostat,
 		__entry->fs_cdrio	= iostat[FS_CDATA_READ_IO];
 		__entry->fs_nrio	= iostat[FS_NODE_READ_IO];
 		__entry->fs_mrio	= iostat[FS_META_READ_IO];
-		__entry->fs_discard	= iostat[FS_DISCARD];
+		__entry->fs_discard	= iostat[FS_DISCARD_IO];
 	),
 
 	TP_printk("dev = (%d,%d), "
-- 
2.25.1


  parent reply	other threads:[~2023-01-04 11:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 11:21 [PATCH 1/4] f2fs: reset iostat_count in f2fs_reset_iostat() Yangtao Li
2023-01-04 11:21 ` [PATCH 2/4] f2fs: no need to call ktime_get_real_seconds() if iostat is not enabled Yangtao Li
2023-01-04 11:21 ` [PATCH 3/4] f2fs: introduce IOSTAT_INFO_SHOW macro Yangtao Li
2023-01-04 11:21 ` Yangtao Li [this message]
2023-01-04 19:20 ` [PATCH 1/4] f2fs: reset iostat_count in f2fs_reset_iostat() Jaegeuk Kim
2023-01-11 14:06   ` Chao Yu
2023-01-11 19:17     ` Jaegeuk Kim
2023-01-12 15:13       ` Yangtao Li
2023-01-12 23:59         ` Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230104112158.15844-4-frank.li@vivo.com \
    --to=frank.li@vivo.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®