]> err.no Git - linux-2.6/commitdiff
[PATCH] inotify: use fget_light
authorRobert Love <rml@novell.com>
Mon, 25 Jul 2005 19:08:37 +0000 (15:08 -0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Jul 2005 20:31:57 +0000 (13:31 -0700)
As an optimization, use fget_light() and fput_light() where possible.

Signed-off-by: Robert Love <rml@novell.com>
Signed-off-by: John McCutchan <ttb@tentacle.dhs.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/inotify.c

index a87926584cd284c9aa1d94230cc2a659dc2d86db..807209f0bcda18d39686386adad8f1db18a44d38 100644 (file)
@@ -923,10 +923,10 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
        struct inotify_device *dev;
        struct nameidata nd;
        struct file *filp;
-       int ret;
+       int ret, fput_needed;
 
-       filp = fget(fd);
-       if (!filp)
+       filp = fget_light(fd, &fput_needed);
+       if (unlikely(!filp))
                return -EBADF;
 
        ret = find_inode(path, &nd);
@@ -973,7 +973,7 @@ out:
        up(&dev->sem);
        up(&inode->inotify_sem);
 fput_and_out:
-       fput(filp);
+       fput_light(filp, fput_needed);
        return ret;
 }
 
@@ -981,14 +981,14 @@ asmlinkage long sys_inotify_rm_watch(int fd, u32 wd)
 {
        struct file *filp;
        struct inotify_device *dev;
-       int ret;
+       int ret, fput_needed;
 
-       filp = fget(fd);
-       if (!filp)
+       filp = fget_light(fd, &fput_needed);
+       if (unlikely(!filp))
                return -EBADF;
        dev = filp->private_data;
        ret = inotify_ignore(dev, wd);
-       fput(filp);
+       fput_light(filp, fput_needed);
 
        return ret;
 }