mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
ext4: make sure ext4_has_free_blocks returns 0 for ENOSPC
Fix ext4_has_free_blocks() to return 0 when we don't have enough space. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
This commit is contained in:
parent
525f4ed8dc
commit
16eb729564
1 changed files with 3 additions and 0 deletions
|
|
@ -1626,6 +1626,9 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
|
|||
free_blocks =
|
||||
percpu_counter_sum_and_set(&sbi->s_freeblocks_counter);
|
||||
#endif
|
||||
if (free_blocks <= root_blocks)
|
||||
/* we don't have free space */
|
||||
return 0;
|
||||
if (free_blocks - root_blocks < nblocks)
|
||||
return free_blocks - root_blocks;
|
||||
return nblocks;
|
||||
|
|
|
|||
Loading…
Reference in a new issue