]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.fixes/ext4-clear-unwritten-flag-after-extent-initialization
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / ext4-clear-unwritten-flag-after-extent-initialization
CommitLineData
2cb7cef9
BS
1From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2Date: Thu, 14 May 2009 21:05:39 +0000 (-0400)
3Subject: ext4: Clear the unwritten buffer_head flag after the extent is initialized
4Patch-mainline: 2.6.30-rc6
5Git-commit: 2a8964d63d50dd2d65d71d342bc7fb6ef4117614
6References: bnc#503161
7
8ext4: Clear the unwritten buffer_head flag after the extent is initialized
9
10The BH_Unwritten flag indicates that the buffer is allocated on disk
11but has not been written; that is, the disk was part of a persistent
12preallocation area. That flag should only be set when a get_blocks()
13function is looking up a inode's logical to physical block mapping.
14
15When ext4_get_blocks_wrap() is called with create=1, the uninitialized
16extent is converted into an initialized one, so the BH_Unwritten flag
17is no longer appropriate. Hence, we need to make sure the
18BH_Unwritten is not left set, since the combination of BH_Mapped and
19BH_Unwritten is not allowed; among other things, it will result ext4's
20get_block() to be called over and over again during the write_begin
21phase of write(2).
22
23Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
24Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
25Acked-by: Jeff Mahoney <jeffm@suse.com>
26---
27
28 fs/ext4/inode.c | 13 +++++++++++++
29 1 file changed, 13 insertions(+)
30
31--- a/fs/ext4/inode.c
32+++ b/fs/ext4/inode.c
33@@ -1058,6 +1058,7 @@ int ext4_get_blocks_wrap(handle_t *handl
34 int retval;
35
36 clear_buffer_mapped(bh);
37+ clear_buffer_unwritten(bh);
38
39 /*
40 * Try to see if we can get the block without requesting
41@@ -1088,6 +1089,18 @@ int ext4_get_blocks_wrap(handle_t *handl
42 return retval;
43
44 /*
45+ * When we call get_blocks without the create flag, the
46+ * BH_Unwritten flag could have gotten set if the blocks
47+ * requested were part of a uninitialized extent. We need to
48+ * clear this flag now that we are committed to convert all or
49+ * part of the uninitialized extent to be an initialized
50+ * extent. This is because we need to avoid the combination
51+ * of BH_Unwritten and BH_Mapped flags being simultaneously
52+ * set on the buffer_head.
53+ */
54+ clear_buffer_unwritten(bh);
55+
56+ /*
57 * New blocks allocate and/or writing to uninitialized extent
58 * will possibly result in updating i_data, so we take
59 * the write lock of i_data_sem, and call get_blocks()