diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-04-24 15:20:16 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-05-02 21:19:48 -0700 |
commit | a817737e87d506ea7b3983d287b4578c99922d85 (patch) | |
tree | 31f5513a6bd36316d5345c4acea6ce94ffa5812c /fs/f2fs/data.c | |
parent | e959c8f543e11dadf7f6923427fb3acb452a0de6 (diff) | |
download | blackbird-obmc-linux-a817737e87d506ea7b3983d287b4578c99922d85.tar.gz blackbird-obmc-linux-a817737e87d506ea7b3983d287b4578c99922d85.zip |
f2fs: introduce valid_ipu_blkaddr to clean up
This patch introduces valid_ipu_blkaddr to clean up checking block address for
inplace-update.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index ca21ecbd6bbd..2f2de18d24fe 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1333,8 +1333,6 @@ static inline bool need_inplace_update(struct f2fs_io_info *fio) { struct inode *inode = fio->page->mapping->host; - if (fio->old_blkaddr == NEW_ADDR) - return false; if (S_ISDIR(inode->i_mode) || f2fs_is_atomic_file(inode)) return false; if (is_cold_data(fio->page)) @@ -1345,6 +1343,15 @@ static inline bool need_inplace_update(struct f2fs_io_info *fio) return need_inplace_update_policy(inode, fio); } +static inline bool valid_ipu_blkaddr(struct f2fs_io_info *fio) +{ + if (fio->old_blkaddr == NEW_ADDR) + return false; + if (fio->old_blkaddr == NULL_ADDR) + return false; + return true; +} + int do_write_data_page(struct f2fs_io_info *fio) { struct page *page = fio->page; @@ -1358,8 +1365,8 @@ int do_write_data_page(struct f2fs_io_info *fio) if (need_inplace_update(fio) && f2fs_lookup_extent_cache(inode, page->index, &ei)) { fio->old_blkaddr = ei.blk + page->index - ei.fofs; - if (fio->old_blkaddr != NULL_ADDR && - fio->old_blkaddr != NEW_ADDR) { + + if (valid_ipu_blkaddr(fio)) { ipu_force = true; goto got_it; } @@ -1386,7 +1393,7 @@ got_it: * If current allocation needs SSR, * it had better in-place writes for updated data. */ - if (ipu_force || need_inplace_update(fio)) { + if (ipu_force || (valid_ipu_blkaddr(fio) && need_inplace_update(fio))) { f2fs_bug_on(fio->sbi, !fio->cp_rwsem_locked); f2fs_unlock_op(fio->sbi); fio->cp_rwsem_locked = false; |