On Fri 25-01-19 20:30:56, zhangyi (F) wrote: > After we remove clean_bdev_aliases() calls which used to unmap extra > blocks in ext4_ext_handle_unwritten_extents(), return extra initialized > region in ext4_ext_convert_to_initialized() is no longer needed, so > in order to simplify logic, this patch convert to return the requested > size instead. > > Signed-off-by: zhangyi (F) <yi.zhang@xxxxxxxxxx> Looks good to me. You can add: Reviewed-by: Jan Kara <jack@xxxxxxx> Honza > --- > fs/ext4/extents.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c > index ffb72d8..ffe9671 100644 > --- a/fs/ext4/extents.c > +++ b/fs/ext4/extents.c > @@ -3456,9 +3456,8 @@ static int ext4_split_extent(handle_t *handle, > * of the logical span [map->m_lblk, map->m_lblk + map->m_len). > * > * Post-conditions on success: > - * - the returned value is the number of blocks beyond map->l_lblk > - * that are allocated and initialized. > - * It is guaranteed to be >= map->m_len. > + * - The returned value is the minimum number of requested blocks or > + * initialized blocks. It is guaranteed to be <= map->m_len. > */ > static int ext4_ext_convert_to_initialized(handle_t *handle, > struct inode *inode, > @@ -3700,7 +3699,6 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, > > split_map.m_len += split_map.m_lblk - ee_block; > split_map.m_lblk = ee_block; > - allocated = map->m_len; > } > } > > @@ -3709,6 +3707,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, > if (err > 0) > err = 0; > out: > + if (allocated > map->m_len) > + allocated = map->m_len; > + > /* If we have gotten a failure, don't zero out status tree */ > if (!err) { > err = ext4_zeroout_es(inode, &zero_ex1); > @@ -4065,11 +4066,10 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode, > if (ret <= 0) { > err = ret; > goto out2; > - } else > - allocated = ret; > + } > + > + allocated = ret; > map->m_flags |= EXT4_MAP_NEW; > - if (allocated > map->m_len) > - allocated = map->m_len; > map->m_len = allocated; > > map_out: > -- > 2.7.4 > -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR