Skip to contentSkip to conversation

remove the redundant code

PATCH New Huang Shijie 1 participant 1 message Nov 30, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove the redundant code

The check code for CONFIG_SWAP is redundant, because there is a non-CONFIG_SWAP version for PageSwapCache() which just returns 0.

So the check code here is confusing when people see the code in page-flags.h.

---
 include/linux/mm.h |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
include/linux/mm.h +1 -4
index 24c3956..a85ed43 100644
@@ -634,12 +634,9 @@ static inline struct address_space *page_mapping(struct page *page)
 	struct address_space *mapping = page->mapping;
 
 	VM_BUG_ON(PageSlab(page));
-#ifdef CONFIG_SWAP
 	if (unlikely(PageSwapCache(page)))
 		mapping = &swapper_space;
-	else
-#endif
-	if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
+	else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
 		mapping = NULL;
 	return mapping;
 }
Signature · 7 lines
1.6.0.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>