qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH for-2.6 2/2] block: Fix blk_aio_write_zeroes()
Date: Fri, 15 Apr 2016 10:34:09 +0200	[thread overview]
Message-ID: <20160415083409.GC4341@noname.redhat.com> (raw)
In-Reply-To: <57102801.1050303@redhat.com>

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

Am 15.04.2016 um 01:30 hat Max Reitz geschrieben:
> On 13.04.2016 13:06, Kevin Wolf wrote:
> > Commit 57d6a428 broke blk_aio_write_zeroes() because in some write
> > functions in the call path don't have an explicit length argument but
> > reuse qiov->size instead. Which is great, except that write_zeroes
> > doesn't have a qiov, which this commit interprets as 0 bytes.
> > Consequently, blk_aio_write_zeroes() didn't effectively do anything.
> 
> You mean it has written null data? :-)
> 
> Alternative version: So it has written zero bytes? Works as intended, then.

I consciously avoided the latter wording. ;-)

> > This patch introduces an explicit acb->bytes in BlkAioEmAIOCB and uses
> > that instead of acb->rwco.size.
> > 
> > The synchronous version of the function is okay because it does pass a
> > qiov (with the right size and a NULL pointer as its base).
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>

> > @@ -937,7 +940,8 @@ BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num,
> >          return blk_abort_aio_request(blk, cb, opaque, -EINVAL);
> >      }
> >  
> > -    return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS, NULL,
> > +    return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS,
> > +                        nb_sectors << BDRV_SECTOR_BITS, NULL,
> >                          blk_aio_write_entry, BDRV_REQ_ZERO_WRITE, cb, opaque);
> >  }
> 
> Another thing about blk_aio_write_zeroes() that might need fixing is
> that it completely ignores its flags parameter.
> 
> That can be done in a seperate patch, however (and is probably not
> critical, as this currently just means that a potential REQ_MAY_UNMAP
> from scsi-disk is ignored), so:

Oh dear... Commit 57d6a428 was not my best patch ever, and apparently
Stefan wasn't suspicious enough to catch the bugs. Maybe someone should
re-review the whole thing...

"just" ignoring REQ_MAY_UNMAP is a regression in discard support, so no,
that's not what I would call harmless. Definitely needs fixing for 2.6.
And we probably need more qtests checking such things.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2016-04-15  8:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 11:06 [Qemu-devel] [PATCH for-2.6 0/2] block: Fix blk_aio_write_zeroes() Kevin Wolf
2016-04-13 11:06 ` [Qemu-devel] [PATCH for-2.6 1/2] qemu-io: Support 'aio_write -z' Kevin Wolf
2016-04-14 23:14   ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-15  8:18     ` Kevin Wolf
2016-04-14 23:24   ` Max Reitz
2016-04-13 11:06 ` [Qemu-devel] [PATCH for-2.6 2/2] block: Fix blk_aio_write_zeroes() Kevin Wolf
2016-04-14 23:30   ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-15  8:34     ` Kevin Wolf [this message]

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=20160415083409.GC4341@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@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).