From: Christian Schoenebeck Date: Mon, 27 Sep 2021 15:50:36 +0000 (+0200) Subject: 9pfs: simplify blksize_to_iounit() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=04a7f9e55e0930b87805f7c97851eea4610e78fc;p=qemu.git 9pfs: simplify blksize_to_iounit() Use QEMU_ALIGN_DOWN() macro to reduce code and to make it more human readable. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Reviewed-by: Philippe Mathieu-Daudé Message-Id: --- diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 5c57344667..e874899ef5 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1280,8 +1280,7 @@ static int32_t blksize_to_iounit(const V9fsPDU *pdu, int32_t blksize) * as well as less than (client msize - P9_IOHDRSZ) */ if (blksize) { - iounit = blksize; - iounit *= (s->msize - P9_IOHDRSZ) / blksize; + iounit = QEMU_ALIGN_DOWN(s->msize - P9_IOHDRSZ, blksize); } if (!iounit) { iounit = s->msize - P9_IOHDRSZ;