History

mm/migrate.c: cleanup expected_page_refs()

Andrea has noted that page migration code propagates page_mapping(page) through the whole migration stack down to migrate_page() function so it seems stupid to then use page_mapping(page) in expected_page_refs() instead of passed down 'mapping' argument. I agree so let's make expected_page_refs() more in line with the rest of the migration stack.

Jan Kara committed 7 years ago

Commit f9004821 parent a862f681 file · +4 −4Browse files

Unified · Split

mm/migrate.c+4−4
@@ -374,7 +374,7 @@ unlock: · 373 unmodified lines
374374 }
375375 #endif
376376
377−static int expected_page_refs(struct page *page)
377+static int expected_page_refs(struct address_space *mapping, struct page *page)
378378 {
379379 int expected_count = 1;
380380
@@ -384,7 +384,7 @@ static int expected_page_refs(struct page *page) · 3 unmodified lines
384384 */
385385 expected_count += is_device_private_page(page);
386386 expected_count += is_device_public_page(page);
387− if (page_mapping(page))
387+ if (mapping)
388388 expected_count += hpage_nr_pages(page) + page_has_private(page);
389389
390390 return expected_count;
@@ -405,7 +405,7 @@ int migrate_page_move_mapping(struct address_space *mapping, · 14 unmodified lines
405405 XA_STATE(xas, &mapping->i_pages, page_index(page));
406406 struct zone *oldzone, *newzone;
407407 int dirty;
408− int expected_count = expected_page_refs(page) + extra_count;
408+ int expected_count = expected_page_refs(mapping, page) + extra_count;
409409
410410 if (!mapping) {
411411 /* Anonymous page without mapping */
@@ -750,7 +750,7 @@ static int __buffer_migrate_page(struct address_space *mapping, · 338 unmodified lines
750750 return migrate_page(mapping, newpage, page, mode);
751751
752752 /* Check whether page does not have extra refs before we do more work */
753− expected_count = expected_page_refs(page);
753+ expected_count = expected_page_refs(mapping, page);
754754 if (page_count(page) != expected_count)
755755 return -EAGAIN;
756756

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t