cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-virtiofsd-Remove-unused-enum-fuse_buf_copy_flags.patch

22c213
From 80237df2b22eca685037456e65d149fed4654165 Mon Sep 17 00:00:00 2001
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
Date: Mon, 27 Jan 2020 19:00:48 +0100
22c213
Subject: [PATCH 017/116] virtiofsd: Remove unused enum fuse_buf_copy_flags
22c213
MIME-Version: 1.0
22c213
Content-Type: text/plain; charset=UTF-8
22c213
Content-Transfer-Encoding: 8bit
22c213
22c213
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
Message-id: <20200127190227.40942-14-dgilbert@redhat.com>
22c213
Patchwork-id: 93465
22c213
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 013/112] virtiofsd: Remove unused enum fuse_buf_copy_flags
22c213
Bugzilla: 1694164
22c213
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22c213
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
22c213
22c213
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
22c213
22c213
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
22c213
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
(cherry picked from commit 8c3fe75e0308ba2f01d160ace534b7e386cea808)
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
---
22c213
 tools/virtiofsd/buffer.c         |  7 +++---
22c213
 tools/virtiofsd/fuse_common.h    | 46 +---------------------------------------
22c213
 tools/virtiofsd/fuse_lowlevel.c  | 13 +++++-------
22c213
 tools/virtiofsd/fuse_lowlevel.h  | 35 ++----------------------------
22c213
 tools/virtiofsd/passthrough_ll.c |  4 ++--
22c213
 5 files changed, 13 insertions(+), 92 deletions(-)
22c213
22c213
diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
22c213
index 5df946c..4d507f3 100644
22c213
--- a/tools/virtiofsd/buffer.c
22c213
+++ b/tools/virtiofsd/buffer.c
22c213
@@ -171,7 +171,7 @@ static ssize_t fuse_buf_fd_to_fd(const struct fuse_buf *dst, size_t dst_off,
22c213
 
22c213
 static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
22c213
                                  const struct fuse_buf *src, size_t src_off,
22c213
-                                 size_t len, enum fuse_buf_copy_flags flags)
22c213
+                                 size_t len)
22c213
 {
22c213
     int src_is_fd = src->flags & FUSE_BUF_IS_FD;
22c213
     int dst_is_fd = dst->flags & FUSE_BUF_IS_FD;
22c213
@@ -224,8 +224,7 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
22c213
     return 1;
22c213
 }
22c213
 
