cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

repair.h (2549B)


      1// SPDX-License-Identifier: GPL-2.0+
      2/*
      3 * Copyright (C) 2018 Oracle.  All Rights Reserved.
      4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
      5 */
      6#ifndef __XFS_SCRUB_REPAIR_H__
      7#define __XFS_SCRUB_REPAIR_H__
      8
      9#include "xfs_quota_defs.h"
     10
     11static inline int xrep_notsupported(struct xfs_scrub *sc)
     12{
     13	return -EOPNOTSUPP;
     14}
     15
     16#ifdef CONFIG_XFS_ONLINE_REPAIR
     17
     18/* Repair helpers */
     19
     20int xrep_attempt(struct xfs_scrub *sc);
     21void xrep_failure(struct xfs_mount *mp);
     22int xrep_roll_ag_trans(struct xfs_scrub *sc);
     23bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks,
     24		enum xfs_ag_resv_type type);
     25xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc);
     26int 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);
     29int 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);
     32
     33struct xbitmap;
     34
     35int xrep_fix_freelist(struct xfs_scrub *sc, bool can_shrink);
     36int xrep_invalidate_blocks(struct xfs_scrub *sc, struct xbitmap *btlist);
     37int xrep_reap_extents(struct xfs_scrub *sc, struct xbitmap *exlist,
     38		const struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type);
     39
     40struct xrep_find_ag_btree {
     41	/* in: rmap owner of the btree we're looking for */
     42	uint64_t			rmap_owner;
     43
     44	/* in: buffer ops */
     45	const struct xfs_buf_ops	*buf_ops;
     46
     47	/* in: maximum btree height */
     48	unsigned int			maxlevels;
     49
     50	/* out: the highest btree block found and the tree height */
     51	xfs_agblock_t			root;
     52	unsigned int			height;
     53};
     54
     55int xrep_find_ag_btree_roots(struct xfs_scrub *sc, struct xfs_buf *agf_bp,
     56		struct xrep_find_ag_btree *btree_info, struct xfs_buf *agfl_bp);
     57void xrep_force_quotacheck(struct xfs_scrub *sc, xfs_dqtype_t type);
     58int xrep_ino_dqattach(struct xfs_scrub *sc);
     59
     60/* Metadata repairers */
     61
     62int xrep_probe(struct xfs_scrub *sc);
     63int xrep_superblock(struct xfs_scrub *sc);
     64int xrep_agf(struct xfs_scrub *sc);
     65int xrep_agfl(struct xfs_scrub *sc);
     66int xrep_agi(struct xfs_scrub *sc);
     67
     68#else
     69
     70static inline int
     71xrep_attempt(
     72	struct xfs_scrub	*sc)
     73{
     74	return -EOPNOTSUPP;
     75}
     76
     77static inline void xrep_failure(struct xfs_mount *mp) {}
     78
     79static inline xfs_extlen_t
     80xrep_calc_ag_resblks(
     81	struct xfs_scrub	*sc)
     82{
     83	return 0;
     84}
     85
     86#define xrep_probe			xrep_notsupported
     87#define xrep_superblock			xrep_notsupported
     88#define xrep_agf			xrep_notsupported
     89#define xrep_agfl			xrep_notsupported
     90#define xrep_agi			xrep_notsupported
     91
     92#endif /* CONFIG_XFS_ONLINE_REPAIR */
     93
     94#endif	/* __XFS_SCRUB_REPAIR_H__ */