linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Rework find_get_entries() and find_lock_entries()
@ 2022-10-13 22:57 Vishal Moola (Oracle)
  2022-10-13 22:57 ` [PATCH v2 1/2] filemap: find_lock_entries() now updates start offset Vishal Moola (Oracle)
  2022-10-13 22:57 ` [PATCH v2 2/2] filemap: find_get_entries() " Vishal Moola (Oracle)
  0 siblings, 2 replies; 4+ messages in thread
From: Vishal Moola (Oracle) @ 2022-10-13 22:57 UTC (permalink / raw)
  To: akpm
  Cc: willy, hughd, linux-fsdevel, linux-mm, linux-kernel,
	Vishal Moola (Oracle)

Originally the callers of find_get_entries() and find_lock_entries()
were keeping track of the start index themselves as
they traverse the search range.

This resulted in hacky code such as in shmem_undo_range():

			index = folio->index + folio_nr_pages(folio) - 1;

where the - 1 is only present to stay in the right spot after
incrementing index later. This sort of calculation was also being done
on every folio despite not even using index later within that function.

These patches change find_get_entries() and find_lock_entries() to calculate
the new index instead of leaving it to the callers so we can avoid all
these complications.

---
v2:
  Fixed an issue when handling shadow entries
  Dropped patches removing the indices array; it is required for value
entries

Vishal Moola (Oracle) (2):
  filemap: find_lock_entries() now updates start offset
  filemap: find_get_entries() now updates start offset

 mm/filemap.c  | 32 +++++++++++++++++++++++++-------
 mm/internal.h |  4 ++--
 mm/shmem.c    | 19 ++++++-------------
 mm/truncate.c | 30 ++++++++++--------------------
 4 files changed, 43 insertions(+), 42 deletions(-)

-- 
2.36.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-14  3:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-13 22:57 [PATCH v2 0/2] Rework find_get_entries() and find_lock_entries() Vishal Moola (Oracle)
2022-10-13 22:57 ` [PATCH v2 1/2] filemap: find_lock_entries() now updates start offset Vishal Moola (Oracle)
2022-10-14  3:24   ` Matthew Wilcox
2022-10-13 22:57 ` [PATCH v2 2/2] filemap: find_get_entries() " Vishal Moola (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).