From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com,
Paolo Bonzini <pbonzini@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 5/5] nbd: Drop unused offset parameter
Date: Mon, 20 Jun 2016 17:39:29 -0600 [thread overview]
Message-ID: <1466465969-25315-6-git-send-email-eblake@redhat.com> (raw)
In-Reply-To: <1466465969-25315-1-git-send-email-eblake@redhat.com>
Now that NBD relies on the block layer to fragment things, we no
longer need to track an offset argument for which fragment of
a request we are actually servicing.
While at it, use true and false instead of 0 and 1 for a bool
parameter.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
include/block/nbd.h | 1 -
nbd/nbd-internal.h | 4 ++--
block/nbd-client.c | 31 ++++++++++++++++---------------
nbd/common.c | 3 +--
4 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/include/block/nbd.h b/include/block/nbd.h
index eeda3eb..503f514 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -89,7 +89,6 @@ enum {
ssize_t nbd_wr_syncv(QIOChannel *ioc,
struct iovec *iov,
size_t niov,
- size_t offset,
size_t length,
bool do_read);
int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags,
diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
index 26a9f4d..93a6ca8 100644
--- a/nbd/nbd-internal.h
+++ b/nbd/nbd-internal.h
@@ -101,14 +101,14 @@ static inline ssize_t read_sync(QIOChannel *ioc, void *buffer, size_t size)
* our request/reply. Synchronization is done with recv_coroutine, so
* that this is coroutine-safe.
*/
- return nbd_wr_syncv(ioc, &iov, 1, 0, size, true);
+ return nbd_wr_syncv(ioc, &iov, 1, size, true);
}
static inline ssize_t write_sync(QIOChannel *ioc, void *buffer, size_t size)
{
struct iovec iov = { .iov_base = buffer, .iov_len = size };
- return nbd_wr_syncv(ioc, &iov, 1, 0, size, false);
+ return nbd_wr_syncv(ioc, &iov, 1, size, false);
}
struct NBDTLSHandshakeData {
diff --git a/block/nbd-client.c b/block/nbd-client.c
index 9f023f8..5841a32 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -116,7 +116,7 @@ static void nbd_restart_write(void *opaque)
static int nbd_co_send_request(BlockDriverState *bs,
struct nbd_request *request,
- QEMUIOVector *qiov, int offset)
+ QEMUIOVector *qiov)
{
NbdClientSession *s = nbd_get_client_session(bs);
AioContext *aio_context;
@@ -149,8 +149,8 @@ static int nbd_co_send_request(BlockDriverState *bs,
qio_channel_set_cork(s->ioc, true);
rc = nbd_send_request(s->ioc, request);
if (rc >= 0) {
- ret = nbd_wr_syncv(s->ioc, qiov->iov, qiov->niov,
- offset, request->len, 0);
+ ret = nbd_wr_syncv(s->ioc, qiov->iov, qiov->niov, request->len,
+ false);
if (ret != request->len) {
rc = -EIO;
}
@@ -167,8 +167,9 @@ static int nbd_co_send_request(BlockDriverState *bs,
}
static void nbd_co_receive_reply(NbdClientSession *s,
- struct nbd_request *request, struct nbd_reply *reply,
- QEMUIOVector *qiov, int offset)
+ struct nbd_request *request,
+ struct nbd_reply *reply,
+ QEMUIOVector *qiov)
{
int ret;
@@ -181,8 +182,8 @@ static void nbd_co_receive_reply(NbdClientSession *s,
reply->error = EIO;
} else {
if (qiov && reply->error == 0) {
- ret = nbd_wr_syncv(s->ioc, qiov->iov, qiov->niov,
- offset, request->len, 1);
+ ret = nbd_wr_syncv(s->ioc, qiov->iov, qiov->niov, request->len,
+ true);
if (ret != request->len) {
reply->error = EIO;
}
@@ -230,11 +231,11 @@ int nbd_client_co_readv(BlockDriverState *bs, int64_t sector_num,
request.len = nb_sectors * 512;
nbd_coroutine_start(client, &request);
- ret = nbd_co_send_request(bs, &request, NULL, 0);
+ ret = nbd_co_send_request(bs, &request, NULL);
if (ret < 0) {
reply.error = -ret;
} else {
- nbd_co_receive_reply(client, &request, &reply, qiov, 0);
+ nbd_co_receive_reply(client, &request, &reply, qiov);
}
nbd_coroutine_end(client, &request);
return -reply.error;
@@ -259,11 +260,11 @@ int nbd_client_co_writev(BlockDriverState *bs, int64_t sector_num,
request.len = nb_sectors * 512;
nbd_coroutine_start(client, &request);
- ret = nbd_co_send_request(bs, &request, qiov, 0);
+ ret = nbd_co_send_request(bs, &request, qiov);
if (ret < 0) {
reply.error = -ret;
} else {
- nbd_co_receive_reply(client, &request, &reply, NULL, 0);
+ nbd_co_receive_reply(client, &request, &reply, NULL);
}
nbd_coroutine_end(client, &request);
return -reply.error;
@@ -284,11 +285,11 @@ int nbd_client_co_flush(BlockDriverState *bs)
request.len = 0;
nbd_coroutine_start(client, &request);
- ret = nbd_co_send_request(bs, &request, NULL, 0);
+ ret = nbd_co_send_request(bs, &request, NULL);
if (ret < 0) {
reply.error = -ret;
} else {
- nbd_co_receive_reply(client, &request, &reply, NULL, 0);
+ nbd_co_receive_reply(client, &request, &reply, NULL);
}
nbd_coroutine_end(client, &request);
return -reply.error;
@@ -309,11 +310,11 @@ int nbd_client_co_discard(BlockDriverState *bs, int64_t sector_num,
request.len = nb_sectors * 512;
nbd_coroutine_start(client, &request);
- ret = nbd_co_send_request(bs, &request, NULL, 0);
+ ret = nbd_co_send_request(bs, &request, NULL);
if (ret < 0) {
reply.error = -ret;
} else {
- nbd_co_receive_reply(client, &request, &reply, NULL, 0);
+ nbd_co_receive_reply(client, &request, &reply, NULL);
}
nbd_coroutine_end(client, &request);
return -reply.error;
diff --git a/nbd/common.c b/nbd/common.c
index 8ddb2dd..4d8e211 100644
--- a/nbd/common.c
+++ b/nbd/common.c
@@ -23,7 +23,6 @@
ssize_t nbd_wr_syncv(QIOChannel *ioc,
struct iovec *iov,
size_t niov,
- size_t offset,
size_t length,
bool do_read)
{
@@ -35,7 +34,7 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc,
nlocal_iov = iov_copy(local_iov, nlocal_iov,
iov, niov,
- offset, length);
+ 0, length);
while (nlocal_iov > 0) {
ssize_t len;
--
2.5.5
next prev parent reply other threads:[~2016-06-20 23:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 23:39 [Qemu-devel] [PATCH 0/5] Auto-fragment large transactions at the block layer Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 1/5] block: Fragment reads to max transfer length Eric Blake
2016-07-08 10:56 ` Kevin Wolf
2016-07-08 14:31 ` Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 2/5] block: Fragment writes " Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 3/5] raw_bsd: Don't advertise flags not supported by protocol layer Eric Blake
2016-07-08 11:05 ` Kevin Wolf
2016-07-08 14:32 ` Eric Blake
2016-06-20 23:39 ` [Qemu-devel] [PATCH 4/5] nbd: Rely on block layer to break up large requests Eric Blake
2016-06-20 23:39 ` Eric Blake [this message]
2016-07-08 11:11 ` [Qemu-devel] [PATCH 5/5] nbd: Drop unused offset parameter Kevin Wolf
2016-06-21 3:19 ` [Qemu-devel] [PATCH 6/5] iscsi: Rely on block layer to break up large requests Eric Blake
2016-06-21 4:17 ` [Qemu-devel] [PATCH 0/5] Auto-fragment large transactions at the block layer Eric Blake
2016-06-21 10:23 ` Stefan Hajnoczi
2016-06-21 10:43 ` Kevin Wolf
2016-06-22 11:41 ` Stefan Hajnoczi
2016-06-21 22:05 ` Eric Blake
2016-06-22 11:41 ` Stefan Hajnoczi
2016-06-22 5:54 ` Fam Zheng
2016-07-06 2:04 ` Eric Blake
2016-07-08 11:15 ` Kevin Wolf
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=1466465969-25315-6-git-send-email-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@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).