File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -4543,6 +4543,17 @@ static int ext4_mb_discard_preallocations(struct super_block *sb, int needed)
4543
4543
return freed ;
4544
4544
}
4545
4545
4546
+ static bool ext4_mb_discard_preallocations_should_retry (struct super_block * sb ,
4547
+ struct ext4_allocation_context * ac )
4548
+ {
4549
+ int freed ;
4550
+
4551
+ freed = ext4_mb_discard_preallocations (sb , ac -> ac_o_ex .fe_len );
4552
+ if (freed )
4553
+ return true;
4554
+ return false;
4555
+ }
4556
+
4546
4557
/*
4547
4558
* Main entry point into mballoc to allocate blocks
4548
4559
* it tries to use preallocation first, then falls back
@@ -4551,7 +4562,6 @@ static int ext4_mb_discard_preallocations(struct super_block *sb, int needed)
4551
4562
ext4_fsblk_t ext4_mb_new_blocks (handle_t * handle ,
4552
4563
struct ext4_allocation_request * ar , int * errp )
4553
4564
{
4554
- int freed ;
4555
4565
struct ext4_allocation_context * ac = NULL ;
4556
4566
struct ext4_sb_info * sbi ;
4557
4567
struct super_block * sb ;
@@ -4656,8 +4666,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4656
4666
ar -> len = ac -> ac_b_ex .fe_len ;
4657
4667
}
4658
4668
} else {
4659
- freed = ext4_mb_discard_preallocations (sb , ac -> ac_o_ex .fe_len );
4660
- if (freed )
4669
+ if (ext4_mb_discard_preallocations_should_retry (sb , ac ))
4661
4670
goto repeat ;
4662
4671
/*
4663
4672
* If block allocation fails then the pa allocated above
You can’t perform that action at this time.
0 commit comments