diff options
Diffstat (limited to 'fs/ext3/balloc.c')
-rw-r--r-- | fs/ext3/balloc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 6386d76f44a7..a2038928f9a3 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -427,7 +427,7 @@ static inline int rsv_is_empty(struct ext3_reserve_window *rsv) | |||
427 | void ext3_init_block_alloc_info(struct inode *inode) | 427 | void ext3_init_block_alloc_info(struct inode *inode) |
428 | { | 428 | { |
429 | struct ext3_inode_info *ei = EXT3_I(inode); | 429 | struct ext3_inode_info *ei = EXT3_I(inode); |
430 | struct ext3_block_alloc_info *block_i = ei->i_block_alloc_info; | 430 | struct ext3_block_alloc_info *block_i; |
431 | struct super_block *sb = inode->i_sb; | 431 | struct super_block *sb = inode->i_sb; |
432 | 432 | ||
433 | block_i = kmalloc(sizeof(*block_i), GFP_NOFS); | 433 | block_i = kmalloc(sizeof(*block_i), GFP_NOFS); |
@@ -1440,14 +1440,14 @@ out: | |||
1440 | * | 1440 | * |
1441 | * Check if filesystem has at least 1 free block available for allocation. | 1441 | * Check if filesystem has at least 1 free block available for allocation. |
1442 | */ | 1442 | */ |
1443 | static int ext3_has_free_blocks(struct ext3_sb_info *sbi) | 1443 | static int ext3_has_free_blocks(struct ext3_sb_info *sbi, int use_reservation) |
1444 | { | 1444 | { |
1445 | ext3_fsblk_t free_blocks, root_blocks; | 1445 | ext3_fsblk_t free_blocks, root_blocks; |
1446 | 1446 | ||
1447 | free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); | 1447 | free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); |
1448 | root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count); | 1448 | root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count); |
1449 | if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) && | 1449 | if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) && |
1450 | sbi->s_resuid != current_fsuid() && | 1450 | !use_reservation && sbi->s_resuid != current_fsuid() && |
1451 | (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) { | 1451 | (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) { |
1452 | return 0; | 1452 | return 0; |
1453 | } | 1453 | } |
@@ -1468,7 +1468,7 @@ static int ext3_has_free_blocks(struct ext3_sb_info *sbi) | |||
1468 | */ | 1468 | */ |
1469 | int ext3_should_retry_alloc(struct super_block *sb, int *retries) | 1469 | int ext3_should_retry_alloc(struct super_block *sb, int *retries) |
1470 | { | 1470 | { |
1471 | if (!ext3_has_free_blocks(EXT3_SB(sb)) || (*retries)++ > 3) | 1471 | if (!ext3_has_free_blocks(EXT3_SB(sb), 0) || (*retries)++ > 3) |
1472 | return 0; | 1472 | return 0; |
1473 | 1473 | ||
1474 | jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); | 1474 | jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); |
@@ -1546,7 +1546,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode, | |||
1546 | if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0)) | 1546 | if (block_i && ((windowsz = block_i->rsv_window_node.rsv_goal_size) > 0)) |
1547 | my_rsv = &block_i->rsv_window_node; | 1547 | my_rsv = &block_i->rsv_window_node; |
1548 | 1548 | ||
1549 | if (!ext3_has_free_blocks(sbi)) { | 1549 | if (!ext3_has_free_blocks(sbi, IS_NOQUOTA(inode))) { |
1550 | *errp = -ENOSPC; | 1550 | *errp = -ENOSPC; |
1551 | goto out; | 1551 | goto out; |
1552 | } | 1552 | } |
@@ -1924,9 +1924,10 @@ unsigned long ext3_bg_num_gdb(struct super_block *sb, int group) | |||
1924 | * reaches any used block. Then issue a TRIM command on this extent and free | 1924 | * reaches any used block. Then issue a TRIM command on this extent and free |
1925 | * the extent in the block bitmap. This is done until whole group is scanned. | 1925 | * the extent in the block bitmap. This is done until whole group is scanned. |
1926 | */ | 1926 | */ |
1927 | ext3_grpblk_t ext3_trim_all_free(struct super_block *sb, unsigned int group, | 1927 | static ext3_grpblk_t ext3_trim_all_free(struct super_block *sb, |
1928 | ext3_grpblk_t start, ext3_grpblk_t max, | 1928 | unsigned int group, |
1929 | ext3_grpblk_t minblocks) | 1929 | ext3_grpblk_t start, ext3_grpblk_t max, |
1930 | ext3_grpblk_t minblocks) | ||
1930 | { | 1931 | { |
1931 | handle_t *handle; | 1932 | handle_t *handle; |
1932 | ext3_grpblk_t next, free_blocks, bit, freed, count = 0; | 1933 | ext3_grpblk_t next, free_blocks, bit, freed, count = 0; |