1 diff -u -r linux-stage.orig/fs/ext4/ext4_extents.h linux-stage/fs/ext4/ext4_extents.h
2 --- linux-stage.orig/fs/ext4/ext4_extents.h 2013-01-02 10:14:02.000000000 -0500
3 +++ linux-stage/fs/ext4/ext4_extents.h 2013-01-02 10:14:14.000000000 -0500
5 * Truncate uses it to simulate recursive walking.
8 + unsigned long p_generation;
11 struct ext4_extent *p_ext;
12 diff -u -r linux-stage.orig/fs/ext4/extents.c linux-stage/fs/ext4/extents.c
13 --- linux-stage.orig/fs/ext4/extents.c 2013-01-02 10:14:02.000000000 -0500
14 +++ linux-stage/fs/ext4/extents.c 2013-01-02 10:16:57.000000000 -0500
17 struct ext4_ext_path *path = NULL;
18 struct ext4_ext_cache cbex;
19 - struct ext4_extent *ex;
20 + struct ext4_extent _ex, *ex;
21 ext4_lblk_t next, start = 0, end = 0;
22 ext4_lblk_t last = block + num;
23 int depth, exists, err = 0;
24 @@ -1895,21 +1895,29 @@
25 /* find extent for this block */
26 down_read(&EXT4_I(inode)->i_data_sem);
27 path = ext4_ext_find_extent(inode, block, path);
28 - up_read(&EXT4_I(inode)->i_data_sem);
30 + up_read(&EXT4_I(inode)->i_data_sem);
36 + path[0].p_generation = EXT4_I(inode)->i_ext_generation;
38 depth = ext_depth(inode);
39 if (unlikely(path[depth].p_hdr == NULL)) {
40 + up_read(&EXT4_I(inode)->i_data_sem);
41 EXT4_ERROR_INODE(inode, "path[%d].p_hdr == NULL", depth);
45 - ex = path[depth].p_ext;
47 + if (path[depth].p_ext) {
48 + _ex = *path[depth].p_ext;
51 next = ext4_ext_next_allocated_block(path);
52 + up_read(&EXT4_I(inode)->i_data_sem);
60 - err = func(inode, path, &cbex, ex, cbdata);
61 + err = func(inode, path, &cbex, NULL, cbdata);
62 ext4_ext_drop_refs(path);