Whamcloud - gitweb
LU-339 use new aops for kernel >= RHEL5.4
[fs/lustre-release.git] / lustre / llite / rw26.c
index 25ade0e..aba93e5 100644 (file)
@@ -472,7 +472,7 @@ out:
         RETURN(tot_bytes ? : result);
 }
 
-#ifdef HAVE_KERNEL_WRITE_BEGIN_END
+#if defined(HAVE_KERNEL_WRITE_BEGIN_END) || defined(MS_HAS_NEW_AOPS)
 static int ll_write_begin(struct file *file, struct address_space *mapping,
                          loff_t pos, unsigned len, unsigned flags,
                          struct page **pagep, void **fsdata)
@@ -520,6 +520,7 @@ int ll_migratepage(struct address_space *mapping,
 }
 #endif
 
+#ifndef MS_HAS_NEW_AOPS
 struct address_space_operations ll_aops = {
         .readpage       = ll_readpage,
 //        .readpages      = ll_readpages,
@@ -542,3 +543,24 @@ struct address_space_operations ll_aops = {
 #endif
         .bmap           = NULL
 };
+#else
+struct address_space_operations_ext ll_aops = {
+        .orig_aops.readpage       = ll_readpage,
+//        .orig_aops.readpages      = ll_readpages,
+        .orig_aops.direct_IO      = ll_direct_IO_26,
+        .orig_aops.writepage      = ll_writepage,
+        .orig_aops.writepages     = generic_writepages,
+        .orig_aops.set_page_dirty = ll_set_page_dirty,
+        .orig_aops.sync_page      = NULL,
+        .orig_aops.prepare_write  = ll_prepare_write,
+        .orig_aops.commit_write   = ll_commit_write,
+        .orig_aops.invalidatepage = ll_invalidatepage,
+        .orig_aops.releasepage    = ll_releasepage,
+#ifdef CONFIG_MIGRATION
+        .orig_aops.migratepage    = ll_migratepage,
+#endif
+        .orig_aops.bmap           = NULL,
+        .write_begin    = ll_write_begin,
+        .write_end      = ll_write_end
+};
+#endif