mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
Replace P2ALIGN with P2ALIGN_TYPED and delete P2ALIGN.
In P2ALIGN, the result would be incorrect when align is unsigned integer and x is larger than max value of the type of align. In that case, -(align) would be a positive integer, which means high bits would be zero and finally stay zero after '&' when align is converted to a larger integer type. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Youzhong Yang <yyang@mathworks.com> Signed-off-by: Qiuhao Chen <chenqiuhao1997@gmail.com> Closes #15940
This commit is contained in:
@@ -4039,7 +4039,8 @@ raidz_reflow_scratch_sync(void *arg, dmu_tx_t *tx)
|
||||
spa_config_enter(spa, SCL_STATE, FTAG, RW_READER);
|
||||
vdev_t *raidvd = vdev_lookup_top(spa, vre->vre_vdev_id);
|
||||
int ashift = raidvd->vdev_ashift;
|
||||
uint64_t write_size = P2ALIGN(VDEV_BOOT_SIZE, 1 << ashift);
|
||||
uint64_t write_size = P2ALIGN_TYPED(VDEV_BOOT_SIZE, 1 << ashift,
|
||||
uint64_t);
|
||||
uint64_t logical_size = write_size * raidvd->vdev_children;
|
||||
uint64_t read_size =
|
||||
P2ROUNDUP(DIV_ROUND_UP(logical_size, (raidvd->vdev_children - 1)),
|
||||
|
||||
Reference in New Issue
Block a user