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=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 8C488C636C8 for ; Thu, 15 Jul 2021 22:55:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3116F613AF for ; Thu, 15 Jul 2021 22:55:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3116F613AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 86CF38D00F4; Thu, 15 Jul 2021 18:55:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81D118D00EC; Thu, 15 Jul 2021 18:55:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BD4D8D00F4; Thu, 15 Jul 2021 18:55:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 447528D00EC for ; Thu, 15 Jul 2021 18:55:44 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8D7331854E for ; Thu, 15 Jul 2021 22:55:41 +0000 (UTC) X-FDA: 78366330882.35.A831C55 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP id 30E671004E74 for ; Thu, 15 Jul 2021 22:55:41 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 4976E613AF; Thu, 15 Jul 2021 22:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626389740; bh=P9uyzQH7V/Vu5iTQd3DZbraQ8Ej5+Fm7bfjvma3F+c4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n2jY8kpWCk9OuIFpx7Sbt4ugXyih8DxDDZo9X87C+6a6klH0p3PEjKLEhlpNsihmv dIVA1Sx5t2FNXUM5+lTvl+3ZqN48p7pvqjA0EsBTnRytiZ6qbfW+8KCW81SijAsRrY riWkplRp/TzC32evC0K1O7aaDw2BL2B792GvYA/VhmhJP+CxtQqNtLsq5VhOxji6gr E12NqYxl1ujJN1J+M/RJOQaOhexuFlBWuVfIpEiYxPUqgsXH9I4KSMTUjQph9xZTJD ppzOrtguGGUm96LDyB0+E4zoJgNCzQgPw9GF1eC35VuySBJfCyMkcMZ8ktdO6osWUM LYtqCC0m/qhJw== Date: Thu, 15 Jul 2021 15:55:39 -0700 From: "Darrick J. Wong" To: Matthew Wilcox 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: <20210715225539.GX22357@magnolia> 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: Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=n2jY8kpW; spf=pass (imf07.hostedemail.com: domain of djwong@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam02 X-Stat-Signature: ux9k6so5mqhb4rriy1feptkopg8zbr5o X-Rspamd-Queue-Id: 30E671004E74 X-HE-Tag: 1626389741-257805 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 11:48:00PM +0100, Matthew Wilcox wrote: > 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. DOH. Yes, I just noticed that. TBH I doubt anyone's really going to care about 4GB folios anyway. Reviewed-by: Darrick J. Wong --D