]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/fscache.h
Merge tag 'for-linus-20130929' of git://github.com/sctscore/official-linux
[karo-tx-linux.git] / include / linux / fscache.h
index d984aff32a117476cadb10286e9cd31fb0bea94b..19b46458e4e88e3e25e55692a00ace4987897441 100644 (file)
@@ -209,6 +209,8 @@ extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
                                         gfp_t);
 extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
                                              struct inode *);
+extern void __fscache_readpages_cancel(struct fscache_cookie *cookie,
+                                      struct list_head *pages);
 
 /**
  * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -589,6 +591,26 @@ int fscache_alloc_page(struct fscache_cookie *cookie,
                return -ENOBUFS;
 }
 
+/**
+ * fscache_readpages_cancel - Cancel read/alloc on pages
+ * @cookie: The cookie representing the inode's cache object.
+ * @pages: The netfs pages that we canceled write on in readpages()
+ *
+ * Uncache/unreserve the pages reserved earlier in readpages() via
+ * fscache_readpages_or_alloc() and similar.  In most successful caches in
+ * readpages() this doesn't do anything.  In cases when the underlying netfs's
+ * readahead failed we need to clean up the pagelist (unmark and uncache).
+ *
+ * This function may sleep as it may have to clean up disk state.
+ */
+static inline
+void fscache_readpages_cancel(struct fscache_cookie *cookie,
+                             struct list_head *pages)
+{
+       if (fscache_cookie_valid(cookie))
+               __fscache_readpages_cancel(cookie, pages);
+}
+
 /**
  * fscache_write_page - Request storage of a page in the cache
  * @cookie: The cookie representing the cache object