master - libdm: simplify dmstats formula.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ba94d0f144844ff3fb15d0a2a87ccf7f27f550bc Commit: ba94d0f144844ff3fb15d0a2a87ccf7f27f550bc Parent: ae4db9f302701ccbde1409647a85f53feaa6e13b Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Aug 18 12:12:07 2015 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Tue Aug 18 15:00:08 2015 +0200
libdm: simplify dmstats formula.
Since we check for stats for not being 0,
simplify the operation and use a single division.
--- libdm/libdm-stats.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
libdm/libdm-stats.c +3 -4
@@ -510,11 +510,10 @@ static uint64_t _nr_areas(uint64_t len, uint64_t step)/* * drivers/md/dm-stats.c::message_stats_create() * A region may be sub-divided into areas with their own counters. -* If step is non-zero, divide len into that many areas, otherwise -* treat the entire region as a single area. Any partial area at the -* end of the region is treated as an additional complete area. +* Any partial area at the 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)