From ccade8502d2bd396623bbc922e9ec6951581c9d0 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Mon, 9 Jan 2017 20:18:47 -0600 Subject: [PATCH] repair: use new extent lookup helpers in bmap_next_offset Signed-off-by: Eric Sandeen --- libxfs/libxfs_api_defs.h | 1 + repair/phase6.c | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index b7b104350..31239caad 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -67,6 +67,7 @@ #define xfs_alloc_read_agf libxfs_alloc_read_agf #define xfs_bmap_last_offset libxfs_bmap_last_offset #define xfs_bmap_search_extents libxfs_bmap_search_extents +#define xfs_iext_lookup_extent libxfs_iext_lookup_extent #define xfs_bmapi_write libxfs_bmapi_write #define xfs_bmapi_read libxfs_bmapi_read #define xfs_bunmapi libxfs_bunmapi diff --git a/repair/phase6.c b/repair/phase6.c index 399ecde36..3eb7cf1ee 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -434,12 +434,10 @@ bmap_next_offset( int whichfork) /* data or attr fork */ { xfs_fileoff_t bno; /* current block */ - int eof; /* hit end of file */ int error; /* error return value */ xfs_bmbt_irec_t got; /* current extent value */ xfs_ifork_t *ifp; /* inode fork pointer */ - xfs_extnum_t lastx; /* last extent used */ - xfs_bmbt_irec_t prev; /* previous extent value */ + xfs_extnum_t idx; /* last extent used */ if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && @@ -454,9 +452,7 @@ bmap_next_offset( (error = -libxfs_iread_extents(tp, ip, whichfork))) return error; bno = *bnop + 1; - libxfs_bmap_search_extents(ip, bno, whichfork, &eof, &lastx, - &got, &prev); - if (eof) + if (!libxfs_iext_lookup_extent(ip, ifp, bno, &idx, &got)) *bnop = NULLFILEOFF; else *bnop = got.br_startoff < bno ? bno : got.br_startoff; -- 2.47.3