Add one-line summary for dont-try-to-resize-if-there-are-no-reserved-gdt-blocks-left
[ext4-patch-queue.git] / ext4_unwritten_extent_delalloc_fix.patch
blobf3709450a70ba2d3064ab8f293239c19b89205fb
1 Ext4: Handle unwritten extent properly with delayed allocation
3 From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
5 When using fallocate the buffer_heads are marked unwritten
6 and unmapped. We need to map them in the writepages after
7 a get_block. Otherwise we split the uninit extents,
8 but never write the content to disk.
10 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
11 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
12 ---
13 fs/ext4/inode.c | 12 ++++++++++--
14 1 file changed, 10 insertions(+), 2 deletions(-)
16 Index: linux-2.6.27-rc1/fs/ext4/inode.c
17 ===================================================================
18 --- linux-2.6.27-rc1.orig/fs/ext4/inode.c 2008-08-11 14:27:43.000000000 -0700
19 +++ linux-2.6.27-rc1/fs/ext4/inode.c 2008-08-11 14:27:48.000000000 -0700
20 @@ -1720,6 +1720,13 @@ static void mpage_put_bnr_to_bhs(struct
21 if (buffer_delay(bh)) {
22 bh->b_blocknr = pblock;
23 clear_buffer_delay(bh);
24 + bh->b_bdev = inode->i_sb->s_bdev;
25 + } else if (buffer_unwritten(bh)) {
26 + bh->b_blocknr = pblock;
27 + clear_buffer_unwritten(bh);
28 + set_buffer_mapped(bh);
29 + set_buffer_new(bh);
30 + bh->b_bdev = inode->i_sb->s_bdev;
31 } else if (buffer_mapped(bh))
32 BUG_ON(bh->b_blocknr != pblock);
34 @@ -1793,7 +1800,7 @@ static void mpage_da_map_blocks(struct m
35 * If blocks are delayed marked, we need to
36 * put actual blocknr and drop delayed bit
38 - if (buffer_delay(lbh))
39 + if (buffer_delay(lbh) || buffer_unwritten(lbh))
40 mpage_put_bnr_to_bhs(mpd, next, &new);
42 /* go for the remaining blocks */
43 @@ -1802,7 +1809,8 @@ static void mpage_da_map_blocks(struct m
47 -#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | (1 << BH_Delay))
48 +#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | \
49 + (1 << BH_Delay) | (1 << BH_Unwritten))
52 * mpage_add_bh_to_extent - try to add one more block to extent of blocks