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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7B0CC636C8 for ; Thu, 15 Jul 2021 22:48:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 39783613D2 for ; Thu, 15 Jul 2021 22:48:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39783613D2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4095D8D00F4; Thu, 15 Jul 2021 18:48:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B94A8D00EC; Thu, 15 Jul 2021 18:48:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25AE88D00F4; Thu, 15 Jul 2021 18:48:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id F23228D00EC for ; Thu, 15 Jul 2021 18:48:48 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BCF7B23E4D for ; Thu, 15 Jul 2021 22:48:47 +0000 (UTC) X-FDA: 78366313494.06.1148D57 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP id 45C1EB0001B4 for ; Thu, 15 Jul 2021 22:48:47 +0000 (UTC) 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> Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aUikITyB; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam05 X-Stat-Signature: hksbux36ex8f3fkbduexb1fp8q5iarjb X-Rspamd-Queue-Id: 45C1EB0001B4 X-HE-Tag: 1626389327-185947 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.