Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2951887rdb; Tue, 12 Sep 2023 18:32:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHOtTw9rkYvkEC0qrgmzlAF1oEiOMiEYjRR+r8QkFyGvckmbRPTdc0psFjjiypMev1Xv5t X-Received: by 2002:a1f:4a07:0:b0:495:b905:d811 with SMTP id x7-20020a1f4a07000000b00495b905d811mr1225522vka.9.1694568734649; Tue, 12 Sep 2023 18:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694568734; cv=none; d=google.com; s=arc-20160816; b=X8UE4OVbVxaqpvtGRCHdwQwYxBtDinUKcp9baZjkCCy8xXcZGjy0lNivDAZ/yoK30z rCG+X9dLZLAdu7jKCQGXBYEdyY1dBvqvpPgTY285cplLrP7EX+gK3WXVpnl3ApS75xMS aOG8aRGiu1isAaT8JKtqCBD6+bLeSMEfunHINO1eci1putZtc8+u5F2/ktNV/hRjSl/V mOKon+Rd/yt2IsOSbpAz8mhbAIROHhtrU5hnw3M32LnVh8z/PDmaLxFnrNU3bWhqQmyd +QxyioklrVcjHnYCHpu+YdPpgRD7XD60U8Pwt1i2T99ENLmfnWFzRCXhy2vIZ0GsqMDW K5zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=g7NJEPVU7AO77+3M2FEyKOFF20B9sEFt3U3XE446kTo=; fh=VLNdmcH5dSG6hQUpiZtN7SVZ9PRBlCiQFAxWzrn/V08=; b=naIaxddLj1tkloc1OHKwUEqo1xaybk1fOCjpkH83ufroXXAktdG2xqSUzIoY6mLEkk hVPmL0HrD4gMfNf+aHzl+h7qb473ztwv6/60fk4zvX1C9YifaLPhYpjo8tauJnmhRcu6 /LfGnY/xUtMpFHPDCaEQpHueWGtW/qTKZ1+toE9C6uHY62n3tPeQjWt9xj7hRU1Ay4C1 NwRrgefccpys1uvsSOc2haDXlBxnRprSGo70iyyHm46LUQgpnsAhhdyYBzyDnlKg6bW2 80K398krvPLD01BvwzGrHgL4Nc/zntzBtIT0e0rXjSKU+JuWJLCLVMRJaLMWshYtB/2U Vw1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cv14-20020a056a0044ce00b0068fe989ba3asi2025254pfb.76.2023.09.12.18.32.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 18:32:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7BF83832271F; Tue, 12 Sep 2023 18:23:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238038AbjIMBXZ (ORCPT + 99 others); Tue, 12 Sep 2023 21:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235138AbjIMBXX (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 ADD5A10FE; 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 4RljPv0X3Wz4f3m6n; Wed, 13 Sep 2023 09:23:15 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgCXpwwDDwFlv7ZLAQ--.25966S3; 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 1/2] fuse: move FR_WAITING set from fuse_request_queue_background to fuse_simple_background Date: Wed, 13 Sep 2023 17:22:45 +0800 Message-Id: <20230913092246.22747-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230913092246.22747-1-shikemeng@huaweicloud.com> References: <20230913092246.22747-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgCXpwwDDwFlv7ZLAQ--.25966S3 X-Coremail-Antispam: 1UD129KBjvJXoW7tw1UGw1UJr4rXry5CFW7Jwb_yoW8Cryrpr 48G3WYyFZrXF4UGr90g3yxZw1ag3yIyrs3CryfGasIyr45Jwsa9rn5GFy3X3WxAr4xZr4a q3ZxW3y3Z34ava7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBjb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_Jrv_JF4l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l 84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07js2-5UUUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 18:23:33 -0700 (PDT) Current way to set FR_WAITING in fuse_simple_background: fuse_simple_background if (args->force) fuse_request_alloc /* need to increase num_waiting before request is queued */ else fuse_get_req atomic_inc(&fc->num_waiting); __set_bit(FR_WAITING, &req->flags); fuse_request_queue_background if (!test_bit(FR_WAITING, &req->flags) __set_bit(FR_WAITING, &req->flags); atomic_inc(&fc->num_waiting); We only need to increase num_waiting for force allocated reqeust in fuse_request_queue_background. Simply increase num_waiting in force block to remove unnecessary test_bit(FR_WAITING). This patch also makes it more intuitive to remove FR_WAITING usage in next commit. Signed-off-by: Kemeng Shi --- fs/fuse/dev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 1a8f82f478cb..59e1357d4880 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -528,10 +528,6 @@ static bool fuse_request_queue_background(struct fuse_req *req) bool queued = false; WARN_ON(!test_bit(FR_BACKGROUND, &req->flags)); - if (!test_bit(FR_WAITING, &req->flags)) { - __set_bit(FR_WAITING, &req->flags); - atomic_inc(&fc->num_waiting); - } __set_bit(FR_ISREPLY, &req->flags); spin_lock(&fc->bg_lock); if (likely(fc->connected)) { @@ -553,10 +549,14 @@ int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args, struct fuse_req *req; if (args->force) { + struct fuse_conn *fc = fm->fc; + WARN_ON(!args->nocreds); req = fuse_request_alloc(fm, gfp_flags); 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); -- 2.30.0