* [PATCH] ext4: general handling preallocated blocks in delayed allocation
@ 2008-02-22 20:36 Mingming Cao
0 siblings, 0 replies; only message in thread
From: Mingming Cao @ 2008-02-22 20:36 UTC (permalink / raw)
To: linux-ext4, Alex Tomas
With delayed allocation, get_block() is only doing block map at the
write_begin() time. If the blocks are prea-allocated, the result bh
is not mapped, but the blocks are actually being allocated.
delalloc should not treat it as other regular unallocated area, thus
mark it as need block allocation later, and doing extra reservation
incorrectly.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
---
fs/ext4/inode.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
Index: linux-2.6.25-rc2/fs/ext4/inode.c
===================================================================
--- linux-2.6.25-rc2.orig/fs/ext4/inode.c 2008-02-19 14:57:00.000000000 -0800
+++ linux-2.6.25-rc2/fs/ext4/inode.c 2008-02-19 15:04:56.000000000 -0800
@@ -1401,20 +1401,18 @@ static int ext4_da_get_block_prep(struct
* XXX: when the filesystem has a lot of free blocks, we could
* reserve even allocated blocks to save this lookup */
ret = ext4_get_blocks_wrap(NULL, inode, iblock, 1, bh_result, 0, 0);
- if (ret >= 0) {
- if (buffer_mapped(bh_result)) {
- bh_result->b_size = (ret << inode->i_blkbits);
- } else {
- /* the block isn't allocated yet, let's reserve space */
- /* XXX: call reservation here */
- /*
- * XXX: __block_prepare_write() unmaps passed block,
- * is it OK?
- */
- map_bh(bh_result, inode->i_sb, 0);
- set_buffer_new(bh_result);
- set_buffer_delay(bh_result);
- }
+ if (ret == 0) {
+ /* the block isn't allocated yet, let's reserve space */
+ /* XXX: call reservation here */
+ /*
+ * XXX: __block_prepare_write() unmaps passed block,
+ * is it OK?
+ */
+ map_bh(bh_result, inode->i_sb, 0);
+ set_buffer_new(bh_result);
+ set_buffer_delay(bh_result);
+ } else if ((ret > 0) && (buffer_mapped(bh_result))) {
+ bh_result->b_size = (ret << inode->i_blkbits);
ret = 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-22 20:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-22 20:36 [PATCH] ext4: general handling preallocated blocks in delayed allocation Mingming Cao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox