From 12b4293efb27b0ad722c51bee4eacf84c51600df Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Fri, 6 Oct 2006 14:30:54 +0000 Subject: [PATCH] STABLE14-linux-2619-aio-and-read-write-changes-20061006 changes to support 2.6.19 (cherry picked from commit 775ea6f1b79b0e0e2b700e3894e01279e26ebbfa) --- acinclude.m4 | 2 ++ src/afs/LINUX/osi_vfsops.c | 3 +-- src/afs/LINUX/osi_vnodeops.c | 12 ++++++++++++ src/cf/linux-test4.m4 | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 5485607a9..faeb56d9f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -608,6 +608,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 245438bc3..0539b4c7b 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -312,8 +312,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 e0fa52606..850543bce 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -75,7 +75,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(); } @@ -121,7 +125,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(); } @@ -565,6 +573,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]) -- 2.39.5