Hi RobL,
Attached patch helps us build and run successfully on top of mainstream
new kernels (2.6.19-rc...)
I have tested out a few runs of iozone and bonnie successfully with the
new interface changes
and there does not appear to by any regressions..
Do check this in if everything looks ok to you.
BTW: I haven't been able to get to the 2.4 mount regression. Can someone
tell me which kernels/distros are broken? Also, if they can post their
pvfs2-config.h that would be awesome to help me debug further..
thanks,
Murali
Hi Murali,
Tell you what, I'll take care of the configure tests (did you know the
return type for kmem_cache_destroy has now been changed to void?) if
you want to fix the actual code this weekend. That would be great --
I'm pretty slow with the kernel stuff, and I also need to prepare for SC.
2.6.19-rc5 is out now. Guess that's the one to test against.
==rob
Index: configure
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/configure,v
retrieving revision 1.323
diff -u -r1.323 configure
--- configure 24 Oct 2006 15:51:59 -0000 1.323
+++ configure 11 Nov 2006 08:06:06 -0000
@@ -7912,6 +7912,129 @@
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+ echo "$as_me:$LINENO: checking for readv callback in struct
file_operations in kernel" >&5
+echo $ECHO_N "checking for readv callback in struct file_operations in
kernel... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #define __KERNEL__
+ #include <linux/fs.h>
+ static struct file_operations fop = {
+ .readv = NULL,
+ };
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_READV_FILE_OPERATIONS 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ echo "$as_me:$LINENO: checking for writev callback in struct
file_operations in kernel" >&5
+echo $ECHO_N "checking for writev callback in struct file_operations in
kernel... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #define __KERNEL__
+ #include <linux/fs.h>
+ static struct file_operations fop = {
+ .writev = NULL,
+ };
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WRITEV_FILE_OPERATIONS 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
echo "$as_me:$LINENO: checking for find_inode_handle callback
in struct super_operations in kernel" >&5
echo $ECHO_N "checking for find_inode_handle callback in struct
super_operations in kernel... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
@@ -8663,6 +8786,73 @@
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ tmp_cflags=$CFLAGS
+ CFLAGS="$CFLAGS -Werror"
+ echo "$as_me:$LINENO: checking for new prototype of aio_read
callback of file_operations structure" >&5
+echo $ECHO_N "checking for new prototype of aio_read callback of
file_operations structure... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #define __KERNEL__
+ #include <linux/fs.h>
+ extern ssize_t my_aio_read(struct kiocb *, const struct
iovec *, unsigned long, loff_t);
+ static struct file_operations fop = {
+ .aio_read = my_aio_read,
+ };
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AIO_NEW_AIO_SIGNATURE 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS=$tmp_cflags
+
fi
tmp_cflags=$CFLAGS
@@ -9867,6 +10057,66 @@
cat >>confdefs.h <<\_ACEOF
#define HAVE_INT_RETURN_INODE_OPERATIONS_FOLLOW_LINK 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ echo "$as_me:$LINENO: checking for int return in
kmem_cache_destroy" >&5
+echo $ECHO_N "checking for int return in kmem_cache_destroy... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #define __KERNEL__
+ #include <linux/slab.h>
+ extern int kmem_cache_destroy(kmem_cache_t *);
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INT_RETURN_KMEM_CACHE_DESTROY 1
_ACEOF
else
Index: pvfs2-config.h.in
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/pvfs2-config.h.in,v
retrieving revision 1.88
diff -u -r1.88 pvfs2-config.h.in
--- pvfs2-config.h.in 23 Oct 2006 22:25:41 -0000 1.88
+++ pvfs2-config.h.in 11 Nov 2006 08:06:06 -0000
@@ -6,6 +6,9 @@
/* Define if kernel has aio support */
#undef HAVE_AIO
+/* Define if VFS AIO support in kernel has a new prototype */
+#undef HAVE_AIO_NEW_AIO_SIGNATURE
+
/* Define if we are enabling VFS AIO support in kernel */
#undef HAVE_AIO_VFS_SUPPORT
@@ -122,6 +125,9 @@
/* Define if return value from follow_link in inode_operations is type int */
#undef HAVE_INT_RETURN_INODE_OPERATIONS_FOLLOW_LINK
+/* Define if return value from kmem_cache_destroy is type int */
+#undef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
+
/* Define if struct inode in kernel has i_blksize member */
#undef HAVE_I_BLKSIZE_IN_STRUCT_INODE
@@ -191,6 +197,9 @@
/* Define if struct file_operations in kernel has readdirplus callback */
#undef HAVE_READDIRPLUS_FILE_OPERATIONS
+/* Define if struct file_operations in kernel has readv callback */
+#undef HAVE_READV_FILE_OPERATIONS
+
/* Define if struct file_operations in kernel has readx callback */
#undef HAVE_READX_FILE_OPERATIONS
@@ -277,6 +286,9 @@
/* Define if get_sb callback has struct vfsmount argument */
#undef HAVE_VFSMOUNT_GETSB
+
+/* Define if struct file_operations in kernel has writev callback */
+#undef HAVE_WRITEV_FILE_OPERATIONS
/* Define if struct file_operations in kernel has writex callback */
#undef HAVE_WRITEX_FILE_OPERATIONS
Index: maint/config/kernel.m4
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/maint/config/kernel.m4,v
retrieving revision 1.21
diff -u -r1.21 kernel.m4
--- maint/config/kernel.m4 24 Oct 2006 15:51:59 -0000 1.21
+++ maint/config/kernel.m4 11 Nov 2006 08:06:07 -0000
@@ -144,6 +144,33 @@
)
fi
+ dnl checking if we have a readv callback in super_operations
+ AC_MSG_CHECKING(for readv callback in struct file_operations in kernel)
+ AC_TRY_COMPILE([
+ #define __KERNEL__
+ #include <linux/fs.h>
+ static struct file_operations fop = {
+ .readv = NULL,
+ };
+ ], [],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_READV_FILE_OPERATIONS, 1, Define if struct
file_operations in kernel has readv callback),
+ AC_MSG_RESULT(no)
+ )
+ dnl checking if we have a writev callback in super_operations
+ AC_MSG_CHECKING(for writev callback in struct file_operations in kernel)
+ AC_TRY_COMPILE([
+ #define __KERNEL__
+ #include <linux/fs.h>
+ static struct file_operations fop = {
+ .writev = NULL,
+ };
+ ], [],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_WRITEV_FILE_OPERATIONS, 1, Define if struct
file_operations in kernel has writev callback),
+ AC_MSG_RESULT(no)
+ )
+
dnl checking if we have a find_inode_handle callback in
super_operations
AC_MSG_CHECKING(for find_inode_handle callback in struct
super_operations in kernel)
AC_TRY_COMPILE([
@@ -322,6 +349,25 @@
AC_DEFINE(HAVE_AIO_VFS_SUPPORT, 1, Define if we are
enabling VFS AIO support in kernel),
AC_MSG_RESULT(no)
)
+
+ tmp_cflags=$CFLAGS
+ dnl if this test passes, the signature of aio_read has changed
to the new one
+ CFLAGS="$CFLAGS -Werror"
+ AC_MSG_CHECKING(for new prototype of aio_read callback of
file_operations structure)
+ AC_TRY_COMPILE([
+ #define __KERNEL__
+ #include <linux/fs.h>
+ extern ssize_t my_aio_read(struct kiocb *, const struct
iovec *, unsigned long, loff_t);
+ static struct file_operations fop = {
+ .aio_read = my_aio_read,
+ };
+ ], [],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_AIO_NEW_AIO_SIGNATURE, 1, Define if VFS
AIO support in kernel has a new prototype),
+ AC_MSG_RESULT(no)
+ )
+ CFLAGS=$tmp_cflags
+
fi
tmp_cflags=$CFLAGS
@@ -558,6 +604,19 @@
], [],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INT_RETURN_INODE_OPERATIONS_FOLLOW_LINK, 1, Define
if return value from follow_link in inode_operations is type int),
+ AC_MSG_RESULT(no)
+ )
+
+ dnl kmem_cache_destroy function may return int only on pre 2.6.19
kernels
+ dnl else it returns a void.
+ AC_MSG_CHECKING(for int return in kmem_cache_destroy)
+ AC_TRY_COMPILE([
+ #define __KERNEL__
+ #include <linux/slab.h>
+ extern int kmem_cache_destroy(kmem_cache_t *);
+ ], [],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INT_RETURN_KMEM_CACHE_DESTROY, 1, Define if return
value from kmem_cache_destroy is type int),
AC_MSG_RESULT(no)
)
Index: src/kernel/linux-2.6/devpvfs2-req.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/devpvfs2-req.c,v
retrieving revision 1.66
diff -u -r1.66 devpvfs2-req.c
--- src/kernel/linux-2.6/devpvfs2-req.c 13 Sep 2006 20:22:55 -0000 1.66
+++ src/kernel/linux-2.6/devpvfs2-req.c 11 Nov 2006 08:06:08 -0000
@@ -232,11 +232,17 @@
return len;
}
-static ssize_t pvfs2_devreq_writev(
- struct file *file,
- const struct iovec *iov,
- unsigned long count,
- loff_t * offset)
+struct devrw_options {
+ struct file *file;
+ /* Asynch I/O control block */
+ struct kiocb *iocb;
+ struct iovec *iov;
+ unsigned long nr_segs;
+ loff_t *offset;
+};
+
+/* Common function for writev() and aio_write() callers into the device */
+static ssize_t do_devreq_writev(struct devrw_options *rw)
{
pvfs2_kernel_op_t *op = NULL;
struct qhash_head *hash_link = NULL;
@@ -250,12 +256,18 @@
int32_t magic = 0;
int32_t proto_ver = 0;
uint64_t tag = 0;
+ struct iovec *iov = NULL;
+ ssize_t total_returned_size = 0;
+ if (!rw || ((iov = rw->iov) == NULL)) {
+ gossip_err("Error: invalid parameter to device vectored write\n");
+ return -EINVAL;
+ }
/* Either there is a trailer or there isn't */
- if (count != notrailer_count && count != (notrailer_count + 1))
+ if (rw->nr_segs != notrailer_count && rw->nr_segs != (notrailer_count + 1))
{
gossip_err("Error: Number of iov vectors is (%ld) and notrailer count
is %d\n",
- count, notrailer_count);
+ rw->nr_segs, notrailer_count);
return -EPROTO;
}
buffer = dev_req_alloc();
@@ -284,6 +296,7 @@
ptr += iov[i].iov_len;
payload_size += iov[i].iov_len;
}
+ total_returned_size = payload_size;
/* these elements are currently 8 byte aligned (8 bytes for (version +
* magic) 8 bytes for tag). If you add another element, either make it 8
@@ -338,10 +351,10 @@
if (op->downcall.status == 0 && op->downcall.trailer_size > 0)
{
gossip_debug(GOSSIP_DEV_DEBUG, "writev: trailer size %ld\n",
(unsigned long) op->downcall.trailer_size);
- if (count != (notrailer_count + 1))
+ if (rw->nr_segs != (notrailer_count + 1))
{
gossip_err("Error: trailer size (%ld) is non-zero, no
trailer elements though? (%ld)\n",
- (unsigned long) op->downcall.trailer_size, count);
+ (unsigned long) op->downcall.trailer_size,
rw->nr_segs);
dev_req_release(buffer);
put_op(op);
return -EPROTO;
@@ -541,8 +554,49 @@
}
dev_req_release(buffer);
- return count;
+ /* if we are called from aio context, just mark that the iocb is completed
*/
+ if (rw->iocb) {
+ aio_complete(rw->iocb, total_returned_size, 0);
+ }
+
+ return total_returned_size;
+}
+
+#ifdef HAVE_WRITEV_FILE_OPERATIONS
+static ssize_t pvfs2_devreq_writev(
+ struct file *file,
+ const struct iovec *iov,
+ unsigned long n_segs,
+ loff_t * offset)
+{
+ struct devrw_options rw;
+
+ memset(&rw, 0, sizeof(rw));
+ rw.iocb = NULL;
+ rw.iov = (struct iovec *) iov;
+ rw.nr_segs = n_segs;
+ rw.offset = offset;
+ return do_devreq_writev(&rw);
}
+#endif
+
+#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
+/* For simplicity I am going to treat this aio call as if it were synchronous
*/
+static ssize_t
+pvfs2_devreq_aio_write(struct kiocb *iocb, const struct iovec *iov,
+ unsigned long n_segs, loff_t offset)
+{
+ struct devrw_options rw;
+
+ memset(&rw, 0, sizeof(rw));
+ rw.file = iocb->ki_filp;
+ rw.iov = (struct iovec *) iov;
+ rw.nr_segs = n_segs;
+ rw.offset = &offset;
+ return do_devreq_writev(&rw);
+}
+
+#endif
/* Returns whether any FS are still pending remounted */
static int mark_all_pending_mounts(void)
@@ -996,14 +1050,21 @@
#ifdef PVFS2_LINUX_KERNEL_2_4
owner: THIS_MODULE,
read : pvfs2_devreq_read,
+#ifdef HAVE_WRITEV_FILE_OPERATIONS
writev : pvfs2_devreq_writev,
+#endif
open : pvfs2_devreq_open,
release : pvfs2_devreq_release,
ioctl : pvfs2_devreq_ioctl,
poll : pvfs2_devreq_poll
#else
.read = pvfs2_devreq_read,
+#ifdef HAVE_WRITEV_FILE_OPERATIONS
.writev = pvfs2_devreq_writev,
+#endif
+#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
+ .aio_write = pvfs2_devreq_aio_write,
+#endif
.open = pvfs2_devreq_open,
.release = pvfs2_devreq_release,
.ioctl = pvfs2_devreq_ioctl,
Index: src/kernel/linux-2.6/file.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/file.c,v
retrieving revision 1.129
diff -u -r1.129 file.c
--- src/kernel/linux-2.6/file.c 29 Sep 2006 16:48:13 -0000 1.129
+++ src/kernel/linux-2.6/file.c 11 Nov 2006 08:06:10 -0000
@@ -725,16 +725,8 @@
rw.dest.address.nr_segs = 1;
rw.off.io.offset = offset;
- if (IS_IMMUTABLE(rw.inode))
- {
- rw.readahead_size = (rw.inode)->i_size;
- return generic_file_read(file, buf, count, offset);
- }
- else
- {
- rw.readahead_size = 0;
- return do_direct_readv_writev(&rw);
- }
+ rw.readahead_size = 0;
+ return do_direct_readv_writev(&rw);
}
/** Write data from a contiguous user buffer into a file at a specified
@@ -767,6 +759,7 @@
return do_direct_readv_writev(&rw);
}
+#ifdef HAVE_READV_FILE_OPERATIONS
/** Reads data to several contiguous user buffers (an iovec) from a file at a
* specified offset.
*/
@@ -794,7 +787,9 @@
rw.readahead_size = 0;
return do_direct_readv_writev(&rw);
}
+#endif
+#ifdef HAVE_WRITEV_FILE_OPERATIONS
/** Write data from a several contiguous user buffers (an iovec) into a file at
* a specified offset.
*/
@@ -822,6 +817,7 @@
return do_direct_readv_writev(&rw);
}
+#endif
/* Construct a trailer of <file offsets, length pairs> in a buffer that we
@@ -2064,12 +2060,32 @@
return error;
}
+#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
+static ssize_t
+pvfs2_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
+ unsigned long n_segs, loff_t offset)
+#else
static ssize_t
pvfs2_file_aio_read(struct kiocb *iocb, char __user *buffer,
size_t count, loff_t offset)
+#endif
{
struct rw_options rw;
+ struct iovec *pvec;
+ unsigned long nr_segs;
+
+#ifndef HAVE_AIO_NEW_AIO_SIGNATURE
struct iovec vec;
+
+ vec.iov_base = (char __user *) buffer;
+ vec.iov_len = count;
+ pvec = (struct iovec *) &vec;
+ nr_segs = 1;
+#else
+ pvec = (struct iovec *) iov;
+ nr_segs = n_segs;
+#endif
+
memset(&rw, 0, sizeof(rw));
rw.async = !is_sync_kiocb(iocb);
rw.type = IO_READ;
@@ -2078,8 +2094,6 @@
rw.copy_to_user = 1;
rw.fnstr = __FUNCTION__;
rw.iocb = iocb;
- vec.iov_base = (char __user *) buffer;
- vec.iov_len = count;
rw.file = iocb->ki_filp;
if (!rw.file || !(rw.file)->f_mapping)
{
@@ -2087,28 +2101,39 @@
}
rw.inode = (rw.file)->f_mapping->host;
rw.pvfs2_inode = PVFS2_I(rw.inode);
- rw.dest.address.iov = &vec;
- rw.dest.address.nr_segs = 1;
+ rw.dest.address.iov = pvec;
+ rw.dest.address.nr_segs = nr_segs;
- if (IS_IMMUTABLE(rw.inode))
- {
- rw.readahead_size = (rw.inode)->i_size;
- return generic_file_aio_read(iocb, buffer, count, offset);
- }
- else
- {
- rw.readahead_size = 0;
- return do_direct_aio_read_write(&rw);
- }
+ rw.readahead_size = 0;
+ return do_direct_aio_read_write(&rw);
}
+#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
+static ssize_t
+pvfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
+ unsigned long n_segs, loff_t offset)
+#else
static ssize_t
pvfs2_file_aio_write(struct kiocb *iocb, const char __user *buffer,
size_t count, loff_t offset)
+#endif
{
struct rw_options rw;
+ struct iovec *pvec;
+ unsigned long nr_segs;
+
+#ifndef HAVE_AIO_NEW_AIO_SIGNATURE
struct iovec vec;
+ vec.iov_base = (char __user *) buffer;
+ vec.iov_len = count;
+ pvec = (struct iovec *) &vec;
+ nr_segs = 1;
+#else
+ pvec = (struct iovec *) iov;
+ nr_segs = n_segs;
+#endif
+
memset(&rw, 0, sizeof(rw));
rw.async = !is_sync_kiocb(iocb);
rw.type = IO_WRITE;
@@ -2118,8 +2143,6 @@
rw.copy_to_user = 1;
rw.fnstr = __FUNCTION__;
rw.iocb = iocb;
- vec.iov_base = (char __user *) buffer;
- vec.iov_len = count;
rw.file = iocb->ki_filp;
if (!rw.file || !(rw.file)->f_mapping)
{
@@ -2127,8 +2150,8 @@
}
rw.inode = (rw.file)->f_mapping->host;
rw.pvfs2_inode = PVFS2_I(rw.inode);
- rw.dest.address.iov = &vec;
- rw.dest.address.nr_segs = 1;
+ rw.dest.address.iov = pvec;
+ rw.dest.address.nr_segs = nr_segs;
return do_direct_aio_read_write(&rw);
}
@@ -2448,8 +2471,12 @@
llseek : pvfs2_file_llseek,
read : pvfs2_file_read,
write : pvfs2_file_write,
+#ifdef HAVE_READV_FILE_OPERATIONS
readv : pvfs2_file_readv,
+#endif
+#ifdef HAVE_WRITEV_FILE_OPERATIONS
writev : pvfs2_file_writev,
+#endif
ioctl : pvfs2_ioctl,
mmap : pvfs2_file_mmap,
open : pvfs2_file_open,
@@ -2459,8 +2486,12 @@
.llseek = pvfs2_file_llseek,
.read = pvfs2_file_read,
.write = pvfs2_file_write,
+#ifdef HAVE_READV_FILE_OPERATIONS
.readv = pvfs2_file_readv,
+#endif
+#ifdef HAVE_WRITEV_FILE_OPERATIONS
.writev = pvfs2_file_writev,
+#endif
#ifdef HAVE_AIO_VFS_SUPPORT
.aio_read = pvfs2_file_aio_read,
.aio_write = pvfs2_file_aio_write,
Index: src/kernel/linux-2.6/pvfs2-cache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-cache.c,v
retrieving revision 1.36
diff -u -r1.36 pvfs2-cache.c
--- src/kernel/linux-2.6/pvfs2-cache.c 20 Sep 2006 22:59:53 -0000 1.36
+++ src/kernel/linux-2.6/pvfs2-cache.c 11 Nov 2006 08:06:11 -0000
@@ -48,7 +48,12 @@
int op_cache_finalize(void)
{
- if (kmem_cache_destroy(op_cache) != 0)
+ int ret = 0;
+#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
+ ret =
+#endif
+ kmem_cache_destroy(op_cache);
+ if (ret != 0)
{
gossip_err("Failed to destroy pvfs2_op_cache\n");
return -EINVAL;
@@ -212,7 +217,12 @@
int dev_req_cache_finalize(void)
{
- if (kmem_cache_destroy(dev_req_cache) != 0)
+ int ret = 0;
+#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
+ ret =
+#endif
+ kmem_cache_destroy(dev_req_cache);
+ if (ret != 0)
{
gossip_err("Failed to destroy pvfs2_devreqcache\n");
return -EINVAL;
@@ -326,6 +336,7 @@
int pvfs2_inode_cache_finalize(void)
{
+ int ret = 0;
if (!list_empty(&pvfs2_inode_list))
{
gossip_err("pvfs2_inode_cache_finalize: WARNING: releasing unreleased
pvfs2 inode objects!\n");
@@ -336,7 +347,11 @@
kmem_cache_free(pvfs2_inode_cache, pinode);
}
}
- if (kmem_cache_destroy(pvfs2_inode_cache) != 0)
+#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
+ ret =
+#endif
+ kmem_cache_destroy(pvfs2_inode_cache);
+ if (ret != 0)
{
gossip_err("Failed to destroy pvfs2_inode_cache\n");
return -EINVAL;
@@ -413,7 +428,12 @@
int kiocb_cache_finalize(void)
{
- if (kmem_cache_destroy(pvfs2_kiocb_cache) != 0)
+ int ret = 0;
+#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
+ ret =
+#endif
+ kmem_cache_destroy(pvfs2_kiocb_cache);
+ if (ret != 0)
{
gossip_err("Failed to destroy pvfs2_devreqcache\n");
return -EINVAL;
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers