yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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