Whamcloud - gitweb
LU-4708 ldiskfs: do not copy NUL terminator from direntry
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / sles11sp2 / restore-path-in-walk_extent_callback.patch
1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: ext4: restore path parameter to ext_prepare_callback
3
4 This patch partially reverts commit c03f8aa9
5 (ext4: use FIEMAP_EXTENT_LAST flag for last extent in fiemap)
6
7 The bug that commit fixed is still eliminated but we restore the
8 struct ext4_ext_path *path parameter to the callback for Lustre.
9
10 next is calculated in ext4_ext_walk_space and can also be calculated in the
11 callback.
12
13 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
14 --
15
16  fs/ext4/ext4_extents.h |    2 +-
17  fs/ext4/extents.c      |    5 +++--
18  2 files changed, 4 insertions(+), 3 deletions(-)
19
20 --- a/fs/ext4/ext4_extents.h
21 +++ b/fs/ext4/ext4_extents.h
22 @@ -125,7 +125,7 @@ struct ext4_ext_path {
23   * positive retcode - signal for ext4_ext_walk_space(), see below
24   * callback must return valid extent (passed or newly created)
25   */
26 -typedef int (*ext_prepare_callback)(struct inode *, ext4_lblk_t,
27 +typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
28                                         struct ext4_ext_cache *,
29                                         struct ext4_extent *, void *);
30
31 --- a/fs/ext4/extents.c
32 +++ b/fs/ext4/extents.c
33 @@ -1964,7 +1964,7 @@ extern int ext4_ext_walk_space(struct in
34                         err = -EIO;
35                         break;
36                 }
37 -               err = func(inode, next, &cbex, ex, cbdata);
38 +               err = func(inode, path, &cbex, ex, cbdata);
39                 ext4_ext_drop_refs(path);
40
41                 if (err < 0)
42 @@ -3954,7 +3954,7 @@ int ext4_convert_unwritten_extents(struc
43  /*
44   * Callback function called for each extent to gather FIEMAP information.
45   */
46 -static int ext4_ext_fiemap_cb(struct inode *inode, ext4_lblk_t next,
47 +static int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path,
48                        struct ext4_ext_cache *newex, struct ext4_extent *ex,
49                        void *data)
50  {
51 @@ -3965,6 +3965,7 @@ static int ext4_ext_fiemap_cb(struct ino
52         int             ret = 0;
53         struct fiemap_extent_info *fieinfo = data;
54         unsigned char blksize_bits;
55 +       ext4_lblk_t next = ext4_ext_next_allocated_block(path);
56
57         blksize_bits = inode->i_sb->s_blocksize_bits;
58         logical = (__u64)newex->ec_block << blksize_bits;