Skip to content

RFC btrfs: go fs_holder_ops and add shutdown_bdev() callback

Qu Wenruo linux-btrfs linux-fsdevel oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6btrfs: introduce a new fs state, EMERGENCY_SHUTDOWNfs/btrfs/fs.h fs/btrfs/messages.c+19 -00 replies
2/6btrfs: reject file operations if in shutdown statefs/btrfs/file.c fs/btrfs/ioctl.c fs/btrfs/reflink.c+30 -10 replies
3/6btrfs: reject delalloc ranges if the fs is shutdownfs/btrfs/inode.c+13 -10 replies
4/6btrfs: implement shutdown ioctlfs/btrfs/ioctl.c include/uapi/linux/btrfs.h+27 -00 replies
5/6fs: introduce a shutdown_bdev super block operationfs/super.c include/linux/fs.h+13 -117 replies
6/6btrfs: implement shutdown_bdev super operation callbackfs/btrfs/super.c fs/btrfs/volumes.c fs/btrfs/volumes.h+41 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/6] btrfs: go fs_holder_ops and add shutdown_bdev() callback

This series is relying on another series here:
https://lore.kernel.org/linux-btrfs/[email protected]/

That above series prepare btrfs to use fs_holder_ops, and the first patch in this series is exactly making btrfs use that fs_holder_ops.

Then patch 2~4 implements the shutdown ioctl for btrfs.

For now the shutdown ioctl has no proper sync yet.

Patch 5 is the one affecting the generic fs_holder_ops and super_operations, that we need a shutdown_bdev() variant, which passes the bdev to the fs and let the fs to determine if they can continue operation or needs to shutdown.

AKA, the shutdown_bdev() variant is for multi-devices filesystems like btrfs and bcachefs.

And finally implement the shutdown_bdev() for btrfs, so that eventually generic/730 can properly pass.

Reason for RFC:

There are still test failures for shutdown group, mostly due to the fact that btrfs is not implementing the proper flags handling (e.g. currently the shutdown never sync the fs no matter what).

But I want to get some feedback about the new super_operations::shutdown_bdev() call back before committing too much.

Qu Wenruo (6):
btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN
btrfs: reject file operations if in shutdown state
btrfs: reject delalloc ranges if the fs is shutdown
btrfs: implement shutdown ioctl
fs: introduce a shutdown_bdev super block operation
btrfs: implement shutdown_bdev super operation callback

 fs/btrfs/file.c            | 25 ++++++++++++++++++++++++-
 fs/btrfs/fs.h              | 18 ++++++++++++++++++
 fs/btrfs/inode.c           | 14 +++++++++++++-
 fs/btrfs/ioctl.c           | 21 +++++++++++++++++++++
 fs/btrfs/messages.c        |  1 +
 fs/btrfs/reflink.c         |  3 +++
 fs/btrfs/super.c           | 34 ++++++++++++++++++++++++++++++++++
 fs/btrfs/volumes.c         |  2 ++
 fs/btrfs/volumes.h         |  5 +++++
 fs/super.c                 |  4 +++-
 include/linux/fs.h         | 10 ++++++++++
 include/uapi/linux/btrfs.h |  9 +++++++++
 12 files changed, 143 insertions(+), 3 deletions(-)
Signature · 1 line
2.49.0