Skip to content

blk_holder_ops, freeze/thaw

Kent Overstreet linux-bcachefs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7fs: export invalidate_inodes()fs/inode.c fs/internal.h include/linux/fs.h+2 -12 replies
2/7bcachefs: Stash a pointer to the filesystem for blk_holder_opsfs/bcachefs/super-io.c fs/bcachefs/super.c fs/bcachefs/super_types.h+15 -20 replies
3/7bcachefs: Make sure c->vfs_sb is set before starting fsfs/bcachefs/fs.c+8 -30 replies
4/7bcachefs: Implement blk_holder_opsfs/bcachefs/super-io.c fs/bcachefs/super.c fs/bcachefs/super.h+99 -30 replies
5/7bcachefs: Fix btree_node_scan io_ref handlingfs/bcachefs/btree_node_scan.c+8 -90 replies
6/7bcachefs: bch2_dev_get_ioref() may now sleepfs/bcachefs/journal_io.c fs/bcachefs/sb-members.h+6 -10 replies
7/7bcachefs: Implement freeze/thawfs/bcachefs/bcachefs.h fs/bcachefs/journal_io.c fs/bcachefs/sb-members.c +2 more+136 -250 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/7] blk_holder_ops, freeze/thaw

Until now, it turns out bcachefs has been lacking freeze/thaw support, which is important for hibernate.

We thought we had freeze/thaw support, but it turns out that when .freeze_fs and .unfreeze_fs were implemented in super_operations, they were never being called - those functions are only called from the blk_holder callbacks, and the engineer implementing them never thought to check that.

So - there's a lesson here, and this is why I keep harping on testing. It's not enough to just fire off the automated test suite and call it a day, you do have to put actual thought into checking that your code is behaving as expected :)

It turns out the method we were originally talking about for freeze/thaw of just using our existing read-only/read-write paths doesn't work, for reasons that I neglected to remember when hooking up blk_holder_ops (locking and conflicting state management, I assume), so we need to block IOs at a lower level - which conveniently we can do with our existing per-device IO references.

This patchset also implements the other blk holder ops - the big one being mark_dead, which now offlines a single device from the filesystem if possible (leaving the filesystem read-write), or if not possible to run in degraded mode, sets the entire filesystem read only.

Kent Overstreet (7):
fs: export invalidate_inodes()
bcachefs: Stash a pointer to the filesystem for blk_holder_ops
bcachefs: Make sure c->vfs_sb is set before starting fs
bcachefs: Implement blk_holder_ops
bcachefs: Fix btree_node_scan io_ref handling
bcachefs: bch2_dev_get_ioref() may now sleep
bcachefs: Implement freeze/thaw

 fs/bcachefs/bcachefs.h        |   3 +
 fs/bcachefs/btree_node_scan.c |  17 ++-
 fs/bcachefs/fs.c              |  11 +-
 fs/bcachefs/journal_io.c      |   7 +-
 fs/bcachefs/sb-members.c      |  49 +++++++++
 fs/bcachefs/sb-members.h      |  18 +---
 fs/bcachefs/super-io.c        |   5 +-
 fs/bcachefs/super.c           | 191 +++++++++++++++++++++++++++++++++-
 fs/bcachefs/super.h           |   2 +
 fs/bcachefs/super_types.h     |   8 +-
 fs/inode.c                    |   1 +
 fs/internal.h                 |   1 -
 include/linux/fs.h            |   1 +
 13 files changed, 272 insertions(+), 42 deletions(-)
Signature · 1 line
2.47.2