@@ -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
14071408repeat :
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
14561454errout :
0 commit comments