[OpenAFS] Re: openafs and linux 2.6.19-rc1 [patch]

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Fri, 06 Oct 2006 09:02:44 -0400


In message <871wpmf7mp.fsf@sycorax.lbl.gov>,Alex Romosan writes:
>sorry to follow up on my own post, but the above patch works only for
>reads. for writes one also needs to add
>
>  .aio_write = generic_file_aio_write,
>
>below .aio_read above.

it needs configure tests for those of us with antique 2.6.18 kernels.
try this:

Index: src/afs/LINUX/osi_vfsops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v
retrieving revision 1.29.2.17
diff -u -u -r1.29.2.17 osi_vfsops.c
--- src/afs/LINUX/osi_vfsops.c	20 Aug 2006 05:34:18 -0000	1.29.2.17
+++ src/afs/LINUX/osi_vfsops.c	6 Oct 2006 13:00:39 -0000
@@ -312,8 +312,7 @@
 void
 afs_destroy_inodecache(void)
 {
-    if (kmem_cache_destroy(afs_inode_cachep))
-	printk(KERN_INFO "afs_inode_cache: not all structures were freed\n");
+    (void) kmem_cache_destroy(afs_inode_cachep);
 }
 #else
 int
Index: src/afs/LINUX/osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.81.2.43
diff -u -u -r1.81.2.43 osi_vnodeops.c
--- src/afs/LINUX/osi_vnodeops.c	13 Aug 2006 16:50:43 -0000	1.81.2.43
+++ src/afs/LINUX/osi_vnodeops.c	6 Oct 2006 13:00:39 -0000
@@ -75,7 +75,11 @@
     else {
 	    osi_FlushPages(vcp, credp);	/* ensure stale pages are gone */
 	    AFS_GUNLOCK();
+#ifdef DO_SYNC_READ
+	    code = do_sync_read(fp, buf, count, offp);
+#else
 	    code = generic_file_read(fp, buf, count, offp);
+#endif
 	    AFS_GLOCK();
     }
 
@@ -121,7 +125,11 @@
 	code = -code;
     else {
 	    AFS_GUNLOCK();
+#ifdef DO_SYNC_READ
+	    code = do_sync_write(fp, buf, count, offp);
+#else
 	    code = generic_file_write(fp, buf, count, offp);
+#endif
 	    AFS_GLOCK();
     }
 
@@ -550,6 +558,10 @@
   .read =	generic_read_dir,
 #endif
   .readdir =	afs_linux_readdir,
+#ifdef GENERIC_FILE_AIO_READ
+  .aio_read =	generic_file_aio_read,
+  .aio_write =	generic_file_aio_write,
+#endif
 #ifdef HAVE_UNLOCKED_IOCTL
   .unlocked_ioctl = afs_unlocked_xioctl,
 #else
Index: src/cf/linux-test4.m4
===================================================================
RCS file: /cvs/openafs/src/cf/linux-test4.m4,v
retrieving revision 1.20.2.13
diff -u -u -r1.20.2.13 linux-test4.m4
--- src/cf/linux-test4.m4	6 Sep 2006 20:57:17 -0000	1.20.2.13
+++ src/cf/linux-test4.m4	6 Oct 2006 13:00:39 -0000
@@ -644,3 +644,29 @@
   if test "x$ac_cv_key_alloc_needs_struct_task" = "xyes"; then
     AC_DEFINE([KEY_ALLOC_NEEDS_STRUCT_TASK], 1, [define if key_alloc takes a struct task *])
   fi])
+
+AC_DEFUN([LINUX_DO_SYNC_READ], [
+  AC_MSG_CHECKING([for linux do_sync_read()])
+  AC_CACHE_VAL([ac_cv_linux_do_sync_read], [
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[do_sync_read(NULL, NULL, 0, NULL);],
+      ac_cv_linux_do_sync_read=yes,
+      ac_cv_linux_do_sync_read=no)])
+  AC_MSG_RESULT($ac_cv_linux_do_sync_read)
+  if test "x$ac_cv_linux_do_sync_read" = "xyes"; then
+    AC_DEFINE([DO_SYNC_READ], 1, [define if your kernel has do_sync_read()])
+  fi])
+
+AC_DEFUN([LINUX_GENERIC_FILE_AIO_READ], [
+  AC_MSG_CHECKING([for linux generic_file_aio_read()])
+  AC_CACHE_VAL([ac_cv_linux_generic_file_aio_read], [
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[generic_file_aio_read(NULL, NULL, 0, 0);],
+      ac_cv_linux_generic_file_aio_read=yes,
+      ac_cv_linux_generic_file_aio_read=no)])
+  AC_MSG_RESULT($ac_cv_linux_generic_file_aio_read)
+  if test "x$ac_cv_linux_generic_file_aio_read" = "xyes"; then
+    AC_DEFINE([GENERIC_FILE_AIO_READ], 1, [define if your kernel has generic_file_aio_read()])
+  fi])
Index: acinclude.m4
===================================================================
RCS file: /cvs/openafs/acinclude.m4,v
retrieving revision 1.114.2.61
diff -u -u -r1.114.2.61 acinclude.m4
--- acinclude.m4	19 Sep 2006 22:23:00 -0000	1.114.2.61
+++ acinclude.m4	6 Oct 2006 13:00:39 -0000
@@ -608,6 +608,8 @@
 		 LINUX_REFRIGERATOR
 		 LINUX_LINUX_KEYRING_SUPPORT
 		 LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
+		 LINUX_DO_SYNC_READ
+		 LINUX_GENERIC_FILE_AIO_READ
                  LINUX_EXPORTS_SYS_CHDIR
                  LINUX_EXPORTS_SYS_CLOSE
                  LINUX_EXPORTS_SYS_OPEN