public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v2] ext4: Handle unwritten extent properly with delayed allocation.
@ 2008-08-11 10:23 Aneesh Kumar K.V
  2008-08-11 10:23 ` [PATCH -v2] ext4: Rework the ext4_da_writepages Aneesh Kumar K.V
  2008-08-11 21:49 ` [PATCH -v2] ext4: Handle unwritten extent properly with delayed allocation Mingming Cao
  0 siblings, 2 replies; 6+ messages in thread
From: Aneesh Kumar K.V @ 2008-08-11 10:23 UTC (permalink / raw)
  To: cmm, tytso, sandeen; +Cc: linux-ext4, Aneesh Kumar K.V

When using fallocate the buffer_heads are marked unwritten
and unmapped. We need to map them in the writepages after
a get_block. Otherwise we split the uninit extents,
but never write the content to disk.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/ext4/inode.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c96cc0b..7a66bba 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1732,6 +1732,13 @@ static void mpage_put_bnr_to_bhs(struct mpage_da_data *mpd, sector_t logical,
 				if (buffer_delay(bh)) {
 					bh->b_blocknr = pblock;
 					clear_buffer_delay(bh);
+					bh->b_bdev = inode->i_sb->s_bdev;
+				} else if (buffer_unwritten(bh)) {
+					bh->b_blocknr = pblock;
+					clear_buffer_unwritten(bh);
+					set_buffer_mapped(bh);
+					set_buffer_new(bh);
+					bh->b_bdev = inode->i_sb->s_bdev;
 				} else if (buffer_mapped(bh))
 					BUG_ON(bh->b_blocknr != pblock);
 
@@ -1805,7 +1812,7 @@ static void mpage_da_map_blocks(struct mpage_da_data *mpd)
 		 * If blocks are delayed marked, we need to
 		 * put actual blocknr and drop delayed bit
 		 */
-		if (buffer_delay(lbh))
+		if (buffer_delay(lbh) || buffer_unwritten(lbh))
 			mpage_put_bnr_to_bhs(mpd, next, &new);
 
 		/* go for the remaining blocks */
@@ -1814,7 +1821,8 @@ static void mpage_da_map_blocks(struct mpage_da_data *mpd)
 	}
 }
 
-#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | (1 << BH_Delay))
+#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | \
+		(1 << BH_Delay) | (1 << BH_Unwritten))
 
 /*
  * mpage_add_bh_to_extent - try to add one more block to extent of blocks
-- 
1.6.0.rc0.42.g186458.dirty


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-11 21:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-11 10:23 [PATCH -v2] ext4: Handle unwritten extent properly with delayed allocation Aneesh Kumar K.V
2008-08-11 10:23 ` [PATCH -v2] ext4: Rework the ext4_da_writepages Aneesh Kumar K.V
2008-08-11 10:23   ` [PATCH -v2] ext4: invalidate pages if delalloc block allocation fails Aneesh Kumar K.V
2008-08-11 21:50     ` Mingming Cao
2008-08-11 21:50   ` [PATCH -v2] ext4: Rework the ext4_da_writepages Mingming Cao
2008-08-11 21:49 ` [PATCH -v2] ext4: Handle unwritten extent properly with 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