linux-mm.kvack.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 3/4] truncate: Remove indices argument from truncate_folio_batch_exceptionals()
Date: Tue, 11 Oct 2022 14:56:33 -0700	[thread overview]
Message-ID: <20221011215634.478330-4-vishal.moola@gmail.com> (raw)
In-Reply-To: <20221011215634.478330-1-vishal.moola@gmail.com>

The indices array is unnecessary. Folios keep track of their xarray indices
in the folio->index field which can simply be accessed as needed.

This change is in preparation for the removal of the indices arguments of
find_get_entries() and find_lock_entries().

Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
 mm/truncate.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/mm/truncate.c b/mm/truncate.c
index 846ddbdb27a4..4e63d885498a 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -58,7 +58,7 @@ static void clear_shadow_entry(struct address_space *mapping, pgoff_t index,
  * exceptional entries similar to what folio_batch_remove_exceptionals() does.
  */
 static void truncate_folio_batch_exceptionals(struct address_space *mapping,
-				struct folio_batch *fbatch, pgoff_t *indices)
+				struct folio_batch *fbatch)
 {
 	int i, j;
 	bool dax;
@@ -82,7 +82,6 @@ static void truncate_folio_batch_exceptionals(struct address_space *mapping,
 
 	for (i = j; i < folio_batch_count(fbatch); i++) {
 		struct folio *folio = fbatch->folios[i];
-		pgoff_t index = indices[i];
 
 		if (!xa_is_value(folio)) {
 			fbatch->folios[j++] = folio;
@@ -90,11 +89,11 @@ static void truncate_folio_batch_exceptionals(struct address_space *mapping,
 		}
 
 		if (unlikely(dax)) {
-			dax_delete_mapping_entry(mapping, index);
+			dax_delete_mapping_entry(mapping, folio->index);
 			continue;
 		}
 
-		__clear_shadow_entry(mapping, index, folio);
+		__clear_shadow_entry(mapping, folio->index, folio);
 	}
 
 	if (!dax) {
@@ -363,7 +362,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
 	index = start;
 	while (index < end && find_lock_entries(mapping, &index, end - 1,
 			&fbatch, indices)) {
-		truncate_folio_batch_exceptionals(mapping, &fbatch, indices);
+		truncate_folio_batch_exceptionals(mapping, &fbatch);
 		for (i = 0; i < folio_batch_count(&fbatch); i++)
 			truncate_cleanup_folio(fbatch.folios[i]);
 		delete_from_page_cache_batch(mapping, &fbatch);
@@ -424,7 +423,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
 			truncate_inode_folio(mapping, folio);
 			folio_unlock(folio);
 		}
-		truncate_folio_batch_exceptionals(mapping, &fbatch, indices);
+		truncate_folio_batch_exceptionals(mapping, &fbatch);
 		folio_batch_release(&fbatch);
 	}
 }
-- 
2.36.1



  parent 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 [PATCH 0/4] Rework find_get_entries() and find_lock_entries() Vishal Moola (Oracle)
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 ` Vishal Moola (Oracle) [this message]
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-4-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