From: Andrew Deason Date: Wed, 29 Aug 2012 19:14:39 +0000 (-0500) Subject: LINUX: Detect non-vectorized aio functions X-Git-Tag: upstream/1.8.0_pre1^2~2067 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e5ba359f64b5d8d874a31a50694398c17f27cfa1;p=packages%2Fo%2Fopenafs.git LINUX: Detect non-vectorized aio functions In kernels before 027445c3, the functions generic_file_aio_read and generic_file_aio_write, as well as the fs operations aio_read and aio_write, do not deal with iovecs but rather just use a single buffer. Detect this, so our aio_read and aio_write implementations have the correct signatures. This removes several warnings on such kernels. Change-Id: I70aa0d43bac5545d83710806b58f36d13d7f6cc8 Reviewed-on: http://gerrit.openafs.org/8020 Reviewed-by: Marc Dionne Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/acinclude.m4 b/acinclude.m4 index 9b465c38f..dbea2dd5a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -936,6 +936,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) [define to disable the nfs translator])]) dnl Assorted more complex tests + LINUX_AIO_NONVECTOR LINUX_EXPORTS_PROC_ROOT_FS LINUX_KMEM_CACHE_INIT LINUX_HAVE_KMEM_CACHE_T diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 5a3ce7aeb..1a4602ed6 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -97,8 +97,15 @@ afs_linux_VerifyVCache(struct vcache *avc, cred_t **retcred) { } #ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ +# ifdef LINUX_HAS_NONVECTOR_AIO static ssize_t -afs_linux_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long segs, loff_t pos) +afs_linux_aio_read(struct kiocb *iocb, char __user *buf, size_t bufsize, + loff_t pos) +# else +static ssize_t +afs_linux_aio_read(struct kiocb *iocb, const struct iovec *buf, + unsigned long bufsize, loff_t pos) +# endif { struct file *fp = iocb->ki_filp; ssize_t code = 0; @@ -106,8 +113,8 @@ afs_linux_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long se AFS_GLOCK(); afs_Trace4(afs_iclSetp, CM_TRACE_AIOREADOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, segs, ICL_TYPE_INT32, - 99999); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, + (afs_int32)bufsize, ICL_TYPE_INT32, 99999); code = afs_linux_VerifyVCache(vcp, NULL); if (code == 0) { @@ -115,13 +122,13 @@ afs_linux_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long se * so we optimise by not using it */ osi_FlushPages(vcp, NULL); /* ensure stale pages are gone */ AFS_GUNLOCK(); - code = generic_file_aio_read(iocb, iov, segs, pos); + code = generic_file_aio_read(iocb, buf, bufsize, pos); AFS_GLOCK(); } afs_Trace4(afs_iclSetp, CM_TRACE_AIOREADOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, segs, ICL_TYPE_INT32, - code); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, + (afs_int32)bufsize, ICL_TYPE_INT32, code); AFS_GUNLOCK(); return code; } @@ -161,8 +168,15 @@ afs_linux_read(struct file *fp, char *buf, size_t count, loff_t * offp) * mode. Call fake open/close to ensure we do writes of core dumps. */ #ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ +# ifdef LINUX_HAS_NONVECTOR_AIO static ssize_t -afs_linux_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long segs, loff_t pos) +afs_linux_aio_write(struct kiocb *iocb, const char __user *buf, size_t bufsize, + loff_t pos) +# else +static ssize_t +afs_linux_aio_write(struct kiocb *iocb, const struct iovec *buf, + unsigned long bufsize, loff_t pos) +# endif { ssize_t code = 0; struct vcache *vcp = VTOAFS(iocb->ki_filp->f_dentry->d_inode); @@ -171,7 +185,8 @@ afs_linux_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long s AFS_GLOCK(); afs_Trace4(afs_iclSetp, CM_TRACE_AIOWRITEOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, segs, ICL_TYPE_INT32, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, + (afs_int32)bufsize, ICL_TYPE_INT32, (iocb->ki_filp->f_flags & O_APPEND) ? 99998 : 99999); code = afs_linux_VerifyVCache(vcp, &credp); @@ -181,7 +196,7 @@ afs_linux_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long s ReleaseWriteLock(&vcp->lock); if (code == 0) { AFS_GUNLOCK(); - code = generic_file_aio_write(iocb, iov, segs, pos); + code = generic_file_aio_write(iocb, buf, bufsize, pos); AFS_GLOCK(); } @@ -194,8 +209,8 @@ afs_linux_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long s ReleaseWriteLock(&vcp->lock); afs_Trace4(afs_iclSetp, CM_TRACE_AIOWRITEOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, segs, ICL_TYPE_INT32, - code); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(pos), ICL_TYPE_INT32, + (afs_int32)bufsize, ICL_TYPE_INT32, code); if (credp) crfree(credp); diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index ad319d0e9..63aab1dfc 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -1,3 +1,17 @@ + +AC_DEFUN([LINUX_AIO_NONVECTOR], + [AC_CHECK_LINUX_BUILD([for non-vectorized aio kernel functions], + [ac_cv_linux_aio_nonvector], + [#include ], + [extern ssize_t + generic_file_aio_read(struct kiocb *, char __user *, + size_t, loff_t);], + [LINUX_HAS_NONVECTOR_AIO], + [define if kernel functions like generic_file_aio_read use + non-vectorized i/o], + []) + ]) + AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [ AC_CHECK_LINUX_BUILD([for exported tasklist_lock], [ac_cv_linux_exports_tasklist_lock],