From: Joanne Koong <joannelkoong@gmail.com>
To: miklos@szeredi.hu
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH v1 4/4] fuse: clean up interrupt reading
Date: Thu, 5 Mar 2026 17:05:25 -0800 [thread overview]
Message-ID: <20260306010525.4105958-5-joannelkoong@gmail.com> (raw)
In-Reply-To: <20260306010525.4105958-1-joannelkoong@gmail.com>
Clean up interrupt reading logic. Remove passing the pointer to the fuse
request as an arg and make the header initializations more readable.
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
---
fs/fuse/dev.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 585677dfc82c..1402843c9068 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1249,23 +1249,22 @@ static int request_pending(struct fuse_iqueue *fiq)
* Called with fiq->lock held, releases it
*/
static int fuse_read_interrupt(struct fuse_iqueue *fiq,
- struct fuse_copy_state *cs,
- struct fuse_req *req)
+ struct fuse_copy_state *cs)
__releases(fiq->lock)
{
- struct fuse_in_header ih;
- struct fuse_interrupt_in arg;
- unsigned reqsize = sizeof(ih) + sizeof(arg);
+ struct fuse_req *req = list_entry(fiq->interrupts.next, struct fuse_req,
+ intr_entry);
+ struct fuse_interrupt_in arg = {
+ .unique = req->in.h.unique,
+ };
+ struct fuse_in_header ih = {
+ .opcode = FUSE_INTERRUPT,
+ .unique = (req->in.h.unique | FUSE_INT_REQ_BIT),
+ .len = sizeof(ih) + sizeof(arg),
+ };
int err;
list_del_init(&req->intr_entry);
- memset(&ih, 0, sizeof(ih));
- memset(&arg, 0, sizeof(arg));
- ih.len = reqsize;
- ih.opcode = FUSE_INTERRUPT;
- ih.unique = (req->in.h.unique | FUSE_INT_REQ_BIT);
- arg.unique = req->in.h.unique;
-
spin_unlock(&fiq->lock);
err = fuse_copy_one(cs, &ih, sizeof(ih));
@@ -1273,7 +1272,7 @@ __releases(fiq->lock)
err = fuse_copy_one(cs, &arg, sizeof(arg));
fuse_copy_finish(cs);
- return err ? err : reqsize;
+ return err ? err : ih.len;
}
static struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq,
@@ -1442,11 +1441,8 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
return fc->aborted ? -ECONNABORTED : -ENODEV;
}
- if (!list_empty(&fiq->interrupts)) {
- req = list_entry(fiq->interrupts.next, struct fuse_req,
- intr_entry);
- return fuse_read_interrupt(fiq, cs, req);
- }
+ if (!list_empty(&fiq->interrupts))
+ return fuse_read_interrupt(fiq, cs);
if (forget_pending(fiq)) {
if (list_empty(&fiq->pending) || fiq->forget_batch-- > 0)
--
2.47.3
prev parent reply other threads:[~2026-03-06 1:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 1:05 [PATCH v1 0/4] fuse: fuse_dev_do_read() cleanups Joanne Koong
2026-03-06 1:05 ` [PATCH v1 1/4] fuse: remove redundant buffer size checks for interrupt and forget requests Joanne Koong
2026-03-06 1:05 ` [PATCH v1 2/4] fuse: get rid of err_unlock goto in fuse_dev_do_read() Joanne Koong
2026-03-06 1:05 ` [PATCH v1 3/4] fuse: remove stray newline " Joanne Koong
2026-03-06 1:05 ` Joanne Koong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260306010525.4105958-5-joannelkoong@gmail.com \
--to=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox