From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Jevon Qiao <scaleqiao@gmail.com>,
qemu-devel@nongnu.org,
"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Cc: sage@newdream.net, haomaiwang@gmail.com,
gkurz@linux.vnet.ibm.com, gfarnum@redhat.com, mst@redhat.com
Subject: Re: [PATCH 2/2] hw/9pfs: fix alignment issue when host filesystem block size is larger than client msize
Date: Sun, 14 Feb 2016 19:08:48 +0530 [thread overview]
Message-ID: <87y4an8l93.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <56C02E4F.6030303@gmail.com>
Jevon Qiao <scaleqiao@gmail.com> writes:
> The following patch is to fix alignment issue when host filesystem block
> size
> is larger than client msize.
>
> Thanks,
> Jevon
That is not the right format to send patch. You can send them as a
series using git-send-email.
>
> From: Jevon Qiao <scaleqiao@gmail.com>
> Date: Sun, 14 Feb 2016 15:11:08 +0800
> Subject: [PATCH] hw/9pfs: fix alignment issue when host filesystem block
> size
> is larger than client msize.
>
> Per the previous implementation, iounit will be assigned to be 0 after the
> first if statement as (s->msize - P9_IOHDRSZ)/stbuf.f_bsize will be zero
> when
> host filesystem block size is larger than msize. Finally, iounit will be
> equal
> to s->msize - P9_IOHDRSZ, which is usually not aligned.
>
> Signed-off-by: Jevon Qiao <scaleqiao@gmail.com>
> ---
> hw/9pfs/virtio-9p.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
> index f972731..005d3a8 100644
> --- a/hw/9pfs/virtio-9p.c
> +++ b/hw/9pfs/virtio-9p.c
> @@ -1326,7 +1326,7 @@ out_nofid:
> static int32_t get_iounit(V9fsPDU *pdu, V9fsPath *path)
> {
> struct statfs stbuf;
> - int32_t iounit = 0;
> + int32_t iounit = 0, unit = 0;
> V9fsState *s = pdu->s;
>
> /*
> @@ -1334,8 +1334,21 @@ static int32_t get_iounit(V9fsPDU *pdu, V9fsPath
> *path)
> * and as well as less than (client msize - P9_IOHDRSZ))
> */
> if (!v9fs_co_statfs(pdu, path, &stbuf)) {
> - iounit = stbuf.f_bsize;
> - iounit *= (s->msize - P9_IOHDRSZ)/stbuf.f_bsize;
> + /*
> + * If host filesystem block size is larger than client msize,
> + * we will use PAGESIZE as the unit. The reason why we choose
> + * PAGESIZE is because the data will be splitted in terms of
> + * PAGESIZE in the virtio layer. In this case, the final
> + * iounit is equal to the value of ((msize/unit) - 1) * unit.
> + */
> + if (stbuf.f_bsize > s->msize) {
> + iounit = 4096;
> + unit = 4096;
What page size it should be guest or host ?. Also why 4096 ?. ppc64 use
64K page size.
> + } else {
> + iounit = stbuf.f_bsize;
> + unit = stbuf.f_bsize;
> + }
> + iounit *= (s->msize - P9_IOHDRSZ)/unit;
> }
> if (!iounit) {
> iounit = s->msize - P9_IOHDRSZ;
> --
-aneesh
next prev parent reply other threads:[~2016-02-14 13:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-14 7:35 [PATCH 2/2] hw/9pfs: fix alignment issue when host filesystem block size is larger than client msize Jevon Qiao
2016-02-14 13:38 ` Aneesh Kumar K.V [this message]
2016-02-17 7:14 ` Jevon Qiao
2016-02-17 10:24 ` Greg Kurz
2016-02-19 9:32 ` Jevon Qiao
2016-02-17 14:44 ` Aneesh Kumar K.V
2016-02-19 8:56 ` Jevon Qiao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y4an8l93.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=ceph-devel@vger.kernel.org \
--cc=gfarnum@redhat.com \
--cc=gkurz@linux.vnet.ibm.com \
--cc=haomaiwang@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sage@newdream.net \
--cc=scaleqiao@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox