aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-23 17:07:38 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-22 23:31:31 -0500
commit496ad9aa8ef448058e36ca7a787c61f2e63f0f54 (patch)
tree8f4abde793cd7db5bb8fde6d27ebcacd0e54379a /mm
parent57eccb830f1cc93d4b506ba306d8dfa685e0c88f (diff)
new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm')
-rw-r--r--mm/fadvise.c2
-rw-r--r--mm/filemap.c2
-rw-r--r--mm/hugetlb.c4
-rw-r--r--mm/mmap.c8
-rw-r--r--mm/nommu.c12
-rw-r--r--mm/shmem.c12
-rw-r--r--mm/swapfile.c2
7 files changed, 21 insertions, 21 deletions
diff --git a/mm/fadvise.c b/mm/fadvise.c
index a47f0f50c89f..6deaa6c04636 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -38,7 +38,7 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
38 if (!f.file) 38 if (!f.file)
39 return -EBADF; 39 return -EBADF;
40 40
41 if (S_ISFIFO(f.file->f_path.dentry->d_inode->i_mode)) { 41 if (S_ISFIFO(file_inode(f.file)->i_mode)) {
42 ret = -ESPIPE; 42 ret = -ESPIPE;
43 goto out; 43 goto out;
44 } 44 }
diff --git a/mm/filemap.c b/mm/filemap.c
index 83efee76a5c0..6a48a7ea8f4f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1711,7 +1711,7 @@ EXPORT_SYMBOL(filemap_fault);
1711int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) 1711int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
1712{ 1712{
1713 struct page *page = vmf->page; 1713 struct page *page = vmf->page;
1714 struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 1714 struct inode *inode = file_inode(vma->vm_file);
1715 int ret = VM_FAULT_LOCKED; 1715 int ret = VM_FAULT_LOCKED;
1716 1716
1717 sb_start_pagefault(inode->i_sb); 1717 sb_start_pagefault(inode->i_sb);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4f3ea0b1e57c..b97e806e5d9a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -127,7 +127,7 @@ static inline struct hugepage_subpool *subpool_inode(struct inode *inode)
127 127
128static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma) 128static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma)
129{ 129{
130 return subpool_inode(vma->vm_file->f_dentry->d_inode); 130 return subpool_inode(file_inode(vma->vm_file));
131} 131}
132 132
133/* 133/*
@@ -2482,7 +2482,7 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
2482 address = address & huge_page_mask(h); 2482 address = address & huge_page_mask(h);
2483 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + 2483 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) +
2484 vma->vm_pgoff; 2484 vma->vm_pgoff;
2485 mapping = vma->vm_file->f_dentry->d_inode->i_mapping; 2485 mapping = file_inode(vma->vm_file)->i_mapping;
2486 2486
2487 /* 2487 /*
2488 * Take the mapping lock for the duration of the table walk. As 2488 * Take the mapping lock for the duration of the table walk. As
diff --git a/mm/mmap.c b/mm/mmap.c
index 35730ee9d515..22dfc01e9681 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -202,7 +202,7 @@ static void __remove_shared_vm_struct(struct vm_area_struct *vma,
202 struct file *file, struct address_space *mapping) 202 struct file *file, struct address_space *mapping)
203{ 203{
204 if (vma->vm_flags & VM_DENYWRITE) 204 if (vma->vm_flags & VM_DENYWRITE)
205 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 205 atomic_inc(&file_inode(file)->i_writecount);
206 if (vma->vm_flags & VM_SHARED) 206 if (vma->vm_flags & VM_SHARED)
207 mapping->i_mmap_writable--; 207 mapping->i_mmap_writable--;
208 208
@@ -567,7 +567,7 @@ static void __vma_link_file(struct vm_area_struct *vma)
567 struct address_space *mapping = file->f_mapping; 567 struct address_space *mapping = file->f_mapping;
568 568
569 if (vma->vm_flags & VM_DENYWRITE) 569 if (vma->vm_flags & VM_DENYWRITE)
570 atomic_dec(&file->f_path.dentry->d_inode->i_writecount); 570 atomic_dec(&file_inode(file)->i_writecount);
571 if (vma->vm_flags & VM_SHARED) 571 if (vma->vm_flags & VM_SHARED)
572 mapping->i_mmap_writable++; 572 mapping->i_mmap_writable++;
573 573
@@ -1217,7 +1217,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1217 return -EAGAIN; 1217 return -EAGAIN;
1218 } 1218 }
1219 1219
1220 inode = file ? file->f_path.dentry->d_inode : NULL; 1220 inode = file ? file_inode(file) : NULL;
1221 1221
1222 if (file) { 1222 if (file) {
1223 switch (flags & MAP_TYPE) { 1223 switch (flags & MAP_TYPE) {
@@ -1403,7 +1403,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
1403 int error; 1403 int error;
1404 struct rb_node **rb_link, *rb_parent; 1404 struct rb_node **rb_link, *rb_parent;
1405 unsigned long charged = 0; 1405 unsigned long charged = 0;
1406 struct inode *inode = file ? file->f_path.dentry->d_inode : NULL; 1406 struct inode *inode = file ? file_inode(file) : NULL;
1407 1407
1408 /* Clear old maps */ 1408 /* Clear old maps */
1409 error = -ENOMEM; 1409 error = -ENOMEM;
diff --git a/mm/nommu.c b/mm/nommu.c
index 79c3cac87afa..f87d2173d0d0 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -941,7 +941,7 @@ static int validate_mmap_request(struct file *file,
941 */ 941 */
942 mapping = file->f_mapping; 942 mapping = file->f_mapping;
943 if (!mapping) 943 if (!mapping)
944 mapping = file->f_path.dentry->d_inode->i_mapping; 944 mapping = file_inode(file)->i_mapping;
945 945
946 capabilities = 0; 946 capabilities = 0;
947 if (mapping && mapping->backing_dev_info) 947 if (mapping && mapping->backing_dev_info)
@@ -950,7 +950,7 @@ static int validate_mmap_request(struct file *file,
950 if (!capabilities) { 950 if (!capabilities) {
951 /* no explicit capabilities set, so assume some 951 /* no explicit capabilities set, so assume some
952 * defaults */ 952 * defaults */
953 switch (file->f_path.dentry->d_inode->i_mode & S_IFMT) { 953 switch (file_inode(file)->i_mode & S_IFMT) {
954 case S_IFREG: 954 case S_IFREG:
955 case S_IFBLK: 955 case S_IFBLK:
956 capabilities = BDI_CAP_MAP_COPY; 956 capabilities = BDI_CAP_MAP_COPY;
@@ -985,11 +985,11 @@ static int validate_mmap_request(struct file *file,
985 !(file->f_mode & FMODE_WRITE)) 985 !(file->f_mode & FMODE_WRITE))
986 return -EACCES; 986 return -EACCES;
987 987
988 if (IS_APPEND(file->f_path.dentry->d_inode) && 988 if (IS_APPEND(file_inode(file)) &&
989 (file->f_mode & FMODE_WRITE)) 989 (file->f_mode & FMODE_WRITE))
990 return -EACCES; 990 return -EACCES;
991 991
992 if (locks_verify_locked(file->f_path.dentry->d_inode)) 992 if (locks_verify_locked(file_inode(file)))
993 return -EAGAIN; 993 return -EAGAIN;
994 994
995 if (!(capabilities & BDI_CAP_MAP_DIRECT)) 995 if (!(capabilities & BDI_CAP_MAP_DIRECT))
@@ -1322,8 +1322,8 @@ unsigned long do_mmap_pgoff(struct file *file,
1322 continue; 1322 continue;
1323 1323
1324 /* search for overlapping mappings on the same file */ 1324 /* search for overlapping mappings on the same file */
1325 if (pregion->vm_file->f_path.dentry->d_inode != 1325 if (file_inode(pregion->vm_file) !=
1326 file->f_path.dentry->d_inode) 1326 file_inode(file))
1327 continue; 1327 continue;
1328 1328
1329 if (pregion->vm_pgoff >= pgend) 1329 if (pregion->vm_pgoff >= pgend)
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
1296static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 1296static 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
1314static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) 1314static 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
1320static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, 1320static 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
1331int shmem_lock(struct file *file, int lock, struct user_struct *user) 1331int 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
1466static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor) 1466static 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)
1808static long shmem_fallocate(struct file *file, int mode, loff_t offset, 1808static 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;
diff --git a/mm/swapfile.c b/mm/swapfile.c
index e97a0e5aea91..ed393002fc09 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1699,7 +1699,7 @@ static int swap_show(struct seq_file *swap, void *v)
1699 len = seq_path(swap, &file->f_path, " \t\n\\"); 1699 len = seq_path(swap, &file->f_path, " \t\n\\");
1700 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", 1700 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
1701 len < 40 ? 40 - len : 1, " ", 1701 len < 40 ? 40 - len : 1, " ",
1702 S_ISBLK(file->f_path.dentry->d_inode->i_mode) ? 1702 S_ISBLK(file_inode(file)->i_mode) ?
1703 "partition" : "file\t", 1703 "partition" : "file\t",
1704 si->pages << (PAGE_SHIFT - 10), 1704 si->pages << (PAGE_SHIFT - 10),
1705 si->inuse_pages << (PAGE_SHIFT - 10), 1705 si->inuse_pages << (PAGE_SHIFT - 10),