diff options
| -rw-r--r-- | fs/xfs/xfs_healthmon.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c index 1bb4b0adf247..4a8cbd879322 100644 --- a/fs/xfs/xfs_healthmon.c +++ b/fs/xfs/xfs_healthmon.c @@ -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, }; /* |
