diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:06:34 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-09 19:07:35 -0800 |
commit | b2040cb16f3e80615c52095d32b5a1a5f0eb3919 (patch) | |
tree | 7f4fcdb69e43c5c65090b2bcba3dffe59e02ff94 /fs/xfs/scrub/repair.c | |
parent | 6310f6895d2345c46c114ba4ae6ae54e3695b46f (diff) |
xfs: hook live rmap operations during a repair operationrepair-rmap-btree_2022-11-09
Hook the regular rmap code when an rmapbt repair operation is running so
that we can unlock the AGF buffer to scan the filesystem and keep the
in-memory btree up to date during the scan.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/repair.c')
-rw-r--r-- | fs/xfs/scrub/repair.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 532eebb79605..56422e5bde38 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -1127,3 +1127,39 @@ xrep_metadata_inode_forks( return 0; } + +/* + * Create a dummy transaction for use in a live update hook function. This + * function MUST NOT be called from regular repair code because the current + * process' transaction is saved via the cookie. + */ +int +xrep_trans_alloc_hook_dummy( + struct xfs_mount *mp, + void **cookiep, + struct xfs_trans **tpp) +{ + int error; + + *cookiep = current->journal_info; + current->journal_info = NULL; + + error = xfs_trans_alloc_empty(mp, tpp); + if (!error) + return 0; + + current->journal_info = *cookiep; + *cookiep = NULL; + return error; +} + +/* Cancel a dummy transaction used by a live update hook function. */ +void +xrep_trans_cancel_hook_dummy( + void **cookiep, + struct xfs_trans *tp) +{ + xfs_trans_cancel(tp); + current->journal_info = *cookiep; + *cookiep = NULL; +} |