Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20572382rwd; Thu, 29 Jun 2023 04:20:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHuX0KmzvZAmLxd26l3p6YNIc/l87HHipKydPicfkU39CThZecKbqQMlXftD9PCUXU4AE+T X-Received: by 2002:a17:903:445:b0:1b8:4c8e:1885 with SMTP id iw5-20020a170903044500b001b84c8e1885mr2484639plb.7.1688037631954; Thu, 29 Jun 2023 04:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688037631; cv=none; d=google.com; s=arc-20160816; b=wEuvWKSPnQwEzKD0t2fOzso/TKgO7+H+w4LRae2hP8mKlb8KzvVgvNvkQqsOfkY+H+ VUs6qm8jHc/cpH5U3y3eDvRtOlJLLxI6wgUS9mNG1Axh9Mq7fFiJoX3Q0hl/Vyd+fWeg 4Nm3STxwws2Mq6tmQbGEq18RRutJpTh3mCLPQGdjPKr6NHCEnsH3ttM7rryhQu0Chzk3 SHKGLsQR2aHcQQQNd3G8VGA8VdsqSsFuNaNtb4aRO2HCrMXteJQU1WB3rlVpOqRWWtgi xKLGS0HQjfiiMehdCJonZf6fUZx5jdBtkdE6fBUHn0CHYbfHoD82gjntsdLpinESx5Qg cAOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=1qHtLjDFCTPjeJw9isUtkpCV8ZlDmCULwOsl6gfQ958=; fh=tR8etD8FjDpmak3hDI4F1Uee7VHXHtfQdkIkXgd7GoU=; b=B3KR10jrSV77GiCSrF1G/0/8yQ0FwJAIM9UvIRJVkXYLbYxpsXtj5LzUj3wcUY1Twa a3kjO24MeFTcKHfV53YLkQ8ckA6uRqMyIrhI914gcHyuQpDweLsK2+VT7TLd3bEZAiZu +zkJqNkgowp9p1DCJ8c92ERWUi0hTUWm/YA24cXK4wtYlQzFztUx90fZ6UyaOV6euWxm PENxM+LZ1rhoH42tYKcjg81f72vV6+u75Ir0kH+HgULiDxJGaEYYoq/Oq+cFnoOrEwk2 gs190a9vaT084X/dqZVQENDZ42rUaKItlgWhBsX6p/u8eLBj/GuixAMxFyTQu3gCaOpj 0eaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=U2SbulpZ; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="zbQ//WpR"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jh1-20020a170903328100b001b3c97a1ea1si9829590plb.162.2023.06.29.04.20.16; Thu, 29 Jun 2023 04:20:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=U2SbulpZ; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="zbQ//WpR"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232381AbjF2LJu (ORCPT + 99 others); Thu, 29 Jun 2023 07:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbjF2LJJ (ORCPT ); Thu, 29 Jun 2023 07:09:09 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6989D4230; Thu, 29 Jun 2023 04:08:15 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 08CC71F8D6; Thu, 29 Jun 2023 11:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1688036894; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1qHtLjDFCTPjeJw9isUtkpCV8ZlDmCULwOsl6gfQ958=; b=U2SbulpZkKl6trrVBa2y2QEJpr4kFWv1STBLkj4vu7DNCq9ty1vtnMmhp1ilaBd3Am6+ea rzmrgVC93jBkzuThBvJa3ZvRYHilmlVkK3Ytmd8s2g1j2lrRCjw2g/VG+OVYGNfBJ39/i6 2xb6+qmCP+QMCE/xLSL8ScM8J3jmLvI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1688036894; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1qHtLjDFCTPjeJw9isUtkpCV8ZlDmCULwOsl6gfQ958=; b=zbQ//WpR6lkTV/vyXbtFK0V12dKh4iZDowmuikTWDRQ/7mjGiQO0VIORRY3MHqJ8r3WPha NJD1XIb/7AyV4LDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EDAA1139FF; Thu, 29 Jun 2023 11:08:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id bcICOh1mnWTHMAAAMHmgww (envelope-from ); Thu, 29 Jun 2023 11:08:13 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 7A435A0722; Thu, 29 Jun 2023 13:08:13 +0200 (CEST) Date: Thu, 29 Jun 2023 13:08:13 +0200 From: Jan Kara To: Baokun Li Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [PATCH v2 6/7] quota: simplify drop_dquot_ref() Message-ID: <20230629110813.kfaja4bdomilmns6@quack3> References: <20230628132155.1560425-1-libaokun1@huawei.com> <20230628132155.1560425-7-libaokun1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230628132155.1560425-7-libaokun1@huawei.com> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 28-06-23 21:21:54, Baokun Li wrote: > Now when dqput() drops the last reference count, it will call > synchronize_srcu(&dquot_srcu) in quota_release_workfn() to ensure that > no other user will use the dquot after the last reference count is dropped, > so we don't need to call synchronize_srcu(&dquot_srcu) in drop_dquot_ref() > and remove the corresponding logic directly to simplify the code. Nice simplification! It is also important that dqput() now cannot sleep which was another reason for the logic with tofree_head in remove_inode_dquot_ref(). Probably this is good to mention in the changelog. > Signed-off-by: Baokun Li > --- > fs/quota/dquot.c | 33 ++++++--------------------------- > 1 file changed, 6 insertions(+), 27 deletions(-) > > diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c > index e8e702ac64e5..df028fb2ce72 100644 > --- a/fs/quota/dquot.c > +++ b/fs/quota/dquot.c > @@ -1090,8 +1090,7 @@ static int add_dquot_ref(struct super_block *sb, int type) > * Remove references to dquots from inode and add dquot to list for freeing > * if we have the last reference to dquot > */ > -static void remove_inode_dquot_ref(struct inode *inode, int type, > - struct list_head *tofree_head) > +static void remove_inode_dquot_ref(struct inode *inode, int type) > { > struct dquot **dquots = i_dquot(inode); > struct dquot *dquot = dquots[type]; > @@ -1100,21 +1099,7 @@ static void remove_inode_dquot_ref(struct inode *inode, int type, > return; > > dquots[type] = NULL; > - if (list_empty(&dquot->dq_free)) { > - /* > - * The inode still has reference to dquot so it can't be in the > - * free list > - */ > - spin_lock(&dq_list_lock); > - list_add(&dquot->dq_free, tofree_head); > - spin_unlock(&dq_list_lock); > - } else { > - /* > - * Dquot is already in a list to put so we won't drop the last > - * reference here. > - */ > - dqput(dquot); > - } > + dqput(dquot); > } I think you can also just drop remove_inode_dquot_ref() as it is trivial now and inline it at its only callsite... Honza -- Jan Kara SUSE Labs, CR