22c213
-ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
22c213
-                      enum fuse_buf_copy_flags flags)
22c213
+ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv)
22c213
 {
22c213
     size_t copied = 0;
22c213
 
22c213
@@ -249,7 +248,7 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
22c213
         dst_len = dst->size - dstv->off;
22c213
         len = min_size(src_len, dst_len);
22c213
 
22c213
-        res = fuse_buf_copy_one(dst, dstv->off, src, srcv->off, len, flags);
22c213
+        res = fuse_buf_copy_one(dst, dstv->off, src, srcv->off, len);
22c213
         if (res < 0) {
22c213
             if (!copied) {
22c213
                 return res;
22c213
diff --git a/tools/virtiofsd/fuse_common.h b/tools/virtiofsd/fuse_common.h
22c213
index bd9bf86..0cb33ac 100644
22c213
--- a/tools/virtiofsd/fuse_common.h
22c213
+++ b/tools/virtiofsd/fuse_common.h
22c213
@@ -605,48 +605,6 @@ enum fuse_buf_flags {
22c213
 };
22c213
 
22c213
 /**
22c213
- * Buffer copy flags
22c213
- */
22c213
-enum fuse_buf_copy_flags {
22c213
-    /**
22c213
-     * Don't use splice(2)
22c213
-     *
22c213
-     * Always fall back to using read and write instead of
22c213
-     * splice(2) to copy data from one file descriptor to another.
22c213
-     *
22c213
-     * If this flag is not set, then only fall back if splice is
22c213
-     * unavailable.
22c213
-     */
22c213
-    FUSE_BUF_NO_SPLICE = (1 << 1),
22c213
-
22c213
-    /**
22c213
-     * Force splice
22c213
-     *
22c213
-     * Always use splice(2) to copy data from one file descriptor
22c213
-     * to another.  If splice is not available, return -EINVAL.
22c213
-     */
22c213
-    FUSE_BUF_FORCE_SPLICE = (1 << 2),
22c213
-
22c213
-    /**
22c213
-     * Try to move data with splice.
22c213
-     *
22c213
-     * If splice is used, try to move pages from the source to the
22c213
-     * destination instead of copying.  See documentation of
22c213
-     * SPLICE_F_MOVE in splice(2) man page.
22c213
-     */
22c213
-    FUSE_BUF_SPLICE_MOVE = (1 << 3),
22c213
-
22c213
-    /**
22c213
-     * Don't block on the pipe when copying data with splice
22c213
-     *
22c213
-     * Makes the operations on the pipe non-blocking (if the pipe
22c213
-     * is full or empty).  See SPLICE_F_NONBLOCK in the splice(2)
22c213
-     * man page.
22c213
-     */
22c213
-    FUSE_BUF_SPLICE_NONBLOCK = (1 << 4),
22c213
-};
22c213
-
22c213
-/**
22c213
  * Single data buffer
22c213
  *
22c213
  * Generic data buffer for I/O, extended attributes, etc...  Data may
22c213
@@ -741,11 +699,9 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv);
22c213
  *
22c213
  * @param dst destination buffer vector
22c213
  * @param src source buffer vector
22c213
- * @param flags flags controlling the copy
22c213
  * @return actual number of bytes copied or -errno on error
22c213
  */
22c213
-ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
22c213
-                      enum fuse_buf_copy_flags flags);
22c213
+ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src);
22c213
 
22c213
 /*
22c213
  * Signal handling
22c213
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
22c213
index eb0ec49..3da80de 100644
22c213
--- a/tools/virtiofsd/fuse_lowlevel.c
22c213
+++ b/tools/virtiofsd/fuse_lowlevel.c
22c213
@@ -490,16 +490,14 @@ static int fuse_send_data_iov_fallback(struct fuse_session *se,
22c213
 
22c213
 static int fuse_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
22c213
                               struct iovec *iov, int iov_count,
22c213
-                              struct fuse_bufvec *buf, unsigned int flags)
22c213
+                              struct fuse_bufvec *buf)
22c213
 {
22c213
     size_t len = fuse_buf_size(buf);
22c213
-    (void)flags;
22c213
 
22c213
     return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
22c213
 }
22c213
 
22c213
-int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
22c213
-                    enum fuse_buf_copy_flags flags)
22c213
+int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv)
22c213
 {
22c213
     struct iovec iov[2];
22c213
     struct fuse_out_header out;
22c213
@@ -511,7 +509,7 @@ int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
22c213
     out.unique = req->unique;
22c213
     out.error = 0;
22c213
 
22c213
-    res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv, flags);
22c213
+    res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv);
22c213
     if (res <= 0) {
22c213
         fuse_free_req(req);
22c213
         return res;
22c213
@@ -1969,8 +1967,7 @@ int fuse_lowlevel_notify_delete(struct fuse_session *se, fuse_ino_t parent,
22c213
 }
22c213
 
22c213
 int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
22c213
-                               off_t offset, struct fuse_bufvec *bufv,
22c213
-                               enum fuse_buf_copy_flags flags)
22c213
+                               off_t offset, struct fuse_bufvec *bufv)
22c213
 {
22c213
     struct fuse_out_header out;
22c213
     struct fuse_notify_store_out outarg;
22c213
@@ -1999,7 +1996,7 @@ int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
22c213
     iov[1].iov_base = &outarg;
22c213
     iov[1].iov_len = sizeof(outarg);
22c213
 
22c213
-    res = fuse_send_data_iov(se, NULL, iov, 2, bufv, flags);
22c213
+    res = fuse_send_data_iov(se, NULL, iov, 2, bufv);
22c213
     if (res > 0) {
22c213
         res = -res;
22c213
     }
22c213
diff --git a/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowlevel.h
22c213
index 12a84b4..2fa225d 100644
22c213
--- a/tools/virtiofsd/fuse_lowlevel.h
22c213
+++ b/tools/virtiofsd/fuse_lowlevel.h
22c213
@@ -1363,33 +1363,6 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
22c213
 /**
22c213
  * Reply with data copied/moved from buffer(s)
22c213
  *
22c213
- * Zero copy data transfer ("splicing") will be used under
22c213
- * the following circumstances:
22c213
- *
22c213
- * 1. FUSE_CAP_SPLICE_WRITE is set in fuse_conn_info.want, and
22c213
- * 2. the kernel supports splicing from the fuse device
22c213
- *    (FUSE_CAP_SPLICE_WRITE is set in fuse_conn_info.capable), and
22c213
- * 3. *flags* does not contain FUSE_BUF_NO_SPLICE
22c213
- * 4. The amount of data that is provided in file-descriptor backed
22c213
- *    buffers (i.e., buffers for which bufv[n].flags == FUSE_BUF_FD)
22c213
- *    is at least twice the page size.
22c213
- *
22c213
- * In order for SPLICE_F_MOVE to be used, the following additional
22c213
- * conditions have to be fulfilled:
22c213
- *
22c213
- * 1. FUSE_CAP_SPLICE_MOVE is set in fuse_conn_info.want, and
22c213
- * 2. the kernel supports it (i.e, FUSE_CAP_SPLICE_MOVE is set in
22c213
-      fuse_conn_info.capable), and
22c213
- * 3. *flags* contains FUSE_BUF_SPLICE_MOVE
22c213
- *
22c213
- * Note that, if splice is used, the data is actually spliced twice:
22c213
- * once into a temporary pipe (to prepend header data), and then again
22c213
- * into the kernel. If some of the provided buffers are memory-backed,
22c213
- * the data in them is copied in step one and spliced in step two.
22c213
- *
22c213
- * The FUSE_BUF_SPLICE_FORCE_SPLICE and FUSE_BUF_SPLICE_NONBLOCK flags
22c213
- * are silently ignored.
22c213
- *
22c213
  * Possible requests:
22c213
  *   read, readdir, getxattr, listxattr
22c213
  *
22c213
@@ -1400,11 +1373,9 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
22c213
  *
22c213
  * @param req request handle
22c213
  * @param bufv buffer vector
22c213
- * @param flags flags controlling the copy
22c213
  * @return zero for success, -errno for failure to send reply
22c213
  */
22c213
-int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
22c213
-                    enum fuse_buf_copy_flags flags);
22c213
+int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv);
22c213
 
