]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/filemap.c: fix the timing of asignment of prev_pos
authorGuixin Liu <kanie@linux.alibaba.com>
Wed, 17 Aug 2022 13:51:57 +0000 (21:51 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 17 Aug 2022 20:58:03 +0000 (13:58 -0700)
commitc5a289f2ba1dae3ecd8bfd3ceeafe22e314a790a
treea2f7d00230709179ab6fb247d99f5ef3c7cd3e42
parent0a421413aca7adfa7cc8a31b8a1b04c1ff29787f
mm/filemap.c: fix the timing of asignment of prev_pos

When I`m running repetitive 4k read io which has same offset, I find that
access to folio_mark_accessed is inevitable in the read process, the
reason is that the prev_pos is assigned after the iocb->ki_pos is
incremented, so that the prev_pos is always not equal to the position
currently visited.

The prev_pos should be assigned before the iocb->ki_pos is incremented, so
that the prev_pos is the exact location of the last visit.

Link: https://lkml.kernel.org/r/1660744317-8183-1-git-send-email-kanie@linux.alibaba.com
Fixes: 06c0444290cec ("mm/filemap.c: generic_file_buffered_read() now uses find_get_pages_contig")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/filemap.c