]> Git Repo - linux.git/blame - fs/xfs/scrub/newbt.h
xfs: repair free space btrees
[linux.git] / fs / xfs / scrub / newbt.h
CommitLineData
be408417
DW
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) 2022-2023 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <[email protected]>
5 */
6#ifndef __XFS_SCRUB_NEWBT_H__
7#define __XFS_SCRUB_NEWBT_H__
8
9struct xrep_newbt_resv {
10 /* Link to list of extents that we've reserved. */
11 struct list_head list;
12
13 struct xfs_perag *pag;
14
6bb9ea8e
DW
15 /* Auto-freeing this reservation if we don't commit. */
16 struct xfs_alloc_autoreap autoreap;
17
be408417
DW
18 /* AG block of the extent we reserved. */
19 xfs_agblock_t agbno;
20
21 /* Length of the reservation. */
22 xfs_extlen_t len;
23
24 /* How much of this reservation has been used. */
25 xfs_extlen_t used;
26};
27
28struct xrep_newbt {
29 struct xfs_scrub *sc;
30
31 /* List of extents that we've reserved. */
32 struct list_head resv_list;
33
34 /* Fake root for new btree. */
35 union {
36 struct xbtree_afakeroot afake;
37 struct xbtree_ifakeroot ifake;
38 };
39
40 /* rmap owner of these blocks */
41 struct xfs_owner_info oinfo;
42
43 /* btree geometry for the bulk loader */
44 struct xfs_btree_bload bload;
45
46 /* Allocation hint */
47 xfs_fsblock_t alloc_hint;
48
49 /* per-ag reservation type */
50 enum xfs_ag_resv_type resv;
51};
52
53void xrep_newbt_init_bare(struct xrep_newbt *xnr, struct xfs_scrub *sc);
54void xrep_newbt_init_ag(struct xrep_newbt *xnr, struct xfs_scrub *sc,
55 const struct xfs_owner_info *oinfo, xfs_fsblock_t alloc_hint,
56 enum xfs_ag_resv_type resv);
57int xrep_newbt_init_inode(struct xrep_newbt *xnr, struct xfs_scrub *sc,
58 int whichfork, const struct xfs_owner_info *oinfo);
59int xrep_newbt_alloc_blocks(struct xrep_newbt *xnr, uint64_t nr_blocks);
4bdfd7d1
DW
60int xrep_newbt_add_extent(struct xrep_newbt *xnr, struct xfs_perag *pag,
61 xfs_agblock_t agbno, xfs_extlen_t len);
be408417
DW
62void xrep_newbt_cancel(struct xrep_newbt *xnr);
63int xrep_newbt_commit(struct xrep_newbt *xnr);
64int xrep_newbt_claim_block(struct xfs_btree_cur *cur, struct xrep_newbt *xnr,
65 union xfs_btree_ptr *ptr);
4bdfd7d1 66unsigned int xrep_newbt_unused_blocks(struct xrep_newbt *xnr);
be408417
DW
67
68#endif /* __XFS_SCRUB_NEWBT_H__ */
This page took 0.046751 seconds and 4 git commands to generate.