Commit a05fc485 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] speed up fget() and fget_light()

Eric Dumazet <dada1@cosmosbay.com>

We can avoid evaluating `current' in a few places.
parent a18fde09
...@@ -198,7 +198,7 @@ struct file fastcall *fget(unsigned int fd) ...@@ -198,7 +198,7 @@ struct file fastcall *fget(unsigned int fd)
struct files_struct *files = current->files; struct files_struct *files = current->files;
spin_lock(&files->file_lock); spin_lock(&files->file_lock);
file = fcheck(fd); file = fcheck_files(files, fd);
if (file) if (file)
get_file(file); get_file(file);
spin_unlock(&files->file_lock); spin_unlock(&files->file_lock);
...@@ -221,10 +221,10 @@ struct file fastcall *fget_light(unsigned int fd, int *fput_needed) ...@@ -221,10 +221,10 @@ struct file fastcall *fget_light(unsigned int fd, int *fput_needed)
*fput_needed = 0; *fput_needed = 0;
if (likely((atomic_read(&files->count) == 1))) { if (likely((atomic_read(&files->count) == 1))) {
file = fcheck(fd); file = fcheck_files(files, fd);
} else { } else {
spin_lock(&files->file_lock); spin_lock(&files->file_lock);
file = fcheck(fd); file = fcheck_files(files, fd);
if (file) { if (file) {
get_file(file); get_file(file);
*fput_needed = 1; *fput_needed = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment