linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
To: akpm@linux-foundation.org
Cc: willy@infradead.org, hughd@google.com,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	"Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Subject: [PATCH 0/4] Rework find_get_entries() and find_lock_entries()
Date: Tue, 11 Oct 2022 14:56:30 -0700	[thread overview]
Message-ID: <20221011215634.478330-1-vishal.moola@gmail.com> (raw)

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 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.

The first two 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.

Furthermore, the indices array is almost exclusively used for the
calculations of index mentioned above. Now that those calculations are
no longer occuring, the indices array serves no purpose aside from
tracking the xarray index of a folio which is also no longer needed. 
Each folio already keeps track of its index and can be accessed using
folio->index instead.

The last 2 patches remove the indices arrays from the calling functions:
truncate_inode_pages_range(), invalidate_inode_pages2_range(),
invalidate_mapping_pagevec(), and shmem_undo_range(). 

Vishal Moola (Oracle) (4):
  filemap: find_lock_entries() now updates start offset
  filemap: find_get_entries() now updates start offset
  truncate: Remove indices argument from
    truncate_folio_batch_exceptionals()
  filemap: Remove indices argument from find_lock_entries() and
    find_get_entries()

 mm/filemap.c  | 40 ++++++++++++++++++++++++++++-----------
 mm/internal.h |  8 ++++----
 mm/shmem.c    | 23 +++++++----------------
 mm/truncate.c | 52 +++++++++++++++++++--------------------------------
 4 files changed, 59 insertions(+), 64 deletions(-)

-- 
2.36.1


             reply	other threads:[~2022-10-11 21:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 21:56 Vishal Moola (Oracle) [this message]
2022-10-11 21:56 ` [PATCH 1/4] filemap: find_lock_entries() now updates start offset Vishal Moola (Oracle)
2022-10-12  2:10   ` Matthew Wilcox
2022-10-12 16:02     ` Vishal Moola
2022-10-11 21:56 ` [PATCH 2/4] filemap: find_get_entries() " Vishal Moola (Oracle)
2022-10-11 21:56 ` [PATCH 3/4] truncate: Remove indices argument from truncate_folio_batch_exceptionals() Vishal Moola (Oracle)
2022-10-11 21:56 ` [PATCH 4/4] filemap: Remove indices argument from find_lock_entries() and find_get_entries() Vishal Moola (Oracle)

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=20221011215634.478330-1-vishal.moola@gmail.com \
    --to=vishal.moola@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).