From: Hyunchul Lee <hyc.lee@gmail.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
kernel-team@lge.com, Jens Axboe <axboe@kernel.dk>,
Hyunchul Lee <cheol.lee@lge.com>
Subject: [PATCH 2/2] f2fs: pass down write hints to block layer for direct write
Date: Tue, 28 Nov 2017 09:23:27 +0900 [thread overview]
Message-ID: <1511828607-624-2-git-send-email-hyc.lee@gmail.com> (raw)
In-Reply-To: <1511828607-624-1-git-send-email-hyc.lee@gmail.com>
From: Hyunchul Lee <cheol.lee@lge.com>
This implements which hint is passed down to block layer
for direct write.
(allocated
file hint segment type) io hint
---------- ------------ --------
WRITE_LIFE_SHORT HOT_DATA WRITE_LIFE_MEDIUM
WRITE_LIFE_EXTREME COLD_DATA WRITE_LIFE_EXTREME
others WARM_DATA WRITE_LIFE_NONE
Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
---
fs/f2fs/data.c | 6 ++++++
fs/f2fs/f2fs.h | 1 +
fs/f2fs/segment.c | 12 ++++++++++++
3 files changed, 19 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 0919a43..eabd569 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2093,6 +2093,7 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
loff_t offset = iocb->ki_pos;
int rw = iov_iter_rw(iter);
int err;
+ enum rw_hint orig_hint;
err = check_direct_IO(inode, iter, offset);
if (err)
@@ -2103,10 +2104,15 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
trace_f2fs_direct_IO_enter(inode, offset, count, rw);
+ orig_hint = iocb->ki_hint;
+ iocb->ki_hint = file_rwhint_to_io_rwhint(iocb->ki_hint);
+
down_read(&F2FS_I(inode)->dio_rwsem[rw]);
err = blockdev_direct_IO(iocb, inode, iter, get_data_block_dio);
up_read(&F2FS_I(inode)->dio_rwsem[rw]);
+ iocb->ki_hint = orig_hint;
+
if (rw == WRITE) {
if (err > 0) {
f2fs_update_iostat(F2FS_I_SB(inode), APP_DIRECT_IO,
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index be3cb0c..426625a 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2676,6 +2676,7 @@ int lookup_journal_in_cursum(struct f2fs_journal *journal, int type,
void destroy_segment_manager_caches(void);
int rw_hint_to_seg_type(enum rw_hint hint);
enum rw_hint io_type_to_rw_hint(enum page_type page, enum temp_type temp);
+enum rw_hint file_rwhint_to_io_rwhint(enum rw_hint hint);
/*
* checkpoint.c
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 0570db7..b4496a5 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2475,6 +2475,18 @@ enum rw_hint io_type_to_rw_hint(enum page_type page, enum temp_type temp)
}
}
+enum rw_hint file_rwhint_to_io_rwhint(enum rw_hint hint)
+{
+ switch(hint) {
+ case WRITE_LIFE_SHORT:
+ return WRITE_LIFE_MEDIUM;
+ case WRITE_LIFE_EXTREME:
+ return WRITE_LIFE_EXTREME;
+ default:
+ return WRITE_LIFE_NONE;
+ }
+}
+
static int __get_segment_type_2(struct f2fs_io_info *fio)
{
if (fio->type == DATA)
--
1.9.1
next prev parent reply other threads:[~2017-11-28 0:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 0:23 [PATCH 1/2] f2fs: pass down write hints to block layer for bufferd write Hyunchul Lee
2017-11-28 0:23 ` Hyunchul Lee [this message]
2017-11-30 6:32 ` Chao Yu
2017-12-01 7:28 ` Jaegeuk Kim
2017-12-01 8:50 ` Hyunchul Lee
2017-12-14 21:18 ` Jaegeuk Kim
2017-11-30 7:06 ` Chao Yu
2017-12-01 8:28 ` Hyunchul Lee
2017-12-11 13:15 ` [f2fs-dev] " Chao Yu
2017-12-12 2:15 ` Hyunchul Lee
2017-12-12 2:45 ` Chao Yu
2017-12-14 1:33 ` Hyunchul Lee
2017-12-15 2:06 ` Jaegeuk Kim
2017-12-18 7:28 ` Hyunchul Lee
2017-12-23 9:44 ` Chao Yu
2017-12-28 3:26 ` Jaegeuk Kim
2017-12-28 5:05 ` Hyunchul Lee
2017-12-28 16:32 ` 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=1511828607-624-2-git-send-email-hyc.lee@gmail.com \
--to=hyc.lee@gmail.com \
--cc=axboe@kernel.dk \
--cc=cheol.lee@lge.com \
--cc=jaegeuk@kernel.org \
--cc=kernel-team@lge.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yuchao0@huawei.com \
/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
Powered by JetHome