Skip to content

Commit 86a4641

Browse files
author
Darrick J. Wong
committed
xfs: cull repair code that will never get used
These two functions date from the era when I thought that we could rebuild btrees by creating an alternate root and adding records one by one. In other words, they predate the btree bulk loader. They're not necessary now, so remove them. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
1 parent d653290 commit 86a4641

3 files changed

Lines changed: 0 additions & 111 deletions

File tree

fs/xfs/scrub/repair.c

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -297,89 +297,6 @@ xrep_calc_ag_resblks(
297297
return max(max(bnobt_sz, inobt_sz), max(rmapbt_sz, refcbt_sz));
298298
}
299299

300-
/* Allocate a block in an AG. */
301-
int
302-
xrep_alloc_ag_block(
303-
struct xfs_scrub *sc,
304-
const struct xfs_owner_info *oinfo,
305-
xfs_fsblock_t *fsbno,
306-
enum xfs_ag_resv_type resv)
307-
{
308-
struct xfs_alloc_arg args = {0};
309-
xfs_agblock_t bno;
310-
int error;
311-
312-
switch (resv) {
313-
case XFS_AG_RESV_AGFL:
314-
case XFS_AG_RESV_RMAPBT:
315-
error = xfs_alloc_get_freelist(sc->sa.pag, sc->tp,
316-
sc->sa.agf_bp, &bno, 1);
317-
if (error)
318-
return error;
319-
if (bno == NULLAGBLOCK)
320-
return -ENOSPC;
321-
xfs_extent_busy_reuse(sc->mp, sc->sa.pag, bno, 1, false);
322-
*fsbno = XFS_AGB_TO_FSB(sc->mp, sc->sa.pag->pag_agno, bno);
323-
if (resv == XFS_AG_RESV_RMAPBT)
324-
xfs_ag_resv_rmapbt_alloc(sc->mp, sc->sa.pag->pag_agno);
325-
return 0;
326-
default:
327-
break;
328-
}
329-
330-
args.tp = sc->tp;
331-
args.mp = sc->mp;
332-
args.pag = sc->sa.pag;
333-
args.oinfo = *oinfo;
334-
args.minlen = 1;
335-
args.maxlen = 1;
336-
args.prod = 1;
337-
args.resv = resv;
338-
339-
error = xfs_alloc_vextent_this_ag(&args, sc->sa.pag->pag_agno);
340-
if (error)
341-
return error;
342-
if (args.fsbno == NULLFSBLOCK)
343-
return -ENOSPC;
344-
ASSERT(args.len == 1);
345-
*fsbno = args.fsbno;
346-
347-
return 0;
348-
}
349-
350-
/* Initialize a new AG btree root block with zero entries. */
351-
int
352-
xrep_init_btblock(
353-
struct xfs_scrub *sc,
354-
xfs_fsblock_t fsb,
355-
struct xfs_buf **bpp,
356-
xfs_btnum_t btnum,
357-
const struct xfs_buf_ops *ops)
358-
{
359-
struct xfs_trans *tp = sc->tp;
360-
struct xfs_mount *mp = sc->mp;
361-
struct xfs_buf *bp;
362-
int error;
363-
364-
trace_xrep_init_btblock(mp, XFS_FSB_TO_AGNO(mp, fsb),
365-
XFS_FSB_TO_AGBNO(mp, fsb), btnum);
366-
367-
ASSERT(XFS_FSB_TO_AGNO(mp, fsb) == sc->sa.pag->pag_agno);
368-
error = xfs_trans_get_buf(tp, mp->m_ddev_targp,
369-
XFS_FSB_TO_DADDR(mp, fsb), XFS_FSB_TO_BB(mp, 1), 0,
370-
&bp);
371-
if (error)
372-
return error;
373-
xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
374-
xfs_btree_init_block(mp, bp, btnum, 0, 0, sc->sa.pag->pag_agno);
375-
xfs_trans_buf_set_type(tp, bp, XFS_BLFT_BTREE_BUF);
376-
xfs_trans_log_buf(tp, bp, 0, BBTOB(bp->b_length) - 1);
377-
bp->b_ops = ops;
378-
*bpp = bp;
379-
380-
return 0;
381-
}
382-
383300
/*
384301
* Reconstructing per-AG Btrees
385302
*

fs/xfs/scrub/repair.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ int xrep_roll_ag_trans(struct xfs_scrub *sc);
2323
bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks,
2424
enum xfs_ag_resv_type type);
2525
xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc);
26-
int xrep_alloc_ag_block(struct xfs_scrub *sc,
27-
const struct xfs_owner_info *oinfo, xfs_fsblock_t *fsbno,
28-
enum xfs_ag_resv_type resv);
29-
int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb,
30-
struct xfs_buf **bpp, xfs_btnum_t btnum,
31-
const struct xfs_buf_ops *ops);
3226

3327
struct xbitmap;
3428
struct xagb_bitmap;

fs/xfs/scrub/trace.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -827,28 +827,6 @@ TRACE_EVENT(xrep_refcount_extent_fn,
827827
__entry->refcount)
828828
)
829829

830-
TRACE_EVENT(xrep_init_btblock,
831-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
832-
xfs_btnum_t btnum),
833-
TP_ARGS(mp, agno, agbno, btnum),
834-
TP_STRUCT__entry(
835-
__field(dev_t, dev)
836-
__field(xfs_agnumber_t, agno)
837-
__field(xfs_agblock_t, agbno)
838-
__field(uint32_t, btnum)
839-
),
840-
TP_fast_assign(
841-
__entry->dev = mp->m_super->s_dev;
842-
__entry->agno = agno;
843-
__entry->agbno = agbno;
844-
__entry->btnum = btnum;
845-
),
846-
TP_printk("dev %d:%d agno 0x%x agbno 0x%x btree %s",
847-
MAJOR(__entry->dev), MINOR(__entry->dev),
848-
__entry->agno,
849-
__entry->agbno,
850-
__print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS))
851-
)
852830
TRACE_EVENT(xrep_findroot_block,
853831
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
854832
uint32_t magic, uint16_t level),

0 commit comments

Comments
 (0)