From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: vsementsov@virtuozzo.com, rjones@redhat.com, qemu-block@nongnu.org
Subject: [PATCH for-6.2? 2/2] nbd/server: Simplify zero and trim
Date: Wed, 17 Nov 2021 11:02:30 -0600 [thread overview]
Message-ID: <20211117170230.1128262-3-eblake@redhat.com> (raw)
In-Reply-To: <20211117170230.1128262-1-eblake@redhat.com>
Now that the block layer supports 64-bit operations, we no longer have
to self-fragment requests larger than 2G, reverting the workaround
added in 890cbccb08 (nbd: Fix large trim/zero requests).
Signed-off-by: Eric Blake <eblake@redhat.com>
---
nbd/server.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index 85877f630533..1b3945220bd3 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -2509,16 +2509,8 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
if (request->flags & NBD_CMD_FLAG_FAST_ZERO) {
flags |= BDRV_REQ_NO_FALLBACK;
}
- ret = 0;
- /* FIXME simplify this when blk_pwrite_zeroes switches to 64-bit */
- while (ret >= 0 && request->len) {
- int align = client->check_align ?: 1;
- int len = MIN(request->len, QEMU_ALIGN_DOWN(BDRV_REQUEST_MAX_BYTES,
- align));
- ret = blk_pwrite_zeroes(exp->common.blk, request->from, len, flags);
- request->len -= len;
- request->from += len;
- }
+ ret = blk_pwrite_zeroes(exp->common.blk, request->from, request->len,
+ flags);
return nbd_send_generic_reply(client, request->handle, ret,
"writing to file failed", errp);
@@ -2532,16 +2524,7 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
"flush failed", errp);
case NBD_CMD_TRIM:
- ret = 0;
- /* FIXME simplify this when blk_co_pdiscard switches to 64-bit */
- while (ret >= 0 && request->len) {
- int align = client->check_align ?: 1;
- int len = MIN(request->len, QEMU_ALIGN_DOWN(BDRV_REQUEST_MAX_BYTES,
- align));
- ret = blk_co_pdiscard(exp->common.blk, request->from, len);
- request->len -= len;
- request->from += len;
- }
+ ret = blk_co_pdiscard(exp->common.blk, request->from, request->len);
if (ret >= 0 && request->flags & NBD_CMD_FLAG_FUA) {
ret = blk_co_flush(exp->common.blk);
}
--
2.33.1
next prev parent reply other threads:[~2021-11-17 17:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 17:02 [PATCH for-6.2 0/2] NBD 6.2-rc fixes Eric Blake
2021-11-17 17:02 ` [PATCH for-6.2 1/2] nbd/server: Don't complain on certain client disconnects Eric Blake
2021-11-17 17:57 ` Vladimir Sementsov-Ogievskiy
2021-11-17 20:40 ` Eric Blake
2021-11-17 17:02 ` Eric Blake [this message]
2021-11-17 18:04 ` [PATCH for-6.2? 2/2] nbd/server: Simplify zero and trim Vladimir Sementsov-Ogievskiy
2021-11-17 20:49 ` Eric Blake
2021-11-17 20:52 ` Vladimir Sementsov-Ogievskiy
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=20211117170230.1128262-3-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=vsementsov@virtuozzo.com \
/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).