mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
c77b37584c
Introduce a variant on XFS_SCRUB_METADATA that allows for a vectored mode. The caller specifies the principal metadata object that they want to scrub (allocation group, inode, etc.) once, followed by an array of scrub types they want called on that object. The kernel runs the scrub operations and writes the output flags and errno code to the corresponding array element. A new pseudo scrub type BARRIER is introduced to force the kernel to return to userspace if any corruptions have been found when scrubbing the previous scrub types in the array. This enables userspace to schedule, for example, the sequence: 1. data fork 2. barrier 3. directory If the data fork scrub is clean, then the kernel will perform the directory scrub. If not, the barrier in 2 will exit back to userspace. The alternative would have been an interface where userspace passes a pointer to an empty buffer, and the kernel formats that with xfs_scrub_vecs that tell userspace what it scrubbed and what the outcome was. With that the kernel would have to communicate that the buffer needed to have been at least X size, even though for our cases XFS_SCRUB_TYPE_NR + 2 would always be enough. Compared to that, this design keeps all the dependency policy and ordering logic in userspace where it already resides instead of duplicating it in the kernel. The downside of that is that it needs the barrier logic. When running fstests in "rebuild all metadata after each test" mode, I observed a 10% reduction in runtime due to fewer transitions across the system call boundary. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
18 lines
538 B
C
18 lines
538 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
|
* Author: Darrick J. Wong <djwong@kernel.org>
|
|
*/
|
|
#ifndef __XFS_SCRUB_H__
|
|
#define __XFS_SCRUB_H__
|
|
|
|
#ifndef CONFIG_XFS_ONLINE_SCRUB
|
|
# define xfs_ioc_scrub_metadata(f, a) (-ENOTTY)
|
|
# define xfs_ioc_scrubv_metadata(f, a) (-ENOTTY)
|
|
#else
|
|
int xfs_ioc_scrub_metadata(struct file *file, void __user *arg);
|
|
int xfs_ioc_scrubv_metadata(struct file *file, void __user *arg);
|
|
#endif /* CONFIG_XFS_ONLINE_SCRUB */
|
|
|
|
#endif /* __XFS_SCRUB_H__ */
|