qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nir Soffer <nirsof@gmail.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Nir Soffer <nsoffer@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH] block: file-posix: Fix alignment probing on glsuter
Date: Tue,  6 Aug 2019 13:43:16 +0300	[thread overview]
Message-ID: <20190806104316.29328-1-nsoffer@redhat.com> (raw)

On Gluster storage with sector size of 4096 bytes, buf_align may be
wrong; reading 4096 bytes into unaligned buffer succeeds. This probably
happens because the actual read happens on the Gluster node with aligned
buffer, and Gluster client does not enforce any alignment on the host.

However request_alignment is always right, since the same size is use on
the Gluster node to perform the actual I/O. Use the maximum value for
setting min_mem_alignment.

With this change we can provision a virtual machine with Gluster storage
using VDO device and fuse mount.

This is a partial fix for https://bugzilla.redhat.com/1737256. To make
this work, the management system must ensure that the first block of the
image is allocated, for example:

    qemu-img create -f raw test.img 1g
    dd if=/dev/zero bs=4096 count=1 of=test.img conv=nortunc

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
---
 block/file-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 4479cc7ab4..d29b9e5229 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1122,7 +1122,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
     }
 
     raw_probe_alignment(bs, s->fd, errp);
-    bs->bl.min_mem_alignment = s->buf_align;
+    bs->bl.min_mem_alignment = MAX(s->buf_align, bs->bl.request_alignment);
     bs->bl.opt_mem_alignment = MAX(s->buf_align, getpagesize());
 }
 
-- 
2.20.1



                 reply	other threads:[~2019-08-06 10:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190806104316.29328-1-nsoffer@redhat.com \
    --to=nirsof@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=nsoffer@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).