On Tue, Apr 02, 2019 at 04:19:46PM +0800, Anand Jain wrote:
> Some btrfs test cases use btrfs module-reload to unregister devices in
> the btrfs kernel. The problem with the module-reload approach is, if test
> system contains btrfs as rootfs, then you can't run these test cases.
>
> Patches [1] introduced btrfs forget feature which can unregister devices
> without the module-reload approach.
>
> [1]
> btrfs-progs: device scan: add new option to forget one or all scanned devices
> btrfs: introduce new ioctl to unregister a btrfs device
>
> And this patch makes relevant changes in the fstests to use this new
> feature, when available.
>
> Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
> ---
> v2:
> Update change log.
> Rename _require_btrfs_forget_if_not_fs_loadable() to _require_btrfs_forget_or_module_loadable()
> Rename _btrfs_forget_if_not_fs_reload() to _btrfs_forget_or_module_reload()
Reviewed-by: David Sterba <dsterba@xxxxxxxx>
> +_require_btrfs_forget_or_module_loadable()
> +{
> + _btrfs_supports_forget && return
> +
> + _require_loadable_fs_module "btrfs"
> +}
> +
> +_btrfs_forget_or_module_reload()
> +{
> + _btrfs_supports_forget && return
> +
> + _reload_fs_module "btrfs"
> +}
The extra return mentioned in v1 is probably just a matter of coding
style so I don't mind as long as it works.