Whamcloud - gitweb
LU-3990 kernel: kernel update [SLES SP2 3.0.93-0.5]
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / sles11sp2 / ext4-store-tree-generation-at-find.patch
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
4 @@ -113,6 +113,7 @@
5   * Truncate uses it to simulate recursive walking.
6   */
7  struct ext4_ext_path {
8 +       unsigned long                   p_generation;
9         ext4_fsblk_t                    p_block;
10         __u16                           p_depth;
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
15 @@ -1882,7 +1882,7 @@
16  {
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);
29                 if (IS_ERR(path)) {
30 +                       up_read(&EXT4_I(inode)->i_data_sem);
31                         err = PTR_ERR(path);
32                         path = NULL;
33                         break;
34                 }
35
36 +               path[0].p_generation = EXT4_I(inode)->i_ext_generation;
37 +
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);
42                         err = -EIO;
43                         break;
44                 }
45 -               ex = path[depth].p_ext;
46 +               ex = NULL;
47 +               if (path[depth].p_ext) {
48 +                       _ex = *path[depth].p_ext;
49 +                       ex = &_ex;
50 +               }
51                 next = ext4_ext_next_allocated_block(path);
52 +               up_read(&EXT4_I(inode)->i_data_sem);
53
54                 exists = 0;
55                 if (!ex) {
56 @@ -1961,7 +1969,7 @@
57                         err = -EIO;
58                         break;
59                 }
60 -               err = func(inode, path, &cbex, ex, cbdata);
61 +               err = func(inode, path, &cbex, NULL, cbdata);
62                 ext4_ext_drop_refs(path);
63
64                 if (err < 0)