diff options
author | pfg <pfg@FreeBSD.org> | 2016-04-30 14:41:18 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-04-30 14:41:18 +0000 |
commit | e72339bbf0cf32cc88d5e54df91debe618e92ada (patch) | |
tree | 06929dc26671f0710b964d5bb0a7634f12528a36 /sys/geom | |
parent | 20431f1fdeea72f57a3a56126ba1e194a9b8d076 (diff) | |
download | FreeBSD-src-e72339bbf0cf32cc88d5e54df91debe618e92ada.zip FreeBSD-src-e72339bbf0cf32cc88d5e54df91debe618e92ada.tar.gz |
sys: Make use of our rounddown() macro when sys/param.h is available.
No functional change.
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/virstor/g_virstor.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c index 7393c10..72d042d 100644 --- a/sys/geom/virstor/g_virstor.c +++ b/sys/geom/virstor/g_virstor.c @@ -1257,7 +1257,7 @@ virstor_check_and_run(struct g_virstor_softc *sc) bs = MIN(MAXPHYS, sc->map_size - count); if (bs % sc->sectorsize != 0) { /* Check for alignment errors */ - bs = (bs / sc->sectorsize) * sc->sectorsize; + bs = rounddown(bs, sc->sectorsize); if (bs == 0) break; LOG_MSG(LVL_ERROR, "Trouble: map is not sector-aligned " @@ -1723,13 +1723,12 @@ g_virstor_start(struct bio *b) * sc_offset will end up pointing to the drive * sector. */ s_offset = chunk_index * sizeof *me; - s_offset = (s_offset / sc->sectorsize) * - sc->sectorsize; + s_offset = rounddown(s_offset, sc->sectorsize); /* data_me points to map entry sector - * in memory (analoguos to offset) */ - data_me = &sc->map[(chunk_index / - sc->me_per_sector) * sc->me_per_sector]; + * in memory (analogous to offset) */ + data_me = &sc->map[rounddown(chunk_index, + sc->me_per_sector)]; /* Commit sector with map entry to storage */ cb->bio_to = sc->components[0].gcons->provider; |