diff options
author | Chao Yu <chao2.yu@samsung.com> | 2016-02-24 17:16:47 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-02-26 11:52:01 -0800 |
commit | f28b3434afb8bb586965970039e46ffb6a1be033 (patch) | |
tree | d24892986e0ee9a34a189762c4c8b11ebe67f740 /fs/f2fs/file.c | |
parent | 4356e48e64374ceac6e4313244eb65158a954b40 (diff) |
f2fs: introduce f2fs_update_data_blkaddr for cleanup
Add a new help f2fs_update_data_blkaddr to clean up redundant codes.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r-- | fs/f2fs/file.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 0e2a2bde2635..ffa1ec20f963 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -857,10 +857,8 @@ static int __exchange_data_block(struct inode *inode, pgoff_t src, } else { new_addr = dn.data_blkaddr; if (!is_checkpointed_data(sbi, new_addr)) { - dn.data_blkaddr = NULL_ADDR; /* do not invalidate this block address */ - set_data_blkaddr(&dn); - f2fs_update_extent_cache(&dn); + f2fs_update_data_blkaddr(&dn, NULL_ADDR); do_replace = true; } f2fs_put_dnode(&dn); @@ -911,9 +909,7 @@ static int __exchange_data_block(struct inode *inode, pgoff_t src, err_out: if (!get_dnode_of_data(&dn, src, LOOKUP_NODE)) { - dn.data_blkaddr = new_addr; - set_data_blkaddr(&dn); - f2fs_update_extent_cache(&dn); + f2fs_update_data_blkaddr(&dn, new_addr); f2fs_put_dnode(&dn); } return ret; @@ -1053,12 +1049,7 @@ static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len, if (dn.data_blkaddr != NEW_ADDR) { invalidate_blocks(sbi, dn.data_blkaddr); - - dn.data_blkaddr = NEW_ADDR; - set_data_blkaddr(&dn); - - dn.data_blkaddr = NULL_ADDR; - f2fs_update_extent_cache(&dn); + f2fs_update_data_blkaddr(&dn, NEW_ADDR); } f2fs_put_dnode(&dn); f2fs_unlock_op(sbi); |