22c213
 /**
22c213
  * Reply with data vector
22c213
@@ -1705,12 +1676,10 @@ int fuse_lowlevel_notify_delete(struct fuse_session *se, fuse_ino_t parent,
22c213
  * @param ino the inode number
22c213
  * @param offset the starting offset into the file to store to
22c213
  * @param bufv buffer vector
22c213
- * @param flags flags controlling the copy
22c213
  * @return zero for success, -errno for failure
22c213
  */
22c213
 int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
22c213
-                               off_t offset, struct fuse_bufvec *bufv,
22c213
-                               enum fuse_buf_copy_flags flags);
22c213
+                               off_t offset, struct fuse_bufvec *bufv);
22c213
 
22c213
 /*
22c213
  * Utility functions
22c213
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
22c213
index 9377718..126a56c 100644
22c213
--- a/tools/virtiofsd/passthrough_ll.c
22c213
+++ b/tools/virtiofsd/passthrough_ll.c
22c213
@@ -931,7 +931,7 @@ static void lo_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t offset,
22c213
     buf.buf[0].fd = fi->fh;
22c213
     buf.buf[0].pos = offset;
22c213
 
22c213
-    fuse_reply_data(req, &buf, FUSE_BUF_SPLICE_MOVE);
22c213
+    fuse_reply_data(req, &buf;;
22c213
 }
22c213
 
22c213
 static void lo_write_buf(fuse_req_t req, fuse_ino_t ino,
22c213
@@ -952,7 +952,7 @@ static void lo_write_buf(fuse_req_t req, fuse_ino_t ino,
22c213
                  out_buf.buf[0].size, (unsigned long)off);
22c213
     }
22c213
 
22c213
-    res = fuse_buf_copy(&out_buf, in_buf, 0);
22c213
+    res = fuse_buf_copy(&out_buf, in_buf);
22c213
     if (res < 0) {
22c213
         fuse_reply_err(req, -res);
22c213
     } else {
22c213
-- 
22c213
1.8.3.1
22c213