linux/fs/xfs/scrub/reap.h
Darrick J. Wong 5befb047b9 xfs: add the ability to reap entire inode forks
In preparation for supporting repair of indexed file-based metadata
(such as realtime bitmaps, directories, and extended attribute data),
add a function to reap the old blocks after a metadata repair finishes.
IOWs, this is an elaborate bunmapi call that deals with crosslinked
blocks by unmapping them without freeing them, and also scans for incore
buffers to invalidate.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2024-04-15 14:58:49 -07:00

39 lines
1.2 KiB
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2022-2023 Oracle. All Rights Reserved.
* Author: Darrick J. Wong <djwong@kernel.org>
*/
#ifndef __XFS_SCRUB_REAP_H__
#define __XFS_SCRUB_REAP_H__
struct xagb_bitmap;
struct xfsb_bitmap;
int xrep_reap_agblocks(struct xfs_scrub *sc, struct xagb_bitmap *bitmap,
const struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type);
int xrep_reap_fsblocks(struct xfs_scrub *sc, struct xfsb_bitmap *bitmap,
const struct xfs_owner_info *oinfo);
int xrep_reap_ifork(struct xfs_scrub *sc, struct xfs_inode *ip, int whichfork);
/* Buffer cache scan context. */
struct xrep_bufscan {
/* Disk address for the buffers we want to scan. */
xfs_daddr_t daddr;
/* Maximum number of sectors to scan. */
xfs_daddr_t max_sectors;
/* Each round, increment the search length by this number of sectors. */
xfs_daddr_t daddr_step;
/* Internal scan state; initialize to zero. */
xfs_daddr_t __sector_count;
};
xfs_daddr_t xrep_bufscan_max_sectors(struct xfs_mount *mp,
xfs_extlen_t fsblocks);
struct xfs_buf *xrep_bufscan_advance(struct xfs_mount *mp,
struct xrep_bufscan *scan);
#endif /* __XFS_SCRUB_REAP_H__ */