btrfs: add parse_param callback for the new mount API
authorJosef Bacik <josef@toxicpanda.com>
Wed, 22 Nov 2023 17:17:45 +0000 (12:17 -0500)
committerDavid Sterba <dsterba@suse.com>
Fri, 15 Dec 2023 19:27:04 +0000 (20:27 +0100)
commit17b3612022fe533e70c0a83ea7634069e5ce33f1
tree5196f657a5171a67b3a35a601f6529d1e78b7d22
parent15ddcdd34ebfe7ab58ff4ef4199fd5796da6a6e3
btrfs: add parse_param callback for the new mount API

The parse_param callback handles one parameter at a time, take our
existing mount option parsing loop and adjust it to handle one parameter
at a time, and tie it into the fs_context_operations.

Create a btrfs_fs_context object that will store the various mount
properties, we'll house this in fc->fs_private.  This is necessary to
separate because remounting will use ->reconfigure, and we'll get a new
copy of the parsed parameters, so we can no longer directly mess with
the fs_info in this stage.

In the future we'll add this to the btrfs_fs_info and update the users
to use the new context object instead.

There's a change how the option device= is processed. Previously all
mount options were parsed in one go under uuid_mutex and the devices
opened. This prevented a concurrent scan to happen during mount. Now we
could see a device scan happen (e.g. by udev) but this should not affect
the end result, mount will either see the populated fs_devices or will
scan the device by itself.

Alternatively we could save all the device paths first and then process
them in one go as before but this does not seem to be necessary.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ add note about device scanning ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/super.c