lkml.org 
[lkml]   [2006]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 03/28] mm: introduce probe_page()
Introduce a pair of functions to probe the existence of file page.
- int __probe_page(mapping, offset)
- int probe_page(mapping, offset)

Signed-off-by: Wu Fengguang <wfg@mail.ustc.edu.cn>
Signed-off-by: Andrew Morton <akpm@osdl.org>
--- linux-2.6.19-rc4-mm1.orig/include/linux/pagemap.h
+++ linux-2.6.19-rc4-mm1/include/linux/pagemap.h
@@ -72,6 +72,8 @@ static inline struct page *page_cache_al

typedef int filler_t(void *, struct page *);

+extern int __probe_page(struct address_space *mapping, pgoff_t offset);
+extern int probe_page(struct address_space *mapping, pgoff_t offset);
extern struct page * find_get_page(struct address_space *mapping,
unsigned long index);
extern struct page * find_lock_page(struct address_space *mapping,
--- linux-2.6.19-rc4-mm1.orig/mm/filemap.c
+++ linux-2.6.19-rc4-mm1/mm/filemap.c
@@ -613,6 +613,29 @@ void fastcall __lock_page_nosync(struct
TASK_UNINTERRUPTIBLE);
}

+/*
+ * Probing page existence.
+ */
+int __probe_page(struct address_space *mapping, pgoff_t offset)
+{
+ return !!radix_tree_lookup(&mapping->page_tree, offset);
+}
+
+/*
+ * Here we just do not bother to grab the page, it's meaningless anyway.
+ */
+int probe_page(struct address_space *mapping, pgoff_t offset)
+{
+ int exists;
+
+ read_lock_irq(&mapping->tree_lock);
+ exists = __probe_page(mapping, offset);
+ read_unlock_irq(&mapping->tree_lock);
+
+ return exists;
+}
+EXPORT_SYMBOL(probe_page);
+
/**
* find_get_page - find and get a page reference
* @mapping: the address_space to search
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-15 08:53    [W:0.099 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site