Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jul 2021 17:15:19 GMT
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 43f57e98d032 - stable/12 - fusefs: delete some dead code
Message-ID:  <202107271715.16RHFJPe010735@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=43f57e98d032414a313f1871b805d8f07a5c416d

commit 43f57e98d032414a313f1871b805d8f07a5c416d
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2020-12-24 19:21:00 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-07-27 17:10:47 +0000

    fusefs: delete some dead code
    
    The original fusefs GSoC project seems to have envisioned exchanging two
    types of messages with FUSE servers.  Perhaps vectored and non-vectored?
    But in practice only one type has ever been used.  Delete the other type.
    
    Reviewed by:            cem
    Differential Revision:  https://reviews.freebsd.org/D27770
    
    (cherry picked from commit 4f4111d2c5ab64591b9e15dab4257d8187458fd1)
---
 sys/fs/fuse/fuse_device.c | 64 ++++++++++++++++-------------------------------
 sys/fs/fuse/fuse_ipc.c    | 33 ++----------------------
 sys/fs/fuse/fuse_ipc.h    |  7 ------
 3 files changed, 24 insertions(+), 80 deletions(-)

diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c
index 3022f8a1aa5b..c634f903e519 100644
--- a/sys/fs/fuse/fuse_device.c
+++ b/sys/fs/fuse/fuse_device.c
@@ -302,9 +302,8 @@ fuse_device_read(struct cdev *dev, struct uio *uio, int ioflag)
 	int err;
 	struct fuse_data *data;
 	struct fuse_ticket *tick;
-	void *buf[] = {NULL, NULL, NULL};
-	int buflen[3];
-	int i;
+	void *buf;
+	int buflen;
 
 	SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read");
 
@@ -367,46 +366,27 @@ again:
 	SDT_PROBE2(fusefs, , device, trace, 1,
 		"fuse device read message successfully");
 
-	KASSERT(tick->tk_ms_bufdata || tick->tk_ms_bufsize == 0,
-	    ("non-null buf pointer with positive size"));
-
-	switch (tick->tk_ms_type) {
-	case FT_M_FIOV:
-		buf[0] = tick->tk_ms_fiov.base;
-		buflen[0] = tick->tk_ms_fiov.len;
-		break;
-	case FT_M_BUF:
-		buf[0] = tick->tk_ms_fiov.base;
-		buflen[0] = tick->tk_ms_fiov.len;
-		buf[1] = tick->tk_ms_bufdata;
-		buflen[1] = tick->tk_ms_bufsize;
-		break;
-	default:
-		panic("unknown message type for fuse_ticket %p", tick);
-	}
+	buf = tick->tk_ms_fiov.base;
+	buflen = tick->tk_ms_fiov.len;
 
-	for (i = 0; buf[i]; i++) {
-		/*
-		 * Why not ban mercilessly stupid daemons who can't keep up
-		 * with us? (There is no much use of a partial read here...)
-		 */
-		/*
-		 * XXX note that in such cases Linux FUSE throws EIO at the
-		 * syscall invoker and stands back to the message queue. The
-		 * rationale should be made clear (and possibly adopt that
-		 * behaviour). Keeping the current scheme at least makes
-		 * fallacy as loud as possible...
-		 */
-		if (uio->uio_resid < buflen[i]) {
-			fdata_set_dead(data);
-			SDT_PROBE2(fusefs, , device, trace, 2,
-			    "daemon is stupid, kick it off...");
-			err = ENODEV;
-			break;
-		}
-		err = uiomove(buf[i], buflen[i], uio);
-		if (err)
-			break;
+	/*
+	 * Why not ban mercilessly stupid daemons who can't keep up
+	 * with us? (There is no much use of a partial read here...)
+	 */
+	/*
+	 * XXX note that in such cases Linux FUSE throws EIO at the
+	 * syscall invoker and stands back to the message queue. The
+	 * rationale should be made clear (and possibly adopt that
+	 * behaviour). Keeping the current scheme at least makes
+	 * fallacy as loud as possible...
+	 */
+	if (uio->uio_resid < buflen) {
+		fdata_set_dead(data);
+		SDT_PROBE2(fusefs, , device, trace, 2,
+		    "daemon is stupid, kick it off...");
+		err = ENODEV;
+	} else {
+		err = uiomove(buf, buflen, uio);
 	}
 
 	FUSE_ASSERT_MS_DONE(tick);
diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c
index 4c2acfbd87c6..73378dee959a 100644
--- a/sys/fs/fuse/fuse_ipc.c
+++ b/sys/fs/fuse/fuse_ipc.c
@@ -357,11 +357,9 @@ fticket_init(void *mem, int size, int flags)
 	bzero(ftick, sizeof(struct fuse_ticket));
 
 	fiov_init(&ftick->tk_ms_fiov, sizeof(struct fuse_in_header));
-	ftick->tk_ms_type = FT_M_FIOV;
 
 	mtx_init(&ftick->tk_aw_mtx, "fuse answer delivery mutex", NULL, MTX_DEF);
 	fiov_init(&ftick->tk_aw_fiov, 0);
-	ftick->tk_aw_type = FT_A_FIOV;
 
 	return 0;
 }
