diff options
| author | Matthew Wilcox <willy@linux.intel.com> | 2013-06-15 07:55:59 -0400 |
|---|---|---|
| committer | Tyler Hicks <tyhicks@canonical.com> | 2013-07-10 02:40:28 -0400 |
| commit | cc18ec3c8f5dd735c1bff5da30fd33860c08a293 (patch) | |
| tree | 50fdd52cf70d0b611a24f42226cdca8467be6f10 | |
| parent | 0df5ed65c14e2c36ed842fcff58118662009f1a1 (diff) | |
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>
| -rw-r--r-- | fs/ecryptfs/file.c | 7 | ||||
| -rw-r--r-- | fs/ecryptfs/main.c | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index a7abbea2c096..0943f6f20b1c 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
| @@ -49,7 +49,7 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, | |||
| 49 | unsigned long nr_segs, loff_t pos) | 49 | unsigned long nr_segs, loff_t pos) |
| 50 | { | 50 | { |
| 51 | ssize_t rc; | 51 | ssize_t rc; |
| 52 | struct path lower; | 52 | struct path *path; |
| 53 | struct file *file = iocb->ki_filp; | 53 | struct file *file = iocb->ki_filp; |
| 54 | 54 | ||
| 55 | rc = generic_file_aio_read(iocb, iov, nr_segs, pos); | 55 | rc = generic_file_aio_read(iocb, iov, nr_segs, pos); |
| @@ -60,9 +60,8 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, | |||
| 60 | if (-EIOCBQUEUED == rc) | 60 | if (-EIOCBQUEUED == rc) |
| 61 | rc = wait_on_sync_kiocb(iocb); | 61 | rc = wait_on_sync_kiocb(iocb); |
| 62 | if (rc >= 0) { | 62 | if (rc >= 0) { |
| 63 | lower.dentry = ecryptfs_dentry_to_lower(file->f_path.dentry); | 63 | path = ecryptfs_dentry_to_lower_path(file->f_path.dentry); |
| 64 | lower.mnt = ecryptfs_dentry_to_lower_mnt(file->f_path.dentry); | 64 | touch_atime(path); |
| 65 | touch_atime(&lower); | ||
| 66 | } | 65 | } |
| 67 | return rc; | 66 | return rc; |
| 68 | } | 67 | } |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index e924cf45aad9..eb1c5979ecaf 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -120,16 +120,15 @@ static int ecryptfs_init_lower_file(struct dentry *dentry, | |||
| 120 | struct file **lower_file) | 120 | struct file **lower_file) |
| 121 | { | 121 | { |
| 122 | const struct cred *cred = current_cred(); | 122 | const struct cred *cred = current_cred(); |
| 123 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | 123 | struct path *path = ecryptfs_dentry_to_lower_path(dentry); |
| 124 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | ||
| 125 | int rc; | 124 | int rc; |
| 126 | 125 | ||
| 127 | rc = ecryptfs_privileged_open(lower_file, lower_dentry, lower_mnt, | 126 | rc = ecryptfs_privileged_open(lower_file, path->dentry, path->mnt, |
| 128 | cred); | 127 | cred); |
| 129 | if (rc) { | 128 | if (rc) { |
| 130 | printk(KERN_ERR "Error opening lower file " | 129 | printk(KERN_ERR "Error opening lower file " |
| 131 | "for lower_dentry [0x%p] and lower_mnt [0x%p]; " | 130 | "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); |
| 133 | (*lower_file) = NULL; | 132 | (*lower_file) = NULL; |
| 134 | } | 133 | } |
| 135 | return rc; | 134 | return rc; |
