summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorYunlei He <heyunlei@huawei.com>2018-03-26 17:32:23 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-03-27 20:13:54 -0700
commitd21b0f238adf4641a72f4b0dd4a2b10aa36d09f5 (patch)
treea03be50b246cc96b66cdc87cb27697da7fea4a58 /fs/f2fs/segment.c
parent2f52052929842ac21a958ab5f07aab01312cc0b2 (diff)
downloadlinux-d21b0f238adf4641a72f4b0dd4a2b10aa36d09f5.tar.gz
linux-d21b0f238adf4641a72f4b0dd4a2b10aa36d09f5.tar.bz2
linux-d21b0f238adf4641a72f4b0dd4a2b10aa36d09f5.zip
f2fs: Add a segment type check in inplace write
This patch add a segment type check in IPU, in case of something wrong with blkadd in dnode. Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@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 637980d04503..5854cc4e1d67 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2790,10 +2790,15 @@ void write_data_page(struct dnode_of_data *dn, struct f2fs_io_info *fio)
int rewrite_data_page(struct f2fs_io_info *fio)
{
int err;
+ struct f2fs_sb_info *sbi = fio->sbi;
fio->new_blkaddr = fio->old_blkaddr;
/* i/o temperature is needed for passing down write hints */
__get_segment_type(fio);
+
+ f2fs_bug_on(sbi, !IS_DATASEG(get_seg_entry(sbi,
+ GET_SEGNO(sbi, fio->new_blkaddr))->type));
+
stat_inc_inplace_blocks(fio->sbi);
err = f2fs_submit_page_bio(fio);