aboutsummaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 16:50:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 16:50:21 -0500
commit6bec0035286119eefc32a5b1102127e6a4032cb2 (patch)
tree440fab001b4c877b0b0c9fd62d8392e956e387e3 /mm/shmem.c
parent5d8e7fb6916556e9b476de33404e8c9e2c9aee61 (diff)
parent15d0f5ea348b9c4e6d41df294dde38a56a39c7bf (diff)
Merge branch 'for-3.20/bdi' of git://git.kernel.dk/linux-block
Pull backing device changes from Jens Axboe: "This contains a cleanup of how the backing device is handled, in preparation for a rework of the life time rules. In this part, the most important change is to split the unrelated nommu mmap flags from it, but also removing a backing_dev_info pointer from the address_space (and inode), and a cleanup of other various minor bits. Christoph did all the work here, I just fixed an oops with pages that have a swap backing. Arnd fixed a missing export, and Oleg killed the lustre backing_dev_info from staging. Last patch was from Al, unexporting parts that are now no longer needed outside" * 'for-3.20/bdi' of git://git.kernel.dk/linux-block: Make super_blocks and sb_lock static mtd: export new mtd_mmap_capabilities fs: make inode_to_bdi() handle NULL inode staging/lustre/llite: get rid of backing_dev_info fs: remove default_backing_dev_info fs: don't reassign dirty inodes to default_backing_dev_info nfs: don't call bdi_unregister ceph: remove call to bdi_unregister fs: remove mapping->backing_dev_info fs: export inode_to_bdi and use it in favor of mapping->backing_dev_info nilfs2: set up s_bdi like the generic mount_bdev code block_dev: get bdev inode bdi directly from the block device block_dev: only write bdev inode on close fs: introduce f_op->mmap_capabilities for nommu mmap support fs: kill BDI_CAP_SWAP_BACKED fs: deduplicate noop_backing_dev_info
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 864c878401e6..a63031fa3e0c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -191,11 +191,6 @@ static const struct inode_operations shmem_dir_inode_operations;
191static const struct inode_operations shmem_special_inode_operations; 191static const struct inode_operations shmem_special_inode_operations;
192static const struct vm_operations_struct shmem_vm_ops; 192static const struct vm_operations_struct shmem_vm_ops;
193 193
194static struct backing_dev_info shmem_backing_dev_info __read_mostly = {
195 .ra_pages = 0, /* No readahead */
196 .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_SWAP_BACKED,
197};
198
199static LIST_HEAD(shmem_swaplist); 194static LIST_HEAD(shmem_swaplist);
200static DEFINE_MUTEX(shmem_swaplist_mutex); 195static DEFINE_MUTEX(shmem_swaplist_mutex);
201 196
@@ -765,11 +760,11 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
765 goto redirty; 760 goto redirty;
766 761
767 /* 762 /*
768 * shmem_backing_dev_info's capabilities prevent regular writeback or 763 * Our capabilities prevent regular writeback or sync from ever calling
769 * sync from ever calling shmem_writepage; but a stacking filesystem 764 * shmem_writepage; but a stacking filesystem might use ->writepage of
770 * might use ->writepage of its underlying filesystem, in which case 765 * its underlying filesystem, in which case tmpfs should write out to
771 * tmpfs should write out to swap only in response to memory pressure, 766 * swap only in response to memory pressure, and not for the writeback
772 * and not for the writeback threads or sync. 767 * threads or sync.
773 */ 768 */
774 if (!wbc->for_reclaim) { 769 if (!wbc->for_reclaim) {
775 WARN_ON_ONCE(1); /* Still happens? Tell us about it! */ 770 WARN_ON_ONCE(1); /* Still happens? Tell us about it! */
@@ -1415,7 +1410,6 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
1415 inode->i_ino = get_next_ino(); 1410 inode->i_ino = get_next_ino();
1416 inode_init_owner(inode, dir, mode); 1411 inode_init_owner(inode, dir, mode);
1417 inode->i_blocks = 0; 1412 inode->i_blocks = 0;
1418 inode->i_mapping->backing_dev_info = &shmem_backing_dev_info;
1419 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1413 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
1420 inode->i_generation = get_seconds(); 1414 inode->i_generation = get_seconds();
1421 info = SHMEM_I(inode); 1415 info = SHMEM_I(inode);
@@ -1461,7 +1455,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
1461 1455
1462bool shmem_mapping(struct address_space *mapping) 1456bool shmem_mapping(struct address_space *mapping)
1463{ 1457{
1464 return mapping->backing_dev_info == &shmem_backing_dev_info; 1458 return mapping->host->i_sb->s_op == &shmem_ops;
1465} 1459}
1466 1460
1467#ifdef CONFIG_TMPFS 1461#ifdef CONFIG_TMPFS
@@ -3225,10 +3219,6 @@ int __init shmem_init(void)
3225 if (shmem_inode_cachep) 3219 if (shmem_inode_cachep)
3226 return 0; 3220 return 0;
3227 3221
3228 error = bdi_init(&shmem_backing_dev_info);
3229 if (error)
3230 goto out4;
3231
3232 error = shmem_init_inodecache(); 3222 error = shmem_init_inodecache();
3233 if (error) 3223 if (error)
3234 goto out3; 3224 goto out3;
@@ -3252,8 +3242,6 @@ out1:
3252out2: 3242out2:
3253 shmem_destroy_inodecache(); 3243 shmem_destroy_inodecache();
3254out3: 3244out3:
3255 bdi_destroy(&shmem_backing_dev_info);
3256out4:
3257 shm_mnt = ERR_PTR(error); 3245 shm_mnt = ERR_PTR(error);
3258 return error; 3246 return error;
3259} 3247}