Skip to content

Commit 5f48d4d

Browse files
LiBaokun96tytso
authored andcommitted
ext4: save unnecessary indentation in ext4_ext_create_new_leaf()
Save an indentation level in ext4_ext_create_new_leaf() by removing unnecessary 'else'. Besides, the variable 'ee_block' is declared to avoid line breaks. No functional changes. Suggested-by: Jan Kara <[email protected]> Signed-off-by: Baokun Li <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 2352e3e commit 5f48d4d

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

fs/ext4/extents.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,7 @@ ext4_ext_create_new_leaf(handle_t *handle, struct inode *inode,
14031403
{
14041404
struct ext4_ext_path *curp;
14051405
int depth, i, err = 0;
1406+
ext4_lblk_t ee_block = le32_to_cpu(newext->ee_block);
14061407

14071408
repeat:
14081409
i = depth = ext_depth(inode);
@@ -1424,33 +1425,30 @@ ext4_ext_create_new_leaf(handle_t *handle, struct inode *inode,
14241425
goto errout;
14251426

14261427
/* refill path */
1427-
path = ext4_find_extent(inode,
1428-
(ext4_lblk_t)le32_to_cpu(newext->ee_block),
1429-
path, gb_flags);
1428+
path = ext4_find_extent(inode, ee_block, path, gb_flags);
14301429
return path;
1431-
} else {
1432-
/* tree is full, time to grow in depth */
1433-
err = ext4_ext_grow_indepth(handle, inode, mb_flags);
1434-
if (err)
1435-
goto errout;
1430+
}
14361431

1437-
/* refill path */
1438-
path = ext4_find_extent(inode,
1439-
(ext4_lblk_t)le32_to_cpu(newext->ee_block),
1440-
path, gb_flags);
1441-
if (IS_ERR(path))
1442-
return path;
1432+
/* tree is full, time to grow in depth */
1433+
err = ext4_ext_grow_indepth(handle, inode, mb_flags);
1434+
if (err)
1435+
goto errout;
14431436

1444-
/*
1445-
* only first (depth 0 -> 1) produces free space;
1446-
* in all other cases we have to split the grown tree
1447-
*/
1448-
depth = ext_depth(inode);
1449-
if (path[depth].p_hdr->eh_entries == path[depth].p_hdr->eh_max) {
1450-
/* now we need to split */
1451-
goto repeat;
1452-
}
1437+
/* refill path */
1438+
path = ext4_find_extent(inode, ee_block, path, gb_flags);
1439+
if (IS_ERR(path))
1440+
return path;
1441+
1442+
/*
1443+
* only first (depth 0 -> 1) produces free space;
1444+
* in all other cases we have to split the grown tree
1445+
*/
1446+
depth = ext_depth(inode);
1447+
if (path[depth].p_hdr->eh_entries == path[depth].p_hdr->eh_max) {
1448+
/* now we need to split */
1449+
goto repeat;
14531450
}
1451+
14541452
return path;
14551453

14561454
errout:

0 commit comments

Comments
 (0)