From: Chas Williams Date: Fri, 6 Oct 2006 14:27:44 +0000 (+0000) Subject: linux-2619-aio-and-read-write-changes-20061006 X-Git-Tag: BP-openafs-windows-kdfs-ifs~1013 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=775ea6f1b79b0e0e2b700e3894e01279e26ebbfa;p=packages%2Fo%2Fopenafs.git linux-2619-aio-and-read-write-changes-20061006 changes to support 2.6.19 --- diff --git a/acinclude.m4 b/acinclude.m4 index 7d0911465..8d8e826cd 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -611,6 +611,8 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) 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 diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 18f68ffa7..9c216064e 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -318,8 +318,7 @@ afs_init_inodecache(void) 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 diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 59bb58239..41b8f14f8 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -73,7 +73,11 @@ afs_linux_read(struct file *fp, char *buf, size_t count, loff_t * offp) 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(); } @@ -119,7 +123,11 @@ afs_linux_write(struct file *fp, const char *buf, size_t count, loff_t * offp) 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(); } @@ -583,6 +591,10 @@ struct file_operations afs_dir_fops = { struct file_operations afs_file_fops = { .read = afs_linux_read, .write = afs_linux_write, +#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 diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 5485b2f23..4585ea7d4 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -644,3 +644,29 @@ AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [ 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 ], +[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 ], +[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])