aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-01-22 12:09:47 -0500
committerMister Oyster <oysterized@gmail.com>2017-05-27 19:39:48 +0200
commit427d2c964d5a609647350a1c3eed6cadf1d53e53 (patch)
tree6fc87f7e28e87ed7239c84e9cf8b76ce4e0fa337
parent244ce5462adda80c97a9b3f4c055fffca5c71276 (diff)
mm: add find_get_page_flags() for 3.18 ext4 backport
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--include/linux/pagemap.h14
-rw-r--r--mm/filemap.c5
2 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 810267983..3b3b58a30 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -243,8 +243,18 @@ static inline struct page *page_cache_alloc_readahead(struct address_space *x)
typedef int filler_t(void *, struct page *);
-extern struct page * find_get_page(struct address_space *mapping,
- pgoff_t index);
+extern struct page * find_get_page_flags(struct address_space *mapping,
+ pgoff_t index, int fgp_flags);
+
+#define FGP_ACCESSED 0x00000001
+
+static inline struct page* find_get_page(struct address_space *mapping,
+ pgoff_t index)
+{
+ return find_get_page_flags(mapping, index, 0);
+}
+
+
extern struct page * find_lock_page(struct address_space *mapping,
pgoff_t index);
extern struct page * find_or_create_page(struct address_space *mapping,
diff --git a/mm/filemap.c b/mm/filemap.c
index 977b53167..b50d511c1 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -716,7 +716,8 @@ int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
* Is there a pagecache struct page at the given (mapping, offset) tuple?
* If yes, increment its refcount and return it; if no, return NULL.
*/
-struct page *find_get_page(struct address_space *mapping, pgoff_t offset)
+struct page *find_get_page_flags(struct address_space *mapping, pgoff_t offset,
+ int fgp_flags)
{
void **pagep;
struct page *page;
@@ -753,6 +754,8 @@ repeat:
}
}
out:
+ if (page && (fgp_flags & FGP_ACCESSED))
+ mark_page_accessed(page);
rcu_read_unlock();
return page;