mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: simplify dmstats formula.
Since we check for stats for not being 0, simplify the operation and use a single division.
This commit is contained in:
parent
ae4db9f302
commit
ba94d0f144
@ -510,11 +510,10 @@ static uint64_t _nr_areas(uint64_t len, uint64_t step)
|
|||||||
/*
|
/*
|
||||||
* drivers/md/dm-stats.c::message_stats_create()
|
* drivers/md/dm-stats.c::message_stats_create()
|
||||||
* A region may be sub-divided into areas with their own counters.
|
* A region may be sub-divided into areas with their own counters.
|
||||||
* If step is non-zero, divide len into that many areas, otherwise
|
* Any partial area at the end of the region is treated as an
|
||||||
* treat the entire region as a single area. Any partial area at the
|
* additional complete area.
|
||||||
* end of the region is treated as an additional complete area.
|
|
||||||
*/
|
*/
|
||||||
return (len / (step ? : len)) + !!(len % step);
|
return (len + step - 1) / step;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t _nr_areas_region(struct dm_stats_region *region)
|
static uint64_t _nr_areas_region(struct dm_stats_region *region)
|
||||||
|
Loading…
Reference in New Issue
Block a user