Commit bee6cf00 authored by Eric Whitney's avatar Eric Whitney Committed by Theodore Ts'o

ext4: remove redundant GET_BLOCKS_CONVERT code

Remove the redundant code assigning values to ext4_map_blocks components
in ext4_ext_handle_unwritten_extents() for the EXT4_GET_BLOCKS_CONVERT
case, using the code at the function exit instead.  Clean up and reorder
that code to eliminate more redundancy and improve readability.
Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
Link: https://lore.kernel.org/r/20200430185320.23001-3-enwlinux@gmail.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent ee802f86
...@@ -3829,20 +3829,14 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode, ...@@ -3829,20 +3829,14 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
} }
/* IO end_io complete, convert the filled extent to written */ /* IO end_io complete, convert the filled extent to written */
if (flags & EXT4_GET_BLOCKS_CONVERT) { if (flags & EXT4_GET_BLOCKS_CONVERT) {
ret = ext4_convert_unwritten_extents_endio(handle, inode, map, err = ext4_convert_unwritten_extents_endio(handle, inode, map,
ppath); ppath);
if (ret >= 0) if (err < 0)
ext4_update_inode_fsync_trans(handle, inode, 1); goto out2;
else ext4_update_inode_fsync_trans(handle, inode, 1);
err = ret; goto map_out;
map->m_flags |= EXT4_MAP_MAPPED;
map->m_pblk = newblock;
if (allocated > map->m_len)
allocated = map->m_len;
map->m_len = allocated;
goto out2;
} }
/* buffered IO case */ /* buffered IO cases */
/* /*
* repeat fallocate creation request * repeat fallocate creation request
* we already have an unwritten extent * we already have an unwritten extent
...@@ -3876,18 +3870,14 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode, ...@@ -3876,18 +3870,14 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
} else } else
allocated = ret; allocated = ret;
map->m_flags |= EXT4_MAP_NEW; map->m_flags |= EXT4_MAP_NEW;
if (allocated > map->m_len)
allocated = map->m_len;
map->m_len = allocated;
map_out: map_out:
map->m_flags |= EXT4_MAP_MAPPED; map->m_flags |= EXT4_MAP_MAPPED;
out1: out1:
map->m_pblk = newblock;
if (allocated > map->m_len) if (allocated > map->m_len)
allocated = map->m_len; allocated = map->m_len;
ext4_ext_show_leaf(inode, path);
map->m_pblk = newblock;
map->m_len = allocated; map->m_len = allocated;
ext4_ext_show_leaf(inode, path);
out2: out2:
return err ? err : allocated; return err ? err : allocated;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment