diff options
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 73ba1df7c8ba..a63031fa3e0c 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! */ |
@@ -1013,7 +1008,7 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp, | |||
1013 | */ | 1008 | */ |
1014 | oldpage = newpage; | 1009 | oldpage = newpage; |
1015 | } else { | 1010 | } else { |
1016 | mem_cgroup_migrate(oldpage, newpage, false); | 1011 | mem_cgroup_migrate(oldpage, newpage, true); |
1017 | lru_cache_add_anon(newpage); | 1012 | lru_cache_add_anon(newpage); |
1018 | *pagep = newpage; | 1013 | *pagep = newpage; |
1019 | } | 1014 | } |
@@ -1131,7 +1126,7 @@ repeat: | |||
1131 | * truncated or holepunched since swap was confirmed. | 1126 | * truncated or holepunched since swap was confirmed. |
1132 | * shmem_undo_range() will have done some of the | 1127 | * shmem_undo_range() will have done some of the |
1133 | * unaccounting, now delete_from_swap_cache() will do | 1128 | * unaccounting, now delete_from_swap_cache() will do |
1134 | * the rest (including mem_cgroup_uncharge_swapcache). | 1129 | * the rest. |
1135 | * Reset swap.val? No, leave it so "failed" goes back to | 1130 | * Reset swap.val? No, leave it so "failed" goes back to |
1136 | * "repeat": reading a hole and writing should succeed. | 1131 | * "repeat": reading a hole and writing should succeed. |
1137 | */ | 1132 | */ |
@@ -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 | ||
1462 | bool shmem_mapping(struct address_space *mapping) | 1456 | bool 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 |
@@ -3201,7 +3195,6 @@ static const struct vm_operations_struct shmem_vm_ops = { | |||
3201 | .set_policy = shmem_set_policy, | 3195 | .set_policy = shmem_set_policy, |
3202 | .get_policy = shmem_get_policy, | 3196 | .get_policy = shmem_get_policy, |
3203 | #endif | 3197 | #endif |
3204 | .remap_pages = generic_file_remap_pages, | ||
3205 | }; | 3198 | }; |
3206 | 3199 | ||
3207 | static struct dentry *shmem_mount(struct file_system_type *fs_type, | 3200 | static struct dentry *shmem_mount(struct file_system_type *fs_type, |
@@ -3226,10 +3219,6 @@ int __init shmem_init(void) | |||
3226 | if (shmem_inode_cachep) | 3219 | if (shmem_inode_cachep) |
3227 | return 0; | 3220 | return 0; |
3228 | 3221 | ||
3229 | error = bdi_init(&shmem_backing_dev_info); | ||
3230 | if (error) | ||
3231 | goto out4; | ||
3232 | |||
3233 | error = shmem_init_inodecache(); | 3222 | error = shmem_init_inodecache(); |
3234 | if (error) | 3223 | if (error) |
3235 | goto out3; | 3224 | goto out3; |
@@ -3253,8 +3242,6 @@ out1: | |||
3253 | out2: | 3242 | out2: |
3254 | shmem_destroy_inodecache(); | 3243 | shmem_destroy_inodecache(); |
3255 | out3: | 3244 | out3: |
3256 | bdi_destroy(&shmem_backing_dev_info); | ||
3257 | out4: | ||
3258 | shm_mnt = ERR_PTR(error); | 3245 | shm_mnt = ERR_PTR(error); |
3259 | return error; | 3246 | return error; |
3260 | } | 3247 | } |