Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp820751pxb; Tue, 12 Apr 2022 14:22:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8Cp2ysnfmTGz2/pqrMisGQSL+qy30nJ99D/wzDnOJ2C3uOdUeIlNxsQBA08JIz47T31iC X-Received: by 2002:a17:903:31d5:b0:158:27f4:fc9f with SMTP id v21-20020a17090331d500b0015827f4fc9fmr22538351ple.60.1649798565197; Tue, 12 Apr 2022 14:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649798565; cv=none; d=google.com; s=arc-20160816; b=VLGBDRFxc4XXUnGBKBLXLwo83l4ugR3Huelz23BrpIacwVRYyKzZPDgQJhUL3MB1zF WYG91dnmKEHvRE73t1S+TcF9yuNyVUzBkL6qjXykHay3yHx9zkywARj+xi/DZFnP6pAm u6nHaOkHmH3mkHTYQ1WiQGLQk71eTa3K8Cu4Z3yakw/mSmHkWgXLyW3WGkaqVXC2iDQu S8FIKoNxVE4Kma675Gm+w9scr95NIT7JEqFEbcV4FmeDM/RcPY3kdohb0Su9ARgncR/T D0OIoFXi1jEjcnR9u7uboTs99oRZLICOwSF+rvm9BiLrTkuYhctMOoRk0ykMU6BkZJu4 g4iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=VYlSwRs2xXTAAyUlwb+gbXuW16FUgB8AcvnUgAkw87M=; b=YSuADgdJJoc5wX48Uo5iZJLKf8Fgw22UZ9vr2m+OM3WQcpIT0WRS4ul24lgDYPwUdJ Vu9J2wNYTYXMQmlAC9yAnZYiCRFpeCgu+QE/MyeH4KM6bRh/V69GqN7FWOEPciN90pjj PHfeXN7WKBG3kKlhdAZCxsyF8Dqc4tJNn4e23AnMSUpeAD5Q0WE5eoIRA57FeSSTQ7O7 cUiBw+yqM9L0j+GFZFlOn11FmKxNg4NoWc/maYanCWi3Ql13EWmkM/ZFCBJaHKHpLEq1 /gTT0Pedf0qUU06VaLx225ZP1fiDDb1BRXc43WEvrI+LG7mguwL733XO77j68cLTW3Xh 6U1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eSbceTFB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m18-20020a170902f65200b0015852f2a130si8047770plg.620.2022.04.12.14.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:22:45 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eSbceTFB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7671510CF36; Tue, 12 Apr 2022 13:34:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351777AbiDLMLj (ORCPT + 99 others); Tue, 12 Apr 2022 08:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352944AbiDLMDp (ORCPT ); Tue, 12 Apr 2022 08:03:45 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D44B40 for ; Tue, 12 Apr 2022 04:02:20 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id u15so17910671ejf.11 for ; Tue, 12 Apr 2022 04:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VYlSwRs2xXTAAyUlwb+gbXuW16FUgB8AcvnUgAkw87M=; b=eSbceTFB98b3Z4e++6Y2eKyh0djI4T4ned0/KGkHF4WkQ2ae1MrCfN/x1DtyjdQ9EK I6uRjCoOv2AxG0UVJB0EOUOEcKG1gRlCsYmqXVCMaB1783YxmdMMk9Er1euKcvHliDpE tRH2iCH/Aaoe6tasaDrdqEiifWeCJ3oo0c8Gps11Zz8r3CFiu+WckRFSke/7vQpAhA39 SdyWjtnFobiiFiq0baedSX18wfT0ay8xSeoyNDUUujyaFI7DfjEyqROymvDx4JAbt5cB Q9dW0CrEFyWsiFUbVC+RGVEBAtPjMno47ARxUA30DU7nZ+ZhEguqThGbutt1Rd0YYr/W YCig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VYlSwRs2xXTAAyUlwb+gbXuW16FUgB8AcvnUgAkw87M=; b=W0PfJwKq/c7samWYmmteiDUbbRjFgRpj+06gPfwQT54BZHbBKbJOjD91XxzcmLozwZ +cffZA70LjtH/fymh2Ia97Tvn/7KEzXMS+H/JZIsjPI+gAJfOvSzzLkojBTsNS86rIMg uA/TNDCUf/Zz4oi6Axb+f50BWJBC8daiYD0TFPS2WziTAmBUj4glZAinSEhBw4+sm8Yn aPvq6GIBkMZiNwTL3ZkPdkF0hJ9+6/HmF7VCqkfQ70ZAbqWzow+TAZCiX9vwPBIlD7nG H5RD2JdtPFLCvoa/bhFtu1xsR+/zl1la0jt8kN25qFrdEgOaUg8eB0lbqTJ5Vh0HPHmv 2RUg== X-Gm-Message-State: AOAM532ggP/8fN5k7AR/ACeCJ/YwLKDS0Ko7DruELjJlxejywX3pjAKf hYw2WE5vx3Up3B7n17dKv+Y= X-Received: by 2002:a17:907:d04:b0:6e8:8cbc:e86a with SMTP id gn4-20020a1709070d0400b006e88cbce86amr9739701ejc.194.1649761338744; Tue, 12 Apr 2022 04:02:18 -0700 (PDT) Received: from smtpclient.apple (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.gmail.com with ESMTPSA id f1-20020a056402194100b00416b174987asm16990227edz.35.2022.04.12.04.02.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Apr 2022 04:02:18 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: [PATCH 1/2] f2fs: use separate list iterator variable to call list_move_tail() From: Jakob Koschel In-Reply-To: <4d54f494-b143-8885-a31e-924a83409e2d@kernel.org> Date: Tue, 12 Apr 2022 13:02:17 +0200 Cc: Jaegeuk Kim , Linux F2FS Dev Mailing List , LKML , Mike Rapoport , Brian Johannesmeyer , Cristiano Giuffrida , "Bos, H.J." Content-Transfer-Encoding: quoted-printable Message-Id: <632AA316-A1B4-4E2C-B5FD-204FD3BE8633@gmail.com> References: <20220331221650.891790-1-jakobkoschel@gmail.com> <4d54f494-b143-8885-a31e-924a83409e2d@kernel.org> To: Chao Yu X-Mailer: Apple Mail (2.3696.80.82.1.1) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 12. Apr 2022, at 11:40, Chao Yu wrote: >=20 > On 2022/4/1 6:16, Jakob Koschel wrote: >> In preparation to limit the scope of a list iterator to the list >> traversal loop, use a dedicated pointer to point to the found element >> [1]. >> If no break is hit or the list is empty, 'next' will be NULL and >> list_move_tail() should be called explicitly on the head directly. >> Link: = https://lore.kernel.org/all/CAHk-=3DwgRr_D8CB-D9Kg-c=3DEHreAsk5SqXPwr9Y7k9= sA6cWXJ6w@mail.gmail.com/ >> Signed-off-by: Jakob Koschel >> --- >> fs/f2fs/segment.c | 12 ++++++++---- >> 1 file changed, 8 insertions(+), 4 deletions(-) >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >> index 22dfeb991529..81ef2c3d08e5 100644 >> --- a/fs/f2fs/segment.c >> +++ b/fs/f2fs/segment.c >> @@ -4175,16 +4175,20 @@ static void release_sit_entry_set(struct = sit_entry_set *ses) >> static void adjust_sit_entry_set(struct sit_entry_set *ses, >> struct list_head *head) >> { >> - struct sit_entry_set *next =3D ses; >> + struct sit_entry_set *next =3D NULL, *iter =3D ses; >> if (list_is_last(&ses->set_list, head)) >> return; >> - list_for_each_entry_continue(next, head, set_list) >> - if (ses->entry_cnt <=3D next->entry_cnt) >> + list_for_each_entry_continue(iter, head, set_list) >> + if (ses->entry_cnt <=3D iter->entry_cnt) { >> + next =3D iter; >> + list_move_tail(&ses->set_list, &iter->set_list); >> break; >=20 > return; >=20 >> + } >> - list_move_tail(&ses->set_list, &next->set_list); >> + if (!next) >> + list_move_tail(&ses->set_list, head); >=20 > list_move_tail(&ses->set_list, head); >=20 > Then we don't need @next variable, right? Of course yes, good spot! I'll fix and resend a v2 in the next days. Thanks for the input. >=20 > Thanks, >=20 >> } >> static void add_sit_entry(unsigned int segno, struct list_head *head) >> base-commit: d888c83fcec75194a8a48ccd283953bdba7b2550