]> git.proxmox.com Git - mirror_qemu.git/commitdiff
9pfs: simplify blksize_to_iounit()
authorChristian Schoenebeck <qemu_oss@crudebyte.com>
Mon, 27 Sep 2021 15:50:36 +0000 (17:50 +0200)
committerChristian Schoenebeck <qemu_oss@crudebyte.com>
Wed, 27 Oct 2021 12:45:22 +0000 (14:45 +0200)
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>

hw/9pfs/9p.c

index 5c573446670480480dafbd83764cf197101e15f9..e874899ef581cde040b456d983cfce7a716c85dc 100644 (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;