|
@@ -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
|