--- zzzz-none-000/linux-3.10.107/fs/ramfs/inode.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/fs/ramfs/inode.c 2021-02-04 17:41:59.000000000 +0000 @@ -43,12 +43,11 @@ static const struct super_operations ramfs_ops; static const struct inode_operations ramfs_dir_inode_operations; -static struct backing_dev_info ramfs_backing_dev_info = { - .name = "ramfs", - .ra_pages = 0, /* No readahead */ - .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | - BDI_CAP_MAP_DIRECT | BDI_CAP_MAP_COPY | - BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP, +static const struct address_space_operations ramfs_aops = { + .readpage = simple_readpage, + .write_begin = simple_write_begin, + .write_end = simple_write_end, + .set_page_dirty = __set_page_dirty_no_writeback, }; struct inode *ramfs_get_inode(struct super_block *sb, @@ -60,7 +59,6 @@ inode->i_ino = get_next_ino(); inode_init_owner(inode, dir, mode); inode->i_mapping->a_ops = &ramfs_aops; - inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info; mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER); mapping_set_unevictable(inode->i_mapping); inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; @@ -244,12 +242,6 @@ return mount_nodev(fs_type, flags, data, ramfs_fill_super); } -static struct dentry *rootfs_mount(struct file_system_type *fs_type, - int flags, const char *dev_name, void *data) -{ - return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); -} - static void ramfs_kill_sb(struct super_block *sb) { kfree(sb->s_fs_info); @@ -262,29 +254,13 @@ .kill_sb = ramfs_kill_sb, .fs_flags = FS_USERNS_MOUNT, }; -static struct file_system_type rootfs_fs_type = { - .name = "rootfs", - .mount = rootfs_mount, - .kill_sb = kill_litter_super, -}; -static int __init init_ramfs_fs(void) +int __init init_ramfs_fs(void) { - return register_filesystem(&ramfs_fs_type); -} -module_init(init_ramfs_fs) + static unsigned long once; -int __init init_rootfs(void) -{ - int err; - - err = bdi_init(&ramfs_backing_dev_info); - if (err) - return err; - - err = register_filesystem(&rootfs_fs_type); - if (err) - bdi_destroy(&ramfs_backing_dev_info); - - return err; + if (test_and_set_bit(0, &once)) + return 0; + return register_filesystem(&ramfs_fs_type); } +fs_initcall(init_ramfs_fs);