From: Qian Yingjin <qian@ddn.com>
To: Matthew Wilcox <willy@infradead.org>,
"coolqyj@163.com" <coolqyj@163.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: 回复: [PATCH] mm/filemap: fix page end in filemap_get_read_batch
Date: Thu, 5 Jan 2023 12:11:01 +0000 [thread overview]
Message-ID: <DM6PR19MB29239A437E190C21792AF291CCFA9@DM6PR19MB2923.namprd19.prod.outlook.com> (raw)
In-Reply-To: <Y7WO6YJvBQ1t1AuR@casper.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 2416 bytes --]
Hi Matthew,
Thank you for your quick reply!
I am okey with your modification.
Regards,
Yingjin
________________________________
发件人: Matthew Wilcox <willy@infradead.org>
发送时间: 2023年1月4日 22:36
收件人: coolqyj@163.com <coolqyj@163.com>
抄送: linux-fsdevel@vger.kernel.org <linux-fsdevel@vger.kernel.org>; linux-mm@kvack.org <linux-mm@kvack.org>; stable@vger.kernel.org <stable@vger.kernel.org>; Qian Yingjin <qian@ddn.com>
主题: Re: [PATCH] mm/filemap: fix page end in filemap_get_read_batch
[????????? willy@infradead.org ????????? https://aka.ms/LearnAboutSenderIdentification?????????????]
On Wed, Jan 04, 2023 at 11:21:24AM +0800, coolqyj@163.com wrote:
> From: Qian Yingjin <qian@ddn.com>
>
> I was running traces of the read code against an RAID storage
> system to understand why read requests were being misaligned
> against the underlying RAID strips. I found that the page end
> offset calculation in filemap_get_read_batch() was off by one.
>
> When a read is submitted with end offset 1048575, then it
> calculates the end page for read of 256 when it should be 255.
> "last_index" is the index of the page beyond the end of the read
> and it should be skipped when get a batch of pages for read in
> @filemap_get_read_batch().
>
> The below simple patch fixes the problem. This code was introduced
> in kernel 5.12.
Thanks for diagnosing & sending a patch. However, I'd really prefer
to work in terms of 'max' instead of 'last_index' in that function.
Would this work for you?
+++ b/mm/filemap.c
@@ -2595,13 +2595,13 @@ static int filemap_get_pages(struct kiocb *iocb, struct iov_iter *iter,
if (fatal_signal_pending(current))
return -EINTR;
- filemap_get_read_batch(mapping, index, last_index, fbatch);
+ filemap_get_read_batch(mapping, index, last_index - 1, fbatch);
if (!folio_batch_count(fbatch)) {
if (iocb->ki_flags & IOCB_NOIO)
return -EAGAIN;
page_cache_sync_readahead(mapping, ra, filp, index,
last_index - index);
- filemap_get_read_batch(mapping, index, last_index, fbatch);
+ filemap_get_read_batch(mapping, index, last_index - 1, fbatch);
}
if (!folio_batch_count(fbatch)) {
if (iocb->ki_flags & (IOCB_NOWAIT | IOCB_WAITQ))
[-- Attachment #2: Type: text/html, Size: 5492 bytes --]
prev parent reply other threads:[~2023-01-05 12:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230104032124.72483-1-coolqyj@163.com>
2023-01-04 14:36 ` Matthew Wilcox
2023-01-05 12:11 ` Qian Yingjin [this message]
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=DM6PR19MB29239A437E190C21792AF291CCFA9@DM6PR19MB2923.namprd19.prod.outlook.com \
--to=qian@ddn.com \
--cc=coolqyj@163.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@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