Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp120852rdb; Wed, 17 Jan 2024 20:22:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEy09O9lf0mD/35DjT6ZIKIg1zOC/9J1LYa1jJuJQit4XHyOxC0O2DUwwCUpFi7ki9/eQRZ X-Received: by 2002:a05:600c:4287:b0:40e:68a9:9373 with SMTP id v7-20020a05600c428700b0040e68a99373mr111865wmc.128.1705551775607; Wed, 17 Jan 2024 20:22:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705551775; cv=pass; d=google.com; s=arc-20160816; b=0uteprRDgHlFqAauL/kXcqRNVwANn/eu20nVWeF8cs7djeoRPu1VKHcLQLj2ZXes4w cGw51T/ZXQjZH4zJOe0kK1zc+u4pGEx9/cXUmOm6Qzk0Z7Jw2a25Mx0HubEvFveNls17 Ew18Am7iv47givkrCn+eR8vGIhmrs+VXfOredALnT3zOVqVK+/oyqg3eCoCm+IjQIwXq XyH954NthMqzmvlEoyxg9f2maiFeL97j0M+siL9v5+yclanv4WAeDkSeJ3IUFcnsZQRH L4+8Cf51q8OT9N5geyzMJ+XkB3723+PiHSYqQzqcPUKz6ZvtGx73Vp9PmIECtCW9UkAk LTDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:subject:from :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=GXiIWkzqAAeUrw0kWY0ArklSvyta9OjAGznuFzyNyFA=; fh=AEn7cBy3ufyh24C1vesvVP41HbxdXYO90AN69tZ7LBo=; b=ugU/P9r7uS7n9YcbbPZRCh6RvhTlKoudHK49RsBr8zj8JIM/ogLqvVrqGrnruBmNmi JnH+f7CXF6YFnryv4JHijlaLL7q2lW0uBs6hHDyIBpAgEx20knLxXSYajCFCK91IMDXI yvQEjW3SmGi2wrUoMGbOdkF39lW5WPlMevlB77L8u7eqVjnPera/cL0Mi3WYLgqNyu3Q mgfdcnK+6SxdDW6dwR9S7QiHlzZwxd2n1PxXmXdYCBoLcblYtUFnqLZTPQevICNfXKz4 x7r2FiF9mTPSYrOK8KM2mmhDXnktEd8pwp8nti2iU2jFFO7A5DYocnhD5Fa8NITr3bfy qq1Q== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-842-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-842-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h12-20020a17090634cc00b00a2b2b17d59esi6307643ejb.723.2024.01.17.20.22.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 20:22:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-842-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-842-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-842-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5E7A41F2315F for ; Thu, 18 Jan 2024 04:22:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4F0E6FBC; Thu, 18 Jan 2024 04:22:48 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CA367481 for ; Thu, 18 Jan 2024 04:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705551768; cv=none; b=lEHJEBJfJ1nIfGRcE0D+ivbya6RkyciGMGpklf/MKfnvt6O44wrOkZfzdaBbxzoceSAiYBtUUbx13B9WiahROXhOFn+J055OpNaBG/A0UCNCEkvff0DedaxqDGdc03Xv79tJCuMiSkqRPDkkRxvsVxnXuPTsxyAG2rX8rJLZzas= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705551768; c=relaxed/simple; bh=NOqwB/W7IgR/vHvdvwBAGIaC3WlvlInmDgD/04Eougk=; h=Received:Received:Received:Message-ID:Date:MIME-Version: User-Agent:From:Subject:To:Cc:References:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-CM-TRANSID:X-Coremail-Antispam: X-CM-SenderInfo; b=D++HgAy9MEHjK6BJhnZLYBXgOAAWl8VFTI6rtSMye1/jHbpIX0dtWu+gWPL/faK62vS8BGG0bbNbTKL0Tbl5LzAAnMz5bA94bgtvBTTqhDbuUxQZQQ85WQ54jOf+B3UUKbwILpLRpnESFLuugfi50uaSuo6TVXoaaVCg11amo0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TFqNG61kZz4f3jq7 for ; Thu, 18 Jan 2024 12:22:38 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 0871A1A08CA for ; Thu, 18 Jan 2024 12:22:41 +0800 (CST) Received: from [10.174.177.210] (unknown [10.174.177.210]) by APP1 (Coremail) with SMTP id cCh0CgDHlxCHp6hlqJS4BA--.13283S3; Thu, 18 Jan 2024 12:22:40 +0800 (CST) Message-ID: Date: Thu, 18 Jan 2024 12:22:31 +0800 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 From: yangerkun Subject: Re: [PATCH 1/2] ext4: remove unused buddy_loaded in ext4_mb_seq_groups_show To: Jan Kara , yangerkun Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org References: <20240117115223.80253-1-yangerkun@huawei.com> <20240117125647.4gyqfhngii2dxnlo@quack3> In-Reply-To: <20240117125647.4gyqfhngii2dxnlo@quack3> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgDHlxCHp6hlqJS4BA--.13283S3 X-Coremail-Antispam: 1UD129KBjvJXoW7CF1UCw4DKFWfJr1fJrykuFg_yoW8AFyxpF sxAF1jkr45Ww1DuF4j9a4qgFyFqw1I9a4fWry3Wr1FvFy7Gr93KF9FgF1Uur1UCFWxGF10 v3W3uFnxur4SkaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyKb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0E wIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E74 80Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0 I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04 k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY 1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUzvtCDUUUU X-CM-SenderInfo: 51dqwvhunx0q5kxd4v5lfo033gof0z/ 在 2024/1/17 20:56, Jan Kara 写道: > On Wed 17-01-24 19:52:22, yangerkun wrote: >> We can just first call ext4_mb_unload_buddy, then copy information from >> ext4_group_info. So remove this unused value. >> >> Signed-off-by: yangerkun > > Looks good. Feel free to add: > > Reviewed-by: Jan Kara > > Although I'd prefer if you add a comment before memcpy() like: > > /* > * We care only about free space counters in the group info and > * these are safe to access even after the buddy has been unloaded > */ > > Honza > Thanks a lot for your review! I will do it next version! >> --- >> fs/ext4/mballoc.c | 9 ++------- >> 1 file changed, 2 insertions(+), 7 deletions(-) >> >> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c >> index f44f668e407f..139f232bdbb5 100644 >> --- a/fs/ext4/mballoc.c >> +++ b/fs/ext4/mballoc.c >> @@ -2990,8 +2990,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) >> { >> struct super_block *sb = pde_data(file_inode(seq->file)); >> ext4_group_t group = (ext4_group_t) ((unsigned long) v); >> - int i; >> - int err, buddy_loaded = 0; >> + int i, err; >> struct ext4_buddy e4b; >> struct ext4_group_info *grinfo; >> unsigned char blocksize_bits = min_t(unsigned char, >> @@ -3021,14 +3020,10 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) >> seq_printf(seq, "#%-5u: I/O error\n", group); >> return 0; >> } >> - buddy_loaded = 1; >> + ext4_mb_unload_buddy(&e4b); >> } >> >> memcpy(&sg, grinfo, i); >> - >> - if (buddy_loaded) >> - ext4_mb_unload_buddy(&e4b); >> - >> seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free, >> sg.info.bb_fragments, sg.info.bb_first_free); >> for (i = 0; i <= 13; i++) >> -- >> 2.39.2 >>