From patchwork Thu Sep 14 15:45:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13384762 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 40D72EDE98A for ; Thu, 14 Sep 2023 07:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230444AbjINHqd (ORCPT ); Thu, 14 Sep 2023 03:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjINHqd (ORCPT ); Thu, 14 Sep 2023 03:46:33 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE801BF6; Thu, 14 Sep 2023 00:46:28 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4RmTsS72Ldz4f3jM3; Thu, 14 Sep 2023 15:46:20 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP3 (Coremail) with SMTP id _Ch0CgAngVBPugJlwkKgAQ--.8394S2; Thu, 14 Sep 2023 15:46:24 +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] fuse: remove unneeded lock which protecting update of congestion_threshold Date: Thu, 14 Sep 2023 23:45:53 +0800 Message-Id: <20230914154553.71939-1-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgAngVBPugJlwkKgAQ--.8394S2 X-Co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of0z/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Commit 670d21c6e17f6 ("fuse: remove reliance on bdi congestion") change how congestion_threshold is used and lock in fuse_conn_congestion_threshold_write is not needed anymore. 1. Access to supe_block is removed along with removing of bdi congestion. Then down_read(&fc->killsb) which protecting access to super_block is no needed. 2. Compare num_background and congestion_threshold without holding bg_lock. Then there is no need to hold bg_lock to update congestion_threshold. Signed-off-by: Kemeng Shi --- fs/fuse/control.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 247ef4f76761..c5d7bf80efed 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -174,11 +174,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file, if (!fc) goto out; - down_read(&fc->killsb); - spin_lock(&fc->bg_lock); fc->congestion_threshold = val; - spin_unlock(&fc->bg_lock); - up_read(&fc->killsb); fuse_conn_put(fc); out: return ret;