[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 27/44] nbd: Use BDRV_REQ_FUA for better FUA where
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v3 27/44] nbd: Use BDRV_REQ_FUA for better FUA where supported |
Date: |
Fri, 22 Apr 2016 17:40:35 -0600 |
Rather than always flushing ourselves, let the block layer
forward the FUA on to the underlying device - where all
layers understand FUA, we are now more efficient; and where
the underlying layer doesn't understand it, now the block
layer takes care of the full flush fallback on our behalf.
Signed-off-by: Eric Blake <address@hidden>
---
nbd/server.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index 9be0a99..fa05a73 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1085,6 +1085,7 @@ static void nbd_trip(void *opaque)
struct nbd_reply reply;
ssize_t ret;
uint32_t command;
+ int flags;
TRACE("Reading request.");
if (client->closing) {
@@ -1153,23 +1154,18 @@ static void nbd_trip(void *opaque)
TRACE("Writing to device");
+ flags = 0;
+ if (request.type & NBD_CMD_FLAG_FUA) {
+ flags |= BDRV_REQ_FUA;
+ }
ret = blk_pwrite(exp->blk, request.from + exp->dev_offset,
- req->data, request.len, 0);
+ req->data, request.len, flags);
if (ret < 0) {
LOG("writing to file failed");
reply.error = -ret;
goto error_reply;
}
- if (request.type & NBD_CMD_FLAG_FUA) {
- ret = blk_co_flush(exp->blk);
- if (ret < 0) {
- LOG("flush failed");
- reply.error = -ret;
- goto error_reply;
- }
- }
-
if (nbd_co_send_reply(req, &reply, 0) < 0) {
goto out;
}
--
2.5.5
- Re: [Qemu-devel] [PATCH v3 41/44] nbd: Implement NBD_CMD_WRITE_ZEROES on server, (continued)
- [Qemu-devel] [PATCH v3 42/44] nbd: Implement NBD_CMD_WRITE_ZEROES on client, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 37/44] nbd: Create struct for tracking export info, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 43/44] nbd: Implement NBD_OPT_BLOCK_SIZE on server, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 19/44] qemu-io: Switch to byte-based block access, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 24/44] qemu-io: Add 'write -f' to test FUA flag, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 25/44] qemu-io: Add 'open -u' to set BDRV_O_UNMAP after the fact, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 27/44] nbd: Use BDRV_REQ_FUA for better FUA where supported,
Eric Blake <=
- [Qemu-devel] [PATCH v3 26/44] qemu-io: Add 'write -z -u' to test MAY_UNMAP flag, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 34/44] nbd: Less allocation during NBD_OPT_LIST, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 35/44] nbd: Support shorter handshake, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 32/44] nbd: Share common option-sending code in client, Eric Blake, 2016/04/22
- [Qemu-devel] [PATCH v3 36/44] nbd: Improve handling of shutdown requests, Eric Blake, 2016/04/22