mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 04:45:43 +01:00
mm: mincore: refactor mincore_page()
Use early returns to reduce indentation and improve readability. Link: https://lore.kernel.org/[email protected] Signed-off-by: Kefeng Wang <[email protected]> Acked-by: David Hildenbrand (Arm) <[email protected]> Cc: Jann Horn <[email protected]> Cc: Liam R. Howlett <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Pedro Falcato <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
1 parent
751a1f061a
commit
557f842e25
1 file changed
+10
-11
+10
-11
@@ -93,7 +93,7 @@ static unsigned char mincore_swap(swp_entry_t entry, bool shmem)
|
||||
*/
|
||||
static unsigned char mincore_page(struct address_space *mapping, pgoff_t index)
|
||||
{
|
||||
unsigned char present = 0;
|
||||
unsigned char present;
|
||||
struct folio *folio;
|
||||
|
||||
/*
|
||||
@@ -103,17 +103,16 @@ static unsigned char mincore_page(struct address_space *mapping, pgoff_t index)
|
||||
* tmpfs's .fault). So swapped out tmpfs mappings are tested here.
|
||||
*/
|
||||
folio = filemap_get_entry(mapping, index);
|
||||
if (folio) {
|
||||
if (xa_is_value(folio)) {
|
||||
if (shmem_mapping(mapping))
|
||||
return mincore_swap(radix_to_swp_entry(folio),
|
||||
true);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
present = folio_test_uptodate(folio);
|
||||
folio_put(folio);
|
||||
if (!folio)
|
||||
return 0;
|
||||
|
||||
if (xa_is_value(folio)) {
|
||||
if (!shmem_mapping(mapping))
|
||||
return 0;
|
||||
return mincore_swap(radix_to_swp_entry(folio), true);
|
||||
}
|
||||
present = folio_test_uptodate(folio);
|
||||
folio_put(folio);
|
||||
|
||||
return present;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user