diff options
author | Christoph Hellwig <hch@lst.de> | 2015-01-14 04:42:31 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-01-20 16:02:56 -0500 |
commit | 97b713ba3ebaa6c8d84c2c720f5468a7c6a6eb4e (patch) | |
tree | a2a430b22f8c220e719114786905b18aa605f9ec /mm/shmem.c | |
parent | a7a2c680a2ad81b3181a335ee76e23d5195007ee (diff) |
fs: kill BDI_CAP_SWAP_BACKED
This bdi flag isn't too useful - we can determine that a vma is backed by
either swap or shmem trivially in the caller.
This also allows removing the backing_dev_info instaces for swap and shmem
in favor of noop_backing_dev_info.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 73ba1df7c8ba..1b77eaf589fd 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -191,11 +191,6 @@ static const struct inode_operations shmem_dir_inode_operations; | |||
191 | static const struct inode_operations shmem_special_inode_operations; | 191 | static const struct inode_operations shmem_special_inode_operations; |
192 | static const struct vm_operations_struct shmem_vm_ops; | 192 | static const struct vm_operations_struct shmem_vm_ops; |
193 | 193 | ||
194 | static 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 | |||
199 | static LIST_HEAD(shmem_swaplist); | 194 | static LIST_HEAD(shmem_swaplist); |
200 | static DEFINE_MUTEX(shmem_swaplist_mutex); | 195 | static 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,7 @@ 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; | 1413 | inode->i_mapping->backing_dev_info = &noop_backing_dev_info; |
1419 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 1414 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
1420 | inode->i_generation = get_seconds(); | 1415 | inode->i_generation = get_seconds(); |
1421 | info = SHMEM_I(inode); | 1416 | info = SHMEM_I(inode); |
@@ -1461,7 +1456,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode | |||
1461 | 1456 | ||
1462 | bool shmem_mapping(struct address_space *mapping) | 1457 | bool shmem_mapping(struct address_space *mapping) |
1463 | { | 1458 | { |
1464 | return mapping->backing_dev_info == &shmem_backing_dev_info; | 1459 | return mapping->host->i_sb->s_op == &shmem_ops; |
1465 | } | 1460 | } |
1466 | 1461 | ||
1467 | #ifdef CONFIG_TMPFS | 1462 | #ifdef CONFIG_TMPFS |
@@ -3226,10 +3221,6 @@ int __init shmem_init(void) | |||
3226 | if (shmem_inode_cachep) | 3221 | if (shmem_inode_cachep) |
3227 | return 0; | 3222 | return 0; |
3228 | 3223 | ||
3229 | error = bdi_init(&shmem_backing_dev_info); | ||
3230 | if (error) | ||
3231 | goto out4; | ||
3232 | |||
3233 | error = shmem_init_inodecache(); | 3224 | error = shmem_init_inodecache(); |
3234 | if (error) | 3225 | if (error) |
3235 | goto out3; | 3226 | goto out3; |
@@ -3253,8 +3244,6 @@ out1: | |||
3253 | out2: | 3244 | out2: |
3254 | shmem_destroy_inodecache(); | 3245 | shmem_destroy_inodecache(); |
3255 | out3: | 3246 | out3: |
3256 | bdi_destroy(&shmem_backing_dev_info); | ||
3257 | out4: | ||
3258 | shm_mnt = ERR_PTR(error); | 3247 | shm_mnt = ERR_PTR(error); |
3259 | return error; | 3248 | return error; |
3260 | } | 3249 | } |