Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2853358rwr; Fri, 21 Apr 2023 15:36:29 -0700 (PDT) X-Google-Smtp-Source: AKy350ZwdSz6tdx39JfdcnXEI5Vios3DlFPnJF3D063KsJPTCe3HjObtxD9jvnXr2jogqjbqBC27 X-Received: by 2002:a05:6a00:1d16:b0:635:4f6:2f38 with SMTP id a22-20020a056a001d1600b0063504f62f38mr6903752pfx.2.1682116589495; Fri, 21 Apr 2023 15:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682116589; cv=none; d=google.com; s=arc-20160816; b=TXAgEm2nchKS027x37PfWVMXIbrDwZP92EpCu05EBtjuy/rS9siaXitkPHGLUb84Vn EzAwUpo8kBoADe4yawhd8J7Es2PiKBQVTef6t7xmcDDW84daFhs2/9t0hz0YmwR+TSn4 a2xY6POdzYu0OjYd20cG2cGxGA7MhVa2NiGn4QdJCxyZQHshbwzzJ5XgaBIGK6D1GF5p 4Zp1ME3EUAN2s7nnfww0V1RtzI84g/iIjymDha3iWMDAtlETkasVVtW94CAg/fNQUbrv mrnEUeDw0KsPiGZqupwfJ22OdFMtokPUFqau4HyE9MctSjGIgJeczGL92ZuGtYJoavSm MnrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WOBbV//TmE5/Vt+YNa7VvWoHjH617/cqrLHE/FuEqvo=; b=IXWad1SKLFXLepFYGiiOf7v4NGlo6bmctgX+unPpwci5I0CWK+K1IYP8T/nIA5YZUp vd/eivSA5AAJK43rzBEXR64PGRIg5ZblYB3WGMtc9Amx1owOempUIYCc2DUdtjXiH/W5 jPMBA8VNcXCC6gILnJSycqulWeLpS6WxelO1LorOqZWESdVj7OXV07/86wmzPGVVbFfP rjmK+3N+2sdgV19UKrLoZPNg+mq18ij08kNbYZtAZblv+gFfze3lA9EOAGg3rrCrJ+Xi S83PYMZv2iMhzy5LYvB84c5JGLqliYFngdtlZ4H8Gg6vNjbaJ/HH26PrVBN5LOAZWGhn C1cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=28YtcKiM; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a625205000000b0063d61f05a8fsi5528448pfb.198.2023.04.21.15.36.16; Fri, 21 Apr 2023 15:36:29 -0700 (PDT) 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=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=28YtcKiM; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233912AbjDUWfu (ORCPT + 99 others); Fri, 21 Apr 2023 18:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233822AbjDUWfr (ORCPT ); Fri, 21 Apr 2023 18:35:47 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47B421FD5 for ; Fri, 21 Apr 2023 15:35:15 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1a6f0d8cdfeso23495125ad.2 for ; Fri, 21 Apr 2023 15:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20221208.gappssmtp.com; s=20221208; t=1682116463; x=1684708463; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WOBbV//TmE5/Vt+YNa7VvWoHjH617/cqrLHE/FuEqvo=; b=28YtcKiMKTyuPMVw5fu/SoweCi0BqDGeWt7RdFQrVk7PAU917keO+0FEYqTQ9/TsLB T1pzM9DhgsBLcc91My2Vu/2jTc0NKv/M54REjAUYDHXH1HKV9Z5I1WFYwId6vQM+JZTT E6n5vpXvzeV5sJVZPomczRMqHlEzbnPY63QdhqjDa6gftGLx/sPZUwv2JfprlGFlZtYf fkSebmqIvZEolZKw757enRENf4URiSoQqdGQEZOuckafZkYiGfcqGHFj/veTqOAh424T Sue6bk+H9d6MxTxRu5J8fCc9HsE6NtJ7Q9mZmdahhGSisRdkO3MgSWcLNMeFOEusAg5H JN3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682116463; x=1684708463; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WOBbV//TmE5/Vt+YNa7VvWoHjH617/cqrLHE/FuEqvo=; b=PU5EWJnZkXiC8EJNGgdJbdQUoB+dmMVR//y7FMolRYlRvJeNOnq5cAuEkYCbaEtUQv jVoB3LLLgB39MRPjdwpCjTAwFxIpdGq1q8koK/O9sdi0pRX6TQPYMXTFP8tG6SUaAQ1m jVBhwHPra8dYlKMsksX5vBXCOp38Bw0pbvdcfcIaPfkbv97KuEN+TwG9YWX9cCQV9DIV kb9n3YMUBKC1HoRy6lLjJSMhliYwYt8VJYJ/o5qW5SEnY5anMm8idBAPfxn5gYIRPSkv wQDf2QBORUzdSezH840t8Zc/nSooTDpcMpGO67uQTjGA9wiA5hOxeW9ETgrCOvYPir4a ISGQ== X-Gm-Message-State: AAQBX9cKzJNelW47dZRkmqmAqVvZO8CDhmWmmXyzLrxnFQ+PFWm2Mhqv 7Sm6Qx5jHOT6m3OwbwSmUgqoz9rrVS+LbQtcx+Q= X-Received: by 2002:a17:902:d4c4:b0:1a6:6fe3:df91 with SMTP id o4-20020a170902d4c400b001a66fe3df91mr7801960plg.50.1682116463609; Fri, 21 Apr 2023 15:34:23 -0700 (PDT) Received: from dread.disaster.area (pa49-180-41-174.pa.nsw.optusnet.com.au. [49.180.41.174]) by smtp.gmail.com with ESMTPSA id v7-20020a1709028d8700b001a6401189a6sm3138777plo.147.2023.04.21.15.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 15:34:23 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1ppzKe-006Dta-Ha; Sat, 22 Apr 2023 08:34:20 +1000 Date: Sat, 22 Apr 2023 08:34:20 +1000 From: Dave Chinner To: Luis Chamberlain Cc: Matthew Wilcox , axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, hch@infradead.org, djwong@kernel.org, minchan@kernel.org, senozhatsky@chromium.org, patches@lists.linux.dev, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, hare@suse.de, p.raghav@samsung.com, da.gomez@samsung.com, kbusch@kernel.org Subject: Re: [PATCH 3/5] iomap: simplify iomap_init() with PAGE_SECTORS Message-ID: <20230421223420.GH3223426@dread.disaster.area> References: <20230421195807.2804512-1-mcgrof@kernel.org> <20230421195807.2804512-4-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Fri, Apr 21, 2023 at 03:02:30PM -0700, Luis Chamberlain wrote: > On Fri, Apr 21, 2023 at 09:14:00PM +0100, Matthew Wilcox wrote: > > On Fri, Apr 21, 2023 at 12:58:05PM -0700, Luis Chamberlain wrote: > > > Just use the PAGE_SECTORS generic define. This produces no functional > > > changes. While at it use left shift to simplify this even further. > > > > How is FOO << 2 simpler than FOO * 4? > > > > > - return bioset_init(&iomap_ioend_bioset, 4 * (PAGE_SIZE / SECTOR_SIZE), > > > + return bioset_init(&iomap_ioend_bioset, PAGE_SECTORS << 2, > > We could just do: > > > - return bioset_init(&iomap_ioend_bioset, 4 * (PAGE_SIZE / SECTOR_SIZE), > + return bioset_init(&iomap_ioend_bioset, 4 * PAGE_SECTORS, Yes, please. > The shift just seemed optimal if we're just going to change it. Nope, it's just premature optimisation at the expense of maintainability. The compiler will optimise the multiplication into shifts if that is the fastest way to do it for the given architecture the code is being compiled to. -Dave. -- Dave Chinner david@fromorbit.com