提交 032d91f9 编写于 作者: D Darrick J. Wong

xfs: fix indentation and other whitespace problems in scrub/repair

Now that we've shortened everything, fix up all the indentation and
whitespace problems.  There are no functional changes.
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
上级 1d8a748a
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
STATIC void STATIC void
xchk_superblock_xref( xchk_superblock_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_agnumber_t agno = sc->sm->sm_agno; xfs_agnumber_t agno = sc->sm->sm_agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
int error; int error;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -68,14 +68,14 @@ int ...@@ -68,14 +68,14 @@ int
xchk_superblock( xchk_superblock(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_buf *bp; struct xfs_buf *bp;
struct xfs_dsb *sb; struct xfs_dsb *sb;
xfs_agnumber_t agno; xfs_agnumber_t agno;
uint32_t v2_ok; uint32_t v2_ok;
__be32 features_mask; __be32 features_mask;
int error; int error;
__be16 vernum_mask; __be16 vernum_mask;
agno = sc->sm->sm_agno; agno = sc->sm->sm_agno;
if (agno == 0) if (agno == 0)
...@@ -367,9 +367,9 @@ static inline void ...@@ -367,9 +367,9 @@ static inline void
xchk_agf_xref_freeblks( xchk_agf_xref_freeblks(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp);
xfs_extlen_t blocks = 0; xfs_extlen_t blocks = 0;
int error; int error;
if (!sc->sa.bno_cur) if (!sc->sa.bno_cur)
return; return;
...@@ -387,11 +387,11 @@ static inline void ...@@ -387,11 +387,11 @@ static inline void
xchk_agf_xref_cntbt( xchk_agf_xref_cntbt(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp);
xfs_agblock_t agbno; xfs_agblock_t agbno;
xfs_extlen_t blocks; xfs_extlen_t blocks;
int have; int have;
int error; int error;
if (!sc->sa.cnt_cur) if (!sc->sa.cnt_cur)
return; return;
...@@ -419,11 +419,11 @@ STATIC void ...@@ -419,11 +419,11 @@ STATIC void
xchk_agf_xref_btreeblks( xchk_agf_xref_btreeblks(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp);
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_agblock_t blocks; xfs_agblock_t blocks;
xfs_agblock_t btreeblks; xfs_agblock_t btreeblks;
int error; int error;
/* Check agf_rmap_blocks; set up for agf_btreeblks check */ /* Check agf_rmap_blocks; set up for agf_btreeblks check */
if (sc->sa.rmap_cur) { if (sc->sa.rmap_cur) {
...@@ -465,9 +465,9 @@ static inline void ...@@ -465,9 +465,9 @@ static inline void
xchk_agf_xref_refcblks( xchk_agf_xref_refcblks(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp);
xfs_agblock_t blocks; xfs_agblock_t blocks;
int error; int error;
if (!sc->sa.refc_cur) if (!sc->sa.refc_cur)
return; return;
...@@ -484,10 +484,10 @@ STATIC void ...@@ -484,10 +484,10 @@ STATIC void
xchk_agf_xref( xchk_agf_xref(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_agblock_t agbno; xfs_agblock_t agbno;
int error; int error;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -516,17 +516,17 @@ int ...@@ -516,17 +516,17 @@ int
xchk_agf( xchk_agf(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_agf *agf; struct xfs_agf *agf;
xfs_agnumber_t agno; xfs_agnumber_t agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
xfs_agblock_t eoag; xfs_agblock_t eoag;
xfs_agblock_t agfl_first; xfs_agblock_t agfl_first;
xfs_agblock_t agfl_last; xfs_agblock_t agfl_last;
xfs_agblock_t agfl_count; xfs_agblock_t agfl_count;
xfs_agblock_t fl_count; xfs_agblock_t fl_count;
int level; int level;
int error = 0; int error = 0;
agno = sc->sa.agno = sc->sm->sm_agno; agno = sc->sa.agno = sc->sm->sm_agno;
error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp, error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp,
...@@ -598,10 +598,10 @@ xchk_agf( ...@@ -598,10 +598,10 @@ xchk_agf(
/* AGFL */ /* AGFL */
struct xchk_agfl_info { struct xchk_agfl_info {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
unsigned int sz_entries; unsigned int sz_entries;
unsigned int nr_entries; unsigned int nr_entries;
xfs_agblock_t *entries; xfs_agblock_t *entries;
struct xfs_scrub *sc; struct xfs_scrub *sc;
}; };
...@@ -609,8 +609,8 @@ struct xchk_agfl_info { ...@@ -609,8 +609,8 @@ struct xchk_agfl_info {
STATIC void STATIC void
xchk_agfl_block_xref( xchk_agfl_block_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
struct xfs_owner_info *oinfo) struct xfs_owner_info *oinfo)
{ {
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -624,13 +624,13 @@ xchk_agfl_block_xref( ...@@ -624,13 +624,13 @@ xchk_agfl_block_xref(
/* Scrub an AGFL block. */ /* Scrub an AGFL block. */
STATIC int STATIC int
xchk_agfl_block( xchk_agfl_block(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_agblock_t agbno, xfs_agblock_t agbno,
void *priv) void *priv)
{ {
struct xchk_agfl_info *sai = priv; struct xchk_agfl_info *sai = priv;
struct xfs_scrub *sc = sai->sc; struct xfs_scrub *sc = sai->sc;
xfs_agnumber_t agno = sc->sa.agno; xfs_agnumber_t agno = sc->sa.agno;
if (xfs_verify_agbno(mp, agno, agbno) && if (xfs_verify_agbno(mp, agno, agbno) &&
sai->nr_entries < sai->sz_entries) sai->nr_entries < sai->sz_entries)
...@@ -662,10 +662,10 @@ STATIC void ...@@ -662,10 +662,10 @@ STATIC void
xchk_agfl_xref( xchk_agfl_xref(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_agblock_t agbno; xfs_agblock_t agbno;
int error; int error;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -693,12 +693,12 @@ int ...@@ -693,12 +693,12 @@ int
xchk_agfl( xchk_agfl(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xchk_agfl_info sai; struct xchk_agfl_info sai;
struct xfs_agf *agf; struct xfs_agf *agf;
xfs_agnumber_t agno; xfs_agnumber_t agno;
unsigned int agflcount; unsigned int agflcount;
unsigned int i; unsigned int i;
int error; int error;
agno = sc->sa.agno = sc->sm->sm_agno; agno = sc->sa.agno = sc->sm->sm_agno;
error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp, error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp,
...@@ -770,10 +770,10 @@ static inline void ...@@ -770,10 +770,10 @@ static inline void
xchk_agi_xref_icounts( xchk_agi_xref_icounts(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_agi *agi = XFS_BUF_TO_AGI(sc->sa.agi_bp); struct xfs_agi *agi = XFS_BUF_TO_AGI(sc->sa.agi_bp);
xfs_agino_t icount; xfs_agino_t icount;
xfs_agino_t freecount; xfs_agino_t freecount;
int error; int error;
if (!sc->sa.ino_cur) if (!sc->sa.ino_cur)
return; return;
...@@ -791,10 +791,10 @@ STATIC void ...@@ -791,10 +791,10 @@ STATIC void
xchk_agi_xref( xchk_agi_xref(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_agblock_t agbno; xfs_agblock_t agbno;
int error; int error;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -820,18 +820,18 @@ int ...@@ -820,18 +820,18 @@ int
xchk_agi( xchk_agi(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_agi *agi; struct xfs_agi *agi;
xfs_agnumber_t agno; xfs_agnumber_t agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
xfs_agblock_t eoag; xfs_agblock_t eoag;
xfs_agino_t agino; xfs_agino_t agino;
xfs_agino_t first_agino; xfs_agino_t first_agino;
xfs_agino_t last_agino; xfs_agino_t last_agino;
xfs_agino_t icount; xfs_agino_t icount;
int i; int i;
int level; int level;
int error = 0; int error = 0;
agno = sc->sa.agno = sc->sm->sm_agno; agno = sc->sa.agno = sc->sm->sm_agno;
error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp, error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp,
......
...@@ -31,10 +31,10 @@ int ...@@ -31,10 +31,10 @@ int
xrep_superblock( xrep_superblock(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_buf *bp; struct xfs_buf *bp;
xfs_agnumber_t agno; xfs_agnumber_t agno;
int error; int error;
/* Don't try to repair AG 0's sb; let xfs_repair deal with it. */ /* Don't try to repair AG 0's sb; let xfs_repair deal with it. */
agno = sc->sm->sm_agno; agno = sc->sm->sm_agno;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
int int
xchk_setup_ag_allocbt( xchk_setup_ag_allocbt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
return xchk_setup_ag_btree(sc, ip, false); return xchk_setup_ag_btree(sc, ip, false);
} }
...@@ -43,14 +43,14 @@ xchk_setup_ag_allocbt( ...@@ -43,14 +43,14 @@ xchk_setup_ag_allocbt(
STATIC void STATIC void
xchk_allocbt_xref_other( xchk_allocbt_xref_other(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
struct xfs_btree_cur **pcur; struct xfs_btree_cur **pcur;
xfs_agblock_t fbno; xfs_agblock_t fbno;
xfs_extlen_t flen; xfs_extlen_t flen;
int has_otherrec; int has_otherrec;
int error; int error;
if (sc->sm->sm_type == XFS_SCRUB_TYPE_BNOBT) if (sc->sm->sm_type == XFS_SCRUB_TYPE_BNOBT)
pcur = &sc->sa.cnt_cur; pcur = &sc->sa.cnt_cur;
...@@ -83,8 +83,8 @@ xchk_allocbt_xref_other( ...@@ -83,8 +83,8 @@ xchk_allocbt_xref_other(
STATIC void STATIC void
xchk_allocbt_xref( xchk_allocbt_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -98,14 +98,14 @@ xchk_allocbt_xref( ...@@ -98,14 +98,14 @@ xchk_allocbt_xref(
/* Scrub a bnobt/cntbt record. */ /* Scrub a bnobt/cntbt record. */
STATIC int STATIC int
xchk_allocbt_rec( xchk_allocbt_rec(
struct xchk_btree *bs, struct xchk_btree *bs,
union xfs_btree_rec *rec) union xfs_btree_rec *rec)
{ {
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
xfs_agnumber_t agno = bs->cur->bc_private.a.agno; xfs_agnumber_t agno = bs->cur->bc_private.a.agno;
xfs_agblock_t bno; xfs_agblock_t bno;
xfs_extlen_t len; xfs_extlen_t len;
int error = 0; int error = 0;
bno = be32_to_cpu(rec->alloc.ar_startblock); bno = be32_to_cpu(rec->alloc.ar_startblock);
len = be32_to_cpu(rec->alloc.ar_blockcount); len = be32_to_cpu(rec->alloc.ar_blockcount);
...@@ -124,10 +124,10 @@ xchk_allocbt_rec( ...@@ -124,10 +124,10 @@ xchk_allocbt_rec(
STATIC int STATIC int
xchk_allocbt( xchk_allocbt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_btnum_t which) xfs_btnum_t which)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG); xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG);
cur = which == XFS_BTNUM_BNO ? sc->sa.bno_cur : sc->sa.cnt_cur; cur = which == XFS_BTNUM_BNO ? sc->sa.bno_cur : sc->sa.cnt_cur;
...@@ -152,11 +152,11 @@ xchk_cntbt( ...@@ -152,11 +152,11 @@ xchk_cntbt(
void void
xchk_xref_is_used_space( xchk_xref_is_used_space(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
bool is_freesp; bool is_freesp;
int error; int error;
if (!sc->sa.bno_cur || xchk_skip_xref(sc->sm)) if (!sc->sa.bno_cur || xchk_skip_xref(sc->sm))
return; return;
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
int int
xchk_setup_xattr( xchk_setup_xattr(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
size_t sz; size_t sz;
/* /*
* Allocate the buffer without the inode lock held. We need enough * Allocate the buffer without the inode lock held. We need enough
...@@ -57,7 +57,7 @@ xchk_setup_xattr( ...@@ -57,7 +57,7 @@ xchk_setup_xattr(
struct xchk_xattr { struct xchk_xattr {
struct xfs_attr_list_context context; struct xfs_attr_list_context context;
struct xfs_scrub *sc; struct xfs_scrub *sc;
}; };
/* /*
...@@ -128,12 +128,12 @@ xchk_xattr_listent( ...@@ -128,12 +128,12 @@ xchk_xattr_listent(
STATIC bool STATIC bool
xchk_xattr_set_map( xchk_xattr_set_map(
struct xfs_scrub *sc, struct xfs_scrub *sc,
unsigned long *map, unsigned long *map,
unsigned int start, unsigned int start,
unsigned int len) unsigned int len)
{ {
unsigned int mapsize = sc->mp->m_attr_geo->blksize; unsigned int mapsize = sc->mp->m_attr_geo->blksize;
bool ret = true; bool ret = true;
if (start >= mapsize) if (start >= mapsize)
return false; return false;
...@@ -155,7 +155,7 @@ xchk_xattr_set_map( ...@@ -155,7 +155,7 @@ xchk_xattr_set_map(
*/ */
STATIC bool STATIC bool
xchk_xattr_check_freemap( xchk_xattr_check_freemap(
struct xfs_scrub *sc, struct xfs_scrub *sc,
unsigned long *map, unsigned long *map,
struct xfs_attr3_icleaf_hdr *leafhdr) struct xfs_attr3_icleaf_hdr *leafhdr)
{ {
...@@ -405,7 +405,7 @@ xchk_xattr_rec( ...@@ -405,7 +405,7 @@ xchk_xattr_rec(
/* Scrub the extended attribute metadata. */ /* Scrub the extended attribute metadata. */
int int
xchk_xattr( xchk_xattr(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xchk_xattr sx; struct xchk_xattr sx;
struct attrlist_cursor_kern cursor = { 0 }; struct attrlist_cursor_kern cursor = { 0 };
......
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
int int
xchk_setup_inode_bmap( xchk_setup_inode_bmap(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
int error; int error;
error = xchk_get_inode(sc, ip); error = xchk_get_inode(sc, ip);
if (error) if (error)
...@@ -80,25 +80,25 @@ xchk_setup_inode_bmap( ...@@ -80,25 +80,25 @@ xchk_setup_inode_bmap(
struct xchk_bmap_info { struct xchk_bmap_info {
struct xfs_scrub *sc; struct xfs_scrub *sc;
xfs_fileoff_t lastoff; xfs_fileoff_t lastoff;
bool is_rt; bool is_rt;
bool is_shared; bool is_shared;
int whichfork; int whichfork;
}; };
/* Look for a corresponding rmap for this irec. */ /* Look for a corresponding rmap for this irec. */
static inline bool static inline bool
xchk_bmap_get_rmap( xchk_bmap_get_rmap(
struct xchk_bmap_info *info, struct xchk_bmap_info *info,
struct xfs_bmbt_irec *irec, struct xfs_bmbt_irec *irec,
xfs_agblock_t agbno, xfs_agblock_t agbno,
uint64_t owner, uint64_t owner,
struct xfs_rmap_irec *rmap) struct xfs_rmap_irec *rmap)
{ {
xfs_fileoff_t offset; xfs_fileoff_t offset;
unsigned int rflags = 0; unsigned int rflags = 0;
int has_rmap; int has_rmap;
int error; int error;
if (info->whichfork == XFS_ATTR_FORK) if (info->whichfork == XFS_ATTR_FORK)
rflags |= XFS_RMAP_ATTR_FORK; rflags |= XFS_RMAP_ATTR_FORK;
...@@ -152,13 +152,13 @@ xchk_bmap_get_rmap( ...@@ -152,13 +152,13 @@ xchk_bmap_get_rmap(
/* Make sure that we have rmapbt records for this extent. */ /* Make sure that we have rmapbt records for this extent. */
STATIC void STATIC void
xchk_bmap_xref_rmap( xchk_bmap_xref_rmap(
struct xchk_bmap_info *info, struct xchk_bmap_info *info,
struct xfs_bmbt_irec *irec, struct xfs_bmbt_irec *irec,
xfs_agblock_t agbno) xfs_agblock_t agbno)
{ {
struct xfs_rmap_irec rmap; struct xfs_rmap_irec rmap;
unsigned long long rmap_end; unsigned long long rmap_end;
uint64_t owner; uint64_t owner;
if (!info->sc->sa.rmap_cur || xchk_skip_xref(info->sc->sm)) if (!info->sc->sa.rmap_cur || xchk_skip_xref(info->sc->sm))
return; return;
...@@ -222,10 +222,10 @@ xchk_bmap_xref_rmap( ...@@ -222,10 +222,10 @@ xchk_bmap_xref_rmap(
/* Cross-reference a single rtdev extent record. */ /* Cross-reference a single rtdev extent record. */
STATIC void STATIC void
xchk_bmap_rt_extent_xref( xchk_bmap_rt_extent_xref(
struct xchk_bmap_info *info, struct xchk_bmap_info *info,
struct xfs_inode *ip, struct xfs_inode *ip,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
struct xfs_bmbt_irec *irec) struct xfs_bmbt_irec *irec)
{ {
if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -237,16 +237,16 @@ xchk_bmap_rt_extent_xref( ...@@ -237,16 +237,16 @@ xchk_bmap_rt_extent_xref(
/* Cross-reference a single datadev extent record. */ /* Cross-reference a single datadev extent record. */
STATIC void STATIC void
xchk_bmap_extent_xref( xchk_bmap_extent_xref(
struct xchk_bmap_info *info, struct xchk_bmap_info *info,
struct xfs_inode *ip, struct xfs_inode *ip,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
struct xfs_bmbt_irec *irec) struct xfs_bmbt_irec *irec)
{ {
struct xfs_mount *mp = info->sc->mp; struct xfs_mount *mp = info->sc->mp;
xfs_agnumber_t agno; xfs_agnumber_t agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
xfs_extlen_t len; xfs_extlen_t len;
int error; int error;
if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -284,15 +284,15 @@ xchk_bmap_extent_xref( ...@@ -284,15 +284,15 @@ xchk_bmap_extent_xref(
/* Scrub a single extent record. */ /* Scrub a single extent record. */
STATIC int STATIC int
xchk_bmap_extent( xchk_bmap_extent(
struct xfs_inode *ip, struct xfs_inode *ip,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
struct xchk_bmap_info *info, struct xchk_bmap_info *info,
struct xfs_bmbt_irec *irec) struct xfs_bmbt_irec *irec)
{ {
struct xfs_mount *mp = info->sc->mp; struct xfs_mount *mp = info->sc->mp;
struct xfs_buf *bp = NULL; struct xfs_buf *bp = NULL;
xfs_filblks_t end; xfs_filblks_t end;
int error = 0; int error = 0;
if (cur) if (cur)
xfs_btree_get_block(cur, 0, &bp); xfs_btree_get_block(cur, 0, &bp);
...@@ -357,16 +357,16 @@ xchk_bmap_extent( ...@@ -357,16 +357,16 @@ xchk_bmap_extent(
/* Scrub a bmbt record. */ /* Scrub a bmbt record. */
STATIC int STATIC int
xchk_bmapbt_rec( xchk_bmapbt_rec(
struct xchk_btree *bs, struct xchk_btree *bs,
union xfs_btree_rec *rec) union xfs_btree_rec *rec)
{ {
struct xfs_bmbt_irec irec; struct xfs_bmbt_irec irec;
struct xchk_bmap_info *info = bs->private; struct xchk_bmap_info *info = bs->private;
struct xfs_inode *ip = bs->cur->bc_private.b.ip; struct xfs_inode *ip = bs->cur->bc_private.b.ip;
struct xfs_buf *bp = NULL; struct xfs_buf *bp = NULL;
struct xfs_btree_block *block; struct xfs_btree_block *block;
uint64_t owner; uint64_t owner;
int i; int i;
/* /*
* Check the owners of the btree blocks up to the level below * Check the owners of the btree blocks up to the level below
...@@ -392,14 +392,14 @@ xchk_bmapbt_rec( ...@@ -392,14 +392,14 @@ xchk_bmapbt_rec(
STATIC int STATIC int
xchk_bmap_btree( xchk_bmap_btree(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
struct xchk_bmap_info *info) struct xchk_bmap_info *info)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_inode *ip = sc->ip; struct xfs_inode *ip = sc->ip;
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
int error; int error;
cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork); cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork);
xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork); xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork);
...@@ -410,8 +410,8 @@ xchk_bmap_btree( ...@@ -410,8 +410,8 @@ xchk_bmap_btree(
struct xchk_bmap_check_rmap_info { struct xchk_bmap_check_rmap_info {
struct xfs_scrub *sc; struct xfs_scrub *sc;
int whichfork; int whichfork;
struct xfs_iext_cursor icur; struct xfs_iext_cursor icur;
}; };
/* Can we find bmaps that fit this rmap? */ /* Can we find bmaps that fit this rmap? */
...@@ -424,7 +424,7 @@ xchk_bmap_check_rmap( ...@@ -424,7 +424,7 @@ xchk_bmap_check_rmap(
struct xfs_bmbt_irec irec; struct xfs_bmbt_irec irec;
struct xchk_bmap_check_rmap_info *sbcri = priv; struct xchk_bmap_check_rmap_info *sbcri = priv;
struct xfs_ifork *ifp; struct xfs_ifork *ifp;
struct xfs_scrub *sc = sbcri->sc; struct xfs_scrub *sc = sbcri->sc;
bool have_map; bool have_map;
/* Is this even the right fork? */ /* Is this even the right fork? */
...@@ -488,7 +488,7 @@ xchk_bmap_check_rmap( ...@@ -488,7 +488,7 @@ xchk_bmap_check_rmap(
/* Make sure each rmap has a corresponding bmbt entry. */ /* Make sure each rmap has a corresponding bmbt entry. */
STATIC int STATIC int
xchk_bmap_check_ag_rmaps( xchk_bmap_check_ag_rmaps(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xfs_agnumber_t agno) xfs_agnumber_t agno)
{ {
...@@ -523,11 +523,11 @@ xchk_bmap_check_ag_rmaps( ...@@ -523,11 +523,11 @@ xchk_bmap_check_ag_rmaps(
STATIC int STATIC int
xchk_bmap_check_rmaps( xchk_bmap_check_rmaps(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork) int whichfork)
{ {
loff_t size; loff_t size;
xfs_agnumber_t agno; xfs_agnumber_t agno;
int error; int error;
if (!xfs_sb_version_hasrmapbt(&sc->mp->m_sb) || if (!xfs_sb_version_hasrmapbt(&sc->mp->m_sb) ||
whichfork == XFS_COW_FORK || whichfork == XFS_COW_FORK ||
...@@ -580,16 +580,16 @@ xchk_bmap_check_rmaps( ...@@ -580,16 +580,16 @@ xchk_bmap_check_rmaps(
STATIC int STATIC int
xchk_bmap( xchk_bmap(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork) int whichfork)
{ {
struct xfs_bmbt_irec irec; struct xfs_bmbt_irec irec;
struct xchk_bmap_info info = { NULL }; struct xchk_bmap_info info = { NULL };
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_inode *ip = sc->ip; struct xfs_inode *ip = sc->ip;
struct xfs_ifork *ifp; struct xfs_ifork *ifp;
xfs_fileoff_t endoff; xfs_fileoff_t endoff;
struct xfs_iext_cursor icur; struct xfs_iext_cursor icur;
int error = 0; int error = 0;
ifp = XFS_IFORK_PTR(ip, whichfork); ifp = XFS_IFORK_PTR(ip, whichfork);
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
static bool static bool
__xchk_btree_process_error( __xchk_btree_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
int level, int level,
int *error, int *error,
__u32 errflag, __u32 errflag,
void *ret_ip) void *ret_ip)
{ {
if (*error == 0) if (*error == 0)
return true; return true;
...@@ -66,9 +66,9 @@ __xchk_btree_process_error( ...@@ -66,9 +66,9 @@ __xchk_btree_process_error(
bool bool
xchk_btree_process_error( xchk_btree_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
int level, int level,
int *error) int *error)
{ {
return __xchk_btree_process_error(sc, cur, level, error, return __xchk_btree_process_error(sc, cur, level, error,
XFS_SCRUB_OFLAG_CORRUPT, __return_address); XFS_SCRUB_OFLAG_CORRUPT, __return_address);
...@@ -77,9 +77,9 @@ xchk_btree_process_error( ...@@ -77,9 +77,9 @@ xchk_btree_process_error(
bool bool
xchk_btree_xref_process_error( xchk_btree_xref_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
int level, int level,
int *error) int *error)
{ {
return __xchk_btree_process_error(sc, cur, level, error, return __xchk_btree_process_error(sc, cur, level, error,
XFS_SCRUB_OFLAG_XFAIL, __return_address); XFS_SCRUB_OFLAG_XFAIL, __return_address);
...@@ -89,10 +89,10 @@ xchk_btree_xref_process_error( ...@@ -89,10 +89,10 @@ xchk_btree_xref_process_error(
static void static void
__xchk_btree_set_corrupt( __xchk_btree_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
int level, int level,
__u32 errflag, __u32 errflag,
void *ret_ip) void *ret_ip)
{ {
sc->sm->sm_flags |= errflag; sc->sm->sm_flags |= errflag;
...@@ -107,8 +107,8 @@ __xchk_btree_set_corrupt( ...@@ -107,8 +107,8 @@ __xchk_btree_set_corrupt(
void void
xchk_btree_set_corrupt( xchk_btree_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
int level) int level)
{ {
__xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_CORRUPT, __xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_CORRUPT,
__return_address); __return_address);
...@@ -117,8 +117,8 @@ xchk_btree_set_corrupt( ...@@ -117,8 +117,8 @@ xchk_btree_set_corrupt(
void void
xchk_btree_xref_set_corrupt( xchk_btree_xref_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
int level) int level)
{ {
__xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_XCORRUPT, __xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_XCORRUPT,
__return_address); __return_address);
...@@ -225,11 +225,11 @@ xchk_btree_key( ...@@ -225,11 +225,11 @@ xchk_btree_key(
*/ */
static bool static bool
xchk_btree_ptr_ok( xchk_btree_ptr_ok(
struct xchk_btree *bs, struct xchk_btree *bs,
int level, int level,
union xfs_btree_ptr *ptr) union xfs_btree_ptr *ptr)
{ {
bool res; bool res;
/* A btree rooted in an inode has no block pointer to the root. */ /* A btree rooted in an inode has no block pointer to the root. */
if ((bs->cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && if ((bs->cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
...@@ -250,18 +250,18 @@ xchk_btree_ptr_ok( ...@@ -250,18 +250,18 @@ xchk_btree_ptr_ok(
/* Check that a btree block's sibling matches what we expect it. */ /* Check that a btree block's sibling matches what we expect it. */
STATIC int STATIC int
xchk_btree_block_check_sibling( xchk_btree_block_check_sibling(
struct xchk_btree *bs, struct xchk_btree *bs,
int level, int level,
int direction, int direction,
union xfs_btree_ptr *sibling) union xfs_btree_ptr *sibling)
{ {
struct xfs_btree_cur *cur = bs->cur; struct xfs_btree_cur *cur = bs->cur;
struct xfs_btree_block *pblock; struct xfs_btree_block *pblock;
struct xfs_buf *pbp; struct xfs_buf *pbp;
struct xfs_btree_cur *ncur = NULL; struct xfs_btree_cur *ncur = NULL;
union xfs_btree_ptr *pp; union xfs_btree_ptr *pp;
int success; int success;
int error; int error;
error = xfs_btree_dup_cursor(cur, &ncur); error = xfs_btree_dup_cursor(cur, &ncur);
if (!xchk_btree_process_error(bs->sc, cur, level + 1, &error) || if (!xchk_btree_process_error(bs->sc, cur, level + 1, &error) ||
...@@ -313,14 +313,14 @@ xchk_btree_block_check_sibling( ...@@ -313,14 +313,14 @@ xchk_btree_block_check_sibling(
/* Check the siblings of a btree block. */ /* Check the siblings of a btree block. */
STATIC int STATIC int
xchk_btree_block_check_siblings( xchk_btree_block_check_siblings(
struct xchk_btree *bs, struct xchk_btree *bs,
struct xfs_btree_block *block) struct xfs_btree_block *block)
{ {
struct xfs_btree_cur *cur = bs->cur; struct xfs_btree_cur *cur = bs->cur;
union xfs_btree_ptr leftsib; union xfs_btree_ptr leftsib;
union xfs_btree_ptr rightsib; union xfs_btree_ptr rightsib;
int level; int level;
int error = 0; int error = 0;
xfs_btree_get_sibling(cur, block, &leftsib, XFS_BB_LEFTSIB); xfs_btree_get_sibling(cur, block, &leftsib, XFS_BB_LEFTSIB);
xfs_btree_get_sibling(cur, block, &rightsib, XFS_BB_RIGHTSIB); xfs_btree_get_sibling(cur, block, &rightsib, XFS_BB_RIGHTSIB);
...@@ -361,15 +361,15 @@ struct check_owner { ...@@ -361,15 +361,15 @@ struct check_owner {
*/ */
STATIC int STATIC int
xchk_btree_check_block_owner( xchk_btree_check_block_owner(
struct xchk_btree *bs, struct xchk_btree *bs,
int level, int level,
xfs_daddr_t daddr) xfs_daddr_t daddr)
{ {
xfs_agnumber_t agno; xfs_agnumber_t agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
xfs_btnum_t btnum; xfs_btnum_t btnum;
bool init_sa; bool init_sa;
int error = 0; int error = 0;
if (!bs->cur) if (!bs->cur)
return 0; return 0;
...@@ -408,12 +408,12 @@ xchk_btree_check_block_owner( ...@@ -408,12 +408,12 @@ xchk_btree_check_block_owner(
/* Check the owner of a btree block. */ /* Check the owner of a btree block. */
STATIC int STATIC int
xchk_btree_check_owner( xchk_btree_check_owner(
struct xchk_btree *bs, struct xchk_btree *bs,
int level, int level,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
struct xfs_btree_cur *cur = bs->cur; struct xfs_btree_cur *cur = bs->cur;
struct check_owner *co; struct check_owner *co;
if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && bp == NULL) if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && bp == NULL)
return 0; return 0;
...@@ -484,14 +484,14 @@ xchk_btree_check_minrecs( ...@@ -484,14 +484,14 @@ xchk_btree_check_minrecs(
*/ */
STATIC int STATIC int
xchk_btree_get_block( xchk_btree_get_block(
struct xchk_btree *bs, struct xchk_btree *bs,
int level, int level,
union xfs_btree_ptr *pp, union xfs_btree_ptr *pp,
struct xfs_btree_block **pblock, struct xfs_btree_block **pblock,
struct xfs_buf **pbp) struct xfs_buf **pbp)
{ {
void *failed_at; xfs_failaddr_t failed_at;
int error; int error;
*pblock = NULL; *pblock = NULL;
*pbp = NULL; *pbp = NULL;
...@@ -538,17 +538,17 @@ xchk_btree_get_block( ...@@ -538,17 +538,17 @@ xchk_btree_get_block(
*/ */
STATIC void STATIC void
xchk_btree_block_keys( xchk_btree_block_keys(
struct xchk_btree *bs, struct xchk_btree *bs,
int level, int level,
struct xfs_btree_block *block) struct xfs_btree_block *block)
{ {
union xfs_btree_key block_keys; union xfs_btree_key block_keys;
struct xfs_btree_cur *cur = bs->cur; struct xfs_btree_cur *cur = bs->cur;
union xfs_btree_key *high_bk; union xfs_btree_key *high_bk;
union xfs_btree_key *parent_keys; union xfs_btree_key *parent_keys;
union xfs_btree_key *high_pk; union xfs_btree_key *high_pk;
struct xfs_btree_block *parent_block; struct xfs_btree_block *parent_block;
struct xfs_buf *bp; struct xfs_buf *bp;
if (level >= cur->bc_nlevels - 1) if (level >= cur->bc_nlevels - 1)
return; return;
...@@ -584,22 +584,22 @@ xchk_btree_block_keys( ...@@ -584,22 +584,22 @@ xchk_btree_block_keys(
int int
xchk_btree( xchk_btree(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
xchk_btree_rec_fn scrub_fn, xchk_btree_rec_fn scrub_fn,
struct xfs_owner_info *oinfo, struct xfs_owner_info *oinfo,
void *private) void *private)
{ {
struct xchk_btree bs = { NULL }; struct xchk_btree bs = { NULL };
union xfs_btree_ptr ptr; union xfs_btree_ptr ptr;
union xfs_btree_ptr *pp; union xfs_btree_ptr *pp;
union xfs_btree_rec *recp; union xfs_btree_rec *recp;
struct xfs_btree_block *block; struct xfs_btree_block *block;
int level; int level;
struct xfs_buf *bp; struct xfs_buf *bp;
struct check_owner *co; struct check_owner *co;
struct check_owner *n; struct check_owner *n;
int i; int i;
int error = 0; int error = 0;
/* Initialize scrub state */ /* Initialize scrub state */
bs.cur = cur; bs.cur = cur;
......
...@@ -14,8 +14,7 @@ bool xchk_btree_process_error(struct xfs_scrub *sc, ...@@ -14,8 +14,7 @@ bool xchk_btree_process_error(struct xfs_scrub *sc,
/* Check for btree xref operation errors. */ /* Check for btree xref operation errors. */
bool xchk_btree_xref_process_error(struct xfs_scrub *sc, bool xchk_btree_xref_process_error(struct xfs_scrub *sc,
struct xfs_btree_cur *cur, int level, struct xfs_btree_cur *cur, int level, int *error);
int *error);
/* Check for btree corruption. */ /* Check for btree corruption. */
void xchk_btree_set_corrupt(struct xfs_scrub *sc, void xchk_btree_set_corrupt(struct xfs_scrub *sc,
...@@ -33,20 +32,20 @@ typedef int (*xchk_btree_rec_fn)( ...@@ -33,20 +32,20 @@ typedef int (*xchk_btree_rec_fn)(
struct xchk_btree { struct xchk_btree {
/* caller-provided scrub state */ /* caller-provided scrub state */
struct xfs_scrub *sc; struct xfs_scrub *sc;
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
xchk_btree_rec_fn scrub_rec; xchk_btree_rec_fn scrub_rec;
struct xfs_owner_info *oinfo; struct xfs_owner_info *oinfo;
void *private; void *private;
/* internal scrub state */ /* internal scrub state */
union xfs_btree_rec lastrec; union xfs_btree_rec lastrec;
bool firstrec; bool firstrec;
union xfs_btree_key lastkey[XFS_BTREE_MAXLEVELS]; union xfs_btree_key lastkey[XFS_BTREE_MAXLEVELS];
bool firstkey[XFS_BTREE_MAXLEVELS]; bool firstkey[XFS_BTREE_MAXLEVELS];
struct list_head to_check; struct list_head to_check;
}; };
int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur, int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
xchk_btree_rec_fn scrub_fn, xchk_btree_rec_fn scrub_fn, struct xfs_owner_info *oinfo,
struct xfs_owner_info *oinfo, void *private); void *private);
#endif /* __XFS_SCRUB_BTREE_H__ */ #endif /* __XFS_SCRUB_BTREE_H__ */
...@@ -70,11 +70,11 @@ ...@@ -70,11 +70,11 @@
static bool static bool
__xchk_process_error( __xchk_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agnumber_t agno, xfs_agnumber_t agno,
xfs_agblock_t bno, xfs_agblock_t bno,
int *error, int *error,
__u32 errflag, __u32 errflag,
void *ret_ip) void *ret_ip)
{ {
switch (*error) { switch (*error) {
case 0: case 0:
...@@ -100,9 +100,9 @@ __xchk_process_error( ...@@ -100,9 +100,9 @@ __xchk_process_error(
bool bool
xchk_process_error( xchk_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agnumber_t agno, xfs_agnumber_t agno,
xfs_agblock_t bno, xfs_agblock_t bno,
int *error) int *error)
{ {
return __xchk_process_error(sc, agno, bno, error, return __xchk_process_error(sc, agno, bno, error,
XFS_SCRUB_OFLAG_CORRUPT, __return_address); XFS_SCRUB_OFLAG_CORRUPT, __return_address);
...@@ -111,9 +111,9 @@ xchk_process_error( ...@@ -111,9 +111,9 @@ xchk_process_error(
bool bool
xchk_xref_process_error( xchk_xref_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agnumber_t agno, xfs_agnumber_t agno,
xfs_agblock_t bno, xfs_agblock_t bno,
int *error) int *error)
{ {
return __xchk_process_error(sc, agno, bno, error, return __xchk_process_error(sc, agno, bno, error,
XFS_SCRUB_OFLAG_XFAIL, __return_address); XFS_SCRUB_OFLAG_XFAIL, __return_address);
...@@ -123,11 +123,11 @@ xchk_xref_process_error( ...@@ -123,11 +123,11 @@ xchk_xref_process_error(
static bool static bool
__xchk_fblock_process_error( __xchk_fblock_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xfs_fileoff_t offset, xfs_fileoff_t offset,
int *error, int *error,
__u32 errflag, __u32 errflag,
void *ret_ip) void *ret_ip)
{ {
switch (*error) { switch (*error) {
case 0: case 0:
...@@ -153,9 +153,9 @@ __xchk_fblock_process_error( ...@@ -153,9 +153,9 @@ __xchk_fblock_process_error(
bool bool
xchk_fblock_process_error( xchk_fblock_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xfs_fileoff_t offset, xfs_fileoff_t offset,
int *error) int *error)
{ {
return __xchk_fblock_process_error(sc, whichfork, offset, error, return __xchk_fblock_process_error(sc, whichfork, offset, error,
XFS_SCRUB_OFLAG_CORRUPT, __return_address); XFS_SCRUB_OFLAG_CORRUPT, __return_address);
...@@ -164,9 +164,9 @@ xchk_fblock_process_error( ...@@ -164,9 +164,9 @@ xchk_fblock_process_error(
bool bool
xchk_fblock_xref_process_error( xchk_fblock_xref_process_error(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xfs_fileoff_t offset, xfs_fileoff_t offset,
int *error) int *error)
{ {
return __xchk_fblock_process_error(sc, whichfork, offset, error, return __xchk_fblock_process_error(sc, whichfork, offset, error,
XFS_SCRUB_OFLAG_XFAIL, __return_address); XFS_SCRUB_OFLAG_XFAIL, __return_address);
...@@ -188,7 +188,7 @@ xchk_fblock_xref_process_error( ...@@ -188,7 +188,7 @@ xchk_fblock_xref_process_error(
void void
xchk_block_set_preen( xchk_block_set_preen(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN;
trace_xchk_block_preen(sc, bp->b_bn, __return_address); trace_xchk_block_preen(sc, bp->b_bn, __return_address);
...@@ -202,7 +202,7 @@ xchk_block_set_preen( ...@@ -202,7 +202,7 @@ xchk_block_set_preen(
void void
xchk_ino_set_preen( xchk_ino_set_preen(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t ino) xfs_ino_t ino)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN;
trace_xchk_ino_preen(sc, ino, __return_address); trace_xchk_ino_preen(sc, ino, __return_address);
...@@ -212,7 +212,7 @@ xchk_ino_set_preen( ...@@ -212,7 +212,7 @@ xchk_ino_set_preen(
void void
xchk_block_set_corrupt( xchk_block_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
trace_xchk_block_error(sc, bp->b_bn, __return_address); trace_xchk_block_error(sc, bp->b_bn, __return_address);
...@@ -222,7 +222,7 @@ xchk_block_set_corrupt( ...@@ -222,7 +222,7 @@ xchk_block_set_corrupt(
void void
xchk_block_xref_set_corrupt( xchk_block_xref_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
trace_xchk_block_error(sc, bp->b_bn, __return_address); trace_xchk_block_error(sc, bp->b_bn, __return_address);
...@@ -236,7 +236,7 @@ xchk_block_xref_set_corrupt( ...@@ -236,7 +236,7 @@ xchk_block_xref_set_corrupt(
void void
xchk_ino_set_corrupt( xchk_ino_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t ino) xfs_ino_t ino)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
trace_xchk_ino_error(sc, ino, __return_address); trace_xchk_ino_error(sc, ino, __return_address);
...@@ -246,7 +246,7 @@ xchk_ino_set_corrupt( ...@@ -246,7 +246,7 @@ xchk_ino_set_corrupt(
void void
xchk_ino_xref_set_corrupt( xchk_ino_xref_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t ino) xfs_ino_t ino)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
trace_xchk_ino_error(sc, ino, __return_address); trace_xchk_ino_error(sc, ino, __return_address);
...@@ -256,8 +256,8 @@ xchk_ino_xref_set_corrupt( ...@@ -256,8 +256,8 @@ xchk_ino_xref_set_corrupt(
void void
xchk_fblock_set_corrupt( xchk_fblock_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xfs_fileoff_t offset) xfs_fileoff_t offset)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
trace_xchk_fblock_error(sc, whichfork, offset, __return_address); trace_xchk_fblock_error(sc, whichfork, offset, __return_address);
...@@ -267,8 +267,8 @@ xchk_fblock_set_corrupt( ...@@ -267,8 +267,8 @@ xchk_fblock_set_corrupt(
void void
xchk_fblock_xref_set_corrupt( xchk_fblock_xref_set_corrupt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xfs_fileoff_t offset) xfs_fileoff_t offset)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
trace_xchk_fblock_error(sc, whichfork, offset, __return_address); trace_xchk_fblock_error(sc, whichfork, offset, __return_address);
...@@ -281,7 +281,7 @@ xchk_fblock_xref_set_corrupt( ...@@ -281,7 +281,7 @@ xchk_fblock_xref_set_corrupt(
void void
xchk_ino_set_warning( xchk_ino_set_warning(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t ino) xfs_ino_t ino)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING;
trace_xchk_ino_warning(sc, ino, __return_address); trace_xchk_ino_warning(sc, ino, __return_address);
...@@ -291,8 +291,8 @@ xchk_ino_set_warning( ...@@ -291,8 +291,8 @@ xchk_ino_set_warning(
void void
xchk_fblock_set_warning( xchk_fblock_set_warning(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xfs_fileoff_t offset) xfs_fileoff_t offset)
{ {
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING;
trace_xchk_fblock_warning(sc, whichfork, offset, __return_address); trace_xchk_fblock_warning(sc, whichfork, offset, __return_address);
...@@ -319,13 +319,13 @@ struct xchk_rmap_ownedby_info { ...@@ -319,13 +319,13 @@ struct xchk_rmap_ownedby_info {
STATIC int STATIC int
xchk_count_rmap_ownedby_irec( xchk_count_rmap_ownedby_irec(
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
struct xfs_rmap_irec *rec, struct xfs_rmap_irec *rec,
void *priv) void *priv)
{ {
struct xchk_rmap_ownedby_info *sroi = priv; struct xchk_rmap_ownedby_info *sroi = priv;
bool irec_attr; bool irec_attr;
bool oinfo_attr; bool oinfo_attr;
irec_attr = rec->rm_flags & XFS_RMAP_ATTR_FORK; irec_attr = rec->rm_flags & XFS_RMAP_ATTR_FORK;
oinfo_attr = sroi->oinfo->oi_flags & XFS_OWNER_INFO_ATTR_FORK; oinfo_attr = sroi->oinfo->oi_flags & XFS_OWNER_INFO_ATTR_FORK;
...@@ -346,11 +346,11 @@ xchk_count_rmap_ownedby_irec( ...@@ -346,11 +346,11 @@ xchk_count_rmap_ownedby_irec(
int int
xchk_count_rmap_ownedby_ag( xchk_count_rmap_ownedby_ag(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
struct xfs_owner_info *oinfo, struct xfs_owner_info *oinfo,
xfs_filblks_t *blocks) xfs_filblks_t *blocks)
{ {
struct xchk_rmap_ownedby_info sroi; struct xchk_rmap_ownedby_info sroi;
sroi.oinfo = oinfo; sroi.oinfo = oinfo;
*blocks = 0; *blocks = 0;
...@@ -372,7 +372,7 @@ xchk_count_rmap_ownedby_ag( ...@@ -372,7 +372,7 @@ xchk_count_rmap_ownedby_ag(
static inline bool static inline bool
want_ag_read_header_failure( want_ag_read_header_failure(
struct xfs_scrub *sc, struct xfs_scrub *sc,
unsigned int type) unsigned int type)
{ {
/* Return all AG header read failures when scanning btrees. */ /* Return all AG header read failures when scanning btrees. */
if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF &&
...@@ -399,13 +399,13 @@ want_ag_read_header_failure( ...@@ -399,13 +399,13 @@ want_ag_read_header_failure(
int int
xchk_ag_read_headers( xchk_ag_read_headers(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agnumber_t agno, xfs_agnumber_t agno,
struct xfs_buf **agi, struct xfs_buf **agi,
struct xfs_buf **agf, struct xfs_buf **agf,
struct xfs_buf **agfl) struct xfs_buf **agfl)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
int error; int error;
error = xfs_ialloc_read_agi(mp, sc->tp, agno, agi); error = xfs_ialloc_read_agi(mp, sc->tp, agno, agi);
if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI))
...@@ -455,8 +455,8 @@ xchk_ag_btcur_init( ...@@ -455,8 +455,8 @@ xchk_ag_btcur_init(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xchk_ag *sa) struct xchk_ag *sa)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_agnumber_t agno = sa->agno; xfs_agnumber_t agno = sa->agno;
if (sa->agf_bp) { if (sa->agf_bp) {
/* Set up a bnobt cursor for cross-referencing. */ /* Set up a bnobt cursor for cross-referencing. */
...@@ -545,10 +545,10 @@ xchk_ag_free( ...@@ -545,10 +545,10 @@ xchk_ag_free(
int int
xchk_ag_init( xchk_ag_init(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agnumber_t agno, xfs_agnumber_t agno,
struct xchk_ag *sa) struct xchk_ag *sa)
{ {
int error; int error;
sa->agno = agno; sa->agno = agno;
error = xchk_ag_read_headers(sc, agno, &sa->agi_bp, error = xchk_ag_read_headers(sc, agno, &sa->agi_bp,
...@@ -566,7 +566,7 @@ xchk_ag_init( ...@@ -566,7 +566,7 @@ xchk_ag_init(
void void
xchk_perag_get( xchk_perag_get(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xchk_ag *sa) struct xchk_ag *sa)
{ {
if (!sa->pag) if (!sa->pag)
sa->pag = xfs_perag_get(mp, sa->agno); sa->pag = xfs_perag_get(mp, sa->agno);
...@@ -587,7 +587,7 @@ xchk_perag_get( ...@@ -587,7 +587,7 @@ xchk_perag_get(
int int
xchk_trans_alloc( xchk_trans_alloc(
struct xfs_scrub *sc, struct xfs_scrub *sc,
uint resblks) uint resblks)
{ {
if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR)
return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate,
...@@ -600,9 +600,9 @@ xchk_trans_alloc( ...@@ -600,9 +600,9 @@ xchk_trans_alloc(
int int
xchk_setup_fs( xchk_setup_fs(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
uint resblks; uint resblks;
resblks = xrep_calc_ag_resblks(sc); resblks = xrep_calc_ag_resblks(sc);
return xchk_trans_alloc(sc, resblks); return xchk_trans_alloc(sc, resblks);
...@@ -612,11 +612,11 @@ xchk_setup_fs( ...@@ -612,11 +612,11 @@ xchk_setup_fs(
int int
xchk_setup_ag_btree( xchk_setup_ag_btree(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip, struct xfs_inode *ip,
bool force_log) bool force_log)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
int error; int error;
/* /*
* If the caller asks us to checkpont the log, do so. This * If the caller asks us to checkpont the log, do so. This
...@@ -659,12 +659,12 @@ xchk_checkpoint_log( ...@@ -659,12 +659,12 @@ xchk_checkpoint_log(
int int
xchk_get_inode( xchk_get_inode(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip_in) struct xfs_inode *ip_in)
{ {
struct xfs_imap imap; struct xfs_imap imap;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_inode *ip = NULL; struct xfs_inode *ip = NULL;
int error; int error;
/* We want to scan the inode we already had opened. */ /* We want to scan the inode we already had opened. */
if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) { if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) {
...@@ -723,10 +723,10 @@ xchk_get_inode( ...@@ -723,10 +723,10 @@ xchk_get_inode(
int int
xchk_setup_inode_contents( xchk_setup_inode_contents(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip, struct xfs_inode *ip,
unsigned int resblks) unsigned int resblks)
{ {
int error; int error;
error = xchk_get_inode(sc, ip); error = xchk_get_inode(sc, ip);
if (error) if (error)
...@@ -754,8 +754,8 @@ xchk_setup_inode_contents( ...@@ -754,8 +754,8 @@ xchk_setup_inode_contents(
bool bool
xchk_should_check_xref( xchk_should_check_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int *error, int *error,
struct xfs_btree_cur **curpp) struct xfs_btree_cur **curpp)
{ {
/* No point in xref if we already know we're corrupt. */ /* No point in xref if we already know we're corrupt. */
if (xchk_skip_xref(sc->sm)) if (xchk_skip_xref(sc->sm))
...@@ -789,9 +789,9 @@ xchk_should_check_xref( ...@@ -789,9 +789,9 @@ xchk_should_check_xref(
void void
xchk_buffer_recheck( xchk_buffer_recheck(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
xfs_failaddr_t fa; xfs_failaddr_t fa;
if (bp->b_ops == NULL) { if (bp->b_ops == NULL) {
xchk_block_set_corrupt(sc, bp); xchk_block_set_corrupt(sc, bp);
...@@ -816,9 +816,9 @@ int ...@@ -816,9 +816,9 @@ int
xchk_metadata_inode_forks( xchk_metadata_inode_forks(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
__u32 smtype; __u32 smtype;
bool shared; bool shared;
int error; int error;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return 0; return 0;
......
...@@ -108,24 +108,21 @@ xchk_setup_quota(struct xfs_scrub *sc, struct xfs_inode *ip) ...@@ -108,24 +108,21 @@ xchk_setup_quota(struct xfs_scrub *sc, struct xfs_inode *ip)
void xchk_ag_free(struct xfs_scrub *sc, struct xchk_ag *sa); void xchk_ag_free(struct xfs_scrub *sc, struct xchk_ag *sa);
int xchk_ag_init(struct xfs_scrub *sc, xfs_agnumber_t agno, int xchk_ag_init(struct xfs_scrub *sc, xfs_agnumber_t agno,
struct xchk_ag *sa); struct xchk_ag *sa);
void xchk_perag_get(struct xfs_mount *mp, struct xchk_ag *sa); void xchk_perag_get(struct xfs_mount *mp, struct xchk_ag *sa);
int xchk_ag_read_headers(struct xfs_scrub *sc, xfs_agnumber_t agno, int xchk_ag_read_headers(struct xfs_scrub *sc, xfs_agnumber_t agno,
struct xfs_buf **agi, struct xfs_buf **agf, struct xfs_buf **agi, struct xfs_buf **agf,
struct xfs_buf **agfl); struct xfs_buf **agfl);
void xchk_ag_btcur_free(struct xchk_ag *sa); void xchk_ag_btcur_free(struct xchk_ag *sa);
int xchk_ag_btcur_init(struct xfs_scrub *sc, int xchk_ag_btcur_init(struct xfs_scrub *sc, struct xchk_ag *sa);
struct xchk_ag *sa); int xchk_count_rmap_ownedby_ag(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
int xchk_count_rmap_ownedby_ag(struct xfs_scrub *sc, struct xfs_owner_info *oinfo, xfs_filblks_t *blocks);
struct xfs_btree_cur *cur,
struct xfs_owner_info *oinfo,
xfs_filblks_t *blocks);
int xchk_setup_ag_btree(struct xfs_scrub *sc, int xchk_setup_ag_btree(struct xfs_scrub *sc, struct xfs_inode *ip,
struct xfs_inode *ip, bool force_log); bool force_log);
int xchk_get_inode(struct xfs_scrub *sc, struct xfs_inode *ip_in); int xchk_get_inode(struct xfs_scrub *sc, struct xfs_inode *ip_in);
int xchk_setup_inode_contents(struct xfs_scrub *sc, int xchk_setup_inode_contents(struct xfs_scrub *sc, struct xfs_inode *ip,
struct xfs_inode *ip, unsigned int resblks); unsigned int resblks);
void xchk_buffer_recheck(struct xfs_scrub *sc, struct xfs_buf *bp); void xchk_buffer_recheck(struct xfs_scrub *sc, struct xfs_buf *bp);
/* /*
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
*/ */
bool bool
xchk_da_process_error( xchk_da_process_error(
struct xchk_da_btree *ds, struct xchk_da_btree *ds,
int level, int level,
int *error) int *error)
{ {
struct xfs_scrub *sc = ds->sc; struct xfs_scrub *sc = ds->sc;
...@@ -72,8 +72,8 @@ xchk_da_process_error( ...@@ -72,8 +72,8 @@ xchk_da_process_error(
*/ */
void void
xchk_da_set_corrupt( xchk_da_set_corrupt(
struct xchk_da_btree *ds, struct xchk_da_btree *ds,
int level) int level)
{ {
struct xfs_scrub *sc = ds->sc; struct xfs_scrub *sc = ds->sc;
...@@ -88,13 +88,13 @@ xchk_da_set_corrupt( ...@@ -88,13 +88,13 @@ xchk_da_set_corrupt(
/* Find an entry at a certain level in a da btree. */ /* Find an entry at a certain level in a da btree. */
STATIC void * STATIC void *
xchk_da_btree_entry( xchk_da_btree_entry(
struct xchk_da_btree *ds, struct xchk_da_btree *ds,
int level, int level,
int rec) int rec)
{ {
char *ents; char *ents;
struct xfs_da_state_blk *blk; struct xfs_da_state_blk *blk;
void *baddr; void *baddr;
/* Dispatch the entry finding function. */ /* Dispatch the entry finding function. */
blk = &ds->state->path.blk[level]; blk = &ds->state->path.blk[level];
...@@ -158,9 +158,9 @@ xchk_da_btree_hash( ...@@ -158,9 +158,9 @@ xchk_da_btree_hash(
*/ */
STATIC bool STATIC bool
xchk_da_btree_ptr_ok( xchk_da_btree_ptr_ok(
struct xchk_da_btree *ds, struct xchk_da_btree *ds,
int level, int level,
xfs_dablk_t blkno) xfs_dablk_t blkno)
{ {
if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) { if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) {
xchk_da_set_corrupt(ds, level); xchk_da_set_corrupt(ds, level);
...@@ -246,13 +246,13 @@ static const struct xfs_buf_ops xchk_da_btree_buf_ops = { ...@@ -246,13 +246,13 @@ static const struct xfs_buf_ops xchk_da_btree_buf_ops = {
/* Check a block's sibling. */ /* Check a block's sibling. */
STATIC int STATIC int
xchk_da_btree_block_check_sibling( xchk_da_btree_block_check_sibling(
struct xchk_da_btree *ds, struct xchk_da_btree *ds,
int level, int level,
int direction, int direction,
xfs_dablk_t sibling) xfs_dablk_t sibling)
{ {
int retval; int retval;
int error; int error;
memcpy(&ds->state->altpath, &ds->state->path, memcpy(&ds->state->altpath, &ds->state->path,
sizeof(ds->state->altpath)); sizeof(ds->state->altpath));
...@@ -294,13 +294,13 @@ xchk_da_btree_block_check_sibling( ...@@ -294,13 +294,13 @@ xchk_da_btree_block_check_sibling(
/* Check a block's sibling pointers. */ /* Check a block's sibling pointers. */
STATIC int STATIC int
xchk_da_btree_block_check_siblings( xchk_da_btree_block_check_siblings(
struct xchk_da_btree *ds, struct xchk_da_btree *ds,
int level, int level,
struct xfs_da_blkinfo *hdr) struct xfs_da_blkinfo *hdr)
{ {
xfs_dablk_t forw; xfs_dablk_t forw;
xfs_dablk_t back; xfs_dablk_t back;
int error = 0; int error = 0;
forw = be32_to_cpu(hdr->forw); forw = be32_to_cpu(hdr->forw);
back = be32_to_cpu(hdr->back); back = be32_to_cpu(hdr->back);
...@@ -474,9 +474,9 @@ xchk_da_btree_block( ...@@ -474,9 +474,9 @@ xchk_da_btree_block(
/* Visit all nodes and leaves of a da btree. */ /* Visit all nodes and leaves of a da btree. */
int int
xchk_da_btree( xchk_da_btree(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int whichfork, int whichfork,
xchk_da_btree_rec_fn scrub_fn, xchk_da_btree_rec_fn scrub_fn,
void *private) void *private)
{ {
struct xchk_da_btree ds = {}; struct xchk_da_btree ds = {};
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
/* dir/attr btree */ /* dir/attr btree */
struct xchk_da_btree { struct xchk_da_btree {
struct xfs_da_args dargs; struct xfs_da_args dargs;
xfs_dahash_t hashes[XFS_DA_NODE_MAXDEPTH]; xfs_dahash_t hashes[XFS_DA_NODE_MAXDEPTH];
int maxrecs[XFS_DA_NODE_MAXDEPTH]; int maxrecs[XFS_DA_NODE_MAXDEPTH];
struct xfs_da_state *state; struct xfs_da_state *state;
struct xfs_scrub *sc; struct xfs_scrub *sc;
void *private; void *private;
/* /*
* Lowest and highest directory block address in which we expect * Lowest and highest directory block address in which we expect
...@@ -22,10 +22,10 @@ struct xchk_da_btree { ...@@ -22,10 +22,10 @@ struct xchk_da_btree {
* (presumably) means between LEAF_OFFSET and FREE_OFFSET; for * (presumably) means between LEAF_OFFSET and FREE_OFFSET; for
* attributes there is no limit. * attributes there is no limit.
*/ */
xfs_dablk_t lowest; xfs_dablk_t lowest;
xfs_dablk_t highest; xfs_dablk_t highest;
int tree_level; int tree_level;
}; };
typedef int (*xchk_da_btree_rec_fn)(struct xchk_da_btree *ds, typedef int (*xchk_da_btree_rec_fn)(struct xchk_da_btree *ds,
...@@ -37,9 +37,8 @@ bool xchk_da_process_error(struct xchk_da_btree *ds, int level, int *error); ...@@ -37,9 +37,8 @@ bool xchk_da_process_error(struct xchk_da_btree *ds, int level, int *error);
/* Check for da btree corruption. */ /* Check for da btree corruption. */
void xchk_da_set_corrupt(struct xchk_da_btree *ds, int level); void xchk_da_set_corrupt(struct xchk_da_btree *ds, int level);
int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, __be32 *hashp);
__be32 *hashp);
int xchk_da_btree(struct xfs_scrub *sc, int whichfork, int xchk_da_btree(struct xfs_scrub *sc, int whichfork,
xchk_da_btree_rec_fn scrub_fn, void *private); xchk_da_btree_rec_fn scrub_fn, void *private);
#endif /* __XFS_SCRUB_DABTREE_H__ */ #endif /* __XFS_SCRUB_DABTREE_H__ */
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
int int
xchk_setup_directory( xchk_setup_directory(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
return xchk_setup_inode_contents(sc, ip, 0); return xchk_setup_inode_contents(sc, ip, 0);
} }
...@@ -44,7 +44,7 @@ xchk_setup_directory( ...@@ -44,7 +44,7 @@ xchk_setup_directory(
struct xchk_dir_ctx { struct xchk_dir_ctx {
/* VFS fill-directory iterator */ /* VFS fill-directory iterator */
struct dir_context dir_iter; struct dir_context dir_iter;
struct xfs_scrub *sc; struct xfs_scrub *sc;
}; };
...@@ -52,15 +52,15 @@ struct xchk_dir_ctx { ...@@ -52,15 +52,15 @@ struct xchk_dir_ctx {
/* Check that an inode's mode matches a given DT_ type. */ /* Check that an inode's mode matches a given DT_ type. */
STATIC int STATIC int
xchk_dir_check_ftype( xchk_dir_check_ftype(
struct xchk_dir_ctx *sdc, struct xchk_dir_ctx *sdc,
xfs_fileoff_t offset, xfs_fileoff_t offset,
xfs_ino_t inum, xfs_ino_t inum,
int dtype) int dtype)
{ {
struct xfs_mount *mp = sdc->sc->mp; struct xfs_mount *mp = sdc->sc->mp;
struct xfs_inode *ip; struct xfs_inode *ip;
int ino_dtype; int ino_dtype;
int error = 0; int error = 0;
if (!xfs_sb_version_hasftype(&mp->m_sb)) { if (!xfs_sb_version_hasftype(&mp->m_sb)) {
if (dtype != DT_UNKNOWN && dtype != DT_DIR) if (dtype != DT_UNKNOWN && dtype != DT_DIR)
...@@ -102,20 +102,20 @@ xchk_dir_check_ftype( ...@@ -102,20 +102,20 @@ xchk_dir_check_ftype(
*/ */
STATIC int STATIC int
xchk_dir_actor( xchk_dir_actor(
struct dir_context *dir_iter, struct dir_context *dir_iter,
const char *name, const char *name,
int namelen, int namelen,
loff_t pos, loff_t pos,
u64 ino, u64 ino,
unsigned type) unsigned type)
{ {
struct xfs_mount *mp; struct xfs_mount *mp;
struct xfs_inode *ip; struct xfs_inode *ip;
struct xchk_dir_ctx *sdc; struct xchk_dir_ctx *sdc;
struct xfs_name xname; struct xfs_name xname;
xfs_ino_t lookup_ino; xfs_ino_t lookup_ino;
xfs_dablk_t offset; xfs_dablk_t offset;
int error = 0; int error = 0;
sdc = container_of(dir_iter, struct xchk_dir_ctx, dir_iter); sdc = container_of(dir_iter, struct xchk_dir_ctx, dir_iter);
ip = sdc->sc->ip; ip = sdc->sc->ip;
...@@ -289,7 +289,7 @@ xchk_dir_rec( ...@@ -289,7 +289,7 @@ xchk_dir_rec(
*/ */
STATIC void STATIC void
xchk_directory_check_free_entry( xchk_directory_check_free_entry(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_dablk_t lblk, xfs_dablk_t lblk,
struct xfs_dir2_data_free *bf, struct xfs_dir2_data_free *bf,
struct xfs_dir2_data_unused *dup) struct xfs_dir2_data_unused *dup)
...@@ -314,7 +314,7 @@ xchk_directory_check_free_entry( ...@@ -314,7 +314,7 @@ xchk_directory_check_free_entry(
/* Check free space info in a directory data block. */ /* Check free space info in a directory data block. */
STATIC int STATIC int
xchk_directory_data_bestfree( xchk_directory_data_bestfree(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_dablk_t lblk, xfs_dablk_t lblk,
bool is_block) bool is_block)
{ {
...@@ -455,7 +455,7 @@ xchk_directory_data_bestfree( ...@@ -455,7 +455,7 @@ xchk_directory_data_bestfree(
*/ */
STATIC void STATIC void
xchk_directory_check_freesp( xchk_directory_check_freesp(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_dablk_t lblk, xfs_dablk_t lblk,
struct xfs_buf *dbp, struct xfs_buf *dbp,
unsigned int len) unsigned int len)
...@@ -474,7 +474,7 @@ xchk_directory_check_freesp( ...@@ -474,7 +474,7 @@ xchk_directory_check_freesp(
/* Check free space info in a directory leaf1 block. */ /* Check free space info in a directory leaf1 block. */
STATIC int STATIC int
xchk_directory_leaf1_bestfree( xchk_directory_leaf1_bestfree(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_da_args *args, struct xfs_da_args *args,
xfs_dablk_t lblk) xfs_dablk_t lblk)
{ {
...@@ -572,7 +572,7 @@ xchk_directory_leaf1_bestfree( ...@@ -572,7 +572,7 @@ xchk_directory_leaf1_bestfree(
/* Check free space info in a directory freespace block. */ /* Check free space info in a directory freespace block. */
STATIC int STATIC int
xchk_directory_free_bestfree( xchk_directory_free_bestfree(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_da_args *args, struct xfs_da_args *args,
xfs_dablk_t lblk) xfs_dablk_t lblk)
{ {
...@@ -628,18 +628,18 @@ STATIC int ...@@ -628,18 +628,18 @@ STATIC int
xchk_directory_blocks( xchk_directory_blocks(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_bmbt_irec got; struct xfs_bmbt_irec got;
struct xfs_da_args args; struct xfs_da_args args;
struct xfs_ifork *ifp; struct xfs_ifork *ifp;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_fileoff_t leaf_lblk; xfs_fileoff_t leaf_lblk;
xfs_fileoff_t free_lblk; xfs_fileoff_t free_lblk;
xfs_fileoff_t lblk; xfs_fileoff_t lblk;
struct xfs_iext_cursor icur; struct xfs_iext_cursor icur;
xfs_dablk_t dabno; xfs_dablk_t dabno;
bool found; bool found;
int is_block = 0; int is_block = 0;
int error; int error;
/* Ignore local format directories. */ /* Ignore local format directories. */
if (sc->ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS && if (sc->ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS &&
...@@ -772,14 +772,14 @@ int ...@@ -772,14 +772,14 @@ int
xchk_directory( xchk_directory(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xchk_dir_ctx sdc = { struct xchk_dir_ctx sdc = {
.dir_iter.actor = xchk_dir_actor, .dir_iter.actor = xchk_dir_actor,
.dir_iter.pos = 0, .dir_iter.pos = 0,
.sc = sc, .sc = sc,
}; };
size_t bufsize; size_t bufsize;
loff_t oldpos; loff_t oldpos;
int error = 0; int error = 0;
if (!S_ISDIR(VFS_I(sc->ip)->i_mode)) if (!S_ISDIR(VFS_I(sc->ip)->i_mode))
return -ENOENT; return -ENOENT;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
int int
xchk_setup_ag_iallocbt( xchk_setup_ag_iallocbt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
return xchk_setup_ag_btree(sc, ip, sc->try_harder); return xchk_setup_ag_btree(sc, ip, sc->try_harder);
} }
...@@ -51,7 +51,7 @@ xchk_setup_ag_iallocbt( ...@@ -51,7 +51,7 @@ xchk_setup_ag_iallocbt(
*/ */
static inline void static inline void
xchk_iallocbt_chunk_xref_other( xchk_iallocbt_chunk_xref_other(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inobt_rec_incore *irec, struct xfs_inobt_rec_incore *irec,
xfs_agino_t agino) xfs_agino_t agino)
{ {
...@@ -76,7 +76,7 @@ xchk_iallocbt_chunk_xref_other( ...@@ -76,7 +76,7 @@ xchk_iallocbt_chunk_xref_other(
/* Cross-reference with the other btrees. */ /* Cross-reference with the other btrees. */
STATIC void STATIC void
xchk_iallocbt_chunk_xref( xchk_iallocbt_chunk_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inobt_rec_incore *irec, struct xfs_inobt_rec_incore *irec,
xfs_agino_t agino, xfs_agino_t agino,
xfs_agblock_t agbno, xfs_agblock_t agbno,
...@@ -364,13 +364,13 @@ xchk_iallocbt_rec( ...@@ -364,13 +364,13 @@ xchk_iallocbt_rec(
STATIC void STATIC void
xchk_iallocbt_xref_rmap_btreeblks( xchk_iallocbt_xref_rmap_btreeblks(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int which) int which)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
xfs_filblks_t blocks; xfs_filblks_t blocks;
xfs_extlen_t inobt_blocks = 0; xfs_extlen_t inobt_blocks = 0;
xfs_extlen_t finobt_blocks = 0; xfs_extlen_t finobt_blocks = 0;
int error; int error;
if (!sc->sa.ino_cur || !sc->sa.rmap_cur || if (!sc->sa.ino_cur || !sc->sa.rmap_cur ||
(xfs_sb_version_hasfinobt(&sc->mp->m_sb) && !sc->sa.fino_cur) || (xfs_sb_version_hasfinobt(&sc->mp->m_sb) && !sc->sa.fino_cur) ||
...@@ -404,12 +404,12 @@ xchk_iallocbt_xref_rmap_btreeblks( ...@@ -404,12 +404,12 @@ xchk_iallocbt_xref_rmap_btreeblks(
STATIC void STATIC void
xchk_iallocbt_xref_rmap_inodes( xchk_iallocbt_xref_rmap_inodes(
struct xfs_scrub *sc, struct xfs_scrub *sc,
int which, int which,
xfs_filblks_t inode_blocks) xfs_filblks_t inode_blocks)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
xfs_filblks_t blocks; xfs_filblks_t blocks;
int error; int error;
if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm))
return; return;
...@@ -428,12 +428,12 @@ xchk_iallocbt_xref_rmap_inodes( ...@@ -428,12 +428,12 @@ xchk_iallocbt_xref_rmap_inodes(
STATIC int STATIC int
xchk_iallocbt( xchk_iallocbt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_btnum_t which) xfs_btnum_t which)
{ {
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
xfs_filblks_t inode_blocks = 0; xfs_filblks_t inode_blocks = 0;
int error; int error;
xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_INOBT); xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_INOBT);
cur = which == XFS_BTNUM_INO ? sc->sa.ino_cur : sc->sa.fino_cur; cur = which == XFS_BTNUM_INO ? sc->sa.ino_cur : sc->sa.fino_cur;
...@@ -475,13 +475,13 @@ xchk_finobt( ...@@ -475,13 +475,13 @@ xchk_finobt(
static inline void static inline void
xchk_xref_inode_check( xchk_xref_inode_check(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len, xfs_extlen_t len,
struct xfs_btree_cur **icur, struct xfs_btree_cur **icur,
bool should_have_inodes) bool should_have_inodes)
{ {
bool has_inodes; bool has_inodes;
int error; int error;
if (!(*icur) || xchk_skip_xref(sc->sm)) if (!(*icur) || xchk_skip_xref(sc->sm))
return; return;
...@@ -497,8 +497,8 @@ xchk_xref_inode_check( ...@@ -497,8 +497,8 @@ xchk_xref_inode_check(
void void
xchk_xref_is_not_inode_chunk( xchk_xref_is_not_inode_chunk(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
xchk_xref_inode_check(sc, agbno, len, &sc->sa.ino_cur, false); xchk_xref_inode_check(sc, agbno, len, &sc->sa.ino_cur, false);
xchk_xref_inode_check(sc, agbno, len, &sc->sa.fino_cur, false); xchk_xref_inode_check(sc, agbno, len, &sc->sa.fino_cur, false);
...@@ -508,8 +508,8 @@ xchk_xref_is_not_inode_chunk( ...@@ -508,8 +508,8 @@ xchk_xref_is_not_inode_chunk(
void void
xchk_xref_is_inode_chunk( xchk_xref_is_inode_chunk(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
xchk_xref_inode_check(sc, agbno, len, &sc->sa.ino_cur, true); xchk_xref_inode_check(sc, agbno, len, &sc->sa.ino_cur, true);
} }
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
int int
xchk_setup_inode( xchk_setup_inode(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
int error; int error;
/* /*
* Try to get the inode. If the verifiers fail, we try again * Try to get the inode. If the verifiers fail, we try again
...@@ -78,12 +78,12 @@ xchk_setup_inode( ...@@ -78,12 +78,12 @@ xchk_setup_inode(
STATIC void STATIC void
xchk_inode_extsize( xchk_inode_extsize(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_dinode *dip, struct xfs_dinode *dip,
xfs_ino_t ino, xfs_ino_t ino,
uint16_t mode, uint16_t mode,
uint16_t flags) uint16_t flags)
{ {
xfs_failaddr_t fa; xfs_failaddr_t fa;
fa = xfs_inode_validate_extsize(sc->mp, be32_to_cpu(dip->di_extsize), fa = xfs_inode_validate_extsize(sc->mp, be32_to_cpu(dip->di_extsize),
mode, flags); mode, flags);
...@@ -100,13 +100,13 @@ xchk_inode_extsize( ...@@ -100,13 +100,13 @@ xchk_inode_extsize(
STATIC void STATIC void
xchk_inode_cowextsize( xchk_inode_cowextsize(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_dinode *dip, struct xfs_dinode *dip,
xfs_ino_t ino, xfs_ino_t ino,
uint16_t mode, uint16_t mode,
uint16_t flags, uint16_t flags,
uint64_t flags2) uint64_t flags2)
{ {
xfs_failaddr_t fa; xfs_failaddr_t fa;
fa = xfs_inode_validate_cowextsize(sc->mp, fa = xfs_inode_validate_cowextsize(sc->mp,
be32_to_cpu(dip->di_cowextsize), mode, flags, be32_to_cpu(dip->di_cowextsize), mode, flags,
...@@ -119,12 +119,12 @@ xchk_inode_cowextsize( ...@@ -119,12 +119,12 @@ xchk_inode_cowextsize(
STATIC void STATIC void
xchk_inode_flags( xchk_inode_flags(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_dinode *dip, struct xfs_dinode *dip,
xfs_ino_t ino, xfs_ino_t ino,
uint16_t mode, uint16_t mode,
uint16_t flags) uint16_t flags)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
if (flags & ~XFS_DIFLAG_ANY) if (flags & ~XFS_DIFLAG_ANY)
goto bad; goto bad;
...@@ -164,13 +164,13 @@ xchk_inode_flags( ...@@ -164,13 +164,13 @@ xchk_inode_flags(
STATIC void STATIC void
xchk_inode_flags2( xchk_inode_flags2(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_dinode *dip, struct xfs_dinode *dip,
xfs_ino_t ino, xfs_ino_t ino,
uint16_t mode, uint16_t mode,
uint16_t flags, uint16_t flags,
uint64_t flags2) uint64_t flags2)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
if (flags2 & ~XFS_DIFLAG2_ANY) if (flags2 & ~XFS_DIFLAG2_ANY)
goto bad; goto bad;
...@@ -207,16 +207,16 @@ xchk_inode_flags2( ...@@ -207,16 +207,16 @@ xchk_inode_flags2(
STATIC void STATIC void
xchk_dinode( xchk_dinode(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_dinode *dip, struct xfs_dinode *dip,
xfs_ino_t ino) xfs_ino_t ino)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
size_t fork_recs; size_t fork_recs;
unsigned long long isize; unsigned long long isize;
uint64_t flags2; uint64_t flags2;
uint32_t nextents; uint32_t nextents;
uint16_t flags; uint16_t flags;
uint16_t mode; uint16_t mode;
flags = be16_to_cpu(dip->di_flags); flags = be16_to_cpu(dip->di_flags);
if (dip->di_version >= 3) if (dip->di_version >= 3)
...@@ -426,7 +426,7 @@ xchk_dinode( ...@@ -426,7 +426,7 @@ xchk_dinode(
*/ */
static void static void
xchk_inode_xref_finobt( xchk_inode_xref_finobt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t ino) xfs_ino_t ino)
{ {
struct xfs_inobt_rec_incore rec; struct xfs_inobt_rec_incore rec;
...@@ -470,12 +470,12 @@ xchk_inode_xref_finobt( ...@@ -470,12 +470,12 @@ xchk_inode_xref_finobt(
STATIC void STATIC void
xchk_inode_xref_bmap( xchk_inode_xref_bmap(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_dinode *dip) struct xfs_dinode *dip)
{ {
xfs_extnum_t nextents; xfs_extnum_t nextents;
xfs_filblks_t count; xfs_filblks_t count;
xfs_filblks_t acount; xfs_filblks_t acount;
int error; int error;
if (xchk_skip_xref(sc->sm)) if (xchk_skip_xref(sc->sm))
return; return;
...@@ -504,13 +504,13 @@ xchk_inode_xref_bmap( ...@@ -504,13 +504,13 @@ xchk_inode_xref_bmap(
STATIC void STATIC void
xchk_inode_xref( xchk_inode_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t ino, xfs_ino_t ino,
struct xfs_dinode *dip) struct xfs_dinode *dip)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
xfs_agnumber_t agno; xfs_agnumber_t agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
int error; int error;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -541,11 +541,11 @@ xchk_inode_xref( ...@@ -541,11 +541,11 @@ xchk_inode_xref(
static void static void
xchk_inode_check_reflink_iflag( xchk_inode_check_reflink_iflag(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t ino) xfs_ino_t ino)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
bool has_shared; bool has_shared;
int error; int error;
if (!xfs_sb_version_hasreflink(&mp->m_sb)) if (!xfs_sb_version_hasreflink(&mp->m_sb))
return; return;
...@@ -566,8 +566,8 @@ int ...@@ -566,8 +566,8 @@ int
xchk_inode( xchk_inode(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_dinode di; struct xfs_dinode di;
int error = 0; int error = 0;
/* /*
* If sc->ip is NULL, that means that the setup function called * If sc->ip is NULL, that means that the setup function called
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
int int
xchk_setup_parent( xchk_setup_parent(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
return xchk_setup_inode_contents(sc, ip, 0); return xchk_setup_inode_contents(sc, ip, 0);
} }
...@@ -39,22 +39,22 @@ xchk_setup_parent( ...@@ -39,22 +39,22 @@ xchk_setup_parent(
/* Look for an entry in a parent pointing to this inode. */ /* Look for an entry in a parent pointing to this inode. */
struct xchk_parent_ctx { struct xchk_parent_ctx {
struct dir_context dc; struct dir_context dc;
xfs_ino_t ino; xfs_ino_t ino;
xfs_nlink_t nlink; xfs_nlink_t nlink;
}; };
/* Look for a single entry in a directory pointing to an inode. */ /* Look for a single entry in a directory pointing to an inode. */
STATIC int STATIC int
xchk_parent_actor( xchk_parent_actor(
struct dir_context *dc, struct dir_context *dc,
const char *name, const char *name,
int namelen, int namelen,
loff_t pos, loff_t pos,
u64 ino, u64 ino,
unsigned type) unsigned type)
{ {
struct xchk_parent_ctx *spc; struct xchk_parent_ctx *spc;
spc = container_of(dc, struct xchk_parent_ctx, dc); spc = container_of(dc, struct xchk_parent_ctx, dc);
if (spc->ino == ino) if (spc->ino == ino)
...@@ -66,19 +66,19 @@ xchk_parent_actor( ...@@ -66,19 +66,19 @@ xchk_parent_actor(
STATIC int STATIC int
xchk_parent_count_parent_dentries( xchk_parent_count_parent_dentries(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *parent, struct xfs_inode *parent,
xfs_nlink_t *nlink) xfs_nlink_t *nlink)
{ {
struct xchk_parent_ctx spc = { struct xchk_parent_ctx spc = {
.dc.actor = xchk_parent_actor, .dc.actor = xchk_parent_actor,
.dc.pos = 0, .dc.pos = 0,
.ino = sc->ip->i_ino, .ino = sc->ip->i_ino,
.nlink = 0, .nlink = 0,
}; };
size_t bufsize; size_t bufsize;
loff_t oldpos; loff_t oldpos;
uint lock_mode; uint lock_mode;
int error = 0; int error = 0;
/* /*
* If there are any blocks, read-ahead block 0 as we're almost * If there are any blocks, read-ahead block 0 as we're almost
...@@ -122,14 +122,14 @@ xchk_parent_count_parent_dentries( ...@@ -122,14 +122,14 @@ xchk_parent_count_parent_dentries(
STATIC int STATIC int
xchk_parent_validate( xchk_parent_validate(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_ino_t dnum, xfs_ino_t dnum,
bool *try_again) bool *try_again)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_inode *dp = NULL; struct xfs_inode *dp = NULL;
xfs_nlink_t expected_nlink; xfs_nlink_t expected_nlink;
xfs_nlink_t nlink; xfs_nlink_t nlink;
int error = 0; int error = 0;
*try_again = false; *try_again = false;
...@@ -257,11 +257,11 @@ int ...@@ -257,11 +257,11 @@ int
xchk_parent( xchk_parent(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
xfs_ino_t dnum; xfs_ino_t dnum;
bool try_again; bool try_again;
int tries = 0; int tries = 0;
int error = 0; int error = 0;
/* /*
* If we're a directory, check that the '..' link points up to * If we're a directory, check that the '..' link points up to
......
...@@ -49,10 +49,10 @@ xchk_quota_to_dqtype( ...@@ -49,10 +49,10 @@ xchk_quota_to_dqtype(
int int
xchk_setup_quota( xchk_setup_quota(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
uint dqtype; uint dqtype;
int error; int error;
if (!XFS_IS_QUOTA_RUNNING(sc->mp) || !XFS_IS_QUOTA_ON(sc->mp)) if (!XFS_IS_QUOTA_RUNNING(sc->mp) || !XFS_IS_QUOTA_ON(sc->mp))
return -ENOENT; return -ENOENT;
...@@ -77,33 +77,33 @@ xchk_setup_quota( ...@@ -77,33 +77,33 @@ xchk_setup_quota(
struct xchk_quota_info { struct xchk_quota_info {
struct xfs_scrub *sc; struct xfs_scrub *sc;
xfs_dqid_t last_id; xfs_dqid_t last_id;
}; };
/* Scrub the fields in an individual quota item. */ /* Scrub the fields in an individual quota item. */
STATIC int STATIC int
xchk_quota_item( xchk_quota_item(
struct xfs_dquot *dq, struct xfs_dquot *dq,
uint dqtype, uint dqtype,
void *priv) void *priv)
{ {
struct xchk_quota_info *sqi = priv; struct xchk_quota_info *sqi = priv;
struct xfs_scrub *sc = sqi->sc; struct xfs_scrub *sc = sqi->sc;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_disk_dquot *d = &dq->q_core; struct xfs_disk_dquot *d = &dq->q_core;
struct xfs_quotainfo *qi = mp->m_quotainfo; struct xfs_quotainfo *qi = mp->m_quotainfo;
xfs_fileoff_t offset; xfs_fileoff_t offset;
unsigned long long bsoft; unsigned long long bsoft;
unsigned long long isoft; unsigned long long isoft;
unsigned long long rsoft; unsigned long long rsoft;
unsigned long long bhard; unsigned long long bhard;
unsigned long long ihard; unsigned long long ihard;
unsigned long long rhard; unsigned long long rhard;
unsigned long long bcount; unsigned long long bcount;
unsigned long long icount; unsigned long long icount;
unsigned long long rcount; unsigned long long rcount;
xfs_ino_t fs_icount; xfs_ino_t fs_icount;
xfs_dqid_t id = be32_to_cpu(d->d_id); xfs_dqid_t id = be32_to_cpu(d->d_id);
/* /*
* Except for the root dquot, the actual dquot we got must either have * Except for the root dquot, the actual dquot we got must either have
...@@ -197,12 +197,12 @@ STATIC int ...@@ -197,12 +197,12 @@ STATIC int
xchk_quota_data_fork( xchk_quota_data_fork(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_bmbt_irec irec = { 0 }; struct xfs_bmbt_irec irec = { 0 };
struct xfs_iext_cursor icur; struct xfs_iext_cursor icur;
struct xfs_quotainfo *qi = sc->mp->m_quotainfo; struct xfs_quotainfo *qi = sc->mp->m_quotainfo;
struct xfs_ifork *ifp; struct xfs_ifork *ifp;
xfs_fileoff_t max_dqid_off; xfs_fileoff_t max_dqid_off;
int error = 0; int error = 0;
/* Invoke the fork scrubber. */ /* Invoke the fork scrubber. */
error = xchk_metadata_inode_forks(sc); error = xchk_metadata_inode_forks(sc);
...@@ -236,11 +236,11 @@ int ...@@ -236,11 +236,11 @@ int
xchk_quota( xchk_quota(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xchk_quota_info sqi; struct xchk_quota_info sqi;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_quotainfo *qi = mp->m_quotainfo; struct xfs_quotainfo *qi = mp->m_quotainfo;
uint dqtype; uint dqtype;
int error = 0; int error = 0;
dqtype = xchk_quota_to_dqtype(sc); dqtype = xchk_quota_to_dqtype(sc);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
int int
xchk_setup_ag_refcountbt( xchk_setup_ag_refcountbt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
return xchk_setup_ag_btree(sc, ip, false); return xchk_setup_ag_btree(sc, ip, false);
} }
...@@ -74,21 +74,21 @@ xchk_setup_ag_refcountbt( ...@@ -74,21 +74,21 @@ xchk_setup_ag_refcountbt(
* should always hold true. If not, the refcount is incorrect. * should always hold true. If not, the refcount is incorrect.
*/ */
struct xchk_refcnt_frag { struct xchk_refcnt_frag {
struct list_head list; struct list_head list;
struct xfs_rmap_irec rm; struct xfs_rmap_irec rm;
}; };
struct xchk_refcnt_check { struct xchk_refcnt_check {
struct xfs_scrub *sc; struct xfs_scrub *sc;
struct list_head fragments; struct list_head fragments;
/* refcount extent we're examining */ /* refcount extent we're examining */
xfs_agblock_t bno; xfs_agblock_t bno;
xfs_extlen_t len; xfs_extlen_t len;
xfs_nlink_t refcount; xfs_nlink_t refcount;
/* number of owners seen */ /* number of owners seen */
xfs_nlink_t seen; xfs_nlink_t seen;
}; };
/* /*
...@@ -278,7 +278,7 @@ xchk_refcountbt_process_rmap_fragments( ...@@ -278,7 +278,7 @@ xchk_refcountbt_process_rmap_fragments(
/* Use the rmap entries covering this extent to verify the refcount. */ /* Use the rmap entries covering this extent to verify the refcount. */
STATIC void STATIC void
xchk_refcountbt_xref_rmap( xchk_refcountbt_xref_rmap(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t bno, xfs_agblock_t bno,
xfs_extlen_t len, xfs_extlen_t len,
xfs_nlink_t refcount) xfs_nlink_t refcount)
...@@ -326,9 +326,9 @@ xchk_refcountbt_xref_rmap( ...@@ -326,9 +326,9 @@ xchk_refcountbt_xref_rmap(
STATIC void STATIC void
xchk_refcountbt_xref( xchk_refcountbt_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len, xfs_extlen_t len,
xfs_nlink_t refcount) xfs_nlink_t refcount)
{ {
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -341,17 +341,17 @@ xchk_refcountbt_xref( ...@@ -341,17 +341,17 @@ xchk_refcountbt_xref(
/* Scrub a refcountbt record. */ /* Scrub a refcountbt record. */
STATIC int STATIC int
xchk_refcountbt_rec( xchk_refcountbt_rec(
struct xchk_btree *bs, struct xchk_btree *bs,
union xfs_btree_rec *rec) union xfs_btree_rec *rec)
{ {
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
xfs_agblock_t *cow_blocks = bs->private; xfs_agblock_t *cow_blocks = bs->private;
xfs_agnumber_t agno = bs->cur->bc_private.a.agno; xfs_agnumber_t agno = bs->cur->bc_private.a.agno;
xfs_agblock_t bno; xfs_agblock_t bno;
xfs_extlen_t len; xfs_extlen_t len;
xfs_nlink_t refcount; xfs_nlink_t refcount;
bool has_cowflag; bool has_cowflag;
int error = 0; int error = 0;
bno = be32_to_cpu(rec->refc.rc_startblock); bno = be32_to_cpu(rec->refc.rc_startblock);
len = be32_to_cpu(rec->refc.rc_blockcount); len = be32_to_cpu(rec->refc.rc_blockcount);
...@@ -383,12 +383,12 @@ xchk_refcountbt_rec( ...@@ -383,12 +383,12 @@ xchk_refcountbt_rec(
STATIC void STATIC void
xchk_refcount_xref_rmap( xchk_refcount_xref_rmap(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_owner_info *oinfo, struct xfs_owner_info *oinfo,
xfs_filblks_t cow_blocks) xfs_filblks_t cow_blocks)
{ {
xfs_extlen_t refcbt_blocks = 0; xfs_extlen_t refcbt_blocks = 0;
xfs_filblks_t blocks; xfs_filblks_t blocks;
int error; int error;
if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm))
return; return;
...@@ -419,9 +419,9 @@ int ...@@ -419,9 +419,9 @@ int
xchk_refcountbt( xchk_refcountbt(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
xfs_agblock_t cow_blocks = 0; xfs_agblock_t cow_blocks = 0;
int error; int error;
xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_REFC); xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_REFC);
error = xchk_btree(sc, sc->sa.refc_cur, xchk_refcountbt_rec, error = xchk_btree(sc, sc->sa.refc_cur, xchk_refcountbt_rec,
...@@ -437,7 +437,7 @@ xchk_refcountbt( ...@@ -437,7 +437,7 @@ xchk_refcountbt(
/* xref check that a cow staging extent is marked in the refcountbt. */ /* xref check that a cow staging extent is marked in the refcountbt. */
void void
xchk_xref_is_cow_staging( xchk_xref_is_cow_staging(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
...@@ -484,11 +484,11 @@ xchk_xref_is_cow_staging( ...@@ -484,11 +484,11 @@ xchk_xref_is_cow_staging(
void void
xchk_xref_is_not_shared( xchk_xref_is_not_shared(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
bool shared; bool shared;
int error; int error;
if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm)) if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm))
return; return;
......
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
*/ */
int int
xrep_attempt( xrep_attempt(
struct xfs_inode *ip, struct xfs_inode *ip,
struct xfs_scrub *sc, struct xfs_scrub *sc,
bool *fixed) bool *fixed)
{ {
int error = 0; int error = 0;
trace_xrep_attempt(ip, sc->sm, error); trace_xrep_attempt(ip, sc->sm, error);
...@@ -94,7 +94,7 @@ xrep_attempt( ...@@ -94,7 +94,7 @@ xrep_attempt(
*/ */
void void
xrep_failure( xrep_failure(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
xfs_alert_ratelimited(mp, xfs_alert_ratelimited(mp,
"Corruption not fixed during online repair. Unmount and run xfs_repair."); "Corruption not fixed during online repair. Unmount and run xfs_repair.");
...@@ -108,7 +108,7 @@ int ...@@ -108,7 +108,7 @@ int
xrep_probe( xrep_probe(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
int error = 0; int error = 0;
if (xchk_should_terminate(sc, &error)) if (xchk_should_terminate(sc, &error))
return error; return error;
...@@ -124,7 +124,7 @@ int ...@@ -124,7 +124,7 @@ int
xrep_roll_ag_trans( xrep_roll_ag_trans(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
int error; int error;
/* Keep the AG header buffers locked so we can keep going. */ /* Keep the AG header buffers locked so we can keep going. */
xfs_trans_bhold(sc->tp, sc->sa.agi_bp); xfs_trans_bhold(sc->tp, sc->sa.agi_bp);
...@@ -163,9 +163,9 @@ xrep_roll_ag_trans( ...@@ -163,9 +163,9 @@ xrep_roll_ag_trans(
*/ */
bool bool
xrep_ag_has_space( xrep_ag_has_space(
struct xfs_perag *pag, struct xfs_perag *pag,
xfs_extlen_t nr_blocks, xfs_extlen_t nr_blocks,
enum xfs_ag_resv_type type) enum xfs_ag_resv_type type)
{ {
return !xfs_ag_resv_critical(pag, XFS_AG_RESV_RMAPBT) && return !xfs_ag_resv_critical(pag, XFS_AG_RESV_RMAPBT) &&
!xfs_ag_resv_critical(pag, XFS_AG_RESV_METADATA) && !xfs_ag_resv_critical(pag, XFS_AG_RESV_METADATA) &&
...@@ -179,7 +179,7 @@ xrep_ag_has_space( ...@@ -179,7 +179,7 @@ xrep_ag_has_space(
*/ */
xfs_extlen_t xfs_extlen_t
xrep_calc_ag_resblks( xrep_calc_ag_resblks(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_scrub_metadata *sm = sc->sm; struct xfs_scrub_metadata *sm = sc->sm;
...@@ -280,13 +280,13 @@ xrep_calc_ag_resblks( ...@@ -280,13 +280,13 @@ xrep_calc_ag_resblks(
int int
xrep_alloc_ag_block( xrep_alloc_ag_block(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_owner_info *oinfo, struct xfs_owner_info *oinfo,
xfs_fsblock_t *fsbno, xfs_fsblock_t *fsbno,
enum xfs_ag_resv_type resv) enum xfs_ag_resv_type resv)
{ {
struct xfs_alloc_arg args = {0}; struct xfs_alloc_arg args = {0};
xfs_agblock_t bno; xfs_agblock_t bno;
int error; int error;
switch (resv) { switch (resv) {
case XFS_AG_RESV_AGFL: case XFS_AG_RESV_AGFL:
...@@ -330,7 +330,7 @@ xrep_alloc_ag_block( ...@@ -330,7 +330,7 @@ xrep_alloc_ag_block(
/* Initialize a new AG btree root block with zero entries. */ /* Initialize a new AG btree root block with zero entries. */
int int
xrep_init_btblock( xrep_init_btblock(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_fsblock_t fsb, xfs_fsblock_t fsb,
struct xfs_buf **bpp, struct xfs_buf **bpp,
xfs_btnum_t btnum, xfs_btnum_t btnum,
...@@ -386,11 +386,11 @@ xrep_init_btblock( ...@@ -386,11 +386,11 @@ xrep_init_btblock(
int int
xrep_collect_btree_extent( xrep_collect_btree_extent(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xrep_extent_list *exlist, struct xrep_extent_list *exlist,
xfs_fsblock_t fsbno, xfs_fsblock_t fsbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
struct xrep_extent *rex; struct xrep_extent *rex;
trace_xrep_collect_btree_extent(sc->mp, trace_xrep_collect_btree_extent(sc->mp,
XFS_FSB_TO_AGNO(sc->mp, fsbno), XFS_FSB_TO_AGNO(sc->mp, fsbno),
...@@ -416,10 +416,10 @@ xrep_collect_btree_extent( ...@@ -416,10 +416,10 @@ xrep_collect_btree_extent(
void void
xrep_cancel_btree_extents( xrep_cancel_btree_extents(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xrep_extent_list *exlist) struct xrep_extent_list *exlist)
{ {
struct xrep_extent *rex; struct xrep_extent *rex;
struct xrep_extent *n; struct xrep_extent *n;
for_each_xrep_extent_safe(rex, n, exlist) { for_each_xrep_extent_safe(rex, n, exlist) {
list_del(&rex->list); list_del(&rex->list);
...@@ -430,12 +430,12 @@ xrep_cancel_btree_extents( ...@@ -430,12 +430,12 @@ xrep_cancel_btree_extents(
/* Compare two btree extents. */ /* Compare two btree extents. */
static int static int
xrep_btree_extent_cmp( xrep_btree_extent_cmp(
void *priv, void *priv,
struct list_head *a, struct list_head *a,
struct list_head *b) struct list_head *b)
{ {
struct xrep_extent *ap; struct xrep_extent *ap;
struct xrep_extent *bp; struct xrep_extent *bp;
ap = container_of(a, struct xrep_extent, list); ap = container_of(a, struct xrep_extent, list);
bp = container_of(b, struct xrep_extent, list); bp = container_of(b, struct xrep_extent, list);
...@@ -464,17 +464,17 @@ xrep_btree_extent_cmp( ...@@ -464,17 +464,17 @@ xrep_btree_extent_cmp(
int int
xrep_subtract_extents( xrep_subtract_extents(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xrep_extent_list *exlist, struct xrep_extent_list *exlist,
struct xrep_extent_list *sublist) struct xrep_extent_list *sublist)
{ {
struct list_head *lp; struct list_head *lp;
struct xrep_extent *ex; struct xrep_extent *ex;
struct xrep_extent *newex; struct xrep_extent *newex;
struct xrep_extent *subex; struct xrep_extent *subex;
xfs_fsblock_t sub_fsb; xfs_fsblock_t sub_fsb;
xfs_extlen_t sub_len; xfs_extlen_t sub_len;
int state; int state;
int error = 0; int error = 0;
if (list_empty(&exlist->list) || list_empty(&sublist->list)) if (list_empty(&exlist->list) || list_empty(&sublist->list))
return 0; return 0;
...@@ -621,13 +621,13 @@ xrep_subtract_extents( ...@@ -621,13 +621,13 @@ xrep_subtract_extents(
int int
xrep_invalidate_blocks( xrep_invalidate_blocks(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xrep_extent_list *exlist) struct xrep_extent_list *exlist)
{ {
struct xrep_extent *rex; struct xrep_extent *rex;
struct xrep_extent *n; struct xrep_extent *n;
struct xfs_buf *bp; struct xfs_buf *bp;
xfs_fsblock_t fsbno; xfs_fsblock_t fsbno;
xfs_agblock_t i; xfs_agblock_t i;
/* /*
* For each block in each extent, see if there's an incore buffer for * For each block in each extent, see if there's an incore buffer for
...@@ -659,9 +659,9 @@ xrep_invalidate_blocks( ...@@ -659,9 +659,9 @@ xrep_invalidate_blocks(
int int
xrep_fix_freelist( xrep_fix_freelist(
struct xfs_scrub *sc, struct xfs_scrub *sc,
bool can_shrink) bool can_shrink)
{ {
struct xfs_alloc_arg args = {0}; struct xfs_alloc_arg args = {0};
args.mp = sc->mp; args.mp = sc->mp;
args.tp = sc->tp; args.tp = sc->tp;
...@@ -679,10 +679,10 @@ xrep_fix_freelist( ...@@ -679,10 +679,10 @@ xrep_fix_freelist(
STATIC int STATIC int
xrep_put_freelist( xrep_put_freelist(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t agbno) xfs_agblock_t agbno)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
int error; int error;
/* Make sure there's space on the freelist. */ /* Make sure there's space on the freelist. */
error = xrep_fix_freelist(sc, true); error = xrep_fix_freelist(sc, true);
...@@ -715,16 +715,16 @@ xrep_put_freelist( ...@@ -715,16 +715,16 @@ xrep_put_freelist(
STATIC int STATIC int
xrep_dispose_btree_block( xrep_dispose_btree_block(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_fsblock_t fsbno, xfs_fsblock_t fsbno,
struct xfs_owner_info *oinfo, struct xfs_owner_info *oinfo,
enum xfs_ag_resv_type resv) enum xfs_ag_resv_type resv)
{ {
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
struct xfs_buf *agf_bp = NULL; struct xfs_buf *agf_bp = NULL;
xfs_agnumber_t agno; xfs_agnumber_t agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
bool has_other_rmap; bool has_other_rmap;
int error; int error;
agno = XFS_FSB_TO_AGNO(sc->mp, fsbno); agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
agbno = XFS_FSB_TO_AGBNO(sc->mp, fsbno); agbno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
...@@ -789,13 +789,13 @@ xrep_dispose_btree_block( ...@@ -789,13 +789,13 @@ xrep_dispose_btree_block(
int int
xrep_reap_btree_extents( xrep_reap_btree_extents(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xrep_extent_list *exlist, struct xrep_extent_list *exlist,
struct xfs_owner_info *oinfo, struct xfs_owner_info *oinfo,
enum xfs_ag_resv_type type) enum xfs_ag_resv_type type)
{ {
struct xrep_extent *rex; struct xrep_extent *rex;
struct xrep_extent *n; struct xrep_extent *n;
int error = 0; int error = 0;
ASSERT(xfs_sb_version_hasrmapbt(&sc->mp->m_sb)); ASSERT(xfs_sb_version_hasrmapbt(&sc->mp->m_sb));
...@@ -851,7 +851,7 @@ xrep_reap_btree_extents( ...@@ -851,7 +851,7 @@ xrep_reap_btree_extents(
*/ */
struct xrep_findroot { struct xrep_findroot {
struct xfs_scrub *sc; struct xfs_scrub *sc;
struct xfs_buf *agfl_bp; struct xfs_buf *agfl_bp;
struct xfs_agf *agf; struct xfs_agf *agf;
struct xrep_find_ag_btree *btree_info; struct xrep_find_ag_btree *btree_info;
...@@ -860,11 +860,11 @@ struct xrep_findroot { ...@@ -860,11 +860,11 @@ struct xrep_findroot {
/* See if our block is in the AGFL. */ /* See if our block is in the AGFL. */
STATIC int STATIC int
xrep_findroot_agfl_walk( xrep_findroot_agfl_walk(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_agblock_t bno, xfs_agblock_t bno,
void *priv) void *priv)
{ {
xfs_agblock_t *agbno = priv; xfs_agblock_t *agbno = priv;
return (*agbno == bno) ? XFS_BTREE_QUERY_RANGE_ABORT : 0; return (*agbno == bno) ? XFS_BTREE_QUERY_RANGE_ABORT : 0;
} }
...@@ -981,7 +981,7 @@ xrep_findroot_rmap( ...@@ -981,7 +981,7 @@ xrep_findroot_rmap(
/* Find the roots of the per-AG btrees described in btree_info. */ /* Find the roots of the per-AG btrees described in btree_info. */
int int
xrep_find_ag_btree_roots( xrep_find_ag_btree_roots(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_buf *agf_bp, struct xfs_buf *agf_bp,
struct xrep_find_ag_btree *btree_info, struct xrep_find_ag_btree *btree_info,
struct xfs_buf *agfl_bp) struct xfs_buf *agfl_bp)
...@@ -1017,9 +1017,9 @@ xrep_find_ag_btree_roots( ...@@ -1017,9 +1017,9 @@ xrep_find_ag_btree_roots(
void void
xrep_force_quotacheck( xrep_force_quotacheck(
struct xfs_scrub *sc, struct xfs_scrub *sc,
uint dqtype) uint dqtype)
{ {
uint flag; uint flag;
flag = xfs_quota_chkd_flag(dqtype); flag = xfs_quota_chkd_flag(dqtype);
if (!(flag & sc->mp->m_qflags)) if (!(flag & sc->mp->m_qflags))
...@@ -1046,7 +1046,7 @@ int ...@@ -1046,7 +1046,7 @@ int
xrep_ino_dqattach( xrep_ino_dqattach(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
int error; int error;
error = xfs_qm_dqattach_locked(sc->ip, false); error = xfs_qm_dqattach_locked(sc->ip, false);
switch (error) { switch (error) {
......
...@@ -15,33 +15,31 @@ static inline int xrep_notsupported(struct xfs_scrub *sc) ...@@ -15,33 +15,31 @@ static inline int xrep_notsupported(struct xfs_scrub *sc)
/* Repair helpers */ /* Repair helpers */
int xrep_attempt(struct xfs_inode *ip, struct xfs_scrub *sc, int xrep_attempt(struct xfs_inode *ip, struct xfs_scrub *sc, bool *fixed);
bool *fixed);
void xrep_failure(struct xfs_mount *mp); void xrep_failure(struct xfs_mount *mp);
int xrep_roll_ag_trans(struct xfs_scrub *sc); int xrep_roll_ag_trans(struct xfs_scrub *sc);
bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks, bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks,
enum xfs_ag_resv_type type); enum xfs_ag_resv_type type);
xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc); xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc);
int xrep_alloc_ag_block(struct xfs_scrub *sc, int xrep_alloc_ag_block(struct xfs_scrub *sc, struct xfs_owner_info *oinfo,
struct xfs_owner_info *oinfo, xfs_fsblock_t *fsbno, xfs_fsblock_t *fsbno, enum xfs_ag_resv_type resv);
enum xfs_ag_resv_type resv);
int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb, int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb,
struct xfs_buf **bpp, xfs_btnum_t btnum, struct xfs_buf **bpp, xfs_btnum_t btnum,
const struct xfs_buf_ops *ops); const struct xfs_buf_ops *ops);
struct xrep_extent { struct xrep_extent {
struct list_head list; struct list_head list;
xfs_fsblock_t fsbno; xfs_fsblock_t fsbno;
xfs_extlen_t len; xfs_extlen_t len;
}; };
struct xrep_extent_list { struct xrep_extent_list {
struct list_head list; struct list_head list;
}; };
static inline void static inline void
xrep_init_extent_list( xrep_init_extent_list(
struct xrep_extent_list *exlist) struct xrep_extent_list *exlist)
{ {
INIT_LIST_HEAD(&exlist->list); INIT_LIST_HEAD(&exlist->list);
} }
...@@ -78,10 +76,8 @@ struct xrep_find_ag_btree { ...@@ -78,10 +76,8 @@ struct xrep_find_ag_btree {
unsigned int height; unsigned int height;
}; };
int xrep_find_ag_btree_roots(struct xfs_scrub *sc, int xrep_find_ag_btree_roots(struct xfs_scrub *sc, struct xfs_buf *agf_bp,
struct xfs_buf *agf_bp, struct xrep_find_ag_btree *btree_info, struct xfs_buf *agfl_bp);
struct xrep_find_ag_btree *btree_info,
struct xfs_buf *agfl_bp);
void xrep_force_quotacheck(struct xfs_scrub *sc, uint dqtype); void xrep_force_quotacheck(struct xfs_scrub *sc, uint dqtype);
int xrep_ino_dqattach(struct xfs_scrub *sc); int xrep_ino_dqattach(struct xfs_scrub *sc);
...@@ -93,9 +89,9 @@ int xrep_superblock(struct xfs_scrub *sc); ...@@ -93,9 +89,9 @@ int xrep_superblock(struct xfs_scrub *sc);
#else #else
static inline int xrep_attempt( static inline int xrep_attempt(
struct xfs_inode *ip, struct xfs_inode *ip,
struct xfs_scrub *sc, struct xfs_scrub *sc,
bool *fixed) bool *fixed)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
int int
xchk_setup_ag_rmapbt( xchk_setup_ag_rmapbt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
return xchk_setup_ag_btree(sc, ip, false); return xchk_setup_ag_btree(sc, ip, false);
} }
...@@ -42,15 +42,15 @@ xchk_setup_ag_rmapbt( ...@@ -42,15 +42,15 @@ xchk_setup_ag_rmapbt(
STATIC void STATIC void
xchk_rmapbt_xref_refc( xchk_rmapbt_xref_refc(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_rmap_irec *irec) struct xfs_rmap_irec *irec)
{ {
xfs_agblock_t fbno; xfs_agblock_t fbno;
xfs_extlen_t flen; xfs_extlen_t flen;
bool non_inode; bool non_inode;
bool is_bmbt; bool is_bmbt;
bool is_attr; bool is_attr;
bool is_unwritten; bool is_unwritten;
int error; int error;
if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm)) if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm))
return; return;
...@@ -73,10 +73,10 @@ xchk_rmapbt_xref_refc( ...@@ -73,10 +73,10 @@ xchk_rmapbt_xref_refc(
STATIC void STATIC void
xchk_rmapbt_xref( xchk_rmapbt_xref(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_rmap_irec *irec) struct xfs_rmap_irec *irec)
{ {
xfs_agblock_t agbno = irec->rm_startblock; xfs_agblock_t agbno = irec->rm_startblock;
xfs_extlen_t len = irec->rm_blockcount; xfs_extlen_t len = irec->rm_blockcount;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
return; return;
...@@ -96,17 +96,17 @@ xchk_rmapbt_xref( ...@@ -96,17 +96,17 @@ xchk_rmapbt_xref(
/* Scrub an rmapbt record. */ /* Scrub an rmapbt record. */
STATIC int STATIC int
xchk_rmapbt_rec( xchk_rmapbt_rec(
struct xchk_btree *bs, struct xchk_btree *bs,
union xfs_btree_rec *rec) union xfs_btree_rec *rec)
{ {
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
struct xfs_rmap_irec irec; struct xfs_rmap_irec irec;
xfs_agnumber_t agno = bs->cur->bc_private.a.agno; xfs_agnumber_t agno = bs->cur->bc_private.a.agno;
bool non_inode; bool non_inode;
bool is_unwritten; bool is_unwritten;
bool is_bmbt; bool is_bmbt;
bool is_attr; bool is_attr;
int error; int error;
error = xfs_rmap_btrec_to_irec(rec, &irec); error = xfs_rmap_btrec_to_irec(rec, &irec);
if (!xchk_btree_process_error(bs->sc, bs->cur, 0, &error)) if (!xchk_btree_process_error(bs->sc, bs->cur, 0, &error))
...@@ -174,7 +174,7 @@ int ...@@ -174,7 +174,7 @@ int
xchk_rmapbt( xchk_rmapbt(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_owner_info oinfo; struct xfs_owner_info oinfo;
xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG); xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG);
return xchk_btree(sc, sc->sa.rmap_cur, xchk_rmapbt_rec, return xchk_btree(sc, sc->sa.rmap_cur, xchk_rmapbt_rec,
...@@ -185,13 +185,13 @@ xchk_rmapbt( ...@@ -185,13 +185,13 @@ xchk_rmapbt(
static inline void static inline void
xchk_xref_check_owner( xchk_xref_check_owner(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t bno, xfs_agblock_t bno,
xfs_extlen_t len, xfs_extlen_t len,
struct xfs_owner_info *oinfo, struct xfs_owner_info *oinfo,
bool should_have_rmap) bool should_have_rmap)
{ {
bool has_rmap; bool has_rmap;
int error; int error;
if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm))
return; return;
...@@ -208,9 +208,9 @@ xchk_xref_check_owner( ...@@ -208,9 +208,9 @@ xchk_xref_check_owner(
void void
xchk_xref_is_owned_by( xchk_xref_is_owned_by(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t bno, xfs_agblock_t bno,
xfs_extlen_t len, xfs_extlen_t len,
struct xfs_owner_info *oinfo) struct xfs_owner_info *oinfo)
{ {
xchk_xref_check_owner(sc, bno, len, oinfo, true); xchk_xref_check_owner(sc, bno, len, oinfo, true);
} }
...@@ -219,9 +219,9 @@ xchk_xref_is_owned_by( ...@@ -219,9 +219,9 @@ xchk_xref_is_owned_by(
void void
xchk_xref_is_not_owned_by( xchk_xref_is_not_owned_by(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t bno, xfs_agblock_t bno,
xfs_extlen_t len, xfs_extlen_t len,
struct xfs_owner_info *oinfo) struct xfs_owner_info *oinfo)
{ {
xchk_xref_check_owner(sc, bno, len, oinfo, false); xchk_xref_check_owner(sc, bno, len, oinfo, false);
} }
...@@ -230,11 +230,11 @@ xchk_xref_is_not_owned_by( ...@@ -230,11 +230,11 @@ xchk_xref_is_not_owned_by(
void void
xchk_xref_has_no_owner( xchk_xref_has_no_owner(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_agblock_t bno, xfs_agblock_t bno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
bool has_rmap; bool has_rmap;
int error; int error;
if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm))
return; return;
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
int int
xchk_setup_rt( xchk_setup_rt(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
int error; int error;
error = xchk_setup_fs(sc, ip); error = xchk_setup_fs(sc, ip);
if (error) if (error)
...@@ -47,13 +47,13 @@ xchk_setup_rt( ...@@ -47,13 +47,13 @@ xchk_setup_rt(
/* Scrub a free extent record from the realtime bitmap. */ /* Scrub a free extent record from the realtime bitmap. */
STATIC int STATIC int
xchk_rtbitmap_rec( xchk_rtbitmap_rec(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_rtalloc_rec *rec, struct xfs_rtalloc_rec *rec,
void *priv) void *priv)
{ {
struct xfs_scrub *sc = priv; struct xfs_scrub *sc = priv;
xfs_rtblock_t startblock; xfs_rtblock_t startblock;
xfs_rtblock_t blockcount; xfs_rtblock_t blockcount;
startblock = rec->ar_startext * tp->t_mountp->m_sb.sb_rextsize; startblock = rec->ar_startext * tp->t_mountp->m_sb.sb_rextsize;
blockcount = rec->ar_extcount * tp->t_mountp->m_sb.sb_rextsize; blockcount = rec->ar_extcount * tp->t_mountp->m_sb.sb_rextsize;
...@@ -70,7 +70,7 @@ int ...@@ -70,7 +70,7 @@ int
xchk_rtbitmap( xchk_rtbitmap(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
int error; int error;
/* Invoke the fork scrubber. */ /* Invoke the fork scrubber. */
error = xchk_metadata_inode_forks(sc); error = xchk_metadata_inode_forks(sc);
...@@ -90,10 +90,10 @@ int ...@@ -90,10 +90,10 @@ int
xchk_rtsummary( xchk_rtsummary(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_inode *rsumip = sc->mp->m_rsumip; struct xfs_inode *rsumip = sc->mp->m_rsumip;
struct xfs_inode *old_ip = sc->ip; struct xfs_inode *old_ip = sc->ip;
uint old_ilock_flags = sc->ilock_flags; uint old_ilock_flags = sc->ilock_flags;
int error = 0; int error = 0;
/* /*
* We ILOCK'd the rt bitmap ip in the setup routine, now lock the * We ILOCK'd the rt bitmap ip in the setup routine, now lock the
...@@ -126,14 +126,14 @@ xchk_rtsummary( ...@@ -126,14 +126,14 @@ xchk_rtsummary(
void void
xchk_xref_is_used_rt_space( xchk_xref_is_used_rt_space(
struct xfs_scrub *sc, struct xfs_scrub *sc,
xfs_rtblock_t fsbno, xfs_rtblock_t fsbno,
xfs_extlen_t len) xfs_extlen_t len)
{ {
xfs_rtblock_t startext; xfs_rtblock_t startext;
xfs_rtblock_t endext; xfs_rtblock_t endext;
xfs_rtblock_t extcount; xfs_rtblock_t extcount;
bool is_free; bool is_free;
int error; int error;
if (xchk_skip_xref(sc->sm)) if (xchk_skip_xref(sc->sm))
return; return;
......
...@@ -153,7 +153,7 @@ static int ...@@ -153,7 +153,7 @@ static int
xchk_probe( xchk_probe(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
int error = 0; int error = 0;
if (xchk_should_terminate(sc, &error)) if (xchk_should_terminate(sc, &error))
return error; return error;
...@@ -167,8 +167,8 @@ xchk_probe( ...@@ -167,8 +167,8 @@ xchk_probe(
STATIC int STATIC int
xchk_teardown( xchk_teardown(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip_in, struct xfs_inode *ip_in,
int error) int error)
{ {
xchk_ag_free(sc, &sc->sa); xchk_ag_free(sc, &sc->sa);
if (sc->tp) { if (sc->tp) {
...@@ -479,7 +479,7 @@ xfs_scrub_metadata( ...@@ -479,7 +479,7 @@ xfs_scrub_metadata(
struct xfs_inode *ip, struct xfs_inode *ip,
struct xfs_scrub_metadata *sm) struct xfs_scrub_metadata *sm)
{ {
struct xfs_scrub sc; struct xfs_scrub sc;
struct xfs_mount *mp = ip->i_mount; struct xfs_mount *mp = ip->i_mount;
bool try_harder = false; bool try_harder = false;
bool already_fixed = false; bool already_fixed = false;
......
...@@ -36,21 +36,21 @@ struct xchk_meta_ops { ...@@ -36,21 +36,21 @@ struct xchk_meta_ops {
/* Buffer pointers and btree cursors for an entire AG. */ /* Buffer pointers and btree cursors for an entire AG. */
struct xchk_ag { struct xchk_ag {
xfs_agnumber_t agno; xfs_agnumber_t agno;
struct xfs_perag *pag; struct xfs_perag *pag;
/* AG btree roots */ /* AG btree roots */
struct xfs_buf *agf_bp; struct xfs_buf *agf_bp;
struct xfs_buf *agfl_bp; struct xfs_buf *agfl_bp;
struct xfs_buf *agi_bp; struct xfs_buf *agi_bp;
/* AG btrees */ /* AG btrees */
struct xfs_btree_cur *bno_cur; struct xfs_btree_cur *bno_cur;
struct xfs_btree_cur *cnt_cur; struct xfs_btree_cur *cnt_cur;
struct xfs_btree_cur *ino_cur; struct xfs_btree_cur *ino_cur;
struct xfs_btree_cur *fino_cur; struct xfs_btree_cur *fino_cur;
struct xfs_btree_cur *rmap_cur; struct xfs_btree_cur *rmap_cur;
struct xfs_btree_cur *refc_cur; struct xfs_btree_cur *refc_cur;
}; };
struct xfs_scrub { struct xfs_scrub {
...@@ -66,7 +66,7 @@ struct xfs_scrub { ...@@ -66,7 +66,7 @@ struct xfs_scrub {
bool has_quotaofflock; bool has_quotaofflock;
/* State tracking for single-AG operations. */ /* State tracking for single-AG operations. */
struct xchk_ag sa; struct xchk_ag sa;
}; };
/* Metadata scrubbers */ /* Metadata scrubbers */
...@@ -115,27 +115,25 @@ xchk_quota(struct xfs_scrub *sc) ...@@ -115,27 +115,25 @@ xchk_quota(struct xfs_scrub *sc)
#endif #endif
/* cross-referencing helpers */ /* cross-referencing helpers */
void xchk_xref_is_used_space(struct xfs_scrub *sc, void xchk_xref_is_used_space(struct xfs_scrub *sc, xfs_agblock_t agbno,
xfs_agblock_t agbno, xfs_extlen_t len); xfs_extlen_t len);
void xchk_xref_is_not_inode_chunk(struct xfs_scrub *sc, void xchk_xref_is_not_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno,
xfs_agblock_t agbno, xfs_extlen_t len); xfs_extlen_t len);
void xchk_xref_is_inode_chunk(struct xfs_scrub *sc, void xchk_xref_is_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno,
xfs_agblock_t agbno, xfs_extlen_t len); xfs_extlen_t len);
void xchk_xref_is_owned_by(struct xfs_scrub *sc, void xchk_xref_is_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno,
xfs_agblock_t agbno, xfs_extlen_t len, xfs_extlen_t len, struct xfs_owner_info *oinfo);
struct xfs_owner_info *oinfo); void xchk_xref_is_not_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno,
void xchk_xref_is_not_owned_by(struct xfs_scrub *sc, xfs_extlen_t len, struct xfs_owner_info *oinfo);
xfs_agblock_t agbno, xfs_extlen_t len, void xchk_xref_has_no_owner(struct xfs_scrub *sc, xfs_agblock_t agbno,
struct xfs_owner_info *oinfo); xfs_extlen_t len);
void xchk_xref_has_no_owner(struct xfs_scrub *sc, void xchk_xref_is_cow_staging(struct xfs_scrub *sc, xfs_agblock_t bno,
xfs_agblock_t agbno, xfs_extlen_t len); xfs_extlen_t len);
void xchk_xref_is_cow_staging(struct xfs_scrub *sc, void xchk_xref_is_not_shared(struct xfs_scrub *sc, xfs_agblock_t bno,
xfs_agblock_t bno, xfs_extlen_t len); xfs_extlen_t len);
void xchk_xref_is_not_shared(struct xfs_scrub *sc,
xfs_agblock_t bno, xfs_extlen_t len);
#ifdef CONFIG_XFS_RT #ifdef CONFIG_XFS_RT
void xchk_xref_is_used_rt_space(struct xfs_scrub *sc, void xchk_xref_is_used_rt_space(struct xfs_scrub *sc, xfs_rtblock_t rtbno,
xfs_rtblock_t rtbno, xfs_extlen_t len); xfs_extlen_t len);
#else #else
# define xchk_xref_is_used_rt_space(sc, rtbno, len) do { } while (0) # define xchk_xref_is_used_rt_space(sc, rtbno, len) do { } while (0)
#endif #endif
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
int int
xchk_setup_symlink( xchk_setup_symlink(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
/* Allocate the buffer without the inode lock held. */ /* Allocate the buffer without the inode lock held. */
sc->buf = kmem_zalloc_large(XFS_SYMLINK_MAXLEN + 1, KM_SLEEP); sc->buf = kmem_zalloc_large(XFS_SYMLINK_MAXLEN + 1, KM_SLEEP);
...@@ -43,10 +43,10 @@ int ...@@ -43,10 +43,10 @@ int
xchk_symlink( xchk_symlink(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xfs_inode *ip = sc->ip; struct xfs_inode *ip = sc->ip;
struct xfs_ifork *ifp; struct xfs_ifork *ifp;
loff_t len; loff_t len;
int error = 0; int error = 0;
if (!S_ISLNK(VFS_I(ip)->i_mode)) if (!S_ISLNK(VFS_I(ip)->i_mode))
return -ENOENT; return -ENOENT;
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
/* Figure out which block the btree cursor was pointing to. */ /* Figure out which block the btree cursor was pointing to. */
static inline xfs_fsblock_t static inline xfs_fsblock_t
xchk_btree_cur_fsbno( xchk_btree_cur_fsbno(
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
int level) int level)
{ {
if (level < cur->bc_nlevels && cur->bc_bufs[level]) if (level < cur->bc_nlevels && cur->bc_bufs[level])
return XFS_DADDR_TO_FSB(cur->bc_mp, cur->bc_bufs[level]->b_bn); return XFS_DADDR_TO_FSB(cur->bc_mp, cur->bc_bufs[level]->b_bn);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册