tree d0bb49ac931db8ad0d5887da75193b42bc00e95f
parent cef07fd6029c20f95571d09cefce45ee3276a920
author Benjamin LaHaise <[EMAIL PROTECTED]> Thu, 11 Aug 2005 04:16:04 -0700
committer David S. Miller <[EMAIL PROTECTED]> Tue, 30 Aug 2005 05:56:38 -0700

[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 <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

 net/socket.c |    4 ++++
 1 files changed, 4 insertions(+)

diff --git a/net/socket.c b/net/socket.c
--- a/net/socket.c
+++ b/net/socket.c
@@ -404,6 +404,7 @@ int sock_map_fd(struct socket *sock)
                file->f_mode = FMODE_READ | FMODE_WRITE;
                file->f_flags = O_RDWR;
                file->f_pos = 0;
+               file->private_data = sock;
                fd_install(fd, file);
        }
 
@@ -436,6 +437,9 @@ struct socket *sockfd_lookup(int fd, int
                return NULL;
        }
 
+       if (file->f_op == &socket_file_ops)
+               return file->private_data;      /* set in sock_map_fd */
+
        inode = file->f_dentry->d_inode;
        if (!S_ISSOCK(inode->i_mode)) {
                *err = -ENOTSOCK;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to