simplify access to ecryptfs inodes in ->readpage() and friends
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 21 May 2010 14:56:12 +0000 (10:56 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 21 May 2010 22:31:28 +0000 (18:31 -0400)
we can get to them from page->mapping->host, no need to mess with
file.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ecryptfs/mmap.c

index 2ee9a3a7b68c4f69be50770a79bf849a79663cbe..14e81c26c3ed54f62b6e13187a9ea8079caac884 100644 (file)
@@ -198,7 +198,7 @@ out:
 static int ecryptfs_readpage(struct file *file, struct page *page)
 {
        struct ecryptfs_crypt_stat *crypt_stat =
-               &ecryptfs_inode_to_private(file->f_path.dentry->d_inode)->crypt_stat;
+               &ecryptfs_inode_to_private(page->mapping->host)->crypt_stat;
        int rc = 0;
 
        if (!crypt_stat
@@ -300,8 +300,7 @@ static int ecryptfs_write_begin(struct file *file,
 
        if (!PageUptodate(page)) {
                struct ecryptfs_crypt_stat *crypt_stat =
-                       &ecryptfs_inode_to_private(
-                               file->f_path.dentry->d_inode)->crypt_stat;
+                       &ecryptfs_inode_to_private(mapping->host)->crypt_stat;
 
                if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)
                    || (crypt_stat->flags & ECRYPTFS_NEW_FILE)) {
@@ -487,7 +486,7 @@ static int ecryptfs_write_end(struct file *file,
        unsigned to = from + copied;
        struct inode *ecryptfs_inode = mapping->host;
        struct ecryptfs_crypt_stat *crypt_stat =
-               &ecryptfs_inode_to_private(file->f_path.dentry->d_inode)->crypt_stat;
+               &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat;
        int rc;
 
        if (crypt_stat->flags & ECRYPTFS_NEW_FILE) {