diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index b2289dfab9a231edf8be4bcdddc426213f4f63b8..7fb081516f5f44ea49e5af93dbce009a4f095c2e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -676,7 +676,6 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, unsigned int ofs_in_node, last_ofs_in_node; blkcnt_t prealloc; struct extent_info ei; - bool allocated = false; block_t blkaddr; if (!maxblocks) @@ -735,10 +734,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, } } else { err = __allocate_data_block(&dn); - if (!err) { + if (!err) set_inode_flag(inode, FI_APPEND_WRITE); - allocated = true; - } } if (err) goto sync_out; @@ -793,7 +790,6 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, err = reserve_new_blocks(&dn, prealloc); if (err) goto sync_out; - allocated = dn.node_changed; map->m_len += dn.ofs_in_node - ofs_in_node; if (prealloc && dn.ofs_in_node != last_ofs_in_node + 1) { @@ -812,9 +808,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, if (create) { f2fs_unlock_op(sbi); - f2fs_balance_fs(sbi, allocated); + f2fs_balance_fs(sbi, dn.node_changed); } - allocated = false; goto next_dnode; sync_out: @@ -822,7 +817,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, unlock_out: if (create) { f2fs_unlock_op(sbi); - f2fs_balance_fs(sbi, allocated); + f2fs_balance_fs(sbi, dn.node_changed); } out: trace_f2fs_map_blocks(inode, map, err);