mm-filemap-fix-page-end-in-filemap_get_read_batch.patch removed from -mm tree
The quilt patch titled
Subject: mm/filemap: fix page end in filemap_get_read_batch
has been removed from the -mm tree. Its filename was
mm-filemap-fix-page-end-in-filemap_get_read_batch.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Qian Yingjin <[email protected]>
Subject: mm/filemap: fix page end in filemap_get_read_batch
Date: Wed, 8 Feb 2023 10:24:00 +0800
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.
---
mm/filemap.c renamed from mm/filemap.c~mm-filemap-fix-page-end-in-filemap_get_read_batch +3 -2
@@ -2588,18 +2588,19 @@ static int filemap_get_pages(struct kiocstruct folio *folio;int err =0 ; +/* "last_index" is the index of the page beyond the end of the read */ last_index =DIV_ROUND_UP (iocb->ki_pos + iter->count,PAGE_SIZE ); retry: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 ))
_
Patches currently in -mm which might be from [email protected] are