@@ -396,18 +394,11 @@ fticket_refresh(struct fuse_ticket *ftick)
 	FUSE_ASSERT_AW_DONE(ftick);
 
 	fiov_refresh(&ftick->tk_ms_fiov);
-	ftick->tk_ms_bufdata = NULL;
-	ftick->tk_ms_bufsize = 0;
-	ftick->tk_ms_type = FT_M_FIOV;
 
 	bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header));
 
 	fiov_refresh(&ftick->tk_aw_fiov);
 	ftick->tk_aw_errno = 0;
-	ftick->tk_aw_bufdata = NULL;
-	ftick->tk_aw_bufsize = 0;
-	ftick->tk_aw_type = FT_A_FIOV;
-
 	ftick->tk_flag = 0;
 }
 
@@ -418,17 +409,9 @@ fticket_reset(struct fuse_ticket *ftick)
 	FUSE_ASSERT_MS_DONE(ftick);
 	FUSE_ASSERT_AW_DONE(ftick);
 
-	ftick->tk_ms_bufdata = NULL;
-	ftick->tk_ms_bufsize = 0;
-	ftick->tk_ms_type = FT_M_FIOV;
-
 	bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header));
 
 	ftick->tk_aw_errno = 0;
-	ftick->tk_aw_bufdata = NULL;
-	ftick->tk_aw_bufsize = 0;
-	ftick->tk_aw_type = FT_A_FIOV;
-
 	ftick->tk_flag = 0;
 }
 
@@ -547,20 +530,8 @@ fticket_aw_pull_uio(struct fuse_ticket *ftick, struct uio *uio)
 	size_t len = uio_resid(uio);
 
 	if (len) {
-		switch (ftick->tk_aw_type) {
-		case FT_A_FIOV:
-			fiov_adjust(fticket_resp(ftick), len);
-			err = uiomove(fticket_resp(ftick)->base, len, uio);
-			break;
-
-		case FT_A_BUF:
-			ftick->tk_aw_bufsize = len;
-			err = uiomove(ftick->tk_aw_bufdata, len, uio);
-			break;
-
-		default:
-			panic("FUSE: unknown answer type for ticket %p", ftick);
-		}
+		fiov_adjust(fticket_resp(ftick), len);
+		err = uiomove(fticket_resp(ftick)->base, len, uio);
 	}
 	return err;
 }
diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h
index ea2eef2ea978..980fb2541ca1 100644
--- a/sys/fs/fuse/fuse_ipc.h
+++ b/sys/fs/fuse/fuse_ipc.h
@@ -123,17 +123,10 @@ struct fuse_ticket {
 
 	/* fields for initiating an upgoing message */
 	struct fuse_iov			tk_ms_fiov;
-	void				*tk_ms_bufdata;
-	size_t				tk_ms_bufsize;
-	enum { FT_M_FIOV, FT_M_BUF }	tk_ms_type;
 	STAILQ_ENTRY(fuse_ticket)	tk_ms_link;
 
 	/* fields for handling answers coming from userspace */
 	struct fuse_iov			tk_aw_fiov;
-	void				*tk_aw_bufdata;
-	size_t				tk_aw_bufsize;
-	enum { FT_A_FIOV, FT_A_BUF }	tk_aw_type;
-
 	struct fuse_out_header		tk_aw_ohead;
 	int				tk_aw_errno;
 	struct mtx			tk_aw_mtx;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107271715.16RHFJPe010735>