From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01CD2C433F5 for ; Thu, 31 Mar 2022 12:02:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235698AbiCaMEC (ORCPT ); Thu, 31 Mar 2022 08:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236167AbiCaMDM (ORCPT ); Thu, 31 Mar 2022 08:03:12 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 835721C16FD; Thu, 31 Mar 2022 05:00:43 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id g20so27870920edw.6; Thu, 31 Mar 2022 05:00:43 -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=eGk6hp1cjRwf/Z2iSyo20kNLHbQVMFCNuaMs0Rs1280=; b=AOVyRosQIc5R2N1+6CICHmtlfUo4QCpEVrmcWBz/JrGlqhg+6pPeHXqvhfRxrcRjws KzaTC02Hv8cOGF6HCXLwm55ukcSQnXmOTuq4e//KmC9j10bu9tLC3K7iXdPXmtS8iXRS j6U2H0SrKB8pxDTTBNdPwJOYSo2/yLfmycuzlqiVgadJgoRxOTGfxcB7vXawbXlTesfu aXmFod8GJDje4nrM8tT8Lofw8NN1bs5FYUx9DdCO6B2YhbTSaFLKGyoh3a/3vKcnZOd4 v91RY1gBMoPU2tS50Bxcyhj676wVBR9ZJf6Kqz8tuSed+XuTxMQxGom4X1SuKu2NPxAH bnsg== 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=eGk6hp1cjRwf/Z2iSyo20kNLHbQVMFCNuaMs0Rs1280=; b=Dnpze0s+1sUZW9hxocMh5oRNeebfv4qqQQMnHg2n897bk9vhLRKDkSqg+gFieDHuTo 0zZT9c6oiXskufvf/WrMumF0y4xmQXl+FSLfFisRN46xK1Yfdq6SMVrRxj+FAvshTxFU ReRdqqCDqOPObXJQXm6KFuOz5omov3Ox5bmxxcQIpsgb/iE270+axVVX3bt+OdB6uyVw 2pkkuogtkruSx3S92DmDCLB+zDKOWdFetPgMx44IddI3l2hukIrsRTX+I3L/XzgvdEPw 1zs0aCMSl4l02x4XMPfjsCXJuUwk/PR93QBLew9gK6ZGzz6dSROD4WknZ702hjcxRyBh wGEA== X-Gm-Message-State: AOAM532Bv2eyOrF13Gxr7NM4nCgi+drfXgK7TAtwYeeKKiFXojDV4ZeD FhC2hpQFrPQYpRST9yD/aiY= X-Google-Smtp-Source: ABdhPJzfmp3R/snJpoz4JKLB8p6kVhzjLK3y15+yg2Msn43WCATfPtX/lADAdX1oJyKqIod0tml/Vw== X-Received: by 2002:aa7:da85:0:b0:419:1e13:205c with SMTP id q5-20020aa7da85000000b004191e13205cmr16173995eds.363.1648728042064; Thu, 31 Mar 2022 05:00:42 -0700 (PDT) Received: from smtpclient.apple (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.gmail.com with ESMTPSA id j18-20020a170906535200b006e007fa9d0fsm9546074ejo.149.2022.03.31.05.00.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Mar 2022 05:00:41 -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 v2] block: use dedicated list iterator variable From: Jakob Koschel In-Reply-To: Date: Thu, 31 Mar 2022 14:00:39 +0200 Cc: linux-block , linux-kernel@vger.kernel.org, Bart Van Assche , Mike Rapoport , Brian Johannesmeyer , Cristiano Giuffrida , "Bos, H.J." Content-Transfer-Encoding: 7bit Message-Id: References: <20220331091218.641532-1-jakobkoschel@gmail.com> To: Jens Axboe X-Mailer: Apple Mail (2.3696.80.82.1.1) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 31. Mar 2022, at 13:59, Jens Axboe wrote: > > On 3/31/22 3:12 AM, Jakob Koschel wrote: >> To move the list iterator variable into the list_for_each_entry_*() >> macro in the future it should be avoided to use the list iterator >> variable after the loop body. >> >> To *never* use the list iterator variable after the loop it was >> concluded to use a separate iterator variable instead of a >> found boolean [1]. > > Not a huge fan of doing a helper for this single use, but I guess it > does make the main function easier to code. So I guess that's fine. But > can you move the call down where the result is checked? > > qe = blk_lookup_qe_pair(head, q); > if (!qe) > return; > > I prefer no distance between call and check, makes it easier to read. I > can make the edit locally and note it in the commit message so you don't > have to re-send it. Let me know, or just resend a v3. I'm fine with you doing the change locally, thanks! > > -- > Jens Axboe > Jakob