aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2009-09-21 20:02:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:38 -0400
commitedcf4748cd56adcdf0856cc99ef108a4ea3ac7fe (patch)
tree317d477d08dea82f5eef2e9c17294d0f0639ea81
parent6c0b13519d1c755d874e82c8fb8a6dcef0ee402c (diff)
mm: return boolean from page_has_private()
Make page_has_private() return a true boolean value and remove the double negations from the two callsites using it for arithmetic. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Christoph Lameter <cl@linux-foundation.org> Reviewed-by: Christoph Lameter <cl@linux-foundation.org> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/page-flags.h13
-rw-r--r--mm/migrate.c2
-rw-r--r--mm/vmscan.c2
3 files changed, 10 insertions, 7 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d07c0bb2203a..13de789f0a5c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -402,8 +402,8 @@ static inline void __ClearPageTail(struct page *page)
402 */ 402 */
403#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 403#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
404 404
405#endif /* !__GENERATING_BOUNDS_H */ 405#define PAGE_FLAGS_PRIVATE \
406 406 (1 << PG_private | 1 << PG_private_2)
407/** 407/**
408 * page_has_private - Determine if page has private stuff 408 * page_has_private - Determine if page has private stuff
409 * @page: The page to be checked 409 * @page: The page to be checked
@@ -411,8 +411,11 @@ static inline void __ClearPageTail(struct page *page)
411 * Determine if a page has private stuff, indicating that release routines 411 * Determine if a page has private stuff, indicating that release routines
412 * should be invoked upon it. 412 * should be invoked upon it.
413 */ 413 */
414#define page_has_private(page) \ 414static inline int page_has_private(struct page *page)
415 ((page)->flags & ((1 << PG_private) | \ 415{
416 (1 << PG_private_2))) 416 return !!(page->flags & PAGE_FLAGS_PRIVATE);
417}
418
419#endif /* !__GENERATING_BOUNDS_H */
417 420
418#endif /* PAGE_FLAGS_H */ 421#endif /* PAGE_FLAGS_H */
diff --git a/mm/migrate.c b/mm/migrate.c
index e97e513fe898..16052e80aaac 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -272,7 +272,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
272 pslot = radix_tree_lookup_slot(&mapping->page_tree, 272 pslot = radix_tree_lookup_slot(&mapping->page_tree,
273 page_index(page)); 273 page_index(page));
274 274
275 expected_count = 2 + !!page_has_private(page); 275 expected_count = 2 + page_has_private(page);
276 if (page_count(page) != expected_count || 276 if (page_count(page) != expected_count ||
277 (struct page *)radix_tree_deref_slot(pslot) != page) { 277 (struct page *)radix_tree_deref_slot(pslot) != page) {
278 spin_unlock_irq(&mapping->tree_lock); 278 spin_unlock_irq(&mapping->tree_lock);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 172119caebcc..f5b5f029288c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -286,7 +286,7 @@ static inline int page_mapping_inuse(struct page *page)
286 286
287static inline int is_page_cache_freeable(struct page *page) 287static inline int is_page_cache_freeable(struct page *page)
288{ 288{
289 return page_count(page) - !!page_has_private(page) == 2; 289 return page_count(page) - page_has_private(page) == 2;
290} 290}
291 291
292static int may_write_to_queue(struct backing_dev_info *bdi) 292static int may_write_to_queue(struct backing_dev_info *bdi)