All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 0/7] btrfs-progs: csum-change: add the initial support for offline csum type change
Date: Thu, 18 May 2023 10:10:38 +0800	[thread overview]
Message-ID: <cover.1684375729.git.wqu@suse.com> (raw)

[CHANGELOG]
v2:
- Skip csum item checks if the fs is under csum change
  Tree-checker can be too sensitive if the csum size doesn not match the
  old csum size, which can lead to false alerts on overlapping csum
  items.

  But we still want the tree checker functionality overall, so just
  disable csum item related checks for csum change.

[DESIGN]
The csum change workflow looks like this:

- Generate new data csums
  New data csums would have a different objectid (CSUM_CHANGE -13),
  other than the existing one (EXTENT_CSUM -10).

  The generation part would also verify the data contents, if any
  mismatch we would error out.

- Delete the old data csums

- Change data csums objectid

- Rewrite metadata csums in-place
  At this stage, we would check the checksum for both old and new algo.
  If the metadata matches the old csum, we rewrite using new csum.
  If the metadata matches the new csum, we skip it.
  If the metadata doesn't match either csum, we error out.

[TESTS]
For now it's only basically tested manually.

So far the result looks good, the result fs can pass "btrfs check
--check-data-csum".

[TODO]
- Support for resume
  Currently we won't resume an interrupted csum conversion.
  Although the design should be able to handle any interruption at data
  csum conversion part, and as long as metadata csum writes are atomic,
  the metadata rewrites should also be fine.

- Support for revert if errors are found
  If we hit data csum mismatch and can not repair from any copy, then
  we should revert back to the old csum.

- Suppot for precaustious metadata check
  We'd better read and very metadata before rewriting them.

- Extra test cases


Qu Wenruo (7):
  btrfs-progs: tune: rework the main idea of csum change
  btrfs-progs: tune: implement the prerequisite checks for csum change
  btrfs-progs: tune: add the ability to read and verify the data before
    generating new checksum
  btrfs-progs: tune: add the ability to generate new data checksums
  btrfs-progs: tune: add the ability to delete old data csums
  btrfs-progs: tune: add the ability to migrate the temporary csum items
    to regular csum items
  btrfs-progs: tune: add the ability to change metadata csums

 check/mode-common.c             |   11 +-
 convert/main.c                  |   12 +-
 kernel-shared/ctree.c           |    3 -
 kernel-shared/ctree.h           |   19 +-
 kernel-shared/disk-io.c         |    8 -
 kernel-shared/file-item.c       |   46 +-
 kernel-shared/file-item.h       |    4 +-
 kernel-shared/print-tree.c      |   11 +-
 kernel-shared/tree-checker.c    |    5 +
 kernel-shared/uapi/btrfs_tree.h |    1 +
 mkfs/rootdir.c                  |   11 +-
 tune/change-csum.c              | 1053 +++++++++++++++++--------------
 tune/main.c                     |    2 +-
 tune/tune.h                     |    3 +-
 14 files changed, 646 insertions(+), 543 deletions(-)

-- 
2.40.1


             reply	other threads:[~2023-05-18  2:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18  2:10 Qu Wenruo [this message]
2023-05-18  2:10 ` [PATCH v2 1/7] btrfs-progs: tune: rework the main idea of csum change Qu Wenruo
2023-05-18  2:10 ` [PATCH v2 2/7] btrfs-progs: tune: implement the prerequisite checks for " Qu Wenruo
2023-05-18  2:10 ` [PATCH v2 3/7] btrfs-progs: tune: add the ability to read and verify the data before generating new checksum Qu Wenruo
2023-05-18  2:10 ` [PATCH v2 4/7] btrfs-progs: tune: add the ability to generate new data checksums Qu Wenruo
2023-05-18  2:10 ` [PATCH v2 5/7] btrfs-progs: tune: add the ability to delete old data csums Qu Wenruo
2023-05-18  2:10 ` [PATCH v2 6/7] btrfs-progs: tune: add the ability to migrate the temporary csum items to regular csum items Qu Wenruo
2023-05-18  2:10 ` [PATCH v2 7/7] btrfs-progs: tune: add the ability to change metadata csums Qu Wenruo
2023-05-22 12:14 ` [PATCH v2 0/7] btrfs-progs: csum-change: add the initial support for offline csum type change David Sterba
2023-05-22 23:45   ` Qu Wenruo
2023-05-22 20:19 ` David Sterba

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=cover.1684375729.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.