mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
xfs: create an ioctl to scrub AG metadata
Create an ioctl that can be used to scrub internal filesystem metadata. The new ioctl takes the metadata type, an (optional) AG number, an (optional) inode number and generation, and a flags argument. This will be used by the upcoming XFS online scrub tool. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
91fb9afc08
commit
36fd6e863c
10 changed files with 292 additions and 0 deletions
|
@ -44,6 +44,7 @@
|
|||
#include "xfs_btree.h"
|
||||
#include <linux/fsmap.h>
|
||||
#include "xfs_fsmap.h"
|
||||
#include "scrub/xfs_scrub.h"
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/cred.h>
|
||||
|
@ -1701,6 +1702,30 @@ xfs_ioc_getfsmap(
|
|||
return 0;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_scrub_metadata(
|
||||
struct xfs_inode *ip,
|
||||
void __user *arg)
|
||||
{
|
||||
struct xfs_scrub_metadata scrub;
|
||||
int error;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&scrub, arg, sizeof(scrub)))
|
||||
return -EFAULT;
|
||||
|
||||
error = xfs_scrub_metadata(ip, &scrub);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (copy_to_user(arg, &scrub, sizeof(scrub)))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
xfs_ioc_swapext(
|
||||
xfs_swapext_t *sxp)
|
||||
|
@ -1882,6 +1907,9 @@ xfs_file_ioctl(
|
|||
case FS_IOC_GETFSMAP:
|
||||
return xfs_ioc_getfsmap(ip, arg);
|
||||
|
||||
case XFS_IOC_SCRUB_METADATA:
|
||||
return xfs_ioc_scrub_metadata(ip, arg);
|
||||
|
||||
case XFS_IOC_FD_TO_HANDLE:
|
||||
case XFS_IOC_PATH_TO_HANDLE:
|
||||
case XFS_IOC_PATH_TO_FSHANDLE: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue