qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Qemu-block <qemu-block@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Unaligned images with O_DIRECT
Date: Tue, 14 May 2019 17:06:55 +0200	[thread overview]
Message-ID: <c276dc0c-0190-1e83-d491-8157d78ec817@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

Hi,

Unaligned images don’t work so well with O_DIRECT:

$ echo > foo
$ qemu-img map --image-opts driver=file,filename=foo,cache.direct=on
Offset          Length          Mapped to       File
qemu-img: block/io.c:2093: bdrv_co_block_status: Assertion `*pnum &&
QEMU_IS_ALIGNED(*pnum, align) && align > offset - aligned_offset' failed.
[1]    10954 abort (core dumped)  qemu-img map --image-opts
driver=file,filename=foo,cache.direct=on

(compare https://bugzilla.redhat.com/show_bug.cgi?id=1588356)

This is because the request_alignment is 512 (in my case), but the EOF
is not aligned accordingly, so raw_co_block_status() returns an aligned
*pnum.

I suppose having an unaligned tail is not so bad and maybe we can just
adjust the assertion accordingly.  On the other hand, this has been
broken for a while.  Does it even make sense to use O_DIRECT with
unaligned images?  Shouldn’t we just reject them outright?

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2019-05-14 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 15:06 Max Reitz [this message]
2019-05-14 15:45 ` [Qemu-devel] Unaligned images with O_DIRECT Eric Blake
2019-05-14 16:15   ` Max Reitz
2019-05-14 17:28     ` Max Reitz
2019-05-14 21:36       ` Eric Blake

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=c276dc0c-0190-1e83-d491-8157d78ec817@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@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).