Fix misleading COPY_BUF_JOURNAL flag on hole slices #78

Merged
vitalif merged 2 commits from changwei.ye/vitastor:fix-misleading-flag into master 2026-08-31 14:22:39 +03:00

2 Commits

Author SHA1 Message Date
10a6782bdf Fix compilation errors regarding type conversions and pointer arithmetic
All checks were successful
Test / test_heal_csum_4k (push) Successful in 2m33s
Test / test_enospc_imm_xor (push) Successful in 24s
Test / test_old_enospc (push) Successful in 22s
Test / test_old_enospc_xor (push) Successful in 20s
Test / test_old_enospc_imm (push) Successful in 23s
Test / test_old_enospc_imm_xor (push) Successful in 21s
Test / test_scrub (push) Successful in 29s
Test / test_scrub_zero_osd_2 (push) Successful in 31s
Test / test_scrub_xor (push) Successful in 32s
Test / test_scrub_pg_size_3 (push) Successful in 30s
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 28s
Test / test_scrub_ec (push) Successful in 33s
Test / test_old_scrub (push) Successful in 28s
Test / test_old_scrub_zero_osd_2 (push) Successful in 30s
Test / test_old_scrub_xor (push) Successful in 34s
Test / test_old_scrub_pg_size_3 (push) Successful in 26s
Test / test_old_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 27s
Test / test_old_scrub_ec (push) Successful in 28s
Test / test_old_partwr_csum (push) Successful in 24s
Test / test_heal_old_csum_32k_dmj (push) Successful in 2m37s
Test / test_heal_old_csum_32k_dj (push) Successful in 2m38s
Test / test_heal_old_csum_32k (push) Successful in 2m33s
Test / test_heal_old_csum_4k_dmj (push) Successful in 2m38s
Test / test_nfs (push) Successful in 20s
Test / test_nfs_unaligned_append (push) Successful in 24s
Test / test_write_encrypted (push) Successful in 34s
Test / test_nfs_long_readdir (push) Successful in 1m6s
Test / test_write_encrypted_ec (push) Successful in 38s
Test / test_heal_old_csum_4k_dj (push) Successful in 2m32s
Test / test_heal_old_csum_4k (push) Successful in 2m27s
- src/blockstore/v1/init.cpp: Add explicit uint32_t cast to fix narrowing conversion error when initializing dirty_entry state.

- src/client/msgr_receive.cpp: Cast void pointer (iov_base) to char* before performing pointer arithmetic.
2026-08-31 18:44:21 +08:00
5f2b46bb57 Fix misleading COPY_BUF_JOURNAL flag on hole slices
During compaction (`fill_partial_checksum_blocks`), when a partially overwritten
checksum block is encountered, the old data needs to be read from the base layer
(`clean_wr`). A coalesced slice is inserted into `read_vec` to logically reference
this base block data.

Previously, this coalesced slice was marked with `COPY_BUF_JOURNAL`. This is a
misuse of the flag because the underlying data originates from the data area (a
BIG_WRITE block), not the journal area. It should conceptually use `COPY_BUF_DATA`.

Although this misuse did not cause any functional bugs—because the coalesced slice
also carries the `COPY_BUF_COALESCED` flag, which perfectly short-circuits the I/O
submission in `read_buffered` and avoids erroneously reading from `journal_fd`—it
creates semantic confusion for future maintainers. `COPY_BUF_JOURNAL` is consistently
used elsewhere to denote small writes (journal data).

This commit changes the flag to `COPY_BUF_DATA` to ensure semantic correctness and
code self-consistency.
2026-08-31 18:44:19 +08:00