diff options
Diffstat (limited to 'fs/ramfs/file-nommu.c')
-rw-r--r-- | fs/ramfs/file-nommu.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 5d7c7ececa64..ebb2c417912c 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/backing-dev.h> | 19 | #include <linux/backing-dev.h> |
20 | #include <linux/ramfs.h> | 20 | #include <linux/ramfs.h> |
21 | #include <linux/quotaops.h> | ||
22 | #include <linux/pagevec.h> | 21 | #include <linux/pagevec.h> |
23 | #include <linux/mman.h> | 22 | #include <linux/mman.h> |
24 | 23 | ||
@@ -60,7 +59,6 @@ const struct inode_operations ramfs_file_inode_operations = { | |||
60 | */ | 59 | */ |
61 | int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) | 60 | int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) |
62 | { | 61 | { |
63 | struct pagevec lru_pvec; | ||
64 | unsigned long npages, xpages, loop, limit; | 62 | unsigned long npages, xpages, loop, limit; |
65 | struct page *pages; | 63 | struct page *pages; |
66 | unsigned order; | 64 | unsigned order; |
@@ -103,24 +101,20 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) | |||
103 | memset(data, 0, newsize); | 101 | memset(data, 0, newsize); |
104 | 102 | ||
105 | /* attach all the pages to the inode's address space */ | 103 | /* attach all the pages to the inode's address space */ |
106 | pagevec_init(&lru_pvec, 0); | ||
107 | for (loop = 0; loop < npages; loop++) { | 104 | for (loop = 0; loop < npages; loop++) { |
108 | struct page *page = pages + loop; | 105 | struct page *page = pages + loop; |
109 | 106 | ||
110 | ret = add_to_page_cache(page, inode->i_mapping, loop, GFP_KERNEL); | 107 | ret = add_to_page_cache_lru(page, inode->i_mapping, loop, |
108 | GFP_KERNEL); | ||
111 | if (ret < 0) | 109 | if (ret < 0) |
112 | goto add_error; | 110 | goto add_error; |
113 | 111 | ||
114 | if (!pagevec_add(&lru_pvec, page)) | ||
115 | __pagevec_lru_add_file(&lru_pvec); | ||
116 | |||
117 | /* prevent the page from being discarded on memory pressure */ | 112 | /* prevent the page from being discarded on memory pressure */ |
118 | SetPageDirty(page); | 113 | SetPageDirty(page); |
119 | 114 | ||
120 | unlock_page(page); | 115 | unlock_page(page); |
121 | } | 116 | } |
122 | 117 | ||
123 | pagevec_lru_add_file(&lru_pvec); | ||
124 | return 0; | 118 | return 0; |
125 | 119 | ||
126 | fsize_exceeded: | 120 | fsize_exceeded: |
@@ -129,10 +123,8 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) | |||
129 | return -EFBIG; | 123 | return -EFBIG; |
130 | 124 | ||
131 | add_error: | 125 | add_error: |
132 | pagevec_lru_add_file(&lru_pvec); | 126 | while (loop < npages) |
133 | page_cache_release(pages + loop); | 127 | __free_page(pages + loop++); |
134 | for (loop++; loop < npages; loop++) | ||
135 | __free_page(pages + loop); | ||
136 | return ret; | 128 | return ret; |
137 | } | 129 | } |
138 | 130 | ||
@@ -205,11 +197,6 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia) | |||
205 | if (ret) | 197 | if (ret) |
206 | return ret; | 198 | return ret; |
207 | 199 | ||
208 | /* by providing our own setattr() method, we skip this quotaism */ | ||
209 | if ((old_ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) || | ||
210 | (old_ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid)) | ||
211 | ret = DQUOT_TRANSFER(inode, ia) ? -EDQUOT : 0; | ||
212 | |||
213 | /* pick out size-changing events */ | 200 | /* pick out size-changing events */ |
214 | if (ia->ia_valid & ATTR_SIZE) { | 201 | if (ia->ia_valid & ATTR_SIZE) { |
215 | loff_t size = i_size_read(inode); | 202 | loff_t size = i_size_read(inode); |