1 Index: linux-stage/fs/ext4/ext4_extents.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4_extents.h
4 +++ linux-stage/fs/ext4/ext4_extents.h
5 @@ -113,6 +113,7 @@ struct ext4_extent_header {
6 * Truncate uses it to simulate recursive walking.
9 + unsigned long p_generation;
12 struct ext4_extent *p_ext;
13 Index: linux-stage/fs/ext4/extents.c
14 ===================================================================
15 --- linux-stage.orig/fs/ext4/extents.c
16 +++ linux-stage/fs/ext4/extents.c
17 @@ -1855,7 +1855,7 @@ int ext4_ext_walk_space(struct inode *in
19 struct ext4_ext_path *path = NULL;
20 struct ext4_ext_cache cbex;
21 - struct ext4_extent *ex;
22 + struct ext4_extent _ex, *ex;
23 ext4_lblk_t next, start = 0, end = 0;
24 ext4_lblk_t last = block + num;
25 int depth, exists, err = 0;
26 @@ -1868,21 +1868,29 @@ int ext4_ext_walk_space(struct inode *in
27 /* find extent for this block */
28 down_read(&EXT4_I(inode)->i_data_sem);
29 path = ext4_ext_find_extent(inode, block, path);
30 - up_read(&EXT4_I(inode)->i_data_sem);
32 + up_read(&EXT4_I(inode)->i_data_sem);
38 + path[0].p_generation = EXT4_I(inode)->i_ext_generation;
40 depth = ext_depth(inode);
41 if (unlikely(path[depth].p_hdr == NULL)) {
42 + up_read(&EXT4_I(inode)->i_data_sem);
43 EXT4_ERROR_INODE(inode, "path[%d].p_hdr == NULL", depth);
47 - ex = path[depth].p_ext;
49 + if (path[depth].p_ext) {
50 + _ex = *path[depth].p_ext;
53 next = ext4_ext_next_allocated_block(path);
54 + up_read(&EXT4_I(inode)->i_data_sem);
58 @@ -1936,7 +1944,7 @@ int ext4_ext_walk_space(struct inode *in
62 - err = func(inode, path, &cbex, ex, cbdata);
63 + err = func(inode, path, &cbex, NULL, cbdata);
64 ext4_ext_drop_refs(path);