linux/fs/xfs/scrub/orphanage.h

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2021-2024 Oracle.  All Rights Reserved.
 * Author: Darrick J. Wong <[email protected]>
 */
#ifndef __XFS_SCRUB_ORPHANAGE_H__
#define __XFS_SCRUB_ORPHANAGE_H__

#ifdef CONFIG_XFS_ONLINE_REPAIR
int xrep_orphanage_create(struct xfs_scrub *sc);

/*
 * If we're doing a repair, ensure that the orphanage exists and attach it to
 * the scrub context.
 */
static inline int
xrep_orphanage_try_create(
	struct xfs_scrub	*sc)
{}

int xrep_orphanage_iolock_two(struct xfs_scrub *sc);

void xrep_orphanage_ilock(struct xfs_scrub *sc, unsigned int ilock_flags);
bool xrep_orphanage_ilock_nowait(struct xfs_scrub *sc,
		unsigned int ilock_flags);
void xrep_orphanage_iunlock(struct xfs_scrub *sc, unsigned int ilock_flags);

void xrep_orphanage_rele(struct xfs_scrub *sc);

/* Information about a request to add a file to the orphanage. */
struct xrep_adoption {};

bool xrep_orphanage_can_adopt(struct xfs_scrub *sc);

int xrep_adoption_trans_alloc(struct xfs_scrub *sc,
		struct xrep_adoption *adopt);
int xrep_adoption_compute_name(struct xrep_adoption *adopt,
		struct xfs_name *xname);
int xrep_adoption_move(struct xrep_adoption *adopt);
int xrep_adoption_trans_roll(struct xrep_adoption *adopt);
#else
struct xrep_adoption { /* empty */ };
#define xrep_orphanage_rele
#endif /* CONFIG_XFS_ONLINE_REPAIR */

#endif /* __XFS_SCRUB_ORPHANAGE_H__ */