]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
2 | Date: Tue, 12 May 2009 18:40:37 +0000 (-0400) | |
3 | Subject: ext4: Use a fake block number for delayed new buffer_head | |
4 | Patch-mainline: 2.6.30-rc6 | |
5 | Git-commit: 33b9817e2ae097c7b8d256e3510ac6c54fc6d9d0 | |
6 | References: bnc#503161 | |
7 | ||
8 | ext4: Use a fake block number for delayed new buffer_head | |
9 | ||
10 | Use a very large unsigned number (~0xffff) as as the fake block number | |
11 | for the delayed new buffer. The VFS should never try to write out this | |
12 | number, but if it does, this will make it obvious. | |
13 | ||
14 | Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | |
15 | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> | |
16 | Acked-by: Jeff Mahoney <jeffm@suse.com> | |
17 | --- | |
18 | ||
19 | fs/ext4/inode.c | 6 +++++- | |
20 | 1 file changed, 5 insertions(+), 1 deletion(-) | |
21 | ||
22 | --- a/fs/ext4/inode.c | |
23 | +++ b/fs/ext4/inode.c | |
24 | @@ -2190,6 +2190,10 @@ static int ext4_da_get_block_prep(struct | |
25 | struct buffer_head *bh_result, int create) | |
26 | { | |
27 | int ret = 0; | |
28 | + sector_t invalid_block = ~((sector_t) 0xffff); | |
29 | + | |
30 | + if (invalid_block < ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es)) | |
31 | + invalid_block = ~0; | |
32 | ||
33 | BUG_ON(create == 0); | |
34 | BUG_ON(bh_result->b_size != inode->i_sb->s_blocksize); | |
35 | @@ -2211,7 +2215,7 @@ static int ext4_da_get_block_prep(struct | |
36 | /* not enough space to reserve */ | |
37 | return ret; | |
38 | ||
39 | - map_bh(bh_result, inode->i_sb, 0); | |
40 | + map_bh(bh_result, inode->i_sb, invalid_block); | |
41 | set_buffer_new(bh_result); | |
42 | set_buffer_delay(bh_result); | |
43 | } else if (ret > 0) { |