[PATCH] fget_light/fput_light for ioctls (fixed)

From: Michael S. Tsirkin
Date: Thu Jan 06 2005 - 11:17:30 EST


Hello!
Sorry, that patch had a typo. Here's an updated version.

>>> Quoting r. Michael S. Tsirkin (mst@xxxxxxxxxxxxxx)

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@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/