From: Kent Overstreet <kent.overstreet@linux.dev>
To: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Subject: [PATCH 0/7] blk_holder_ops, freeze/thaw
Date: Fri, 7 Mar 2025 08:49:24 -0500 [thread overview]
Message-ID: <20250307134933.1033872-1-kent.overstreet@linux.dev> (raw)
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(-)
--
2.47.2
next reply other threads:[~2025-03-07 13:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 13:49 Kent Overstreet [this message]
2025-03-07 13:49 ` [PATCH 1/7] fs: export invalidate_inodes() Kent Overstreet
2025-03-07 14:44 ` Jan Kara
2025-03-07 15:43 ` Kent Overstreet
2025-03-07 13:49 ` [PATCH 2/7] bcachefs: Stash a pointer to the filesystem for blk_holder_ops Kent Overstreet
2025-03-07 13:49 ` [PATCH 3/7] bcachefs: Make sure c->vfs_sb is set before starting fs Kent Overstreet
2025-03-07 13:49 ` [PATCH 4/7] bcachefs: Implement blk_holder_ops Kent Overstreet
2025-03-07 13:49 ` [PATCH 5/7] bcachefs: Fix btree_node_scan io_ref handling Kent Overstreet
2025-03-07 13:49 ` [PATCH 6/7] bcachefs: bch2_dev_get_ioref() may now sleep Kent Overstreet
2025-03-07 13:49 ` [PATCH 7/7] bcachefs: Implement freeze/thaw Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250307134933.1033872-1-kent.overstreet@linux.dev \
--to=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox