Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1428537rdg; Sat, 12 Aug 2023 00:23:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRPSJJtwDTeCn8hijVij9S747hBcA/O/TjVBdwYJR1Jidb/CTTw3MqjZUBNfZUJyd/AmDk X-Received: by 2002:a17:90a:34ca:b0:262:ed49:ffe7 with SMTP id m10-20020a17090a34ca00b00262ed49ffe7mr3482230pjf.25.1691825034927; Sat, 12 Aug 2023 00:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691825034; cv=none; d=google.com; s=arc-20160816; b=POQAy1QjkbCQR6Qnh0HD1S287oiuqohhKzqCiroMbtbX1wZyicgAq1KUpNPAowSgsS MRgEarrjjGGpo5KAJybT5KBWiJXhWMY6Ahl2Poc+ikmDvHXtqmufj6jWiZCTLBjVwEnG DOriOD+lPC7c28Kqi3+y2vWfW24zdJ8HDDw2ugGJ5j8+6RVTMTk0ISBwIZN9WDYLg7J8 HzGXhovjjsA7gx9QpKRwROYaBPiHV1PJ3JOQEZesSL3w4Ix0rekCy4PcVmxws29DNT4b 9Ax2538k+aQGAViEtiZlJjPHtonbrJAUS+XnHMGz09O2mn9wKsNJm0eR4x+nr/l/sG2O R9Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3s111VjzypFQtZjW+nznpvMA7rtjeFLqeYs99tzOytk=; fh=/fJYuDKDAXfmIIcfW0Vj3O8o/uIKzIhDm0UcfMtqmM4=; b=KIzQi35e9v29WjTk7ppXJip3vcL8uN+Iu6BAPOTEgyN44hnXBgybPnPRAkrTqKpzLi +JO35zb6x7Kjh7Vm39RVwVDZ7sl/4b3W8vq9v7IntappAtqm4EC6CI5QCs1WslFCg5wg 1lAPIiY7kbUomFxGhhjHdjEP+NISsJkZ78wYmjILiBiGW3zClr5L3wNqcZRdfahcnx4I 68hinxfIV5oHTgj+dWARrvU+73lKN4PLOu/cRDxmhksIj0XxfGboaWl58K4QrcWp0A/H qvOo+o32raKOJzeaWoMFE+fbYyKvOeGJ+Zt00qlOqgYc2LQCUXvSAkx8y33ZRXvLLV8k bYYQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a170902c70300b001bb7b0d358bsi4305353plp.272.2023.08.12.00.23.34; Sat, 12 Aug 2023 00:23:54 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbjHLHTL (ORCPT + 99 others); Sat, 12 Aug 2023 03:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbjHLHTL (ORCPT ); Sat, 12 Aug 2023 03:19:11 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 947E29C for ; Sat, 12 Aug 2023 00:19:10 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RNBn13w8WzTmNG; Sat, 12 Aug 2023 15:17:09 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 12 Aug 2023 15:19:08 +0800 From: Ruan Jinjie To: , Theodore Ts'o , Andreas Dilger CC: Subject: [PATCH -next] ext4: mballoc: Use LIST_HEAD() to initialize the list_head Date: Sat, 12 Aug 2023 15:18:39 +0800 Message-ID: <20230812071839.3481909-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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 Use LIST_HEAD() to initialize the list_head instead of open-coding it. Signed-off-by: Ruan Jinjie --- fs/ext4/mballoc.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 21b903fe546e..2130a310b784 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3501,11 +3501,10 @@ static void ext4_discard_work(struct work_struct *work) struct super_block *sb = sbi->s_sb; struct ext4_free_data *fd, *nfd; struct ext4_buddy e4b; - struct list_head discard_list; + LIST_HEAD(discard_list); ext4_group_t grp, load_grp; int err = 0; - INIT_LIST_HEAD(&discard_list); spin_lock(&sbi->s_md_lock); list_splice_init(&sbi->s_discard_list, &discard_list); spin_unlock(&sbi->s_md_lock); @@ -3879,12 +3878,10 @@ void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid) { struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_free_data *entry, *tmp; - struct list_head freed_data_list; + LIST_HEAD(freed_data_list); struct list_head *cut_pos = NULL; bool wake; - INIT_LIST_HEAD(&freed_data_list); - spin_lock(&sbi->s_md_lock); list_for_each_entry(entry, &sbi->s_freed_data_list, efd_list) { if (entry->efd_tid != commit_tid) @@ -5419,7 +5416,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, struct ext4_group_info *grp = ext4_get_group_info(sb, group); struct buffer_head *bitmap_bh = NULL; struct ext4_prealloc_space *pa, *tmp; - struct list_head list; + LIST_HEAD(list); struct ext4_buddy e4b; struct ext4_inode_info *ei; int err; @@ -5448,7 +5445,6 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, goto out_dbg; } - INIT_LIST_HEAD(&list); ext4_lock_group(sb, group); list_for_each_entry_safe(pa, tmp, &grp->bb_prealloc_list, pa_group_list) { @@ -5529,7 +5525,7 @@ void ext4_discard_preallocations(struct inode *inode, unsigned int needed) struct buffer_head *bitmap_bh = NULL; struct ext4_prealloc_space *pa, *tmp; ext4_group_t group = 0; - struct list_head list; + LIST_HEAD(list); struct ext4_buddy e4b; struct rb_node *iter; int err; @@ -5546,8 +5542,6 @@ void ext4_discard_preallocations(struct inode *inode, unsigned int needed) trace_ext4_discard_preallocations(inode, atomic_read(&ei->i_prealloc_active), needed); - INIT_LIST_HEAD(&list); - if (needed == 0) needed = UINT_MAX; @@ -5865,13 +5859,11 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb, { ext4_group_t group = 0; struct ext4_buddy e4b; - struct list_head discard_list; + LIST_HEAD(discard_list); struct ext4_prealloc_space *pa, *tmp; mb_debug(sb, "discard locality group preallocation\n"); - INIT_LIST_HEAD(&discard_list); - spin_lock(&lg->lg_prealloc_lock); list_for_each_entry_rcu(pa, &lg->lg_prealloc_list[order], pa_node.lg_list, -- 2.34.1