f2fs: provide a way to attach HIPRI for Direct IO
Subsystems (3)
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: provide a way to attach HIPRI for Direct IO
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.
--- Documentation/ABI/testing/sysfs-fs-f2fs | 16 +++++++++------- fs/f2fs/data.c | 2 ++ fs/f2fs/f2fs.h | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-)
Documentation/ABI/testing/sysfs-fs-f2fs +9 -7
@@ -369,13 +369,15 @@ Contact: "Jaegeuk Kim" <[email protected]> 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
fs/f2fs/data.c +2 -0
@@ -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 :
fs/f2fs/f2fs.h +3 -0
@@ -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 */
Signature · 1 line
2.34.0.rc0.344.g81b53c2807-goog
Quoted 4 lines · Jaegeuk Kim
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 <[email protected]>
Thanks,
Quoted 2 lines · Jaegeuk Kim
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.
NAK. This flag should only be used when explicitly specified by the submitter of the I/O.
Quoted 65 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- Documentation/ABI/testing/sysfs-fs-f2fs | 16 +++++++++------- fs/f2fs/data.c | 2 ++ fs/f2fs/f2fs.h | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-)Documentation/ABI/testing/sysfs-fs-f2fs +9
-7@@ -369,13 +369,15 @@ Contact: "Jaegeuk Kim" <[email protected]> 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 2020fs/f2fs/data.c +2
-0@@ -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 :fs/f2fs/f2fs.h +3
-0@@ -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 */ Signature · 1 line
2.34.0.rc0.344.g81b53c2807-goog
---end quoted text---
Jens Axboe
maintainerQuoted 6 lines · Christoph Hellwig
Quoted 2 lines · Jaegeuk Kim
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.NAK. This flag should only be used when explicitly specified by the submitter of the I/O.
Yes, this cannot be set in the middle for a multitude of reasons. I wonder if we should add a comment to that effect near the definition of it.
Signature · 1 line
Jens Axboe
Jaegeuk Kim
maintainerQuoted 10 lines · Jens Axboe
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Jaegeuk Kim
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.NAK. This flag should only be used when explicitly specified by the submitter of the I/O.
Yes, this cannot be set in the middle for a multitude of reasons. I wonder if we should add a comment to that effect near the definition of it.
Not surprising. I was wondering we can add this for testing purpose only. Btw, is there a reasonable way that filesystem can use IO polling?
Quoted 3 lines
Signature · 2 lines
-- Jens Axboe
Jens Axboe
maintainerQuoted 6 lines · Jaegeuk Kim
Quoted 5 lines · Jens Axboe
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Jaegeuk Kim
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.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
NAK. This flag should only be used when explicitly specified by the submitter of the I/O.
Yes, this cannot be set in the middle for a multitude of reasons. I wonder if we should add a comment to that effect near the definition of it.
Not surprising. I was wondering we can add this for testing purpose only. Btw, is there a reasonable way that filesystem can use IO polling?
Whether an IO is polled or not belongs to the issuer of the IO, as it comes with certain obligations like "I will actively poll for the completion of this request", and it incurs certain restrictions in the block layer in terms of whether or not you can ever sleep for requests.
You could certainly use in in an fs, but only IFF you are the original issuer of the request, which then also means that you are the one that needs to poll for completion of it.
It's not a drive-by "let's set this flag to speed things up" kind of flag, there are a lot more moving parts than that.
I don't think it will be useful for you.
Signature · 1 line
Jens Axboe