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

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