mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-04 00:06:36 +00:00
xfs: return a failure address from xfs_rmap_irec_offset_unpack
Currently, xfs_rmap_irec_offset_unpack returns only 0 or -EFSCORRUPTED. Change this function to return the code address of a failed conversion in preparation for the next patch, which standardizes localized record checking and reporting code. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
2b30cc0bf0
commit
39ab26d59f
3 changed files with 14 additions and 15 deletions
|
@ -193,7 +193,7 @@ done:
|
|||
}
|
||||
|
||||
/* Convert an internal btree record to an rmap record. */
|
||||
int
|
||||
xfs_failaddr_t
|
||||
xfs_rmap_btrec_to_irec(
|
||||
const union xfs_btree_rec *rec,
|
||||
struct xfs_rmap_irec *irec)
|
||||
|
@ -2320,11 +2320,10 @@ xfs_rmap_query_range_helper(
|
|||
{
|
||||
struct xfs_rmap_query_range_info *query = priv;
|
||||
struct xfs_rmap_irec irec;
|
||||
int error;
|
||||
|
||||
error = xfs_rmap_btrec_to_irec(rec, &irec);
|
||||
if (error)
|
||||
return error;
|
||||
if (xfs_rmap_btrec_to_irec(rec, &irec) != NULL)
|
||||
return -EFSCORRUPTED;
|
||||
|
||||
return query->fn(cur, &irec, query->priv);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,13 +62,14 @@ xfs_rmap_irec_offset_pack(
|
|||
return x;
|
||||
}
|
||||
|
||||
static inline int
|
||||
static inline xfs_failaddr_t
|
||||
xfs_rmap_irec_offset_unpack(
|
||||
__u64 offset,
|
||||
struct xfs_rmap_irec *irec)
|
||||
{
|
||||
if (offset & ~(XFS_RMAP_OFF_MASK | XFS_RMAP_OFF_FLAGS))
|
||||
return -EFSCORRUPTED;
|
||||
return __this_address;
|
||||
|
||||
irec->rm_offset = XFS_RMAP_OFF(offset);
|
||||
irec->rm_flags = 0;
|
||||
if (offset & XFS_RMAP_OFF_ATTR_FORK)
|
||||
|
@ -77,7 +78,7 @@ xfs_rmap_irec_offset_unpack(
|
|||
irec->rm_flags |= XFS_RMAP_BMBT_BLOCK;
|
||||
if (offset & XFS_RMAP_OFF_UNWRITTEN)
|
||||
irec->rm_flags |= XFS_RMAP_UNWRITTEN;
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -192,7 +193,7 @@ int xfs_rmap_lookup_le_range(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
|||
int xfs_rmap_compare(const struct xfs_rmap_irec *a,
|
||||
const struct xfs_rmap_irec *b);
|
||||
union xfs_btree_rec;
|
||||
int xfs_rmap_btrec_to_irec(const union xfs_btree_rec *rec,
|
||||
xfs_failaddr_t xfs_rmap_btrec_to_irec(const union xfs_btree_rec *rec,
|
||||
struct xfs_rmap_irec *irec);
|
||||
int xfs_rmap_has_record(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
||||
xfs_extlen_t len, bool *exists);
|
||||
|
|
|
@ -100,11 +100,11 @@ xchk_rmapbt_rec(
|
|||
bool is_unwritten;
|
||||
bool is_bmbt;
|
||||
bool is_attr;
|
||||
int error;
|
||||
|
||||
error = xfs_rmap_btrec_to_irec(rec, &irec);
|
||||
if (!xchk_btree_process_error(bs->sc, bs->cur, 0, &error))
|
||||
goto out;
|
||||
if (xfs_rmap_btrec_to_irec(rec, &irec) != NULL) {
|
||||
xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check extent. */
|
||||
if (irec.rm_startblock + irec.rm_blockcount <= irec.rm_startblock)
|
||||
|
@ -159,8 +159,7 @@ xchk_rmapbt_rec(
|
|||
}
|
||||
|
||||
xchk_rmapbt_xref(bs->sc, &irec);
|
||||
out:
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Scrub the rmap btree for some AG. */
|
||||
|
|
Loading…
Add table
Reference in a new issue