Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jan Kara and committed by
Jens Axboe
99edd458 0db10944

+9 -19
+9 -16
fs/ubifs/super.c
··· 1827 1827 } 1828 1828 1829 1829 ubifs_umount(c); 1830 - bdi_destroy(&c->bdi); 1831 1830 ubi_close_volume(c->ubi); 1832 1831 mutex_unlock(&c->umount_mutex); 1833 1832 } ··· 2018 2019 goto out; 2019 2020 } 2020 2021 2022 + err = ubifs_parse_options(c, data, 0); 2023 + if (err) 2024 + goto out_close; 2025 + 2021 2026 /* 2022 2027 * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For 2023 2028 * UBIFS, I/O is not deferred, it is done immediately in readpage, 2024 2029 * which means the user would have to wait not just for their own I/O 2025 2030 * but the read-ahead I/O as well i.e. completely pointless. 2026 2031 * 2027 - * Read-ahead will be disabled because @c->bdi.ra_pages is 0. 2032 + * Read-ahead will be disabled because @sb->s_bdi->ra_pages is 0. Also 2033 + * @sb->s_bdi->capabilities are initialized to 0 so there won't be any 2034 + * writeback happening. 2028 2035 */ 2029 - c->bdi.name = "ubifs", 2030 - c->bdi.capabilities = 0; 2031 - err = bdi_init(&c->bdi); 2036 + err = super_setup_bdi_name(sb, "ubifs_%d_%d", c->vi.ubi_num, 2037 + c->vi.vol_id); 2032 2038 if (err) 2033 2039 goto out_close; 2034 - err = bdi_register(&c->bdi, NULL, "ubifs_%d_%d", 2035 - c->vi.ubi_num, c->vi.vol_id); 2036 - if (err) 2037 - goto out_bdi; 2038 2040 2039 - err = ubifs_parse_options(c, data, 0); 2040 - if (err) 2041 - goto out_bdi; 2042 - 2043 - sb->s_bdi = &c->bdi; 2044 2041 sb->s_fs_info = c; 2045 2042 sb->s_magic = UBIFS_SUPER_MAGIC; 2046 2043 sb->s_blocksize = UBIFS_BLOCK_SIZE; ··· 2075 2080 ubifs_umount(c); 2076 2081 out_unlock: 2077 2082 mutex_unlock(&c->umount_mutex); 2078 - out_bdi: 2079 - bdi_destroy(&c->bdi); 2080 2083 out_close: 2081 2084 ubi_close_volume(c->ubi); 2082 2085 out:
-3
fs/ubifs/ubifs.h
··· 972 972 * struct ubifs_info - UBIFS file-system description data structure 973 973 * (per-superblock). 974 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 976 * @highest_inum: highest used inode number 978 977 * @max_sqnum: current global sequence number ··· 1219 1220 */ 1220 1221 struct ubifs_info { 1221 1222 struct super_block *vfs_sb; 1222 - struct backing_dev_info bdi; 1223 1223 1224 1224 ino_t highest_inum; 1225 1225 unsigned long long max_sqnum; ··· 1459 1461 extern const struct file_operations ubifs_dir_operations; 1460 1462 extern const struct inode_operations ubifs_dir_inode_operations; 1461 1463 extern const struct inode_operations ubifs_symlink_inode_operations; 1462 - extern struct backing_dev_info ubifs_backing_dev_info; 1463 1464 extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; 1464 1465 1465 1466 /* io.c */