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é <philmd@redhat.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <b84eb324d2ebdcc6f9c442c97b5b4d01eecb4f43.1632758315.git.qemu_oss@crudebyte.com>
master
Christian Schoenebeck 2021-09-27 17:50:36 +02:00
parent b565bccb00
commit 04a7f9e55e
1 changed files with 1 additions and 2 deletions

View File

@ -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;