linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [f2fs-dev] [PATCH] f2fs: provide a way to attach HIPRI for Direct IO
Date: Mon,  8 Nov 2021 18:13:36 -0800	[thread overview]
Message-ID: <20211109021336.3796538-1-jaegeuk@kernel.org> (raw)

This patch adds a way to attach HIPRI by expanding the existing sysfs's
data_io_flag. User can measure IO performance by enabling it.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 Documentation/ABI/testing/sysfs-fs-f2fs | 16 +++++++++-------
 fs/f2fs/data.c                          |  2 ++
 fs/f2fs/f2fs.h                          |  3 +++
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index b268e3e18b4a..ac52e1c6bcbc 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -369,13 +369,15 @@ Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
 Description:	Give a way to attach REQ_META|FUA to data writes
 		given temperature-based bits. Now the bits indicate:
 
-		+-------------------+-------------------+
-		|      REQ_META     |      REQ_FUA      |
-		+------+------+-----+------+------+-----+
-		|    5 |    4 |   3 |    2 |    1 |   0 |
-		+------+------+-----+------+------+-----+
-		| Cold | Warm | Hot | Cold | Warm | Hot |
-		+------+------+-----+------+------+-----+
+		+------------+-------------------+-------------------+
+		| HIPRI_DIO  |      REQ_META     |      REQ_FUA      |
+		+------------+------+------+-----+------+------+-----+
+		|          6 |    5 |    4 |   3 |    2 |    1 |   0 |
+		+------------+------+------+-----+------+------+-----+
+		|        All | Cold | Warm | Hot | Cold | Warm | Hot |
+		+------------+------+------+-----+------+------+-----+
+
+		Note that, HIPRI_DIO bit is only for direct IO path.
 
 What:		/sys/fs/f2fs/<disk>/node_io_flag
 Date:		June 2020
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 9f754aaef558..faa40aca2848 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3707,6 +3707,8 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 		if (do_opu)
 			down_read(&fi->i_gc_rwsem[READ]);
 	}
+	if (sbi->data_io_flag & HIPRI_DIO)
+		iocb->ki_flags |= IOCB_HIPRI;
 
 	err = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,
 			iter, rw == WRITE ? get_data_block_dio_write :
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index ce9fc9f13000..094f1e8ff82b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1557,6 +1557,9 @@ struct decompress_io_ctx {
 #define MAX_COMPRESS_LOG_SIZE		8
 #define MAX_COMPRESS_WINDOW_SIZE(log_size)	((PAGE_SIZE) << (log_size))
 
+/* HIPRI for direct IO used in sysfs/data_io_flag */
+#define HIPRI_DIO			(1 << 6)
+
 struct f2fs_sb_info {
 	struct super_block *sb;			/* pointer to VFS super block */
 	struct proc_dir_entry *s_proc;		/* proc entry */
-- 
2.34.0.rc0.344.g81b53c2807-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

             reply	other threads:[~2021-11-09  2:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09  2:13 Jaegeuk Kim [this message]
2021-11-09 14:13 ` [f2fs-dev] [PATCH] f2fs: provide a way to attach HIPRI for Direct IO Chao Yu
2021-11-09 16:39 ` Christoph Hellwig
2021-11-09 16:42   ` Jens Axboe
2021-11-10 19:08     ` Jaegeuk Kim
2021-11-11  0:26       ` Jens Axboe

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=20211109021336.3796538-1-jaegeuk@kernel.org \
    --to=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;
as well as URLs for NNTP newsgroup(s).