在 2025/7/8 14:35, Dave Chinner 写道:
[...]
Not really worthy if we only want a single different behavior.

This is the *3rd* different behaviour for ->mark_dead. We
have the generic behaviour, the bcachefs behaviour, and now the
btrfs behaviour (whatever that may be).

Then why not merging the btrfs/bcachefs callback into one generic callback? Other than introducing 3 different bdev_holder_ops?

This looks exactly the opposite what VFS is trying to do.

Thanks,
Qu


Thus I strongly prefer to do with the existing fs_holder_ops, no matter
if it's using/renaming the shutdown() callback, or a new callback.

Previously Christoph is against a new ->remove_bdev() callback, as it is
conflicting with the existing ->shutdown().

So what about a new ->handle_bdev_remove() callback, that we do something
like this inside fs_bdev_mark_dead():

{
        bdev_super_lock();
        if (!surprise)
                sync_filesystem();

        if (s_op->handle_bdev_remove) {
                ret = s_op->handle_bdev_remove();
                if (!ret) {
                        super_unlock_shared();
                        return;
                }
        }
        shrink_dcache_sb();
        evict_inodes();
        if (s_op->shutdown)
                s_op->shutdown();
}

So that the new ->handle_bdev_remove() is not conflicting with
->shutdown() but an optional one.

And if the fs can not handle the removal, just let
->handle_bdev_remove() return an error so that we fallback to the existing
shutdown routine.

Would this be more acceptable?

No.

-Dave.



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to