diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:06:34 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-14 14:16:47 -0700 |
commit | 647bfade0c109168ed8a44f5e0a8ebd15c312bb7 (patch) | |
tree | 6bb160af5655d08da528d96bbf1ffebd12860d92 /fs/xfs/scrub/repair.c | |
parent | d06f57a6fb0b65edb8a49b9bc2c83d1f37f1c839 (diff) |
xfs: hook live rmap operations during a repair operationrepair-rmap-btree_2022-10-14
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 6924ac413a17..5697fa8da0ee 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -1116,3 +1116,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; +} |