[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/24] DAX/unmap virtiofsd: Route unmappable reads
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PATCH 19/24] DAX/unmap virtiofsd: Route unmappable reads |
Date: |
Tue, 9 Feb 2021 19:02:19 +0000 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
When a read with unmappable buffers is found, map it to a slave
read command.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
tools/virtiofsd/fuse_virtio.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index 8fa438525f..316d1f2463 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -397,6 +397,37 @@ int virtio_send_data_iov(struct fuse_session *se, struct
fuse_chan *ch,
in_sg_left -= ret;
len -= ret;
} while (in_sg_left);
+
+ if (bad_in_num) {
+ while (len && bad_in_num) {
+ VhostUserFSSlaveMsg msg = { 0 };
+ msg.flags[0] = VHOST_USER_FS_FLAG_MAP_R;
+ msg.fd_offset[0] = buf->buf[0].pos;
+ msg.c_offset[0] = (uint64_t)(uintptr_t)in_sg_ptr[0].iov_base;
+ msg.len[0] = in_sg_ptr[0].iov_len;
+ if (len < msg.len[0]) {
+ msg.len[0] = len;
+ }
+ int64_t req_res = fuse_virtio_io(se, &msg, buf->buf[0].fd);
+ fuse_log(FUSE_LOG_DEBUG,
+ "%s: bad loop; len=%zd bad_in_num=%d fd_offset=%zd "
+ "c_offset=%p req_res=%ld\n",
+ __func__, len, bad_in_num, buf->buf[0].pos,
+ in_sg_ptr[0].iov_base, req_res);
+ if (req_res > 0) {
+ len -= msg.len[0];
+ buf->buf[0].pos += msg.len[0];
+ in_sg_ptr++;
+ bad_in_num--;
+ } else if (req_res == 0) {
+ break;
+ } else {
+ ret = req_res;
+ free(in_sg_cpy);
+ goto err;
+ }
+ }
+ }
free(in_sg_cpy);
/* Need to fix out->len on EOF */
--
2.29.2
- Re: [PATCH 12/24] DAX: virtiofsd: Wire up passthrough_ll's lo_setupmapping, (continued)
- [PATCH 11/24] DAX: virtiofsd: Add setup/remove mapping handlers to passthrough_ll, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 13/24] DAX: virtiofsd: Make lo_removemapping() work, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 14/24] DAX: virtiofsd: route se down to destroy method, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 15/24] DAX: virtiofsd: Perform an unmap on destroy, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 19/24] DAX/unmap virtiofsd: Route unmappable reads,
Dr. David Alan Gilbert (git) <=
- [PATCH 18/24] DAX/unmap virtiofsd: Parse unmappable elements, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 17/24] DAX/unmap virtiofsd: Add wrappers for VHOST_USER_SLAVE_FS_IO, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 20/24] DAX/unmap virtiofsd: route unmappable write to slave command, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 21/24] DAX:virtiofsd: implement FUSE_INIT map_alignment field, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 22/24] vhost-user-fs: Extend VhostUserFSSlaveMsg to pass additional info, Dr. David Alan Gilbert (git), 2021/02/09
- [PATCH 16/24] DAX/unmap: virtiofsd: Add VHOST_USER_SLAVE_FS_IO, Dr. David Alan Gilbert (git), 2021/02/09