diff options
author | Yufen Yu <yuyufen@huawei.com> | 2022-05-25 11:43:36 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-05-25 19:48:56 +0200 |
commit | 908ea6541661d72c6852650f91adebba88b0de0b (patch) | |
tree | f39bf74b1d0cf8464b80431e2976e0f527341d42 /fs/f2fs/super.c | |
parent | f2fs: avoid unneeded error handling for revoke_entry_slab allocation (diff) | |
download | linux-908ea6541661d72c6852650f91adebba88b0de0b.tar.xz linux-908ea6541661d72c6852650f91adebba88b0de0b.zip |
f2fs: add f2fs_init_write_merge_io function
Almost all other initialization of variables in f2fs_fill_super are
extraced to a single function. Also do it for write_io[], which can
make code more clean.
This patch just refactors the code, theres no functional change.
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
[Jaegeuk Kim: clean up]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 63daae67a9d9..5b558f69c461 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4091,30 +4091,9 @@ try_onemore: set_sbi_flag(sbi, SBI_POR_DOING); spin_lock_init(&sbi->stat_lock); - for (i = 0; i < NR_PAGE_TYPE; i++) { - int n = (i == META) ? 1 : NR_TEMP_TYPE; - int j; - - sbi->write_io[i] = - f2fs_kmalloc(sbi, - array_size(n, - sizeof(struct f2fs_bio_info)), - GFP_KERNEL); - if (!sbi->write_io[i]) { - err = -ENOMEM; - goto free_bio_info; - } - - for (j = HOT; j < n; j++) { - init_f2fs_rwsem(&sbi->write_io[i][j].io_rwsem); - sbi->write_io[i][j].sbi = sbi; - sbi->write_io[i][j].bio = NULL; - spin_lock_init(&sbi->write_io[i][j].io_lock); - INIT_LIST_HEAD(&sbi->write_io[i][j].io_list); - INIT_LIST_HEAD(&sbi->write_io[i][j].bio_list); - init_f2fs_rwsem(&sbi->write_io[i][j].bio_list_lock); - } - } + err = f2fs_init_write_merge_io(sbi); + if (err) + goto free_bio_info; init_f2fs_rwsem(&sbi->cp_rwsem); init_f2fs_rwsem(&sbi->quota_sem); |