aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBenjamin LaHaise <bcrl@linux.intel.com>2005-08-10 17:16:04 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:56:38 -0400
commit07dc3f0718d2c88c3094a0aadeeb4744effc5439 (patch)
treed0bb49ac931db8ad0d5887da75193b42bc00e95f /net
parentcef07fd6029c20f95571d09cefce45ee3276a920 (diff)
[NET]: Make use of ->private_data in sockfd_lookup
Please consider the patch below which makes use of file->private_data to store the pointer to the socket, which avoids touching several unused cachelines in the dentry and inode in sockfd_lookup. Signed-off-by: Benjamin LaHaise <bcrl@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 6f2a17881972..5f76ab8a1594 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -404,6 +404,7 @@ int sock_map_fd(struct socket *sock)
404 file->f_mode = FMODE_READ | FMODE_WRITE; 404 file->f_mode = FMODE_READ | FMODE_WRITE;
405 file->f_flags = O_RDWR; 405 file->f_flags = O_RDWR;
406 file->f_pos = 0; 406 file->f_pos = 0;
407 file->private_data = sock;
407 fd_install(fd, file); 408 fd_install(fd, file);
408 } 409 }
409 410
@@ -436,6 +437,9 @@ struct socket *sockfd_lookup(int fd, int *err)
436 return NULL; 437 return NULL;
437 } 438 }
438 439
440 if (file->f_op == &socket_file_ops)
441 return file->private_data; /* set in sock_map_fd */
442
439 inode = file->f_dentry->d_inode; 443 inode = file->f_dentry->d_inode;
440 if (!S_ISSOCK(inode->i_mode)) { 444 if (!S_ISSOCK(inode->i_mode)) {
441 *err = -ENOTSOCK; 445 *err = -ENOTSOCK;