mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-30 02:34:14 +03:00
Avoid 64bit division in multilist index functions
The number of sublists in a multilist is relatively small. We dont need 64 bits to calculate an index. 32 bits is sufficient and makes the code more efficient. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Mark Maybee <mark.maybee@delphix.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored-By: iXsystems, Inc. Closes #12288
This commit is contained in:
committed by
Brian Behlendorf
parent
4ebda5d4d3
commit
ea47857090
@@ -1874,7 +1874,12 @@ static unsigned int
|
||||
metaslab_idx_func(multilist_t *ml, void *arg)
|
||||
{
|
||||
metaslab_t *msp = arg;
|
||||
return (msp->ms_id % multilist_get_num_sublists(ml));
|
||||
|
||||
/*
|
||||
* ms_id values are allocated sequentially, so full 64bit
|
||||
* division would be a waste of time, so limit it to 32 bits.
|
||||
*/
|
||||
return ((unsigned int)msp->ms_id % multilist_get_num_sublists(ml));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
||||
Reference in New Issue
Block a user