From owner-dev-commits-src-main@freebsd.org Mon Dec 28 19:05:43 2020 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D439F4BE405; Mon, 28 Dec 2020 19:05:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D4RpH5jdXz4b4v; Mon, 28 Dec 2020 19:05:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B69B51EB38; Mon, 28 Dec 2020 19:05:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 0BSJ5hBp019451; Mon, 28 Dec 2020 19:05:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 0BSJ5hj9019450; Mon, 28 Dec 2020 19:05:43 GMT (envelope-from git) Date: Mon, 28 Dec 2020 19:05:43 GMT Message-Id: <202012281905.0BSJ5hj9019450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 4f4111d2c5ab - main - fusefs: delete some dead code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f4111d2c5ab64591b9e15dab4257d8187458fd1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for the main branch of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2020 19:05:43 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=4f4111d2c5ab64591b9e15dab4257d8187458fd1 commit 4f4111d2c5ab64591b9e15dab4257d8187458fd1 Author: Alan Somers AuthorDate: 2020-12-24 19:21:00 +0000 Commit: Alan Somers CommitDate: 2020-12-28 19:05:35 +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 --- 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 1698f962415f..cab5925c91de 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -287,9 +287,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"); @@ -352,46 +351,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 8d82cc492b4c..776a4ecd11d7 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -356,11 +356,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; } @@ -395,18 +393,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; } @@ -417,17 +408,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; } @@ -546,20 +529,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 980a52052218..c8a665abded7 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;