diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-09-28 10:12:46 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-09 19:07:21 -0800 |
commit | 6a6e8bb180d14be6c2ae483a5b5a92aac048a3f0 (patch) | |
tree | 6354a364eee85b572dcc8deca27da149334bbb7b /fs/xfs/scrub/agheader_repair.c | |
parent | a9142e5a3fd3509bff13c705e15b71d3f5a4f68f (diff) |
xfs: convert xbitmap to interval treerepair-bitmap-rework_2022-11-09
Convert the xbitmap code to use interval trees instead of linked lists.
This reduces the amount of coding required to handle the disunion
operation and in the future will make it easier to set bits in arbitrary
order yet later be able to extract maximally sized extents, which we'll
need for rebuilding certain structures. We define our own interval tree
type so that it can deal with 64-bit indices even on 32-bit machines.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/agheader_repair.c')
-rw-r--r-- | fs/xfs/scrub/agheader_repair.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/xfs/scrub/agheader_repair.c b/fs/xfs/scrub/agheader_repair.c index 26bce2f12b09..c22dc71fdd82 100644 --- a/fs/xfs/scrub/agheader_repair.c +++ b/fs/xfs/scrub/agheader_repair.c @@ -662,7 +662,7 @@ xrep_agfl_fill( } /* Write out a totally new AGFL. */ -STATIC void +STATIC int xrep_agfl_init_header( struct xfs_scrub *sc, struct xfs_buf *agfl_bp, @@ -675,6 +675,7 @@ xrep_agfl_init_header( }; struct xfs_mount *mp = sc->mp; struct xfs_agfl *agfl; + int error; ASSERT(flcount <= xfs_agfl_size(mp)); @@ -696,12 +697,15 @@ xrep_agfl_init_header( xbitmap_init(&af.used_extents); af.agfl_bno = xfs_buf_to_agfl_bno(agfl_bp), xbitmap_walk(agfl_extents, xrep_agfl_fill, &af); - xbitmap_disunion(agfl_extents, &af.used_extents); + error = xbitmap_disunion(agfl_extents, &af.used_extents); + if (error) + return error; /* Write new AGFL to disk. */ xfs_trans_buf_set_type(sc->tp, agfl_bp, XFS_BLFT_AGFL_BUF); xfs_trans_log_buf(sc->tp, agfl_bp, 0, BBTOB(agfl_bp->b_length) - 1); xbitmap_destroy(&af.used_extents); + return 0; } /* Repair the AGFL. */ @@ -754,7 +758,9 @@ xrep_agfl( * buffers until we know that part works. */ xrep_agfl_update_agf(sc, agf_bp, flcount); - xrep_agfl_init_header(sc, agfl_bp, &agfl_extents, flcount); + error = xrep_agfl_init_header(sc, agfl_bp, &agfl_extents, flcount); + if (error) + goto err; /* * Ok, the AGFL should be ready to go now. Roll the transaction to |