From patchwork Wed Sep 13 09:22:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13382369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D9A2EE49A4 for ; Wed, 13 Sep 2023 01:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238036AbjIMBXZ (ORCPT ); Tue, 12 Sep 2023 21:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238022AbjIMBXX (ORCPT ); Tue, 12 Sep 2023 21:23:23 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A05F910F6; Tue, 12 Sep 2023 18:23:19 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RljPw2FMhz4f3kKk; Wed, 13 Sep 2023 09:23:16 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgCXpwwDDwFlv7ZLAQ--.25966S4; Wed, 13 Sep 2023 09:23:16 +0800 (CST) From: Kemeng Shi To: miklos@szeredi.hu, bernd.schubert@fastmail.fm, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] fuse: remove usage of FR_WATING flag Date: Wed, 13 Sep 2023 17:22:46 +0800 Message-Id: <20230913092246.22747-3-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230913092246.22747-1-shikemeng@huaweicloud.com> References: <20230913092246.22747-1-shikem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UJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUsmiiDUUUU X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Each allocated request from fuse_request_alloc counts to num_waiting before request is freed. Simply drop num_waiting without FR_WAITING flag check in fuse_put_request to remove unneeded usage of FR_WAITING flag. Signed-off-by: Kemeng Shi Reviewed-by: Bernd Schubert --- fs/fuse/dev.c | 9 +-------- fs/fuse/fuse_i.h | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 59e1357d4880..4f49b1946635 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -139,7 +139,6 @@ static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background) req->in.h.gid = from_kgid(fc->user_ns, current_fsgid()); req->in.h.pid = pid_nr_ns(task_pid(current), fc->pid_ns); - __set_bit(FR_WAITING, &req->flags); if (for_background) __set_bit(FR_BACKGROUND, &req->flags); @@ -171,11 +170,7 @@ static void fuse_put_request(struct fuse_req *req) spin_unlock(&fc->bg_lock); } - if (test_bit(FR_WAITING, &req->flags)) { - __clear_bit(FR_WAITING, &req->flags); - fuse_drop_waiting(fc); - } - + fuse_drop_waiting(fc); fuse_request_free(req); } } @@ -495,7 +490,6 @@ ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args) if (!args->nocreds) fuse_force_creds(req); - __set_bit(FR_WAITING, &req->flags); __set_bit(FR_FORCE, &req->flags); } else { WARN_ON(args->nocreds); @@ -556,7 +550,6 @@ int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args, if (!req) return -ENOMEM; atomic_inc(&fc->num_waiting); - __set_bit(FR_WAITING, &req->flags); __set_bit(FR_BACKGROUND, &req->flags); } else { WARN_ON(args->nocreds); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index bf0b85d0b95c..a78764cef313 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -312,7 +312,6 @@ struct fuse_io_priv { * FR_ISREPLY: set if the request has reply * FR_FORCE: force sending of the request even if interrupted * FR_BACKGROUND: request is sent in the background - * FR_WAITING: request is counted as "waiting" * FR_ABORTED: the request was aborted * FR_INTERRUPTED: the request has been interrupted * FR_LOCKED: data is being copied to/from the request @@ -326,7 +325,6 @@ enum fuse_req_flag { FR_ISREPLY, FR_FORCE, FR_BACKGROUND, - FR_WAITING, FR_ABORTED, FR_INTERRUPTED, FR_LOCKED,