aboutsummaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-11-25 21:55:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-11-25 21:55:44 -0500
commit277f850fbc4a0c732311af2b9a2d28d29a3c5582 (patch)
tree49edadbb3dc04d62117b7ceeb6018e5ac8df0596 /fs/aio.c
parentd1ca00078071cb6c45f15ab589682182cb5e628e (diff)
parent835f252c6debd204fcd607c79975089b1ecd3472 (diff)
Merge git://git.kvack.org/~bcrl/aio-fixes
Pull aio fix from Ben LaHaise: "Dirty page accounting fix for aio" * git://git.kvack.org/~bcrl/aio-fixes: aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 84a751005f5b..14b93159ef83 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -165,6 +165,15 @@ static struct vfsmount *aio_mnt;
165static const struct file_operations aio_ring_fops; 165static const struct file_operations aio_ring_fops;
166static const struct address_space_operations aio_ctx_aops; 166static const struct address_space_operations aio_ctx_aops;
167 167
168/* Backing dev info for aio fs.
169 * -no dirty page accounting or writeback happens
170 */
171static struct backing_dev_info aio_fs_backing_dev_info = {
172 .name = "aiofs",
173 .state = 0,
174 .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_MAP_COPY,
175};
176
168static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) 177static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
169{ 178{
170 struct qstr this = QSTR_INIT("[aio]", 5); 179 struct qstr this = QSTR_INIT("[aio]", 5);
@@ -176,6 +185,7 @@ static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
176 185
177 inode->i_mapping->a_ops = &aio_ctx_aops; 186 inode->i_mapping->a_ops = &aio_ctx_aops;
178 inode->i_mapping->private_data = ctx; 187 inode->i_mapping->private_data = ctx;
188 inode->i_mapping->backing_dev_info = &aio_fs_backing_dev_info;
179 inode->i_size = PAGE_SIZE * nr_pages; 189 inode->i_size = PAGE_SIZE * nr_pages;
180 190
181 path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this); 191 path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this);
@@ -220,6 +230,9 @@ static int __init aio_setup(void)
220 if (IS_ERR(aio_mnt)) 230 if (IS_ERR(aio_mnt))
221 panic("Failed to create aio fs mount."); 231 panic("Failed to create aio fs mount.");
222 232
233 if (bdi_init(&aio_fs_backing_dev_info))
234 panic("Failed to init aio fs backing dev info.");
235
223 kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); 236 kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
224 kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); 237 kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
225 238
@@ -281,11 +294,6 @@ static const struct file_operations aio_ring_fops = {
281 .mmap = aio_ring_mmap, 294 .mmap = aio_ring_mmap,
282}; 295};
283 296
284static int aio_set_page_dirty(struct page *page)
285{
286 return 0;
287}
288
289#if IS_ENABLED(CONFIG_MIGRATION) 297#if IS_ENABLED(CONFIG_MIGRATION)
290static int aio_migratepage(struct address_space *mapping, struct page *new, 298static int aio_migratepage(struct address_space *mapping, struct page *new,
291 struct page *old, enum migrate_mode mode) 299 struct page *old, enum migrate_mode mode)
@@ -357,7 +365,7 @@ out:
357#endif 365#endif
358 366
359static const struct address_space_operations aio_ctx_aops = { 367static const struct address_space_operations aio_ctx_aops = {
360 .set_page_dirty = aio_set_page_dirty, 368 .set_page_dirty = __set_page_dirty_no_writeback,
361#if IS_ENABLED(CONFIG_MIGRATION) 369#if IS_ENABLED(CONFIG_MIGRATION)
362 .migratepage = aio_migratepage, 370 .migratepage = aio_migratepage,
363#endif 371#endif
@@ -412,7 +420,6 @@ static int aio_setup_ring(struct kioctx *ctx)
412 pr_debug("pid(%d) page[%d]->count=%d\n", 420 pr_debug("pid(%d) page[%d]->count=%d\n",
413 current->pid, i, page_count(page)); 421 current->pid, i, page_count(page));
414 SetPageUptodate(page); 422 SetPageUptodate(page);
415 SetPageDirty(page);
416 unlock_page(page); 423 unlock_page(page);
417 424
418 ctx->ring_pages[i] = page; 425 ctx->ring_pages[i] = page;