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 16:31:57 -0400 |
commit | 33ea2f52b8758ef62ae4a9d2f91821c47d999ee9 (patch) | |
tree | becd1efe5e2c0951706333673808542804c508ed /fs/inotify.c | |
parent | b680716ed28baf549f777fb125fc23ba975985c5 (diff) |
[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) | |||
923 | struct inotify_device *dev; | 923 | struct inotify_device *dev; |
924 | struct nameidata nd; | 924 | struct nameidata nd; |
925 | struct file *filp; | 925 | struct file *filp; |
926 | int ret; | 926 | int ret, fput_needed; |
927 | 927 | ||
928 | filp = fget(fd); | 928 | filp = fget_light(fd, &fput_needed); |
929 | if (!filp) | 929 | if (unlikely(!filp)) |
930 | return -EBADF; | 930 | return -EBADF; |
931 | 931 | ||
932 | ret = find_inode(path, &nd); | 932 | ret = find_inode(path, &nd); |
@@ -973,7 +973,7 @@ out: | |||
973 | up(&dev->sem); | 973 | up(&dev->sem); |
974 | up(&inode->inotify_sem); | 974 | up(&inode->inotify_sem); |
975 | fput_and_out: | 975 | fput_and_out: |
976 | fput(filp); | 976 | fput_light(filp, fput_needed); |
977 | return ret; | 977 | return ret; |
978 | } | 978 | } |
979 | 979 | ||
@@ -981,14 +981,14 @@ asmlinkage long sys_inotify_rm_watch(int fd, u32 wd) | |||
981 | { | 981 | { |
982 | struct file *filp; | 982 | struct file *filp; |
983 | struct inotify_device *dev; | 983 | struct inotify_device *dev; |
984 | int ret; | 984 | int ret, fput_needed; |
985 | 985 | ||
986 | filp = fget(fd); | 986 | filp = fget_light(fd, &fput_needed); |
987 | if (!filp) | 987 | if (unlikely(!filp)) |
988 | return -EBADF; | 988 | return -EBADF; |
989 | dev = filp->private_data; | 989 | dev = filp->private_data; |
990 | ret = inotify_ignore(dev, wd); | 990 | ret = inotify_ignore(dev, wd); |
991 | fput(filp); | 991 | fput_light(filp, fput_needed); |
992 | 992 | ||
993 | return ret; | 993 | return ret; |
994 | } | 994 | } |