mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
More consistent use of TREE_* macros in AVL comparators
Where is it appropriate and obvious, use TREE_CMP(), TREE_ISIGN() and TREE_PCMP() instead or direct comparisons. It can make the code a lot smaller, less error prone, and easier to read. Sponsored-by: TrueNAS Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@truenas.com> Closes #18259
This commit is contained in:
@@ -226,10 +226,10 @@ vdev_queue_to_compare(const void *x1, const void *x2)
|
||||
const zio_t *z1 = (const zio_t *)x1;
|
||||
const zio_t *z2 = (const zio_t *)x2;
|
||||
|
||||
int tcmp = TREE_CMP(z1->io_timestamp >> VDQ_T_SHIFT,
|
||||
int cmp = TREE_CMP(z1->io_timestamp >> VDQ_T_SHIFT,
|
||||
z2->io_timestamp >> VDQ_T_SHIFT);
|
||||
int ocmp = TREE_CMP(z1->io_offset, z2->io_offset);
|
||||
int cmp = tcmp ? tcmp : ocmp;
|
||||
if (cmp == 0)
|
||||
cmp = TREE_CMP(z1->io_offset, z2->io_offset);
|
||||
|
||||
if (likely(cmp | (z1->io_queue_state == ZIO_QS_NONE)))
|
||||
return (cmp);
|
||||
|
||||
Reference in New Issue
Block a user