2023-04-11 18:59:56 -07:00
// SPDX-License-Identifier: GPL-2.0-or-later
2018-05-14 06:34:36 -07:00
/*
2023-04-11 18:59:57 -07:00
* Copyright ( C ) 2018 - 2023 Oracle . All Rights Reserved .
2023-04-11 18:59:56 -07:00
* Author : Darrick J . Wong < djwong @ kernel . org >
2018-05-14 06:34:36 -07:00
*/
# ifndef __XFS_SCRUB_REPAIR_H__
# define __XFS_SCRUB_REPAIR_H__
2020-07-15 17:53:43 -07:00
# include "xfs_quota_defs.h"
2018-07-19 12:29:12 -07:00
static inline int xrep_notsupported ( struct xfs_scrub * sc )
2018-05-14 06:34:36 -07:00
{
return - EOPNOTSUPP ;
}
# ifdef CONFIG_XFS_ONLINE_REPAIR
/* Repair helpers */
2021-04-07 17:59:39 -07:00
int xrep_attempt ( struct xfs_scrub * sc ) ;
2018-07-19 12:29:11 -07:00
void xrep_failure ( struct xfs_mount * mp ) ;
2018-07-19 12:29:12 -07:00
int xrep_roll_ag_trans ( struct xfs_scrub * sc ) ;
2018-07-19 12:29:11 -07:00
bool xrep_ag_has_space ( struct xfs_perag * pag , xfs_extlen_t nr_blocks ,
2018-05-29 22:18:08 -07:00
enum xfs_ag_resv_type type ) ;
2018-07-19 12:29:12 -07:00
xfs_extlen_t xrep_calc_ag_resblks ( struct xfs_scrub * sc ) ;
2018-12-12 08:46:23 -08:00
int xrep_alloc_ag_block ( struct xfs_scrub * sc ,
const struct xfs_owner_info * oinfo , xfs_fsblock_t * fsbno ,
enum xfs_ag_resv_type resv ) ;
2018-07-19 12:29:12 -07:00
int xrep_init_btblock ( struct xfs_scrub * sc , xfs_fsblock_t fsb ,
2018-05-29 22:18:09 -07:00
struct xfs_buf * * bpp , xfs_btnum_t btnum ,
const struct xfs_buf_ops * ops ) ;
2018-05-14 06:34:36 -07:00
2020-03-16 17:13:05 -07:00
struct xbitmap ;
2023-04-11 19:00:37 -07:00
struct xagb_bitmap ;
2018-05-29 22:18:09 -07:00
2018-07-19 12:29:12 -07:00
int xrep_fix_freelist ( struct xfs_scrub * sc , bool can_shrink ) ;
2020-03-16 17:13:05 -07:00
int xrep_invalidate_blocks ( struct xfs_scrub * sc , struct xbitmap * btlist ) ;
int xrep_reap_extents ( struct xfs_scrub * sc , struct xbitmap * exlist ,
2018-12-12 08:46:23 -08:00
const struct xfs_owner_info * oinfo , enum xfs_ag_resv_type type ) ;
2018-05-29 22:18:09 -07:00
2018-07-19 12:29:11 -07:00
struct xrep_find_ag_btree {
2018-05-29 22:18:10 -07:00
/* in: rmap owner of the btree we're looking for */
uint64_t rmap_owner ;
/* in: buffer ops */
const struct xfs_buf_ops * buf_ops ;
2021-09-16 12:21:56 -07:00
/* in: maximum btree height */
unsigned int maxlevels ;
2018-05-29 22:18:10 -07:00
/* out: the highest btree block found and the tree height */
xfs_agblock_t root ;
unsigned int height ;
} ;
2018-07-19 12:29:12 -07:00
int xrep_find_ag_btree_roots ( struct xfs_scrub * sc , struct xfs_buf * agf_bp ,
struct xrep_find_ag_btree * btree_info , struct xfs_buf * agfl_bp ) ;
2020-07-15 17:53:43 -07:00
void xrep_force_quotacheck ( struct xfs_scrub * sc , xfs_dqtype_t type ) ;
2018-07-19 12:29:12 -07:00
int xrep_ino_dqattach ( struct xfs_scrub * sc ) ;
2018-05-29 22:18:10 -07:00
2018-05-14 06:34:36 -07:00
/* Metadata repairers */
2018-07-19 12:29:12 -07:00
int xrep_probe ( struct xfs_scrub * sc ) ;
int xrep_superblock ( struct xfs_scrub * sc ) ;
2018-08-09 22:42:53 -07:00
int xrep_agf ( struct xfs_scrub * sc ) ;
2018-08-09 22:43:02 -07:00
int xrep_agfl ( struct xfs_scrub * sc ) ;
2018-08-09 22:43:04 -07:00
int xrep_agi ( struct xfs_scrub * sc ) ;
2018-05-14 06:34:36 -07:00
# else
2021-04-07 17:59:39 -07:00
static inline int
xrep_attempt (
2019-04-16 08:22:00 -07:00
struct xfs_scrub * sc )
2018-05-14 06:34:36 -07:00
{
return - EOPNOTSUPP ;
}
2018-07-19 12:29:11 -07:00
static inline void xrep_failure ( struct xfs_mount * mp ) { }
2018-05-14 06:34:36 -07:00
2018-05-29 22:18:08 -07:00
static inline xfs_extlen_t
2018-07-19 12:29:11 -07:00
xrep_calc_ag_resblks (
2018-07-19 12:29:12 -07:00
struct xfs_scrub * sc )
2018-05-29 22:18:08 -07:00
{
return 0 ;
}
2018-07-19 12:29:11 -07:00
# define xrep_probe xrep_notsupported
# define xrep_superblock xrep_notsupported
2018-08-09 22:42:53 -07:00
# define xrep_agf xrep_notsupported
2018-08-09 22:43:02 -07:00
# define xrep_agfl xrep_notsupported
2018-08-09 22:43:04 -07:00
# define xrep_agi xrep_notsupported
2018-05-14 06:34:36 -07:00
# endif /* CONFIG_XFS_ONLINE_REPAIR */
# endif /* __XFS_SCRUB_REPAIR_H__ */