mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
f2fs: update blkaddr in __set_data_blkaddr() for cleanup
This patch allows caller to pass blkaddr to f2fs_set_data_blkaddr() and let __set_data_blkaddr() inside f2fs_set_data_blkaddr() to update dn->data_blkaddr w/ last value of blkaddr. Just cleanup, no logic changes. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
2020cd48e4
commit
59d0d4c3ea
@ -1179,10 +1179,11 @@ static int f2fs_submit_page_read(struct inode *inode, struct page *page,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __set_data_blkaddr(struct dnode_of_data *dn)
|
||||
static void __set_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr)
|
||||
{
|
||||
__le32 *addr = get_dnode_addr(dn->inode, dn->node_page);
|
||||
|
||||
dn->data_blkaddr = blkaddr;
|
||||
addr[dn->ofs_in_node] = cpu_to_le32(dn->data_blkaddr);
|
||||
}
|
||||
|
||||
@ -1192,18 +1193,17 @@ static void __set_data_blkaddr(struct dnode_of_data *dn)
|
||||
* ->node_page
|
||||
* update block addresses in the node page
|
||||
*/
|
||||
void f2fs_set_data_blkaddr(struct dnode_of_data *dn)
|
||||
void f2fs_set_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr)
|
||||
{
|
||||
f2fs_wait_on_page_writeback(dn->node_page, NODE, true, true);
|
||||
__set_data_blkaddr(dn);
|
||||
__set_data_blkaddr(dn, blkaddr);
|
||||
if (set_page_dirty(dn->node_page))
|
||||
dn->node_changed = true;
|
||||
}
|
||||
|
||||
void f2fs_update_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr)
|
||||
{
|
||||
dn->data_blkaddr = blkaddr;
|
||||
f2fs_set_data_blkaddr(dn);
|
||||
f2fs_set_data_blkaddr(dn, blkaddr);
|
||||
f2fs_update_read_extent_cache(dn);
|
||||
}
|
||||
|
||||
@ -1230,8 +1230,7 @@ int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count)
|
||||
block_t blkaddr = f2fs_data_blkaddr(dn);
|
||||
|
||||
if (blkaddr == NULL_ADDR) {
|
||||
dn->data_blkaddr = NEW_ADDR;
|
||||
__set_data_blkaddr(dn);
|
||||
__set_data_blkaddr(dn, NEW_ADDR);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
@ -3822,7 +3822,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio);
|
||||
struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi,
|
||||
block_t blk_addr, sector_t *sector);
|
||||
int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr);
|
||||
void f2fs_set_data_blkaddr(struct dnode_of_data *dn);
|
||||
void f2fs_set_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr);
|
||||
void f2fs_update_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr);
|
||||
int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count);
|
||||
int f2fs_reserve_new_block(struct dnode_of_data *dn);
|
||||
|
@ -582,8 +582,7 @@ void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count)
|
||||
if (blkaddr == NULL_ADDR)
|
||||
continue;
|
||||
|
||||
dn->data_blkaddr = NULL_ADDR;
|
||||
f2fs_set_data_blkaddr(dn);
|
||||
f2fs_set_data_blkaddr(dn, NULL_ADDR);
|
||||
|
||||
if (__is_valid_data_blkaddr(blkaddr)) {
|
||||
if (!f2fs_is_valid_blkaddr(sbi, blkaddr,
|
||||
@ -1478,8 +1477,7 @@ static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start,
|
||||
}
|
||||
|
||||
f2fs_invalidate_blocks(sbi, dn->data_blkaddr);
|
||||
dn->data_blkaddr = NEW_ADDR;
|
||||
f2fs_set_data_blkaddr(dn);
|
||||
f2fs_set_data_blkaddr(dn, NEW_ADDR);
|
||||
}
|
||||
|
||||
f2fs_update_read_extent_cache_range(dn, start, 0, index - start);
|
||||
@ -3454,8 +3452,7 @@ static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count)
|
||||
if (blkaddr != NEW_ADDR)
|
||||
continue;
|
||||
|
||||
dn->data_blkaddr = NULL_ADDR;
|
||||
f2fs_set_data_blkaddr(dn);
|
||||
f2fs_set_data_blkaddr(dn, NULL_ADDR);
|
||||
}
|
||||
|
||||
f2fs_i_compr_blocks_update(dn->inode, compr_blocks, false);
|
||||
@ -3621,8 +3618,7 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count)
|
||||
continue;
|
||||
}
|
||||
|
||||
dn->data_blkaddr = NEW_ADDR;
|
||||
f2fs_set_data_blkaddr(dn);
|
||||
f2fs_set_data_blkaddr(dn, NEW_ADDR);
|
||||
}
|
||||
|
||||
reserved = cluster_size - compr_blocks;
|
||||
|
Loading…
Reference in New Issue
Block a user