diff options
author | Robert Love <rml@novell.com> | 2005-07-25 15:08:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-26 13:31:57 -0700 |
commit | 33ea2f52b8758ef62ae4a9d2f91821c47d999ee9 (patch) | |
tree | becd1efe5e2c0951706333673808542804c508ed /fs/inotify.c | |
parent | b680716ed28baf549f777fb125fc23ba975985c5 (diff) | |
download | linux-stable-33ea2f52b8758ef62ae4a9d2f91821c47d999ee9.tar.gz linux-stable-33ea2f52b8758ef62ae4a9d2f91821c47d999ee9.tar.bz2 linux-stable-33ea2f52b8758ef62ae4a9d2f91821c47d999ee9.zip |
[PATCH] inotify: use fget_light
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>
Diffstat (limited to 'fs/inotify.c')
-rw-r--r-- | fs/inotify.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/inotify.c b/fs/inotify.c index a87926584cd2..807209f0bcda 100644 --- a/fs/inotify.c +++ b/fs/inotify.c @@ -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; } |