Skip to content

Commit cc18ec3

Browse files
Matthew Wilcoxtyhicks
authored andcommitted
Use ecryptfs_dentry_to_lower_path in a couple of places
There are two places in ecryptfs that benefit from using ecryptfs_dentry_to_lower_path() instead of separate calls to ecryptfs_dentry_to_lower() and ecryptfs_dentry_to_lower_mnt(). Both sites use fewer instructions and less stack (determined by examining objdump output). Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
1 parent 0df5ed6 commit cc18ec3

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎fs/ecryptfs/file.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
4949
unsigned long nr_segs, loff_t pos)
5050
{
5151
ssize_t rc;
52-
struct path lower;
52+
struct path *path;
5353
struct file *file = iocb->ki_filp;
5454

5555
rc = generic_file_aio_read(iocb, iov, nr_segs, pos);
@@ -60,9 +60,8 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
6060
if (-EIOCBQUEUED == rc)
6161
rc = wait_on_sync_kiocb(iocb);
6262
if (rc >= 0) {
63-
lower.dentry = ecryptfs_dentry_to_lower(file->f_path.dentry);
64-
lower.mnt = ecryptfs_dentry_to_lower_mnt(file->f_path.dentry);
65-
touch_atime(&lower);
63+
path = ecryptfs_dentry_to_lower_path(file->f_path.dentry);
64+
touch_atime(path);
6665
}
6766
return rc;
6867
}

‎fs/ecryptfs/main.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,15 @@ static int ecryptfs_init_lower_file(struct dentry *dentry,
120120
struct file **lower_file)
121121
{
122122
const struct cred *cred = current_cred();
123-
struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
124-
struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
123+
struct path *path = ecryptfs_dentry_to_lower_path(dentry);
125124
int rc;
126125

127-
rc = ecryptfs_privileged_open(lower_file, lower_dentry, lower_mnt,
126+
rc = ecryptfs_privileged_open(lower_file, path->dentry, path->mnt,
128127
cred);
129128
if (rc) {
130129
printk(KERN_ERR "Error opening lower file "
131130
"for lower_dentry [0x%p] and lower_mnt [0x%p]; "
132-
"rc = [%d]\n", lower_dentry, lower_mnt, rc);
131+
"rc = [%d]\n", path->dentry, path->mnt, rc);
133132
(*lower_file) = NULL;
134133
}
135134
return rc;

0 commit comments

Comments
 (0)