diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-09-27 18:33:18 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-09-30 18:41:22 -0700 |
commit | 39a8695824510a951ded696d69b8dea3c720b109 (patch) | |
tree | fa3be21e5cf852b521c4d031b63b29521d4e5f94 /fs/f2fs/data.c | |
parent | bab475c5414e8d1fa182fd17ae966864e9c85741 (diff) | |
download | lwn-39a8695824510a951ded696d69b8dea3c720b109.tar.gz lwn-39a8695824510a951ded696d69b8dea3c720b109.zip |
f2fs: refactor ->page_mkwrite() flow
Thread A Thread B
- f2fs_vm_page_mkwrite
- f2fs_setattr
- down_write(i_mmap_sem)
- truncate_setsize
- f2fs_truncate
- up_write(i_mmap_sem)
- f2fs_reserve_block
reserve NEW_ADDR
- skip dirty page due to truncation
1. we don't need to rserve new block address for a truncated page.
2. dn.data_blkaddr is used out of node page lock coverage.
Refactor ->page_mkwrite() flow to fix above issues:
- use __do_map_lock() to avoid racing checkpoint()
- lock data page in prior to dnode page
- cover f2fs_reserve_block with i_mmap_sem lock
- wait page writeback before zeroing page
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index ea16cadd416e..3f01bc2d73eb 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -972,7 +972,7 @@ map_blocks: return err; } -static inline void __do_map_lock(struct f2fs_sb_info *sbi, int flag, bool lock) +void __do_map_lock(struct f2fs_sb_info *sbi, int flag, bool lock) { if (flag == F2FS_GET_BLOCK_PRE_AIO) { if (lock) |