diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-05-26 04:00:13 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-05-31 21:31:51 +0300 |
commit | 107a805de87ec071dab602071c14e67b98b0c519 (patch) | |
tree | 543c688ea92b6651a9bb03b4a7bd09d728aab754 /fs/f2fs/gc.c | |
parent | e5e5732d8120654159254c16834bc8663d8be124 (diff) | |
download | linux-107a805de87ec071dab602071c14e67b98b0c519.tar.xz |
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/gc.c')
-rw-r--r-- | fs/f2fs/gc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 9bb2ddbbed1e..ec9b1579c510 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -614,6 +614,7 @@ static void move_data_block(struct inode *inode, block_t bidx, struct page *page; block_t newaddr; int err; + bool lfs_mode = test_opt(fio.sbi, LFS); /* do not read out */ page = f2fs_grab_cache_page(inode->i_mapping, bidx, false); @@ -654,6 +655,9 @@ static void move_data_block(struct inode *inode, block_t bidx, fio.page = page; fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; + if (lfs_mode) + down_write(&fio.sbi->io_order_lock); + allocate_data_block(fio.sbi, NULL, fio.old_blkaddr, &newaddr, &sum, CURSEG_COLD_DATA, NULL, false); @@ -710,6 +714,8 @@ static void move_data_block(struct inode *inode, block_t bidx, put_page_out: f2fs_put_page(fio.encrypted_page, 1); recover_block: + if (lfs_mode) + up_write(&fio.sbi->io_order_lock); if (err) __f2fs_replace_block(fio.sbi, &sum, newaddr, fio.old_blkaddr, true, true); |