提交 68629f29 编写于 作者: A Aneesh Kumar K.V 提交者: Theodore Ts'o

ext4: Fix ext4 nomballoc allocator for ENOSPC

We run into ENOSPC error on nonmballoc ext4, even when there is free blocks
on the filesystem.

The patch includes two changes:

a) Set reservation to NULL if we trying to allocate near group_target_block
from the goal group if the free block in the group is less than windows.
This should give us a better chance to allocate near group_target_block.
This also ensures that if we are not allocating near group_target_block
then we don't trun off reservation. This should enable us to allocate
with reservation from other groups that have large free blocks count.

b) we don't need to check the window size if the block reservation is off.
Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: NMingming Cao <cmm@us.ibm.com>
Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 5c791616
...@@ -1804,15 +1804,17 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode, ...@@ -1804,15 +1804,17 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
goto io_error; goto io_error;
free_blocks = le16_to_cpu(gdp->bg_free_blocks_count); free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
/*
* if there is not enough free blocks to make a new resevation
* turn off reservation for this allocation
*/
if (my_rsv && (free_blocks < windowsz)
&& (rsv_is_empty(&my_rsv->rsv_window)))
my_rsv = NULL;
if (free_blocks > 0) { if (free_blocks > 0) {
/*
* try to allocate with group target block
* in the goal group. If we have low free_blocks
* count turn off reservation
*/
if (my_rsv && (free_blocks < windowsz)
&& (rsv_is_empty(&my_rsv->rsv_window)))
my_rsv = NULL;
bitmap_bh = ext4_read_block_bitmap(sb, group_no); bitmap_bh = ext4_read_block_bitmap(sb, group_no);
if (!bitmap_bh) if (!bitmap_bh)
goto io_error; goto io_error;
...@@ -1845,7 +1847,7 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode, ...@@ -1845,7 +1847,7 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
* free blocks is less than half of the reservation * free blocks is less than half of the reservation
* window size. * window size.
*/ */
if (free_blocks <= (windowsz/2)) if (my_rsv && (free_blocks <= (windowsz/2)))
continue; continue;
brelse(bitmap_bh); brelse(bitmap_bh);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册