summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-04-12 06:24:46 -0400
committerJens Axboe <axboe@fb.com>2017-04-20 14:09:55 -0400
commit99edd4580b7444f57d7494e6433cdbdb08d5a19d (patch)
tree16c60f55ab38f2131a42b48c77dc8ba61112f05c /fs
parent0db10944a76ba09f37d43b99d0fe085a18307f22 (diff)
ubifs: Convert to separately allocated bdi
Allocate struct backing_dev_info separately instead of embedding it inside the superblock. This unifies handling of bdi among users. CC: Richard Weinberger <richard@nod.at> CC: Artem Bityutskiy <dedekind1@gmail.com> CC: Adrian Hunter <adrian.hunter@intel.com> CC: linux-mtd@lists.infradead.org Acked-by: Richard Weinberger <richard@nod.at> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/super.c25
-rw-r--r--fs/ubifs/ubifs.h3
2 files changed, 9 insertions, 19 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index b73811bd7676..cf4cc99b75b5 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1827,7 +1827,6 @@ static void ubifs_put_super(struct super_block *sb)
1827 } 1827 }
1828 1828
1829 ubifs_umount(c); 1829 ubifs_umount(c);
1830 bdi_destroy(&c->bdi);
1831 ubi_close_volume(c->ubi); 1830 ubi_close_volume(c->ubi);
1832 mutex_unlock(&c->umount_mutex); 1831 mutex_unlock(&c->umount_mutex);
1833} 1832}
@@ -2019,29 +2018,25 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
2019 goto out; 2018 goto out;
2020 } 2019 }
2021 2020
2021 err = ubifs_parse_options(c, data, 0);
2022 if (err)
2023 goto out_close;
2024
2022 /* 2025 /*
2023 * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For 2026 * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For
2024 * UBIFS, I/O is not deferred, it is done immediately in readpage, 2027 * UBIFS, I/O is not deferred, it is done immediately in readpage,
2025 * which means the user would have to wait not just for their own I/O 2028 * which means the user would have to wait not just for their own I/O
2026 * but the read-ahead I/O as well i.e. completely pointless. 2029 * but the read-ahead I/O as well i.e. completely pointless.
2027 * 2030 *
2028 * Read-ahead will be disabled because @c->bdi.ra_pages is 0. 2031 * Read-ahead will be disabled because @sb->s_bdi->ra_pages is 0. Also
2032 * @sb->s_bdi->capabilities are initialized to 0 so there won't be any
2033 * writeback happening.
2029 */ 2034 */
2030 c->bdi.name = "ubifs", 2035 err = super_setup_bdi_name(sb, "ubifs_%d_%d", c->vi.ubi_num,
2031 c->bdi.capabilities = 0; 2036 c->vi.vol_id);
2032 err = bdi_init(&c->bdi);
2033 if (err) 2037 if (err)
2034 goto out_close; 2038 goto out_close;
2035 err = bdi_register(&c->bdi, NULL, "ubifs_%d_%d",
2036 c->vi.ubi_num, c->vi.vol_id);
2037 if (err)
2038 goto out_bdi;
2039
2040 err = ubifs_parse_options(c, data, 0);
2041 if (err)
2042 goto out_bdi;
2043 2039
2044 sb->s_bdi = &c->bdi;
2045 sb->s_fs_info = c; 2040 sb->s_fs_info = c;
2046 sb->s_magic = UBIFS_SUPER_MAGIC; 2041 sb->s_magic = UBIFS_SUPER_MAGIC;
2047 sb->s_blocksize = UBIFS_BLOCK_SIZE; 2042 sb->s_blocksize = UBIFS_BLOCK_SIZE;
@@ -2080,8 +2075,6 @@ out_umount:
2080 ubifs_umount(c); 2075 ubifs_umount(c);
2081out_unlock: 2076out_unlock:
2082 mutex_unlock(&c->umount_mutex); 2077 mutex_unlock(&c->umount_mutex);
2083out_bdi:
2084 bdi_destroy(&c->bdi);
2085out_close: 2078out_close:
2086 ubi_close_volume(c->ubi); 2079 ubi_close_volume(c->ubi);
2087out: 2080out:
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 4d57e488038e..4da10a6d702a 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -972,7 +972,6 @@ struct ubifs_debug_info;
972 * struct ubifs_info - UBIFS file-system description data structure 972 * struct ubifs_info - UBIFS file-system description data structure
973 * (per-superblock). 973 * (per-superblock).
974 * @vfs_sb: VFS @struct super_block object 974 * @vfs_sb: VFS @struct super_block object
975 * @bdi: backing device info object to make VFS happy and disable read-ahead
976 * 975 *
977 * @highest_inum: highest used inode number 976 * @highest_inum: highest used inode number
978 * @max_sqnum: current global sequence number 977 * @max_sqnum: current global sequence number
@@ -1220,7 +1219,6 @@ struct ubifs_debug_info;
1220 */ 1219 */
1221struct ubifs_info { 1220struct ubifs_info {
1222 struct super_block *vfs_sb; 1221 struct super_block *vfs_sb;
1223 struct backing_dev_info bdi;
1224 1222
1225 ino_t highest_inum; 1223 ino_t highest_inum;
1226 unsigned long long max_sqnum; 1224 unsigned long long max_sqnum;
@@ -1461,7 +1459,6 @@ extern const struct inode_operations ubifs_file_inode_operations;
1461extern const struct file_operations ubifs_dir_operations; 1459extern const struct file_operations ubifs_dir_operations;
1462extern const struct inode_operations ubifs_dir_inode_operations; 1460extern const struct inode_operations ubifs_dir_inode_operations;
1463extern const struct inode_operations ubifs_symlink_inode_operations; 1461extern const struct inode_operations ubifs_symlink_inode_operations;
1464extern struct backing_dev_info ubifs_backing_dev_info;
1465extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; 1462extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
1466 1463
1467/* io.c */ 1464/* io.c */