diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/cleancache.c | 2 | ||||
-rw-r--r-- | mm/fadvise.c | 2 | ||||
-rw-r--r-- | mm/filemap.c | 2 | ||||
-rw-r--r-- | mm/hugetlb.c | 4 | ||||
-rw-r--r-- | mm/mmap.c | 8 | ||||
-rw-r--r-- | mm/nommu.c | 12 | ||||
-rw-r--r-- | mm/shmem.c | 52 | ||||
-rw-r--r-- | mm/swapfile.c | 2 |
8 files changed, 47 insertions, 37 deletions
diff --git a/mm/cleancache.c b/mm/cleancache.c index 32e6f4136fa2..d76ba74be2d0 100644 --- a/mm/cleancache.c +++ b/mm/cleancache.c | |||
@@ -89,7 +89,7 @@ static int cleancache_get_key(struct inode *inode, | |||
89 | fhfn = sb->s_export_op->encode_fh; | 89 | fhfn = sb->s_export_op->encode_fh; |
90 | if (fhfn) { | 90 | if (fhfn) { |
91 | len = (*fhfn)(inode, &key->u.fh[0], &maxlen, NULL); | 91 | len = (*fhfn)(inode, &key->u.fh[0], &maxlen, NULL); |
92 | if (len <= 0 || len == 255) | 92 | if (len <= FILEID_ROOT || len == FILEID_INVALID) |
93 | return -1; | 93 | return -1; |
94 | if (maxlen > CLEANCACHE_KEY_MAX) | 94 | if (maxlen > CLEANCACHE_KEY_MAX) |
95 | return -1; | 95 | return -1; |
diff --git a/mm/fadvise.c b/mm/fadvise.c index 909ec558625c..7e092689a12a 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c | |||
@@ -39,7 +39,7 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) | |||
39 | if (!f.file) | 39 | if (!f.file) |
40 | return -EBADF; | 40 | return -EBADF; |
41 | 41 | ||
42 | if (S_ISFIFO(f.file->f_path.dentry->d_inode->i_mode)) { | 42 | if (S_ISFIFO(file_inode(f.file)->i_mode)) { |
43 | ret = -ESPIPE; | 43 | ret = -ESPIPE; |
44 | goto out; | 44 | goto out; |
45 | } | 45 | } |
diff --git a/mm/filemap.c b/mm/filemap.c index c610076c30e1..e1979fdca805 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1711,7 +1711,7 @@ EXPORT_SYMBOL(filemap_fault); | |||
1711 | int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 1711 | int 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 cdb64e4d238a..0a0be33bb199 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 | ||
128 | static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma) | 128 | static 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 | /* |
@@ -2479,7 +2479,7 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2479 | address = address & huge_page_mask(h); | 2479 | address = address & huge_page_mask(h); |
2480 | pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + | 2480 | pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + |
2481 | vma->vm_pgoff; | 2481 | vma->vm_pgoff; |
2482 | mapping = vma->vm_file->f_dentry->d_inode->i_mapping; | 2482 | mapping = file_inode(vma->vm_file)->i_mapping; |
2483 | 2483 | ||
2484 | /* | 2484 | /* |
2485 | * Take the mapping lock for the duration of the table walk. As | 2485 | * Take the mapping lock for the duration of the table walk. As |
@@ -203,7 +203,7 @@ static void __remove_shared_vm_struct(struct vm_area_struct *vma, | |||
203 | struct file *file, struct address_space *mapping) | 203 | struct file *file, struct address_space *mapping) |
204 | { | 204 | { |
205 | if (vma->vm_flags & VM_DENYWRITE) | 205 | if (vma->vm_flags & VM_DENYWRITE) |
206 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 206 | atomic_inc(&file_inode(file)->i_writecount); |
207 | if (vma->vm_flags & VM_SHARED) | 207 | if (vma->vm_flags & VM_SHARED) |
208 | mapping->i_mmap_writable--; | 208 | mapping->i_mmap_writable--; |
209 | 209 | ||
@@ -576,7 +576,7 @@ static void __vma_link_file(struct vm_area_struct *vma) | |||
576 | struct address_space *mapping = file->f_mapping; | 576 | struct address_space *mapping = file->f_mapping; |
577 | 577 | ||
578 | if (vma->vm_flags & VM_DENYWRITE) | 578 | if (vma->vm_flags & VM_DENYWRITE) |
579 | atomic_dec(&file->f_path.dentry->d_inode->i_writecount); | 579 | atomic_dec(&file_inode(file)->i_writecount); |
580 | if (vma->vm_flags & VM_SHARED) | 580 | if (vma->vm_flags & VM_SHARED) |
581 | mapping->i_mmap_writable++; | 581 | mapping->i_mmap_writable++; |
582 | 582 | ||
@@ -1229,7 +1229,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
1229 | return -EAGAIN; | 1229 | return -EAGAIN; |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | inode = file ? file->f_path.dentry->d_inode : NULL; | 1232 | inode = file ? file_inode(file) : NULL; |
1233 | 1233 | ||
1234 | if (file) { | 1234 | if (file) { |
1235 | switch (flags & MAP_TYPE) { | 1235 | switch (flags & MAP_TYPE) { |
@@ -1431,7 +1431,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, | |||
1431 | int error; | 1431 | int error; |
1432 | struct rb_node **rb_link, *rb_parent; | 1432 | struct rb_node **rb_link, *rb_parent; |
1433 | unsigned long charged = 0; | 1433 | unsigned long charged = 0; |
1434 | struct inode *inode = file ? file->f_path.dentry->d_inode : NULL; | 1434 | struct inode *inode = file ? file_inode(file) : NULL; |
1435 | 1435 | ||
1436 | /* Clear old maps */ | 1436 | /* Clear old maps */ |
1437 | error = -ENOMEM; | 1437 | error = -ENOMEM; |
diff --git a/mm/nommu.c b/mm/nommu.c index da0d210fd403..e19328087534 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -943,7 +943,7 @@ static int validate_mmap_request(struct file *file, | |||
943 | */ | 943 | */ |
944 | mapping = file->f_mapping; | 944 | mapping = file->f_mapping; |
945 | if (!mapping) | 945 | if (!mapping) |
946 | mapping = file->f_path.dentry->d_inode->i_mapping; | 946 | mapping = file_inode(file)->i_mapping; |
947 | 947 | ||
948 | capabilities = 0; | 948 | capabilities = 0; |
949 | if (mapping && mapping->backing_dev_info) | 949 | if (mapping && mapping->backing_dev_info) |
@@ -952,7 +952,7 @@ static int validate_mmap_request(struct file *file, | |||
952 | if (!capabilities) { | 952 | if (!capabilities) { |
953 | /* no explicit capabilities set, so assume some | 953 | /* no explicit capabilities set, so assume some |
954 | * defaults */ | 954 | * defaults */ |
955 | switch (file->f_path.dentry->d_inode->i_mode & S_IFMT) { | 955 | switch (file_inode(file)->i_mode & S_IFMT) { |
956 | case S_IFREG: | 956 | case S_IFREG: |
957 | case S_IFBLK: | 957 | case S_IFBLK: |
958 | capabilities = BDI_CAP_MAP_COPY; | 958 | capabilities = BDI_CAP_MAP_COPY; |
@@ -987,11 +987,11 @@ static int validate_mmap_request(struct file *file, | |||
987 | !(file->f_mode & FMODE_WRITE)) | 987 | !(file->f_mode & FMODE_WRITE)) |
988 | return -EACCES; | 988 | return -EACCES; |
989 | 989 | ||
990 | if (IS_APPEND(file->f_path.dentry->d_inode) && | 990 | if (IS_APPEND(file_inode(file)) && |
991 | (file->f_mode & FMODE_WRITE)) | 991 | (file->f_mode & FMODE_WRITE)) |
992 | return -EACCES; | 992 | return -EACCES; |
993 | 993 | ||
994 | if (locks_verify_locked(file->f_path.dentry->d_inode)) | 994 | if (locks_verify_locked(file_inode(file))) |
995 | return -EAGAIN; | 995 | return -EAGAIN; |
996 | 996 | ||
997 | if (!(capabilities & BDI_CAP_MAP_DIRECT)) | 997 | if (!(capabilities & BDI_CAP_MAP_DIRECT)) |
@@ -1327,8 +1327,8 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
1327 | continue; | 1327 | continue; |
1328 | 1328 | ||
1329 | /* search for overlapping mappings on the same file */ | 1329 | /* search for overlapping mappings on the same file */ |
1330 | if (pregion->vm_file->f_path.dentry->d_inode != | 1330 | if (file_inode(pregion->vm_file) != |
1331 | file->f_path.dentry->d_inode) | 1331 | file_inode(file)) |
1332 | continue; | 1332 | continue; |
1333 | 1333 | ||
1334 | if (pregion->vm_pgoff >= pgend) | 1334 | if (pregion->vm_pgoff >= pgend) |
diff --git a/mm/shmem.c b/mm/shmem.c index 39de1d6a077a..ed2befb4952e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1294,7 +1294,7 @@ unlock: | |||
1294 | 1294 | ||
1295 | static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 1295 | static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1296 | { | 1296 | { |
1297 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1297 | struct inode *inode = file_inode(vma->vm_file); |
1298 | int error; | 1298 | int error; |
1299 | int ret = VM_FAULT_LOCKED; | 1299 | int ret = VM_FAULT_LOCKED; |
1300 | 1300 | ||
@@ -1312,14 +1312,14 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1312 | #ifdef CONFIG_NUMA | 1312 | #ifdef CONFIG_NUMA |
1313 | static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) | 1313 | static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) |
1314 | { | 1314 | { |
1315 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1315 | struct inode *inode = file_inode(vma->vm_file); |
1316 | return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol); | 1316 | return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol); |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, | 1319 | static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, |
1320 | unsigned long addr) | 1320 | unsigned long addr) |
1321 | { | 1321 | { |
1322 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1322 | struct inode *inode = file_inode(vma->vm_file); |
1323 | pgoff_t index; | 1323 | pgoff_t index; |
1324 | 1324 | ||
1325 | index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | 1325 | index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
@@ -1329,7 +1329,7 @@ static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, | |||
1329 | 1329 | ||
1330 | int shmem_lock(struct file *file, int lock, struct user_struct *user) | 1330 | int shmem_lock(struct file *file, int lock, struct user_struct *user) |
1331 | { | 1331 | { |
1332 | struct inode *inode = file->f_path.dentry->d_inode; | 1332 | struct inode *inode = file_inode(file); |
1333 | struct shmem_inode_info *info = SHMEM_I(inode); | 1333 | struct shmem_inode_info *info = SHMEM_I(inode); |
1334 | int retval = -ENOMEM; | 1334 | int retval = -ENOMEM; |
1335 | 1335 | ||
@@ -1464,7 +1464,7 @@ shmem_write_end(struct file *file, struct address_space *mapping, | |||
1464 | 1464 | ||
1465 | static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor) | 1465 | static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor) |
1466 | { | 1466 | { |
1467 | struct inode *inode = filp->f_path.dentry->d_inode; | 1467 | struct inode *inode = file_inode(filp); |
1468 | struct address_space *mapping = inode->i_mapping; | 1468 | struct address_space *mapping = inode->i_mapping; |
1469 | pgoff_t index; | 1469 | pgoff_t index; |
1470 | unsigned long offset; | 1470 | unsigned long offset; |
@@ -1807,7 +1807,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) | |||
1807 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, | 1807 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, |
1808 | loff_t len) | 1808 | loff_t len) |
1809 | { | 1809 | { |
1810 | struct inode *inode = file->f_path.dentry->d_inode; | 1810 | struct inode *inode = file_inode(file); |
1811 | struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); | 1811 | struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); |
1812 | struct shmem_falloc shmem_falloc; | 1812 | struct shmem_falloc shmem_falloc; |
1813 | pgoff_t start, index, end; | 1813 | pgoff_t start, index, end; |
@@ -2350,7 +2350,7 @@ static int shmem_encode_fh(struct inode *inode, __u32 *fh, int *len, | |||
2350 | { | 2350 | { |
2351 | if (*len < 3) { | 2351 | if (*len < 3) { |
2352 | *len = 3; | 2352 | *len = 3; |
2353 | return 255; | 2353 | return FILEID_INVALID; |
2354 | } | 2354 | } |
2355 | 2355 | ||
2356 | if (inode_unhashed(inode)) { | 2356 | if (inode_unhashed(inode)) { |
@@ -2879,6 +2879,16 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); | |||
2879 | 2879 | ||
2880 | /* common code */ | 2880 | /* common code */ |
2881 | 2881 | ||
2882 | static char *shmem_dname(struct dentry *dentry, char *buffer, int buflen) | ||
2883 | { | ||
2884 | return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)", | ||
2885 | dentry->d_name.name); | ||
2886 | } | ||
2887 | |||
2888 | static struct dentry_operations anon_ops = { | ||
2889 | .d_dname = shmem_dname | ||
2890 | }; | ||
2891 | |||
2882 | /** | 2892 | /** |
2883 | * shmem_file_setup - get an unlinked file living in tmpfs | 2893 | * shmem_file_setup - get an unlinked file living in tmpfs |
2884 | * @name: name for dentry (to be seen in /proc/<pid>/maps | 2894 | * @name: name for dentry (to be seen in /proc/<pid>/maps |
@@ -2887,15 +2897,14 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); | |||
2887 | */ | 2897 | */ |
2888 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) | 2898 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) |
2889 | { | 2899 | { |
2890 | int error; | 2900 | struct file *res; |
2891 | struct file *file; | ||
2892 | struct inode *inode; | 2901 | struct inode *inode; |
2893 | struct path path; | 2902 | struct path path; |
2894 | struct dentry *root; | 2903 | struct super_block *sb; |
2895 | struct qstr this; | 2904 | struct qstr this; |
2896 | 2905 | ||
2897 | if (IS_ERR(shm_mnt)) | 2906 | if (IS_ERR(shm_mnt)) |
2898 | return (void *)shm_mnt; | 2907 | return ERR_CAST(shm_mnt); |
2899 | 2908 | ||
2900 | if (size < 0 || size > MAX_LFS_FILESIZE) | 2909 | if (size < 0 || size > MAX_LFS_FILESIZE) |
2901 | return ERR_PTR(-EINVAL); | 2910 | return ERR_PTR(-EINVAL); |
@@ -2903,18 +2912,19 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags | |||
2903 | if (shmem_acct_size(flags, size)) | 2912 | if (shmem_acct_size(flags, size)) |
2904 | return ERR_PTR(-ENOMEM); | 2913 | return ERR_PTR(-ENOMEM); |
2905 | 2914 | ||
2906 | error = -ENOMEM; | 2915 | res = ERR_PTR(-ENOMEM); |
2907 | this.name = name; | 2916 | this.name = name; |
2908 | this.len = strlen(name); | 2917 | this.len = strlen(name); |
2909 | this.hash = 0; /* will go */ | 2918 | this.hash = 0; /* will go */ |
2910 | root = shm_mnt->mnt_root; | 2919 | sb = shm_mnt->mnt_sb; |
2911 | path.dentry = d_alloc(root, &this); | 2920 | path.dentry = d_alloc_pseudo(sb, &this); |
2912 | if (!path.dentry) | 2921 | if (!path.dentry) |
2913 | goto put_memory; | 2922 | goto put_memory; |
2923 | d_set_d_op(path.dentry, &anon_ops); | ||
2914 | path.mnt = mntget(shm_mnt); | 2924 | path.mnt = mntget(shm_mnt); |
2915 | 2925 | ||
2916 | error = -ENOSPC; | 2926 | res = ERR_PTR(-ENOSPC); |
2917 | inode = shmem_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0, flags); | 2927 | inode = shmem_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0, flags); |
2918 | if (!inode) | 2928 | if (!inode) |
2919 | goto put_dentry; | 2929 | goto put_dentry; |
2920 | 2930 | ||
@@ -2923,23 +2933,23 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags | |||
2923 | clear_nlink(inode); /* It is unlinked */ | 2933 | clear_nlink(inode); /* It is unlinked */ |
2924 | #ifndef CONFIG_MMU | 2934 | #ifndef CONFIG_MMU |
2925 | error = ramfs_nommu_expand_for_mapping(inode, size); | 2935 | error = ramfs_nommu_expand_for_mapping(inode, size); |
2936 | res = ERR_PTR(error); | ||
2926 | if (error) | 2937 | if (error) |
2927 | goto put_dentry; | 2938 | goto put_dentry; |
2928 | #endif | 2939 | #endif |
2929 | 2940 | ||
2930 | error = -ENFILE; | 2941 | res = alloc_file(&path, FMODE_WRITE | FMODE_READ, |
2931 | file = alloc_file(&path, FMODE_WRITE | FMODE_READ, | ||
2932 | &shmem_file_operations); | 2942 | &shmem_file_operations); |
2933 | if (!file) | 2943 | if (IS_ERR(res)) |
2934 | goto put_dentry; | 2944 | goto put_dentry; |
2935 | 2945 | ||
2936 | return file; | 2946 | return res; |
2937 | 2947 | ||
2938 | put_dentry: | 2948 | put_dentry: |
2939 | path_put(&path); | 2949 | path_put(&path); |
2940 | put_memory: | 2950 | put_memory: |
2941 | shmem_unacct_size(flags, size); | 2951 | shmem_unacct_size(flags, size); |
2942 | return ERR_PTR(error); | 2952 | return res; |
2943 | } | 2953 | } |
2944 | EXPORT_SYMBOL_GPL(shmem_file_setup); | 2954 | EXPORT_SYMBOL_GPL(shmem_file_setup); |
2945 | 2955 | ||
diff --git a/mm/swapfile.c b/mm/swapfile.c index c72c648f750c..a1f7772a01fc 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1774,7 +1774,7 @@ static int swap_show(struct seq_file *swap, void *v) | |||
1774 | len = seq_path(swap, &file->f_path, " \t\n\\"); | 1774 | len = seq_path(swap, &file->f_path, " \t\n\\"); |
1775 | seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", | 1775 | seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", |
1776 | len < 40 ? 40 - len : 1, " ", | 1776 | len < 40 ? 40 - len : 1, " ", |
1777 | S_ISBLK(file->f_path.dentry->d_inode->i_mode) ? | 1777 | S_ISBLK(file_inode(file)->i_mode) ? |
1778 | "partition" : "file\t", | 1778 | "partition" : "file\t", |
1779 | si->pages << (PAGE_SHIFT - 10), | 1779 | si->pages << (PAGE_SHIFT - 10), |
1780 | si->inuse_pages << (PAGE_SHIFT - 10), | 1780 | si->inuse_pages << (PAGE_SHIFT - 10), |