])
#
+# 3.11 invalidatepage requires the length of the range to invalidate
+#
+AC_DEFUN([LC_INVALIDATE_RANGE],
+[AC_MSG_CHECKING([if address_space_operations.invalidatepage requires 3 arguments])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct address_space_operations a_ops;
+
+ a_ops.invalidatepage(NULL,0,0);
+],[
+ AC_DEFINE(HAVE_INVALIDATE_RANGE, 1, [address_space_operations.invalidatepage needs 3 arguments])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# 3.11 readdir now takes the new struct dir_context
#
AC_DEFUN([LC_HAVE_DIR_CONTEXT],
LC_BLKDEV_RELEASE_RETURN_INT
# 3.11
+ LC_INVALIDATE_RANGE
LC_HAVE_DIR_CONTEXT
LC_D_COMPARE_5ARGS
LC_HAVE_DCOUNT
static inline void
truncate_complete_page(struct address_space *mapping, struct page *page)
{
- if (page->mapping != mapping)
- return;
+ if (page->mapping != mapping)
+ return;
- if (PagePrivate(page))
- page->mapping->a_ops->invalidatepage(page, 0);
-
- cancel_dirty_page(page, PAGE_SIZE);
- ClearPageMappedToDisk(page);
- ll_delete_from_page_cache(page);
+ if (PagePrivate(page))
+#ifdef HAVE_INVALIDATE_RANGE
+ page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE);
+#else
+ page->mapping->a_ops->invalidatepage(page, 0);
+#endif
+ cancel_dirty_page(page, PAGE_SIZE);
+ ClearPageMappedToDisk(page);
+ ll_delete_from_page_cache(page);
}
#endif /* !HAVE_TRUNCATE_COMPLETE_PAGE */
* aligned truncate). Lustre leaves partially truncated page in the cache,
* relying on struct inode::i_size to limit further accesses.
*/
-static void ll_invalidatepage(struct page *vmpage, unsigned long offset)
+static void ll_invalidatepage(struct page *vmpage,
+#ifdef HAVE_INVALIDATE_RANGE
+ unsigned int offset, unsigned int length
+#else
+ unsigned long offset
+#endif
+ )
{
struct inode *inode;
struct lu_env *env;
LASSERT(PageLocked(vmpage));
LASSERT(!PageWriteback(vmpage));
- /*
- * It is safe to not check anything in invalidatepage/releasepage
- * below because they are run with page locked and all our io is
- * happening with locked page too
- */
- if (offset == 0) {
+ /*
+ * It is safe to not check anything in invalidatepage/releasepage
+ * below because they are run with page locked and all our io is
+ * happening with locked page too
+ */
+#ifdef HAVE_INVALIDATE_RANGE
+ if (offset == 0 && length == PAGE_CACHE_SIZE) {
+#else
+ if (offset == 0) {
+#endif
env = cl_env_get(&refcheck);
if (!IS_ERR(env)) {
inode = vmpage->mapping->host;