Whamcloud - gitweb
b=22980 Support unlocked_ioctl
authorNiu Yawei <niu@whamcloud.com>
Wed, 26 Jan 2011 07:28:59 +0000 (23:28 -0800)
committerTerry Rutledge <terry.rutledge@oracle.com>
Wed, 26 Jan 2011 17:11:54 +0000 (09:11 -0800)
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
lustre/obdclass/linux/linux-module.c
lustre/obdecho/echo_client.c
lustre/tests/obdfilter-survey.sh

index a0ed244..4b48565 100644 (file)
@@ -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,
index 4b45287..0e1eb5b 100644 (file)
@@ -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 */
 };
index 227c77a..619f097 100644 (file)
@@ -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;
 }
 
index 043883f..e290976 100644 (file)
@@ -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}