From abd1a0390c60c962725f29030808c08a86c4194f Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Tue, 25 Jan 2011 23:28:59 -0800 Subject: [PATCH] b=22980 Support unlocked_ioctl Adding 'unlocked_ioctl' for performance sensitive ioctls, such as OBD_IOC_BRW_READ/WRITE i=andreas i=johann Change-Id: I963aaad6bf9e2fdf9b70f15659e5ad47180e0d5a --- lustre/llite/file.c | 18 ++++++++++++++++++ lustre/obdclass/linux/linux-module.c | 9 +++++++++ lustre/obdecho/echo_client.c | 6 ++++-- lustre/tests/obdfilter-survey.sh | 1 + 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index a0ed244..4b48565 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -2900,9 +2900,15 @@ error: RETURN(rc); } +#ifdef HAVE_UNLOCKED_IOCTL +long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct inode *inode = file->f_dentry->d_inode; +#else int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { +#endif struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int flags; ENTRY; @@ -3637,7 +3643,11 @@ struct file_operations ll_file_operations = { #else .aio_write = ll_file_aio_write, #endif +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = ll_file_ioctl, +#else .ioctl = ll_file_ioctl, +#endif .open = ll_file_open, .release = ll_file_release, .mmap = ll_file_mmap, @@ -3665,7 +3675,11 @@ struct file_operations ll_file_operations_flock = { #else .aio_write = ll_file_aio_write, #endif +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = ll_file_ioctl, +#else .ioctl = ll_file_ioctl, +#endif .open = ll_file_open, .release = ll_file_release, .mmap = ll_file_mmap, @@ -3698,7 +3712,11 @@ struct file_operations ll_file_operations_noflock = { #else .aio_write = ll_file_aio_write, #endif +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = ll_file_ioctl, +#else .ioctl = ll_file_ioctl, +#endif .open = ll_file_open, .release = ll_file_release, .mmap = ll_file_mmap, diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 4b45287..0e1eb5b 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -198,8 +198,13 @@ static int obd_class_release(struct inode * inode, struct file * file) } /* to control /dev/obd */ +#ifdef HAVE_UNLOCKED_IOCTL +static long obd_class_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) +#else static int obd_class_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) +#endif { int err = 0; ENTRY; @@ -218,7 +223,11 @@ static int obd_class_ioctl(struct inode *inode, struct file *filp, /* declare character device */ static struct file_operations obd_psdev_fops = { .owner = THIS_MODULE, +#if HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = obd_class_ioctl, /* unlocked_ioctl */ +#else .ioctl = obd_class_ioctl, /* ioctl */ +#endif .open = obd_class_open, /* open */ .release = obd_class_release, /* release */ }; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 227c77a..619f097 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -1184,8 +1184,9 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int i; ENTRY; +#ifndef HAVE_UNLOCKED_IOCTL unlock_kernel(); - +#endif memset(&dummy_oti, 0, sizeof(dummy_oti)); obd = exp->exp_obd; @@ -1308,8 +1309,9 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, ldlm_lock_decref(&ack_lock->lock, ack_lock->mode); } +#ifndef HAVE_UNLOCKED_IOCTL lock_kernel(); - +#endif return rc; } diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh index 043883f..e290976 100644 --- a/lustre/tests/obdfilter-survey.sh +++ b/lustre/tests/obdfilter-survey.sh @@ -5,6 +5,7 @@ set -e LUSTRE=${LUSTRE:-`dirname $0`/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ +init_logging nobjhi=${nobjhi:-1} thrhi=${thrhi:-16} -- 1.8.3.1