peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0019-virtiofsd-Remove-unused-enum-fuse_buf_copy_flags.patch

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