diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-02-22 21:30:45 +0100 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-02-22 21:30:45 +0100 |
commit | 8660c7b74aeab67210064a8dc756960b2adfd613 (patch) | |
tree | 2d8f617a236abc1af8f2733ec915f863a1d6797c /fs/xfs/xfs_sysfs.c | |
parent | xfs: speed up xfs_iwalk_adjust_start a little bit (diff) | |
download | linux-8660c7b74aeab67210064a8dc756960b2adfd613.tar.xz linux-8660c7b74aeab67210064a8dc756960b2adfd613.zip |
xfs: implement live inode scan for scrub
This patch implements a live file scanner for online fsck functions that
require the ability to walk a filesystem to gather metadata records and
stay informed about metadata changes to files that have already been
visited.
The iscan structure consists of two inode number cursors: one to track
which inode we want to visit next, and a second one to track which
inodes have already been visited. This second cursor is key to
capturing live updates to files previously scanned while the main thread
continues scanning -- any inode greater than this value hasn't been
scanned and can go on its way; any other update must be incorporated
into the collected data. It is critical for the scanning thraad to hold
exclusive access on the inode until after marking the inode visited.
This new code is a separate patch from the patchsets adding callers for
the sake of enabling the author to move patches around his tree with
ease. The intended usage model for this code is roughly:
xchk_iscan_start(iscan, 0, 0);
while ((error = xchk_iscan_iter(sc, iscan, &ip)) == 1) {
xfs_ilock(ip, ...);
/* capture inode metadata */
xchk_iscan_mark_visited(iscan, ip);
xfs_iunlock(ip, ...);
xfs_irele(ip);
}
xchk_iscan_stop(iscan);
if (error)
return error;
Hook functions for live updates can then do:
if (xchk_iscan_want_live_update(...))
/* update the captured inode metadata */
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_sysfs.c')
0 files changed, 0 insertions, 0 deletions