Revision b16671e8f493e3df40b1fb0dff4078f391c5099a authored by Coly Li on 04 January 2021, 07:41:21 UTC, committed by Jens Axboe on 09 January 2021, 16:21:03 UTC
When large bucket feature was added, BCH_FEATURE_INCOMPAT_LARGE_BUCKET
was introduced into the incompat feature set. It used bucket_size_hi
(which was added at the tail of struct cache_sb_disk) to extend current
16bit bucket size to 32bit with existing bucket_size in struct
cache_sb_disk.

This is not a good idea, there are two obvious problems,
- Bucket size is always value power of 2, if store log2(bucket size) in
  existing bucket_size of struct cache_sb_disk, it is unnecessary to add
  bucket_size_hi.
- Macro csum_set() assumes d[SB_JOURNAL_BUCKETS] is the last member in
  struct cache_sb_disk, bucket_size_hi was added after d[] which makes
  csum_set calculate an unexpected super block checksum.

To fix the above problems, this patch introduces a new incompat feature
bit BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE, when this bit is set, it
means bucket_size in struct cache_sb_disk stores the order of power-of-2
bucket size value. When user specifies a bucket size larger than 32768
sectors, BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE will be set to
incompat feature set, and bucket_size stores log2(bucket size) more
than store the real bucket size value.

The obsoleted BCH_FEATURE_INCOMPAT_LARGE_BUCKET won't be used anymore,
it is renamed to BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET and still only
recognized by kernel driver for legacy compatible purpose. The previous
bucket_size_hi is renmaed to obso_bucket_size_hi in struct cache_sb_disk
and not used in bcache-tools anymore.

For cache device created with BCH_FEATURE_INCOMPAT_LARGE_BUCKET feature,
bcache-tools and kernel driver still recognize the feature string and
display it as "obso_large_bucket".

With this change, the unnecessary extra space extend of bcache on-disk
super block can be avoided, and csum_set() may generate expected check
sum as well.

Fixes: ffa470327572 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket")
Signed-off-by: Coly Li <colyli@suse.de>
Cc: stable@vger.kernel.org # 5.9+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 1dfc068
History
File Mode Size
atmel_lcdc.h -rw-r--r-- 6.2 KB
aty128.h -rw-r--r-- 13.3 KB
broadsheetfb.h -rw-r--r-- 2.1 KB
cirrus.h -rw-r--r-- 5.7 KB
cvisionppc.h -rw-r--r-- 1.5 KB
da8xx-fb.h -rw-r--r-- 2.0 KB
display_timing.h -rw-r--r-- 3.1 KB
edid.h -rw-r--r-- 228 bytes
gbe.h -rw-r--r-- 10.4 KB
hecubafb.h -rw-r--r-- 1.5 KB
ili9320.h -rw-r--r-- 5.7 KB
imx-ipu-image-convert.h -rw-r--r-- 6.5 KB
imx-ipu-v3.h -rw-r--r-- 16.3 KB
kyro.h -rw-r--r-- 2.4 KB
mach64.h -rw-r--r-- 46.9 KB
maxinefb.h -rw-r--r-- 1.2 KB
metronomefb.h -rw-r--r-- 1.5 KB
mipi_display.h -rw-r--r-- 5.0 KB
mmp_disp.h -rw-r--r-- 7.0 KB
neomagic.h -rw-r--r-- 4.9 KB
newport.h -rw-r--r-- 18.7 KB
of_display_timing.h -rw-r--r-- 788 bytes
of_videomode.h -rw-r--r-- 367 bytes
omap-panel-data.h -rw-r--r-- 1.7 KB
omapfb_dss.h -rw-r--r-- 23.9 KB
omapvrfb.h -rw-r--r-- 1.8 KB
permedia2.h -rw-r--r-- 9.0 KB
platform_lcd.h -rw-r--r-- 440 bytes
pm3fb.h -rw-r--r-- 45.3 KB
pmag-ba-fb.h -rw-r--r-- 1.0 KB
pmagb-b-fb.h -rw-r--r-- 2.3 KB
pxa168fb.h -rw-r--r-- 2.5 KB
radeon.h -rw-r--r-- 109.2 KB
s1d13xxxfb.h -rw-r--r-- 9.9 KB
sa1100fb.h -rw-r--r-- 1.3 KB
samsung_fimd.h -rw-r--r-- 17.0 KB
sh_mobile_lcdc.h -rw-r--r-- 6.0 KB
sisfb.h -rw-r--r-- 606 bytes
sstfb.h -rw-r--r-- 11.0 KB
tdfx.h -rw-r--r-- 5.3 KB
tgafb.h -rw-r--r-- 6.9 KB
trident.h -rw-r--r-- 3.2 KB
udlfb.h -rw-r--r-- 2.9 KB
uvesafb.h -rw-r--r-- 2.9 KB
vga.h -rw-r--r-- 13.7 KB
videomode.h -rw-r--r-- 1.3 KB
w100fb.h -rw-r--r-- 3.6 KB

back to top