mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
xfs: allow toggling verbose logging on the health monitoring file
Make it so that we can reconfigure the health monitoring device by calling the XFS_IOC_HEALTH_MONITOR ioctl on it. As of right now we can only toggle the verbose flag, but this is less annoying than having to closing the monitor fd and reopen it. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
dfa8bad3a8
commit
c0e719cb36
|
|
@ -23,6 +23,7 @@
|
|||
#include "xfs_fsops.h"
|
||||
#include "xfs_notify_failure.h"
|
||||
#include "xfs_file.h"
|
||||
#include "xfs_ioctl.h"
|
||||
|
||||
#include <linux/anon_inodes.h>
|
||||
#include <linux/eventpoll.h>
|
||||
|
|
@ -1066,12 +1067,55 @@ xfs_healthmon_show_fdinfo(
|
|||
mutex_unlock(&hm->lock);
|
||||
}
|
||||
|
||||
/* Reconfigure the health monitor. */
|
||||
STATIC long
|
||||
xfs_healthmon_reconfigure(
|
||||
struct file *file,
|
||||
unsigned int cmd,
|
||||
void __user *arg)
|
||||
{
|
||||
struct xfs_health_monitor hmo;
|
||||
struct xfs_healthmon *hm = file->private_data;
|
||||
|
||||
if (copy_from_user(&hmo, arg, sizeof(hmo)))
|
||||
return -EFAULT;
|
||||
|
||||
if (!xfs_healthmon_validate(&hmo))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&hm->lock);
|
||||
hm->verbose = !!(hmo.flags & XFS_HEALTH_MONITOR_VERBOSE);
|
||||
mutex_unlock(&hm->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Handle ioctls for the health monitoring thread. */
|
||||
STATIC long
|
||||
xfs_healthmon_ioctl(
|
||||
struct file *file,
|
||||
unsigned int cmd,
|
||||
unsigned long p)
|
||||
{
|
||||
void __user *arg = (void __user *)p;
|
||||
|
||||
switch (cmd) {
|
||||
case XFS_IOC_HEALTH_MONITOR:
|
||||
return xfs_healthmon_reconfigure(file, cmd, arg);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
static const struct file_operations xfs_healthmon_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.show_fdinfo = xfs_healthmon_show_fdinfo,
|
||||
.read_iter = xfs_healthmon_read_iter,
|
||||
.poll = xfs_healthmon_poll,
|
||||
.release = xfs_healthmon_release,
|
||||
.unlocked_ioctl = xfs_healthmon_ioctl,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user