summaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V2008-09-09 05:14:50 +0200
committerTheodore Ts'o2008-09-09 05:14:50 +0200
commit030ba6bc67b4f2bc5cd174f57785a1745c929abe (patch)
tree14c57b4f6f8afddac0bd2415bfa050fba8d25980 /fs/ext4/mballoc.c
parentext4: Make sure all the block allocation paths reserve blocks (diff)
downloadkernel-qcow2-linux-030ba6bc67b4f2bc5cd174f57785a1745c929abe.tar.gz
kernel-qcow2-linux-030ba6bc67b4f2bc5cd174f57785a1745c929abe.tar.xz
kernel-qcow2-linux-030ba6bc67b4f2bc5cd174f57785a1745c929abe.zip
ext4: Retry block reservation
During block reservation if we don't have enough blocks left, retry block reservation with smaller block counts. This makes sure we try fallocate and DIO with smaller request size and don't fail early. The delayed allocation reservation cannot try with smaller block count. So retry block reservation to handle temporary disk full conditions. Also print free blocks details if we fail block allocation during writepages. 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>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 2c10b5058a8d..e4f30de11a9d 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4395,7 +4395,12 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
/*
* With delalloc we already reserved the blocks
*/
- if (ext4_claim_free_blocks(sbi, ar->len)) {
+ while (ar->len && ext4_claim_free_blocks(sbi, ar->len)) {
+ /* let others to free the space */
+ yield();
+ ar->len = ar->len >> 1;
+ }
+ if (!ar->len) {
*errp = -ENOSPC;
return 0;
}