1 [RFC] ext4-delayed-allocation.patch
5 I tested your patch on my system with a 20TB device, but some tests
6 failed. Looking at the code, I saw that the support of 48-bit block
7 number in extents is lacking.
9 I made some changes in the code (see the patch in attachment) and now
11 The patch is not complete, I didn't update calls to wb_debug() which
18 From: Valerie Clement <valerie.clement@bull.net>
22 fs/ext4/writeback.c | 19 +++++++++++++------
23 1 files changed, 13 insertions(+), 6 deletions(-)
25 diff --git a/fs/ext4/writeback.c b/fs/ext4/writeback.c
26 index 8861500..20e1d2e 100644
27 --- a/fs/ext4/writeback.c
28 +++ b/fs/ext4/writeback.c
29 @@ -274,7 +274,8 @@ static int ext4_wb_submit_extent(struct ext4_wb_control *wc, handle_t *handle,
30 struct inode *inode = wc->mapping->host;
31 int blkbits = inode->i_blkbits;
33 - unsigned long blk, off, len, remain;
35 + unsigned long blk, len, remain;
36 unsigned long pstart, plen, prev;
37 struct bio *bio = NULL;
39 @@ -332,6 +333,7 @@ alloc_new_bio:
40 nr_pages = (ex->ee_len - (blk - ex->ee_block));
41 nr_pages = (nr_pages >> (PAGE_CACHE_SHIFT - blkbits));
42 off = ex->ee_start + (blk - ex->ee_block);
43 + off |= (ext4_fsblk_t) ex->ee_start_hi << 32;
44 bio = ext4_wb_bio_alloc(inode, off, nr_pages + 2);
47 @@ -377,7 +379,9 @@ ext4_wb_find_goal(struct inode *inode, struct ext4_ext_path *path,
49 /* try to predict block placement */
50 if ((ex = path[depth].p_ext))
51 - return ex->ee_start + (block - ex->ee_block);
52 + return ((ex->ee_start
53 + | ((ext4_fsblk_t) ex->ee_start_hi << 32))
54 + + (block - ex->ee_block));
56 /* it looks index is empty
57 * try to find starting from index itself */
58 @@ -416,7 +420,8 @@ static int ext4_wb_handle_extent(struct inode *inode,
59 (unsigned) ec->ec_block,
60 (unsigned) ec->ec_len,
61 (unsigned) ec->ec_start);
62 - nex.ee_start = ec->ec_start;
63 + nex.ee_start = ec->ec_start & 0xffffffff;
64 + nex.ee_start_hi = (ec->ec_start >> 32) & 0xffff;
65 nex.ee_block = ec->ec_block;
66 nex.ee_len = ec->ec_len;
67 err = ext4_wb_submit_extent(wc, NULL, &nex, 0);
68 @@ -488,8 +493,8 @@ static int ext4_wb_handle_extent(struct inode *inode,
69 pblock, count, inode->i_ino, ec->ec_len);
71 /* insert new extent */
72 - nex.ee_start = pblock;
73 - nex.ee_start_hi = 0;
74 + nex.ee_start = pblock & 0xffffffff;
75 + nex.ee_start_hi = (pblock >> 32) & 0xffff;
77 nex.ee_block = ec->ec_block;
78 err = ext4_ext_insert_extent(handle, inode, path, &nex);
79 @@ -520,7 +525,9 @@ static int ext4_wb_handle_extent(struct inode *inode,
80 /* block have been allocated for data, so time to drop dirty
81 * in correspondend buffer_heads to prevent corruptions */
82 for (i = 0; i < nex.ee_len; i++)
83 - unmap_underlying_metadata(sb->s_bdev, nex.ee_start + i);
84 + unmap_underlying_metadata(sb->s_bdev,
85 + ((ext4_fsblk_t) nex.ee_start_hi << 32)
86 + + nex.ee_start + i);
88 /* correct on-disk inode size */