Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7278034rwb; Tue, 15 Nov 2022 09:54:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6C2khgn+ZQKe8rA7/4TwcxMqxYmRtP7TLsT/swm3CkebZhL7/vROtFvEoHWc6yL3XqIFI8 X-Received: by 2002:a17:906:7692:b0:7ae:3fa3:d7c6 with SMTP id o18-20020a170906769200b007ae3fa3d7c6mr13859282ejm.494.1668534889581; Tue, 15 Nov 2022 09:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668534889; cv=none; d=google.com; s=arc-20160816; b=r0SWeQ83Y9N3t/7ZAebwFQsUxTmjjXfRzqzeCKN75boWIajydUtqyL2Ht5DK3M2f0p Qiez4KMUqOv5pDRW8yQLw3JKbEZfT7R2xjm7105v3pljooU8eq5fOVeFUFwTjYPhOCOA JV1FJvxqpIokfYXAAnAMwRC6QBkFF8BmD/DszcrTZJMQlmR0i2FVHp/IXr8Y7rfqsa2H qfYQ1TLwRmDNM5C9A35pcECJVT4ps/Wty0j5wVKcjG/ARRaRVbpUxA0jNm+Ln0MQsF2p Nakg7PE0/tOHbvLregsZvOmKaJAzF2QKJXjIUCl01T3YbxnqkmUe9efzxas6HBX5rAJV l8tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=QDUOe6qx/ITECWfExxKR6UHSqNkvVa8qB8JyT77HML4=; b=aaniec2MAPbE78qhQFFFCgHNm09V4mewXjvwCoxDqlruR3xqA2CabaplQO2tXs1S1U so6h6fs0wz0jfT0PauWjAcRcNBaO6VCvMo0bSR/plJdjM13m82R9IxZxYXvsZvRzOMVJ /riP1V068Vf+CL7+NphrjLNycD5WBoka6OHUn1oF7+yxoNvVSaHGFcJvs2+HrQwloUpn xJFQjcmTmXK99zuX0MKZTmr7tJ6cVwVbSo2CN5HJMLz0d3hez9idYtYU7OY4deg3at4Q j/4n5IHxQqqw3feZUi9YOXfoCOlLM9ocMl+wkF06M7W9irp4txCEt6yb8iS2SEoVJsdO /vIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=oe+1hJ5P; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=K6I53FWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 qb23-20020a1709077e9700b0078dcf17c084si12251456ejc.728.2022.11.15.09.54.27; Tue, 15 Nov 2022 09:54:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=oe+1hJ5P; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=K6I53FWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229554AbiKOReS (ORCPT + 90 others); Tue, 15 Nov 2022 12:34:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbiKOReO (ORCPT ); Tue, 15 Nov 2022 12:34:14 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E10B9186FC; Tue, 15 Nov 2022 09:34:09 -0800 (PST) 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-out1.suse.de (Postfix) with ESMTPS id 955D122ACD; Tue, 15 Nov 2022 17:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1668533648; h=from:from:reply-to: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=QDUOe6qx/ITECWfExxKR6UHSqNkvVa8qB8JyT77HML4=; b=oe+1hJ5PadI0DQYx0jMDpWIebMOMPLbCcrnm9JG0uhCfA1isvIYzCfN4kwrsgkJ5/tem/9 4Cs/mICZ4I6Rzy5b9Nimdwak0UqOffoF0BUTwa8j331+XptM+bUSrl9m+EdJdq6C9FIHH9 dBSxeZLwDRH4zGXxqGw4raFIYgAU6Ik= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1668533648; h=from:from:reply-to: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=QDUOe6qx/ITECWfExxKR6UHSqNkvVa8qB8JyT77HML4=; b=K6I53FWEjfDWU3tc2jw2RyDc3Y2OHtdph65NlYK+vM0DNz+qli94DJej15Hp4GtkSAzxsk 1VTSsngLM3hNqtAA== 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 5279613A91; Tue, 15 Nov 2022 17:34:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id l54hE5DNc2P/WQAAMHmgww (envelope-from ); Tue, 15 Nov 2022 17:34:08 +0000 Date: Tue, 15 Nov 2022 18:33:42 +0100 From: David Sterba To: ChenXiaoSong Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangxiaoxu5@huawei.com, yanaijie@huawei.com, quwenruo.btrfs@gmx.com, wqu@suse.com Subject: Re: [PATCH v4 2/3] btrfs: qgroup: introduce btrfs_update_quoto_limit() helper Message-ID: <20221115173342.GL5824@suse.cz> Reply-To: dsterba@suse.cz References: <20221115171709.3774614-1-chenxiaosong2@huawei.com> <20221115171709.3774614-3-chenxiaosong2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115171709.3774614-3-chenxiaosong2@huawei.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) 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 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-kernel@vger.kernel.org On Wed, Nov 16, 2022 at 01:17:08AM +0800, ChenXiaoSong wrote: > No functional changed. Just simplify the code. Please write some description of the change, like "factor out quota limit update that also marks qgroup as inconsistent if it fals". > Signed-off-by: ChenXiaoSong > --- > fs/btrfs/qgroup.c | 34 +++++++++++++++++----------------- > 1 file changed, 17 insertions(+), 17 deletions(-) > > diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c > index d0480b9c6c86..ca609a70d067 100644 > --- a/fs/btrfs/qgroup.c > +++ b/fs/btrfs/qgroup.c > @@ -1677,6 +1677,19 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid) > return ret; > } > > +static int btrfs_update_quoto_limit(struct btrfs_trans_handle *trans, Typo 'quoto' and it should rather be qgroup as the limit is related to a qgroup, quota is usually in connection with the whole subsystem. > + struct btrfs_qgroup *qgroup, > + struct btrfs_fs_info *fs_info) > +{ > + int ret = update_qgroup_limit_item(trans, qgroup); > + if (ret) { > + qgroup_mark_inconsistent(fs_info); > + btrfs_info(fs_info, "unable to update quota limit for %llu", > + qgroup->qgroupid); > + } > + return ret; > +} > + > int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid, > struct btrfs_qgroup_limit *limit) > { > @@ -1742,13 +1755,7 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid, > > spin_unlock(&fs_info->qgroup_lock); > > - ret = update_qgroup_limit_item(trans, qgroup); > - if (ret) { > - qgroup_mark_inconsistent(fs_info); > - btrfs_info(fs_info, "unable to update quota limit for %llu", > - qgroupid); > - } > - > + ret = btrfs_update_quoto_limit(trans, qgroup, fs_info); > out: > mutex_unlock(&fs_info->qgroup_ioctl_lock); > return ret; > @@ -2824,9 +2831,7 @@ int btrfs_run_qgroups(struct btrfs_trans_handle *trans) > ret = update_qgroup_info_item(trans, qgroup); > if (ret) > qgroup_mark_inconsistent(fs_info); > - ret = update_qgroup_limit_item(trans, qgroup); > - if (ret) > - qgroup_mark_inconsistent(fs_info); > + ret = btrfs_update_quoto_limit(trans, qgroup, fs_info); > spin_lock(&fs_info->qgroup_lock); > } > if (test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) > @@ -2953,14 +2958,9 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, > dstgroup->rsv_rfer = inherit->lim.rsv_rfer; > dstgroup->rsv_excl = inherit->lim.rsv_excl; > > - ret = update_qgroup_limit_item(trans, dstgroup); > - if (ret) { > - qgroup_mark_inconsistent(fs_info); > - btrfs_info(fs_info, > - "unable to update quota limit for %llu", > - dstgroup->qgroupid); > + ret = btrfs_update_quoto_limit(trans, dstgroup, fs_info); > + if (ret) > goto unlock; > - } > } > > if (srcid) { > -- > 2.31.1 >