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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, 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 324B5C43462 for ; Mon, 10 May 2021 22:28:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA44E61585 for ; Mon, 10 May 2021 22:27:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA44E61585 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 249996B006E; Mon, 10 May 2021 18:27:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D2F06B0071; Mon, 10 May 2021 18:27:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04BAF6B0072; Mon, 10 May 2021 18:27:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D80A86B006E for ; Mon, 10 May 2021 18:27:58 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7F3EDA2B3 for ; Mon, 10 May 2021 22:27:58 +0000 (UTC) X-FDA: 78126760236.37.C58743C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf09.hostedemail.com (Postfix) with ESMTP id 1E76E60006EF for ; Mon, 10 May 2021 22:27:47 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id E7ADC61581; Mon, 10 May 2021 22:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620685677; bh=ehJYH3TD8ERjQHzpZ5B4TU4ritKItlOc4gX/puyPiYU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nh89huUIIjieij8wReL/BCFHp+mbPvjMEH2Gjj5Ed44hDHUKaUxYpqhU5hFh8cKeO voauboPxP8elC2E4m1kBwQzrHnOyx+zoTbHIuENHzlVUsWVX7XOqAfZ6CFttfZXVee vTwIkXmHGTp5WsJ3ONqiouXTAqlWbJY4L1mmwZZ268aDIFwHfAs4HiJ3jxUX3JK9wG MC6hyuYrJl85kPCXvn3qvgCcnOIUl2CYEAgaCChI4muom9s4DZZngLRpJtzJ4dzLjL oyh+MoVTv95I7icIyUoVxketYfeITOfJlmVBX/4I+Nxvv1nUelGtpZ6gi6iRDZDAnE 8L+fPCiAs8aFg== Date: Mon, 10 May 2021 15:27:56 -0700 From: "Darrick J. Wong" To: "Matthew Wilcox (Oracle)" Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH] mm/filemap: Fix readahead return types Message-ID: <20210510222756.GI8582@magnolia> References: <20210510201201.1558972-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210510201201.1558972-1-willy@infradead.org> Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=nh89huUI; spf=pass (imf09.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: rspam01 X-Rspamd-Queue-Id: 1E76E60006EF X-Stat-Signature: b3rqthyiqi9drfghw99tqmhknjjqydxr Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620685667-676100 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 Mon, May 10, 2021 at 09:12:01PM +0100, Matthew Wilcox (Oracle) wrote: > A readahead request will not allocate more memory than can be represented > by a size_t, even on systems that have HIGHMEM available. Change the > length functions from returning an loff_t to a size_t. > > Signed-off-by: Matthew Wilcox (Oracle) Looks reasonable to me; is this a 5.13 bugfix or just something that doesn't look right (i.e. save it for 5.14)? Reviewed-by: Darrick J. Wong --D > --- > fs/iomap/buffered-io.c | 4 ++-- > include/linux/pagemap.h | 6 +++--- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index f2cd2034a87b..9023717c5188 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -394,7 +394,7 @@ void iomap_readahead(struct readahead_control *rac, const struct iomap_ops *ops) > { > struct inode *inode = rac->mapping->host; > loff_t pos = readahead_pos(rac); > - loff_t length = readahead_length(rac); > + size_t length = readahead_length(rac); > struct iomap_readpage_ctx ctx = { > .rac = rac, > }; > @@ -402,7 +402,7 @@ void iomap_readahead(struct readahead_control *rac, const struct iomap_ops *ops) > trace_iomap_readahead(inode, readahead_count(rac)); > > while (length > 0) { > - loff_t ret = iomap_apply(inode, pos, length, 0, ops, > + ssize_t ret = iomap_apply(inode, pos, length, 0, ops, > &ctx, iomap_readahead_actor); > if (ret <= 0) { > WARN_ON_ONCE(ret == 0); > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h > index a4bd41128bf3..e89df447fae3 100644 > --- a/include/linux/pagemap.h > +++ b/include/linux/pagemap.h > @@ -997,9 +997,9 @@ static inline loff_t readahead_pos(struct readahead_control *rac) > * readahead_length - The number of bytes in this readahead request. > * @rac: The readahead request. > */ > -static inline loff_t readahead_length(struct readahead_control *rac) > +static inline size_t readahead_length(struct readahead_control *rac) > { > - return (loff_t)rac->_nr_pages * PAGE_SIZE; > + return rac->_nr_pages * PAGE_SIZE; > } > > /** > @@ -1024,7 +1024,7 @@ static inline unsigned int readahead_count(struct readahead_control *rac) > * readahead_batch_length - The number of bytes in the current batch. > * @rac: The readahead request. > */ > -static inline loff_t readahead_batch_length(struct readahead_control *rac) > +static inline size_t readahead_batch_length(struct readahead_control *rac) > { > return rac->_batch_count * PAGE_SIZE; > } > -- > 2.30.2 >