mbox series

[0/6] bcache-tools: improve large bucket on-disk layout

Message ID 20210102071244.58353-1-colyli@suse.de (mailing list archive)
Headers show
Series bcache-tools: improve large bucket on-disk layout | expand

Message

Coly Li Jan. 2, 2021, 7:12 a.m. UTC
Current large bucket layout is a preparation for the future zoned cache
device, by which the cache device bucket can be aligned to zone size and
boundary of the zoned SSD.

Original patch introduces bucket_size_hi in struct cache_sb_disk, this
is problematic and can be improved,
- The bucket size is always power-of-2 value, it is unnecessary to add
  extra space in struct cache_sb_disk to store the real size value. Just
  using existing bucket_size to store the order of power-of-2 value is
  enough.
- The added bucket_size_hi is behind d[SB_JOURNAL_BUCKETS] in struct
  cache_sb_disk, which breaks a very implicit restriction from macro
  csum_set(). This restriction requires member d[] must be the last
  member in data structure to calculate the checksum.

This series is to improve the above issue from user space tools. Basic
ideas of this series are,
- Add BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE incompat feature bit.
  When it is set, for bucket size >16MB, bucket_size stores the order
  of power-of-2 bucket size value. Then no extra space introduced and
  csum_set() has all data to calculate super block checksum.
- Rename struct cache_sb_disk's bucket_size_hi to obso_bucket_size_hi,
  and rename the incompat feature bit BCH_FEATURE_INCOMPAT_LARGE_BUCKET
  to BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET, to indicate they are not
  used anymore and obsoleted.
- If a cache device was created for bucket size >16MB with obsoleted
  layout, "bcache show" command still display the expected bucket size
  value for legacy compatibility purpose.

Although there almost no one else uses bucket size >16MB except me (the
btree node usage code is not optimized yet), it is still necessary to
fix and improve the layout usage as soon as possible.

Coly Li
---
Coly Li (6):
  bcache.h: fix typo from SUUP to SUPP
  bcache-tools: only call set_bucket_size() for cache device
  bcache.h: add BCH_FEATURE_INCOMPAT_LARGE_BUCKET to
    BCH_FEATURE_INCOMPAT_SUPP
  bcache-tools: check incompatible feature set
  bcache-tools: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE for
    large bucket
  bcache-tools: display obsoleted bucket size configuration

 bcache.h   | 17 +++++++++++------
 features.c |  4 +++-
 lib.c      | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 lib.h      |  2 +-
 make.c     |  3 ++-
 5 files changed, 65 insertions(+), 13 deletions(-)