summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-05-26 09:00:13 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-05-31 11:31:51 -0700
commit107a805de87ec071dab602071c14e67b98b0c519 (patch)
tree543c688ea92b6651a9bb03b4a7bd09d728aab754 /fs/f2fs/segment.c
parente5e5732d8120654159254c16834bc8663d8be124 (diff)
downloadlinux-stable-107a805de87ec071dab602071c14e67b98b0c519.tar.gz
linux-stable-107a805de87ec071dab602071c14e67b98b0c519.tar.bz2
linux-stable-107a805de87ec071dab602071c14e67b98b0c519.zip
f2fs: keep migration IO order in LFS mode
For non-migration IO, we will keep order of data/node blocks' submitting as allocation sequence by sorting IOs in per log io_list list, but for migration IO, it could be out-of-order. In LFS mode, we should keep all IOs including migration IO be ordered, so that this patch fixes to add an additional lock to keep submitting order. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Yunlong Song <yunlong.song@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8fabf3a34bd7..9f27e9b64c1c 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2750,7 +2750,10 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
{
int type = __get_segment_type(fio);
int err;
+ bool keep_order = (test_opt(fio->sbi, LFS) && type == CURSEG_COLD_DATA);
+ if (keep_order)
+ down_read(&fio->sbi->io_order_lock);
reallocate:
allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
&fio->new_blkaddr, sum, type, fio, true);
@@ -2763,6 +2766,8 @@ reallocate:
} else if (!err) {
update_device_state(fio);
}
+ if (keep_order)
+ up_read(&fio->sbi->io_order_lock);
}
void write_meta_page(struct f2fs_sb_info *sbi, struct page *page,