All of lore.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: linux-bcache@vger.kernel.org
Cc: linux-block@vger.kernel.org, Coly Li <colyli@suse.de>
Subject: [PATCH 0/4] bcache: improve large bucket size on-disk layout
Date: Sat,  2 Jan 2021 15:12:19 +0800	[thread overview]
Message-ID: <20210102071223.58303-1-colyli@suse.de> (raw)

Current large bucket (size >16MB) 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.

Commit ffa470327572 ("bcache: add bucket_size_hi into struct
cache_sb_disk for large bucket") extends bucket size from 16MB to 1TB,
but this change is problematic and can be improved,
- The bucket size is always power-of-2 value, it is unnecessary to add
  extra member 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 bcache kernel code. The
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 driver will print error message for the obsoleted
  layout and all following attached bcache device will be read-only. If
  there is dirty data on cache device, after the writeback accomplished
  the cache device can be re-created with new bucket_size usage by the
  latest bcache-tools.

Because the btree node usage is not optimized, I doubt there is people
really uses bucket size >16MB at this moment, except me. But this is
something needs to be improved and better as soon as possible.

Coly Li
---
Coly Li (4):
  bcache: fix typo from SUUP to SUPP in features.h
  bcache: check unsupported feature sets for bcache register
  bcache: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE for large
    bucket
  bcache: set bcache device into read-only mode for
    BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET

 drivers/md/bcache/features.c |  2 +-
 drivers/md/bcache/features.h | 30 +++++++++++++++++----
 drivers/md/bcache/super.c    | 51 +++++++++++++++++++++++++++++++++---
 include/uapi/linux/bcache.h  |  2 +-
 4 files changed, 75 insertions(+), 10 deletions(-)

-- 
2.26.2


             reply	other threads:[~2021-01-02  7:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-02  7:12 Coly Li [this message]
2021-01-02  7:12 ` [PATCH 1/4] bcache: fix typo from SUUP to SUPP in features.h Coly Li
2021-01-02  7:12 ` [PATCH 2/4] bcache: check unsupported feature sets for bcache register Coly Li
2021-01-02  7:12 ` [PATCH 3/4] bcache: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE for large bucket Coly Li
2021-01-02  7:12 ` [PATCH 4/4] bcache: set bcache device into read-only mode for BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET Coly Li

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=20210102071223.58303-1-colyli@suse.de \
    --to=colyli@suse.de \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@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.