From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 00/15] btrfs: make open_ctree() init/exit sequence strictly matched
Date: Wed, 12 Oct 2022 17:12:56 +0800 [thread overview]
Message-ID: <cover.1665565866.git.wqu@suse.com> (raw)
[Changelog]
v2:
- Rebased to latest misc-next
Most conflicts comes from the new function btrfs_check_features().
Just like init_btrfs_fs(), open_ctree() also has tons of different
labels for its error handling.
And unsurprisingly the error handling labels are not matched correctly,
e.g. we always call btrfs_mapping_tree_free() even we didn't reach
sys chunk array read.
And every time we need to add some new function, it will be a disaster
just to understand where the new function should be put and how the
error handling should be done.
This patchset will follow the init_btrfs_fs() method, by introducing
an open_ctree_seq[] array, which contains the following sections:
- btree_inode init/exit
- super block read and verification
- mount options and features check
- workqueues init/exit
- chunk tree init/exit
- tree roots init/exit
- mount time check and various item load
- sysfs init/exit
- block group tree init/exit
- subvolume trees init/exit
- kthread init/exit
- qgroup init/exit
The remaining part of open_ctree() is only less than 50 lines, and are
all related to the very end of the mount progress, including log-replay,
uuid tree check.
Also to do better testing, for DEBUG build there will be a new mount
option, "fail_mount=%u" to allow open_ctree() to fail at certain stage
of open_ctree_seq[].
Unfortunately since that mount option can only be parsed in
open_ctree_features_init(), this means we can only fail after stage 2.
But this should still provide much better testing coverage.
Qu Wenruo (15):
btrfs: initialize fs_info->sb at the very beginning of open_ctree()
btrfs: remove @fs_devices argument from open_ctree()
btrfs: extract btree inode init code into its own init/exit helpers
btrfs: extract super block read code into its own init helper
btrfs: extract mount options and features init code into its own init
helper
btrfs: move btrfs_init_workqueus() and btrfs_stop_all_workers() into
open_ctree_seq[]
btrfs: extract chunk tree read code into its own init/exit helpers
btrfs: extract tree roots and zone info initialization into init/exit
helpers
btrfs: extract mount time checks and items load code into its init
helper
btrfs: extract sysfs init into its own helper
btrfs: extra block groups read code into its own init/exit helpers
btrfs: move the fs root related code into its own init/exit helpers
btrfs: extract kthread code into its own init/exit helpers
btrfs: move qgroup init/exit code into open_ctree_seq[] array
btrfs: introduce a debug mount option to do error injection for each
stage of open_ctree()
fs/btrfs/ctree.h | 7 +
fs/btrfs/disk-io.c | 611 +++++++++++++++++++++++++++++----------------
fs/btrfs/disk-io.h | 4 +-
fs/btrfs/super.c | 18 +-
4 files changed, 418 insertions(+), 222 deletions(-)
--
2.37.3
next reply other threads:[~2022-10-12 9:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 9:12 Qu Wenruo [this message]
2022-10-12 9:12 ` [PATCH v2 01/15] btrfs: initialize fs_info->sb at the very beginning of open_ctree() Qu Wenruo
2022-10-12 9:12 ` [PATCH v2 02/15] btrfs: remove @fs_devices argument from open_ctree() Qu Wenruo
2022-10-12 9:12 ` [PATCH v2 03/15] btrfs: extract btree inode init code into its own init/exit helpers Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 04/15] btrfs: extract super block read code into its own init helper Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 05/15] btrfs: extract mount options and features init " Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 06/15] btrfs: move btrfs_init_workqueus() and btrfs_stop_all_workers() into open_ctree_seq[] Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 07/15] btrfs: extract chunk tree read code into its own init/exit helpers Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 08/15] btrfs: extract tree roots and zone info initialization into " Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 09/15] btrfs: extract mount time checks and items load code into its init helper Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 10/15] btrfs: extract sysfs init into its own helper Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 11/15] btrfs: extra block groups read code into its own init/exit helpers Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 12/15] btrfs: move the fs root related " Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 13/15] btrfs: extract kthread " Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 14/15] btrfs: move qgroup init/exit code into open_ctree_seq[] array Qu Wenruo
2022-10-12 9:13 ` [PATCH v2 15/15] btrfs: introduce a debug mount option to do error injection for each stage of open_ctree() Qu Wenruo
2022-10-14 12:43 ` Josef Bacik
2022-10-14 23:04 ` Qu Wenruo
2022-10-24 13:47 ` [PATCH v2 00/15] btrfs: make open_ctree() init/exit sequence strictly matched David Sterba
2022-10-24 23:02 ` Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1665565866.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.