Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp769354pxv; Thu, 15 Jul 2021 15:49:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytZjiiI7tEr6MtF1cggtsttyiExbYBSbXPWUO4xTgRmO+YVMwLoqdArpE8cDAcLgrZKTaX X-Received: by 2002:a05:6602:140e:: with SMTP id t14mr4979635iov.42.1626389364047; Thu, 15 Jul 2021 15:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626389364; cv=none; d=google.com; s=arc-20160816; b=CkWMZO2QiElh/8Ci9lF2Vd7K11DXpZ88Kew2AkWDUWP/TMuM6HdxPytP96Sgu5XAVf 2i1umaQHMZ3ZvMRn86r23y3FvXusP2ovrimQvOChwVmDVVvW9NKmIRauHkfGakgHJ+9w 7cj9IfM5jW7Do5wAwL5Hf00zhLJqa4OChvg7QAgQVClc06g9IJ+vpqblGXrGFwI2nBuC u81+7B2v07fKzuHVJtPlvc7ZZYcZUOySMgsI7BCBqvDT9Xcz0UBDjk97UDF5ev+RuXQs 4rz6GTFvihCv1yYVX5qo6tL2pVBveAxq5d7o3oRfU8rkM8DIpYYTU6K7MrS+x1u0H+0G o15Q== 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=4qnSrdZ/w1EUw3zlkvJMz7MVun67Nfs0vsvhY9+UfNI=; b=NcaCEVfHyaBo7E68qJk/yNEw/XUAgsP6Vw+0sF98EHhf53I2cJuI+pKOlGUupQ1Avs YaD+GxLKphtv2A26GaFWtloq57G3Khh5Mu1ScyXkliQirbzCZ3OP0JrRSn5R7+isAxhF oIv3XhW93EcHyRAsMXNEW3rOVVbxBtDi9ymvH/D709tYhPAaL7oF5pwht7Dc+ZEWKtq6 qzcZ6nWzPqoULlVY/RptUIot4BQV8l3CFiYd1ZQUAHpRrfkHhZ+r49oULVbESysUYvFT N9krggUb9/wLbnTEcKF4yXcRW+OirO0W+ax72g9PJXE5F5pvcT+R+ycxg/KL4jGfpXwF L7dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=aUikITyB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si7933434ilr.103.2021.07.15.15.49.10; Thu, 15 Jul 2021 15:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=aUikITyB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbhGOWvb (ORCPT + 99 others); Thu, 15 Jul 2021 18:51:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbhGOWva (ORCPT ); Thu, 15 Jul 2021 18:51:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6390C06175F; Thu, 15 Jul 2021 15:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4qnSrdZ/w1EUw3zlkvJMz7MVun67Nfs0vsvhY9+UfNI=; b=aUikITyByImuKlueFD/xvuB2jf vRl67XKzSCrw+VgQRCOVNNHC7AShTiw1eMjI2XVUg7cAKuglCLo/fFFjP+JJ8BLDE/YbBybXIOSuo Uh2YL4Vz8C8a/6NCHrMQFbwChE1lA5+Su+cEpHHT4e4usjB2cFslFNUW9d7izazTOX4L72EvNag+X dKd6Lxnh8p27bmSFkHnt8LI+5iIKOgKuj7bDhELu06GPOkARzeOzV16BdNGD/9bkcPPpiasN/nAHn nyYrGj7UMBC0INae5MEOjwOzg2Wng0EcgrrH1B4lSON7rNrEnKa4RiJPfQXNqq4IPueaf39kWcoXo t5AI+gvg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m4A9A-003wr7-5o; Thu, 15 Jul 2021 22:48:10 +0000 Date: Thu, 15 Jul 2021 23:48:00 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v14 098/138] iomap: Use folio offsets instead of page offsets Message-ID: References: <20210715033704.692967-1-willy@infradead.org> <20210715033704.692967-99-willy@infradead.org> <20210715212657.GI22357@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715212657.GI22357@magnolia> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 02:26:57PM -0700, Darrick J. Wong wrote: > > + size_t poff = offset_in_folio(folio, *pos); > > + size_t plen = min_t(loff_t, folio_size(folio) - poff, length); > > I'm confused about 'size_t poff' here vs. 'unsigned end' later -- why do > we need a 64-bit quantity for poff? I suppose some day we might want to > have folios larger than 4GB or so, but so far we don't need that large > of a byte offset within a page/folio, right? > > Or are you merely moving the codebase towards using size_t for all byte > offsets? Both. 'end' isn't a byte count -- it's a block count. > > if (orig_pos <= isize && orig_pos + length > isize) { > > - unsigned end = offset_in_page(isize - 1) >> block_bits; > > + unsigned end = offset_in_folio(folio, isize - 1) >> block_bits; That right shift makes it not-a-byte-count. I don't especially want to do all the work needed to support folios >2GB, but I do like using size_t to represent a byte count.