osd: account for key_index_bytes when calculating chained read bitmap_len #89

Merged
vitalif merged 1 commits from changwei.ye/vitastor:fix-bitmap-len into master 2026-10-11 12:49:10 +03:00
Contributor

Description

osd: account for key_index_bytes when calculating chained read bitmap_len

When OSD_OP_RETURN_CHAIN is set, the primary OSD appends chain info to
the returned bitmap buffer. The space required for chain info is
(len / bs_bitmap_granularity) * key_index_bytes, where key_index_bytes
depends on the snapshot chain depth (1 byte for <= 255 items, 2 bytes for
<= 65535, etc.).

Previously, cur_op->reply.rw.bitmap_len only added (len / bs_bitmap_granularity)
without multiplying by key_index_bytes. When the snapshot chain depth
exceeded 255 (key_index_bytes == 2), the reported bitmap_len was too short,
causing the client to receive truncated chain info.

Multiply by key_index_bytes when updating cur_op->reply.rw.bitmap_len, and
add test_chained_read_large_chain_info regression test in osd_test.

Contributor Name

Changwei Ye (Datatom, https://www.datatom.com/)

CLA

### Description osd: account for key_index_bytes when calculating chained read bitmap_len When OSD_OP_RETURN_CHAIN is set, the primary OSD appends chain info to the returned bitmap buffer. The space required for chain info is (len / bs_bitmap_granularity) * key_index_bytes, where key_index_bytes depends on the snapshot chain depth (1 byte for <= 255 items, 2 bytes for <= 65535, etc.). Previously, cur_op->reply.rw.bitmap_len only added (len / bs_bitmap_granularity) without multiplying by key_index_bytes. When the snapshot chain depth exceeded 255 (key_index_bytes == 2), the reported bitmap_len was too short, causing the client to receive truncated chain info. Multiply by key_index_bytes when updating cur_op->reply.rw.bitmap_len, and add test_chained_read_large_chain_info regression test in osd_test. ### Contributor Name Changwei Ye (Datatom, https://www.datatom.com/) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
changwei.ye added 1 commit 2026-10-09 12:24:33 +03:00
osd: account for key_index_bytes when calculating chained read bitmap_len
All checks were successful
Test / test_enospc_imm_xor (push) Successful in 19s
Test / test_old_enospc (push) Successful in 22s
Test / test_old_enospc_imm (push) Successful in 16s
Test / test_heal_csum_4k (push) Successful in 2m30s
Test / test_old_enospc_xor (push) Successful in 22s
Test / test_old_enospc_imm_xor (push) Successful in 24s
Test / test_scrub (push) Successful in 24s
Test / test_scrub_zero_osd_2 (push) Successful in 29s
Test / test_scrub_xor (push) Successful in 27s
Test / test_scrub_pg_size_3 (push) Successful in 24s
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 28s
Test / test_old_scrub (push) Successful in 21s
Test / test_scrub_ec (push) Successful in 24s
Test / test_old_scrub_zero_osd_2 (push) Successful in 31s
Test / test_old_scrub_pg_size_3 (push) Successful in 22s
Test / test_old_scrub_xor (push) Successful in 26s
Test / test_old_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 24s
Test / test_old_partwr_csum (push) Successful in 18s
Test / test_old_scrub_ec (push) Successful in 24s
Test / test_heal_old_csum_32k_dj (push) Successful in 2m27s
Test / test_heal_old_csum_32k_dmj (push) Successful in 2m39s
Test / test_heal_old_csum_4k_dmj (push) Successful in 2m23s
Test / test_heal_old_csum_32k (push) Successful in 2m32s
Test / test_nfs (push) Successful in 19s
Test / test_nfs_unaligned_append (push) Successful in 17s
Test / test_write_encrypted (push) Successful in 34s
Test / test_nfs_long_readdir (push) Successful in 56s
Test / test_write_encrypted_ec (push) Successful in 31s
Test / test_heal_old_csum_4k_dj (push) Successful in 2m20s
Test / test_heal_old_csum_4k (push) Successful in 2m32s
45ce3f2842
When OSD_OP_RETURN_CHAIN is set, the primary OSD appends chain info to
the returned bitmap buffer. The space required for chain info is
(len / bs_bitmap_granularity) * key_index_bytes, where key_index_bytes
depends on the snapshot chain depth (1 byte for <= 255 items, 2 bytes for
<= 65535, etc.).

Previously, cur_op->reply.rw.bitmap_len only added (len / bs_bitmap_granularity)
without multiplying by key_index_bytes. When the snapshot chain depth
exceeded 255 (key_index_bytes == 2), the reported bitmap_len was too short,
causing the client to receive truncated chain info.

Multiply by key_index_bytes when updating cur_op->reply.rw.bitmap_len, and
add test_chained_read_large_chain_info regression test in osd_test.
changwei.ye requested review from vitalif 2026-10-09 12:24:45 +03:00
vitalif approved these changes 2026-10-11 12:49:01 +03:00
vitalif merged commit 45ce3f2842 into master 2026-10-11 12:49:10 +03:00
Owner

Thanks, merged!

Thanks, merged!
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#89
No description provided.