9pfs: fix wrong I/O block size in Rgetattr
authorChristian Schoenebeck <qemu_oss@crudebyte.com>
Wed, 22 Sep 2021 13:13:31 +0000 (15:13 +0200)
committerChristian Schoenebeck <qemu_oss@crudebyte.com>
Wed, 27 Oct 2021 12:45:22 +0000 (14:45 +0200)
commit669ced09b3b6070d478acce51810591b78ab0ccd
tree42dc8961696cfca1bf96b5ea638d0db0f78c6725
parent931ce30859176f0f7daac6bac255dae5eb21284e
9pfs: fix wrong I/O block size in Rgetattr

When client sent a 9p Tgetattr request then the wrong I/O block
size value was returned by 9p server; instead of host file
system's I/O block size it should rather return an I/O block
size according to 9p session's 'msize' value, because the value
returned to client should be an "optimum" block size for I/O
(i.e. to maximize performance), it should not reflect the actual
physical block size of the underlying storage media.

The I/O block size of a host filesystem is typically 4k, so the
value returned was far too low for good 9p I/O performance.

This patch adds stat_to_iounit() with a similar approach as the
existing get_iounit() function.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <E1mT2Js-0000DW-OH@lizzy.crudebyte.com>
hw/9pfs/9p.c