diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index efd3ebaa4fc8..697020cef820 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1431,13 +1431,12 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type) return err; dn->data_blkaddr = f2fs_data_blkaddr(dn); - if (dn->data_blkaddr != NULL_ADDR) - goto alloc; + if (dn->data_blkaddr == NULL_ADDR) { + err = inc_valid_block_count(sbi, dn->inode, &count); + if (unlikely(err)) + return err; + } - if (unlikely((err = inc_valid_block_count(sbi, dn->inode, &count)))) - return err; - -alloc: set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version); old_blkaddr = dn->data_blkaddr; f2fs_allocate_data_block(sbi, NULL, old_blkaddr, &dn->data_blkaddr,