diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-23 17:07:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-22 23:31:31 -0500 |
commit | 496ad9aa8ef448058e36ca7a787c61f2e63f0f54 (patch) | |
tree | 8f4abde793cd7db5bb8fde6d27ebcacd0e54379a /mm/shmem.c | |
parent | 57eccb830f1cc93d4b506ba306d8dfa685e0c88f (diff) |
new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 5dd56f6efdbd..814d5546cb35 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1295,7 +1295,7 @@ unlock: | |||
1295 | 1295 | ||
1296 | static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 1296 | static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1297 | { | 1297 | { |
1298 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1298 | struct inode *inode = file_inode(vma->vm_file); |
1299 | int error; | 1299 | int error; |
1300 | int ret = VM_FAULT_LOCKED; | 1300 | int ret = VM_FAULT_LOCKED; |
1301 | 1301 | ||
@@ -1313,14 +1313,14 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1313 | #ifdef CONFIG_NUMA | 1313 | #ifdef CONFIG_NUMA |
1314 | static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) | 1314 | static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) |
1315 | { | 1315 | { |
1316 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1316 | struct inode *inode = file_inode(vma->vm_file); |
1317 | return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol); | 1317 | return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol); |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, | 1320 | static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, |
1321 | unsigned long addr) | 1321 | unsigned long addr) |
1322 | { | 1322 | { |
1323 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1323 | struct inode *inode = file_inode(vma->vm_file); |
1324 | pgoff_t index; | 1324 | pgoff_t index; |
1325 | 1325 | ||
1326 | index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | 1326 | index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
@@ -1330,7 +1330,7 @@ static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, | |||
1330 | 1330 | ||
1331 | int shmem_lock(struct file *file, int lock, struct user_struct *user) | 1331 | int shmem_lock(struct file *file, int lock, struct user_struct *user) |
1332 | { | 1332 | { |
1333 | struct inode *inode = file->f_path.dentry->d_inode; | 1333 | struct inode *inode = file_inode(file); |
1334 | struct shmem_inode_info *info = SHMEM_I(inode); | 1334 | struct shmem_inode_info *info = SHMEM_I(inode); |
1335 | int retval = -ENOMEM; | 1335 | int retval = -ENOMEM; |
1336 | 1336 | ||
@@ -1465,7 +1465,7 @@ shmem_write_end(struct file *file, struct address_space *mapping, | |||
1465 | 1465 | ||
1466 | static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor) | 1466 | static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor) |
1467 | { | 1467 | { |
1468 | struct inode *inode = filp->f_path.dentry->d_inode; | 1468 | struct inode *inode = file_inode(filp); |
1469 | struct address_space *mapping = inode->i_mapping; | 1469 | struct address_space *mapping = inode->i_mapping; |
1470 | pgoff_t index; | 1470 | pgoff_t index; |
1471 | unsigned long offset; | 1471 | unsigned long offset; |
@@ -1808,7 +1808,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) | |||
1808 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, | 1808 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, |
1809 | loff_t len) | 1809 | loff_t len) |
1810 | { | 1810 | { |
1811 | struct inode *inode = file->f_path.dentry->d_inode; | 1811 | struct inode *inode = file_inode(file); |
1812 | struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); | 1812 | struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); |
1813 | struct shmem_falloc shmem_falloc; | 1813 | struct shmem_falloc shmem_falloc; |
1814 | pgoff_t start, index, end; | 1814 | pgoff_t start, index, end; |