From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-block@nongnu.org, berto@igalia.com, mreitz@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 7/8] quorum: Implement .bdrv_co_preadv/pwritev()
Date: Tue, 22 Nov 2016 12:45:20 +0100 [thread overview]
Message-ID: <20161122114520.GC5615@noname.redhat.com> (raw)
In-Reply-To: <122bc834-8ab3-ce9d-2b22-8459afe6feee@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3637 bytes --]
Am 21.11.2016 um 21:04 hat Eric Blake geschrieben:
> On 11/21/2016 11:31 AM, Kevin Wolf wrote:
> > This enables byte granularity requests on quorum nodes.
> >
> > Note that the QMP events emitted by the driver are an external API that
> > we were careless enough to define as sector based. The offset and length
> > of requests reported in events are rounded therefore.
> >
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> > block/quorum.c | 79 ++++++++++++++++++++++++++--------------------------------
> > 1 file changed, 36 insertions(+), 43 deletions(-)
> >
>
> > -static void quorum_report_bad(QuorumOpType type, uint64_t sector_num,
> > - int nb_sectors, char *node_name, int ret)
> > +static void quorum_report_bad(QuorumOpType type, uint64_t offset,
> > + uint64_t bytes, char *node_name, int ret)
> > {
> > const char *msg = NULL;
> > + int64_t start_sector = offset / BDRV_SECTOR_SIZE;
> > + int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE);
>
> This one looks correct,
>
> > +
> > if (ret < 0) {
> > msg = strerror(-ret);
> > }
> >
> > - qapi_event_send_quorum_report_bad(type, !!msg, msg, node_name,
> > - sector_num, nb_sectors, &error_abort);
> > + qapi_event_send_quorum_report_bad(type, !!msg, msg, node_name, start_sector,
> > + end_sector - start_sector, &error_abort);
> > }
> >
> > static void quorum_report_failure(QuorumAIOCB *acb)
> > {
> > const char *reference = bdrv_get_device_or_node_name(acb->bs);
> > - qapi_event_send_quorum_failure(reference, acb->sector_num,
> > - acb->nb_sectors, &error_abort);
> > + qapi_event_send_quorum_failure(reference,
> > + acb->offset / BDRV_SECTOR_SIZE,
> > + acb->bytes / BDRV_SECTOR_SIZE,
>
> but this one still looks like it could give unexpected results for
> acb->bytes < BDRV_SECTOR_SIZE.
Thanks, I missed this one. I'll send a v2.
> > -static int quorum_co_readv(BlockDriverState *bs,
> > - int64_t sector_num, int nb_sectors,
> > - QEMUIOVector *qiov)
> > +static int quorum_co_preadv(BlockDriverState *bs, uint64_t offset,
> > + uint64_t bytes, QEMUIOVector *qiov, int flags)
> > {
>
> Is it worth adding assert(!flags)? For now, the block layer doesn't
> have any defined flags (and if it did, we'd probably want to add a
> .supported_read_flags to parallel the existing .supported_write_flags).
I don't think we need to assert this, no other driver does that. We have
.supported_write_flags and I would indeed add .supported_read_flags
if/when we start using flags for read requests, so we can be reasonably
sure that only those flags are set even without asserting it.
> [Huh - side thought: right now, we don't have any defined semantics for
> BDRV_REQUEST_FUA on reads (although we modeled it in part after SCSI,
> which does have it defined for reads). But quorum rewrites on read
> might be an interesting application of where we can trigger a write
> during reads, and where we may want to guarantee FUA semantics on those
> writes, thus making a potentially plausible use of the flag on read]
Makes sense to me, but that's something for a different series. And
actually, I'm not sure who would even send a read with FUA set today.
Can this even happen yet?
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2016-11-22 11:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-21 17:31 [Qemu-devel] [PATCH 0/8] quorum: Implement .bdrv_co_preadv/pwritev() Kevin Wolf
2016-11-21 17:31 ` [Qemu-devel] [PATCH 1/8] coroutine: Introduce qemu_coroutine_enter_if_inactive() Kevin Wolf
2016-11-21 17:31 ` [Qemu-devel] [PATCH 2/8] quorum: Remove s from quorum_aio_get() arguments Kevin Wolf
2016-11-21 17:31 ` [Qemu-devel] [PATCH 3/8] quorum: Implement .bdrv_co_readv/writev Kevin Wolf
2016-11-21 17:58 ` Eric Blake
2016-11-22 11:32 ` Kevin Wolf
2016-11-22 7:39 ` Alberto Garcia
2016-11-21 17:31 ` [Qemu-devel] [PATCH 4/8] quorum: Do cleanup in caller coroutine Kevin Wolf
2016-11-21 19:03 ` Eric Blake
2016-11-21 17:31 ` [Qemu-devel] [PATCH 5/8] quorum: Inline quorum_aio_cb() Kevin Wolf
2016-11-21 19:21 ` Eric Blake
2016-11-22 7:43 ` Alberto Garcia
2016-11-21 17:31 ` [Qemu-devel] [PATCH 6/8] quorum: Avoid bdrv_aio_writev() for rewrites Kevin Wolf
2016-11-21 19:52 ` Eric Blake
2016-11-22 7:45 ` Alberto Garcia
2016-11-21 17:31 ` [Qemu-devel] [PATCH 7/8] quorum: Implement .bdrv_co_preadv/pwritev() Kevin Wolf
2016-11-21 20:04 ` Eric Blake
2016-11-22 11:45 ` Kevin Wolf [this message]
2016-11-22 12:49 ` Eric Blake
2016-11-21 17:31 ` [Qemu-devel] [PATCH 8/8] quorum: Inline quorum_fifo_aio_cb() Kevin Wolf
2016-11-21 20:08 ` Eric Blake
2016-11-22 9:23 ` Alberto Garcia
2016-11-22 12:51 ` 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=20161122114520.GC5615@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=berto@igalia.com \
--cc=eblake@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).