diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-08-19 21:16:54 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-08-19 21:16:54 -0400 |
commit | 16eb72956496594d023a7d7cd14a86404ad195ad (patch) | |
tree | 1fed199d788b33be4b329a58e5b6946f41ee6a20 | |
parent | 525f4ed8dcb72c71b306a78ecbf06f41d08fe441 (diff) |
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 <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/balloc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 1ae5004e93fc..e9fa960ba6da 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -1626,6 +1626,9 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, | |||
1626 | free_blocks = | 1626 | free_blocks = |
1627 | percpu_counter_sum_and_set(&sbi->s_freeblocks_counter); | 1627 | percpu_counter_sum_and_set(&sbi->s_freeblocks_counter); |
1628 | #endif | 1628 | #endif |
1629 | if (free_blocks <= root_blocks) | ||
1630 | /* we don't have free space */ | ||
1631 | return 0; | ||
1629 | if (free_blocks - root_blocks < nblocks) | 1632 | if (free_blocks - root_blocks < nblocks) |
1630 | return free_blocks - root_blocks; | 1633 | return free_blocks - root_blocks; |
1631 | return nblocks; | 1634 | return nblocks; |