Fix broken put_bh->brelse conversion
[ext4-patch-queue.git] / ext4-delalloc-extents-48bit.patch
blobd15f4f74fa0f01775b5f508b87bab3e6855f6463
1 ext4: Add basic delayed allocation support
3 From: Alex Tomas <alex@clusterfs.com>
5 Signed-off-by: Alex Tomas <alex@clusterfs.com>
6 ---
7 ---
8 fs/ext4/writeback.c | 20 ++++++++++++++------
9 1 file changed, 14 insertions(+), 6 deletions(-)
11 Index: linux-2.6.23-rc3/fs/ext4/writeback.c
12 ===================================================================
13 --- linux-2.6.23-rc3.orig/fs/ext4/writeback.c 2007-08-14 16:37:58.000000000 -0700
14 +++ linux-2.6.23-rc3/fs/ext4/writeback.c 2007-08-14 17:11:33.000000000 -0700
15 @@ -275,7 +275,8 @@ static int ext4_wb_submit_extent(struct
16 struct inode *inode = wc->mapping->host;
17 int blkbits = inode->i_blkbits;
18 struct page *page;
19 - unsigned long blk, off, len, remain;
20 + ext4_fsblk_t off;
21 + unsigned long blk, len, remain;
22 unsigned long pstart, plen, prev;
23 struct bio *bio = NULL;
24 int nr_pages;
25 @@ -336,6 +337,8 @@ alloc_new_bio:
26 nr_pages = (nr_pages >> (PAGE_CACHE_SHIFT - blkbits));
27 off = le32_to_cpu(ex->ee_start) +
28 (blk - le32_to_cpu(ex->ee_block));
29 + off |= (ext4_fsblk_t)
30 + le16_to_cpu(ex->ee_start_hi) << 32;
31 bio = ext4_wb_bio_alloc(inode, off, nr_pages + 2);
32 if (bio == NULL)
33 return -ENOMEM;
34 @@ -383,7 +386,9 @@ ext4_wb_find_goal(struct inode *inode, s
35 /* try to predict block placement */
36 ex = path[depth].p_ext;
37 if (ex)
38 - return le32_to_cpu(ex->ee_start) +
39 + return (le32_to_cpu(ex->ee_start) |
40 + ((ext4_fsblk_t)
41 + le16_to_cpu(ex->ee_start_hi) << 32)) +
42 (block - le32_to_cpu(ex->ee_block));
44 /* it looks index is empty
45 @@ -423,7 +428,8 @@ static int ext4_wb_handle_extent(struct
46 (unsigned) ec->ec_block,
47 (unsigned) ec->ec_len,
48 (unsigned) ec->ec_start);
49 - nex.ee_start = cpu_to_le32(ec->ec_start);
50 + nex.ee_start = cpu_to_le32(ec->ec_start & 0xffffffff);
51 + nex.ee_start_hi = cpu_to_le16((ec->ec_start >> 32) & 0xffff);
52 nex.ee_block = cpu_to_le32(ec->ec_block);
53 nex.ee_len = cpu_to_le16(ec->ec_len);
54 err = ext4_wb_submit_extent(wc, NULL, &nex, 0);
55 @@ -497,8 +503,8 @@ static int ext4_wb_handle_extent(struct
56 pblock, count, inode->i_ino, ec->ec_len);
58 /* insert new extent */
59 - nex.ee_start = cpu_to_le32(pblock);
60 - nex.ee_start_hi = 0;
61 + nex.ee_start = cpu_to_le32(pblock & 0xffffffff);
62 + nex.ee_start_hi = cpu_to_le16((pblock >> 32) & 0xffff);
63 nex.ee_len = cpu_to_le16(count);
64 nex.ee_block = cpu_to_le32(ec->ec_block);
65 err = ext4_ext_insert_extent(handle, inode, path, &nex);
66 @@ -533,7 +539,9 @@ static int ext4_wb_handle_extent(struct
67 * in correspondend buffer_heads to prevent corruptions */
68 for (i = 0; i < le16_to_cpu(nex.ee_len); i++)
69 unmap_underlying_metadata(sb->s_bdev,
70 - le32_to_cpu(nex.ee_start) + i);
71 + ((ext4_fsblk_t)
72 + le16_to_cpu(nex.ee_start_hi) << 32) +
73 + le32_to_cpu(nex.ee_start) + i);
75 /* correct on-disk inode size */
76 if (le16_to_cpu(nex.ee_len) > 0) {