public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <luis@igalia.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Bernd Schubert <bernd@bsbernd.com>,
	Laura Promberger <laura.promberger@cern.ch>,
	Dave Chinner <david@fromorbit.com>,
	Matt Harvey <mharvey@jumptrading.com>,
	linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com,
	linux-kernel@vger.kernel.org, Luis Henriques <luis@igalia.com>
Subject: [RFC PATCH v6 4/4] fuse: refactor fuse_conn_put() to remove negative logic.
Date: Tue, 16 Sep 2025 14:53:10 +0100	[thread overview]
Message-ID: <20250916135310.51177-5-luis@igalia.com> (raw)
In-Reply-To: <20250916135310.51177-1-luis@igalia.com>

There is no functional change with this patch.  It simply refactors
function fuse_conn_put() to not use negative logic, which makes it more
easier to read.

Signed-off-by: Luis Henriques <luis@igalia.com>
---
 fs/fuse/inode.c | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index c054f02e661d..80cce3bb6b00 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1012,27 +1012,28 @@ static void delayed_release(struct rcu_head *p)
 
 void fuse_conn_put(struct fuse_conn *fc)
 {
-	if (refcount_dec_and_test(&fc->count)) {
-		struct fuse_iqueue *fiq = &fc->iq;
-		struct fuse_sync_bucket *bucket;
-
-		if (IS_ENABLED(CONFIG_FUSE_DAX))
-			fuse_dax_conn_free(fc);
-		if (fc->timeout.req_timeout)
-			cancel_delayed_work_sync(&fc->timeout.work);
-		cancel_work_sync(&fc->epoch_work);
-		if (fiq->ops->release)
-			fiq->ops->release(fiq);
-		put_pid_ns(fc->pid_ns);
-		bucket = rcu_dereference_protected(fc->curr_bucket, 1);
-		if (bucket) {
-			WARN_ON(atomic_read(&bucket->count) != 1);
-			kfree(bucket);
-		}
-		if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
-			fuse_backing_files_free(fc);
-		call_rcu(&fc->rcu, delayed_release);
+	struct fuse_iqueue *fiq = &fc->iq;
+	struct fuse_sync_bucket *bucket;
+
+	if (!refcount_dec_and_test(&fc->count))
+		return;
+
+	if (IS_ENABLED(CONFIG_FUSE_DAX))
+		fuse_dax_conn_free(fc);
+	if (fc->timeout.req_timeout)
+		cancel_delayed_work_sync(&fc->timeout.work);
+	cancel_work_sync(&fc->epoch_work);
+	if (fiq->ops->release)
+		fiq->ops->release(fiq);
+	put_pid_ns(fc->pid_ns);
+	bucket = rcu_dereference_protected(fc->curr_bucket, 1);
+	if (bucket) {
+		WARN_ON(atomic_read(&bucket->count) != 1);
+		kfree(bucket);
 	}
+	if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
+		fuse_backing_files_free(fc);
+	call_rcu(&fc->rcu, delayed_release);
 }
 EXPORT_SYMBOL_GPL(fuse_conn_put);
 

  parent reply	other threads:[~2025-09-16 13:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 13:53 [RFC PATCH v6 0/4] fuse: work queues to invalided dentries Luis Henriques
2025-09-16 13:53 ` [RFC PATCH v6 1/4] dcache: export shrink_dentry_list() and add new helper d_dispose_if_unused() Luis Henriques
2025-09-16 13:53 ` [RFC PATCH v6 2/4] fuse: new work queue to periodically invalidate expired dentries Luis Henriques
2025-09-16 13:53 ` [RFC PATCH v6 3/4] fuse: new work queue to invalidate dentries from old epochs Luis Henriques
2025-09-16 13:53 ` Luis Henriques [this message]
2025-10-20 13:17 ` [RFC PATCH v6 0/4] fuse: work queues to invalided dentries Luis Henriques
2025-11-13  9:02 ` Miklos Szeredi
2025-11-13  9:43   ` Luis Henriques

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=20250916135310.51177-5-luis@igalia.com \
    --to=luis@igalia.com \
    --cc=bernd@bsbernd.com \
    --cc=david@fromorbit.com \
    --cc=kernel-dev@igalia.com \
    --cc=laura.promberger@cern.ch \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mharvey@jumptrading.com \
    --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