Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20807770rwd; Thu, 29 Jun 2023 07:17:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6vhIg/nwBrroD2/NtOCuiYNUd2dC/juxQY3Mq7/7VS7Y9HndGipPfSHR6Rv+mVlsKfR1qt X-Received: by 2002:a05:6a20:6a25:b0:126:7648:1be8 with SMTP id p37-20020a056a206a2500b0012676481be8mr19427672pzk.35.1688048231027; Thu, 29 Jun 2023 07:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688048231; cv=none; d=google.com; s=arc-20160816; b=DdgQ3tSQ0J8PZS92A9CQxULYLp3y15JVQz+x6vVHAF0JoKLqwX482S4wE4RVuaJVBm v6wjDOkwLr6zcomufVckuQ/WXByJ5jcCYDT7ZKTVbV3WA0lXw+dO2TVtqT621R0LIHOC 5Bib9LACHjKy8L+H22QUaNPRvjbLILR00wiOZR5s+ErnTDEvM5SLDUJSNMJ3dp+G66LW ReM60Q7u4J72+cKTzXuBqe0yq9VajffYK8ST1l+sssbO5rx6rLP3YwfBeuMpgm4q94uD CQ3wWWyM1odp4Zi4z14aFigyATGOQv6chwqeuDzqrrqf0CvLAKJCM3CqBt4VIetGwAtr FXaA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=71RZpLoOR8WYSh7imeQpwmDDhV+BCqDsCV9ISGQsCK8=; fh=g9R67Jh3/bk856kmA8XVLoP0slgbpj3g5F2jAGnuQIc=; b=zWgKQ5dQof3v3HIy7XNaR8WfDvKZjIFvPEEbpCNIkxuj1z6vUTO59Ci+VheLuG++ti 3FWfaQ64fezJS+4tmM5f2mqMySrLO8n0TxdkauOS+3v5qVI5h3sXIenoqYAcWEEso9O4 L5tJh7Ysdes3gKsssxR1QrNWtnJqghGAeX5mRgnZE/jqJnNHFHeuJRsEsWBCx7n1NaNf xO6YVXQljdN0C6iHPBxz7YPsfAbJCqBClOOSVo4TsfzdVBM/ae8/ozPl6dQ6Jk1uyQlt 32MQAf88sNHx9mybsuNY2YAeO/HwzSNeqJmoI3mZR9ygs2xnm3bGR3hK60VgYOuKw4J1 XPaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=bOzAat0N; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=8PYcx+Xc; 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 s190-20020a632cc7000000b0055ae4bb1199si7585560pgs.698.2023.06.29.07.16.38; Thu, 29 Jun 2023 07:17:11 -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=bOzAat0N; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=8PYcx+Xc; 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 S231668AbjF2OJ0 (ORCPT + 99 others); Thu, 29 Jun 2023 10:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231443AbjF2OJZ (ORCPT ); Thu, 29 Jun 2023 10:09:25 -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 EA27D1B1; Thu, 29 Jun 2023 07:09:23 -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 A69BB1F8AF; Thu, 29 Jun 2023 14:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1688047762; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=71RZpLoOR8WYSh7imeQpwmDDhV+BCqDsCV9ISGQsCK8=; b=bOzAat0NSo7RDK5B8cqq0vhPaf0FH7qw+zwCC6CiHe85TxXZnp2GjF4deTGUHSbtiBj7KT hPAxL+k6qQUXWv6R3wkYSqvVByhhoWWoitIRg+rW36nxGuS1uxQ+HRjjXXIB2BzosnINLu HYQ8kG/7lgiKV2f1WGfkeK5AKLKsp98= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1688047762; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=71RZpLoOR8WYSh7imeQpwmDDhV+BCqDsCV9ISGQsCK8=; b=8PYcx+XcIW466le2pRQYKLH8oKk8vPZ2U7BVCLyhZUBlulCyZsforuBWV4b2fIVyiihntb j7roBo0AWsAkgpCg== 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 9440513905; Thu, 29 Jun 2023 14:09:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 7lsjJJKQnWRUDgAAMHmgww (envelope-from ); Thu, 29 Jun 2023 14:09:22 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 18201A0722; Thu, 29 Jun 2023 16:09:22 +0200 (CEST) Date: Thu, 29 Jun 2023 16:09:22 +0200 From: Jan Kara To: Baokun Li Cc: Jan Kara , 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: <20230629140922.dp74owntkbm5avop@quack3> References: <20230628132155.1560425-1-libaokun1@huawei.com> <20230628132155.1560425-7-libaokun1@huawei.com> <20230629110813.kfaja4bdomilmns6@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Thu 29-06-23 20:13:05, Baokun Li wrote: > On 2023/6/29 19:08, Jan Kara wrote: > > 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(). > > I don't understand this sentence very well, so I would appreciate it > > if you could explain it in detail. ???? OK, let me phrase it in a "changelog" way :): remove_inode_dquot_ref() currently does not release the last dquot reference but instead adds the dquot to tofree_head list. This is because dqput() can sleep while dropping of the last dquot reference (writing back the dquot and calling ->release_dquot()) and that must not happen under dq_list_lock. Now that dqput() queues the final dquot cleanup into a workqueue, remove_inode_dquot_ref() can call dqput() unconditionally and we can significantly simplify it. Honza -- Jan Kara SUSE Labs, CR