lkml.org 
[lkml]   [2005]   [Jan]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateThu, 6 Jan 2005 18:18:10 +0200
From"Michael S. Tsirkin" <>
Subject[PATCH] fget_light/fput_light for ioctls (fixed)
Hello!
Sorry, that patch had a typo. Here's an updated version.

>>> Quoting r. Michael S. Tsirkin (mst@mellanox.co.il)

With new unlocked_ioctl and ioctl_compat, ioctls can now
be as fast as read/write.  So lets use fget_light/fput_light there,
to get some speedup in common case on SMP.

mst

Signed-off-by: Michael s. Tsirkin <mst@mellanox.co.il>

diff -rup linux-2.6.10/fs/compat.c linux-2.6.10-ioctls/fs/compat.c
--- linux-2.6.10/fs/compat.c	2005-01-06 17:54:13.000000000 +0200
+++ linux-2.6.10-ioctls/fs/compat.c	2005-01-06 20:15:44.407259408 +0200
@@ -431,8 +431,9 @@ asmlinkage long compat_sys_ioctl(unsigne
 	struct file *filp;
 	int error = -EBADF;
 	struct ioctl_trans *t;
+	int fput_needed;
 
-	filp = fget(fd);
+	filp = fget_light(fd, &fput_needed);
 	if (!filp)
 		goto out;
 
@@ -476,7 +479,7 @@ asmlinkage long compat_sys_ioctl(unsigne
  do_ioctl:
 	error = sys_ioctl(fd, cmd, arg);
  out_fput:
-	fput(filp);
+	fput_light(filp, fput_needed);
  out:
 	return error;
 }
diff -rup linux-2.6.10/fs/ioctl.c linux-2.6.10-ioctls/fs/ioctl.c
--- linux-2.6.10/fs/ioctl.c	2005-01-06 17:54:13.000000000 +0200
+++ linux-2.6.10-ioctls/fs/ioctl.c	2005-01-06 20:34:09.329285728 +0200
@@ -80,8 +83,9 @@ asmlinkage long sys_ioctl(unsigned int f
 	struct file * filp;
 	unsigned int flag;
 	int on, error = -EBADF;
+	int fput_needed;
 
-	filp = fget(fd);
+	filp = fget_light(fd, &fput_needed);
 	if (!filp)
 		goto out;
 
@@ -154,7 +158,7 @@ asmlinkage long sys_ioctl(unsigned int f
 			break;
 	}
  out_fput:
-	fput(filp);
+	fput_light(filp, fput_needed);
  out:
 	return error;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:09    [from the cache]
©2003-2008