aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2008-07-11 19:27:31 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-07-11 19:27:31 -0400
commit07031431072ece801d53d2c03d5e5bb21f4f64a4 (patch)
treeb3075b21242bda4e16c35814fceeaef64a027647 /fs/ext4/mballoc.c
parentd755fb384250d6bd7fd18a0930e71965acc8e72e (diff)
ext4: mballoc avoid use root reserved blocks for non root allocation
mballoc allocation missed check for blocks reserved for root users. Add ext4_has_free_blocks() check before allocation. Also modified ext4_has_free_blocks() to support multiple block allocation request. 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 816ba8cce79a..1666ac184e31 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4045,6 +4045,12 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4045 &(ar->len), errp); 4045 &(ar->len), errp);
4046 return block; 4046 return block;
4047 } 4047 }
4048 ar->len = ext4_has_free_blocks(sbi, ar->len);
4049
4050 if (ar->len == 0) {
4051 *errp = -ENOSPC;
4052 return 0;
4053 }
4048 4054
4049 while (ar->len && DQUOT_ALLOC_BLOCK(ar->inode, ar->len)) { 4055 while (ar->len && DQUOT_ALLOC_BLOCK(ar->inode, ar->len)) {
4050 ar->flags |= EXT4_MB_HINT_NOPREALLOC; 4056 ar->flags |= EXT4_MB_HINT_NOPREALLOC;
@@ -4073,7 +4079,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4073 4079
4074 ac->ac_op = EXT4_MB_HISTORY_PREALLOC; 4080 ac->ac_op = EXT4_MB_HISTORY_PREALLOC;
4075 if (!ext4_mb_use_preallocated(ac)) { 4081 if (!ext4_mb_use_preallocated(ac)) {
4076
4077 ac->ac_op = EXT4_MB_HISTORY_ALLOC; 4082 ac->ac_op = EXT4_MB_HISTORY_ALLOC;
4078 ext4_mb_normalize_request(ac, ar); 4083 ext4_mb_normalize_request(ac, ar);
4079repeat: 4084repeat: