From: "Darrick J. Wong" <djwong@kernel.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
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
Date: Mon, 10 May 2021 15:27:56 -0700 [thread overview]
Message-ID: <20210510222756.GI8582@magnolia> (raw)
In-Reply-To: <20210510201201.1558972-1-willy@infradead.org>
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) <willy@infradead.org>
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 <djwong@kernel.org>
--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
>
next prev parent reply other threads:[~2021-05-10 22:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 20:12 Matthew Wilcox (Oracle)
2021-05-10 22:27 ` Darrick J. Wong [this message]
2021-05-10 23:17 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210510222756.GI8582@magnolia \
--to=djwong@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox