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>
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);
up(&dev->sem);
up(&inode->inotify_sem);
fput_and_out:
- fput(filp);
+ fput_light(filp, fput_needed);
return ret;
}
{
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;
}