Skip to contentSkip to conversation

make-bcache's bucket size and block size values are ignored

DISCUSSION Mike Snitzer 2 participants 3 messages Apr 9, 2013 2 messages not in the archive bcache (block layer cache)

lore
Share & tools
lore
#0 lore raw

Hey Kent,

No matter what I specify via make-bcache's -b and -w args they are always 512k and 512b respectively, e.g.:

# make-bcache -B /dev/mapper/test-dev-174467 -C /dev/mapper/test-dev-24832 --cache_replacement_policy=fifo -b 2048k --writeback --discard
    UUID:                       3705b1d8-4b44-406c-abf2-594c0cb146be
    Set UUID:           a16dc554-c054-4a24-90fa-40f624e3a652
    nbuckets:           8192
    block_size:         1
    bucket_size:                1024
    nr_in_set:          1
    nr_this_dev:                0
    first_bucket:               1
    UUID:                       46a37bba-2582-4533-a95b-1eb29c71e53f
    Set UUID:           a16dc554-c054-4a24-90fa-40f624e3a652
    nbuckets:           512
    block_size:         1
    bucket_size:                1024
    nr_in_set:          1
    nr_this_dev:                0
    first_bucket:               1
# cat /sys/block/bcache3/bcache/cache/bucket_size 
512k

I can take a look at the make-bcache source in a bit but figured I'd let you know sooner rather than later.

Mike

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 23 lines · Mike Snitzer

Hey Kent,

No matter what I specify via make-bcache's -b and -w args they are always 512k and 512b respectively, e.g.:

# make-bcache -B /dev/mapper/test-dev-174467 -C /dev/mapper/test-dev-24832 --cache_replacement_policy=fifo -b 2048k --writeback --discard
    UUID:                       3705b1d8-4b44-406c-abf2-594c0cb146be
    Set UUID:           a16dc554-c054-4a24-90fa-40f624e3a652
    nbuckets:           8192
    block_size:         1
    bucket_size:                1024
    nr_in_set:          1
    nr_this_dev:                0
    first_bucket:               1
    UUID:                       46a37bba-2582-4533-a95b-1eb29c71e53f
    Set UUID:           a16dc554-c054-4a24-90fa-40f624e3a652
    nbuckets:           512
    block_size:         1
    bucket_size:                1024
    nr_in_set:          1
    nr_this_dev:                0
    first_bucket:               1
Quoted 5 lines
# cat /sys/block/bcache3/bcache/cache/bucket_size 
512k

I can take a look at the make-bcache source in a bit but figured I'd let you know sooner rather than later.

Oh, it's because you specified the bucket size after the device. If you specify the devices last it'll work.

So it's definitely unintuitive and semi broken, the reason it works that way is for formatting backing devices and cache devices at the same time; it walks through the options, and when it sees a device it formats it with the options seen so far.

Right way to do it would be to make two passes... I suppose I should just do that so it doesn't trip other people up.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 30 lines · Kent Overstreet
Quoted 23 lines · Mike Snitzer

Hey Kent,

No matter what I specify via make-bcache's -b and -w args they are always 512k and 512b respectively, e.g.:

# make-bcache -B /dev/mapper/test-dev-174467 -C /dev/mapper/test-dev-24832 --cache_replacement_policy=fifo -b 2048k --writeback --discard
    UUID:                       3705b1d8-4b44-406c-abf2-594c0cb146be
    Set UUID:           a16dc554-c054-4a24-90fa-40f624e3a652
    nbuckets:           8192
    block_size:         1
    bucket_size:                1024
    nr_in_set:          1
    nr_this_dev:                0
    first_bucket:               1
    UUID:                       46a37bba-2582-4533-a95b-1eb29c71e53f
    Set UUID:           a16dc554-c054-4a24-90fa-40f624e3a652
    nbuckets:           512
    block_size:         1
    bucket_size:                1024
    nr_in_set:          1
    nr_this_dev:                0
    first_bucket:               1
Quoted 5 lines
# cat /sys/block/bcache3/bcache/cache/bucket_size 
512k

I can take a look at the make-bcache source in a bit but figured I'd let you know sooner rather than later.

Quoted 7 lines

Oh, it's because you specified the bucket size after the device. If you specify the devices last it'll work.

So it's definitely unintuitive and semi broken, the reason it works that way is for formatting backing devices and cache devices at the same time; it walks through the options, and when it sees a device it formats it with the options seen so far.

OK, thanks for the insight.

Quoted 1 line

Right way to do it would be to make two passes...

Or just defer the formatting until all args are processed.

Quoted 1 line

I suppose I should just do that so it doesn't trip other people up.

Yeah, probably for the best.

Thanks.