All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Fasheh <mark.fasheh@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write()
Date: Tue Jan  8 16:17:57 2008	[thread overview]
Message-ID: <20080109001715.GY23506@ca-server1.us.oracle.com> (raw)
In-Reply-To: <1199388006-32658-26-git-send-email-sunil.mushran@oracle.com>

On Thu, Jan 03, 2008 at 11:20:03AM -0800, Sunil Mushran wrote:
> Commit 027445c37282bc1ed26add45e573ad2d3e4860a5 in mainline vectorized
> fileops aio_read() and aio_write(). This patch allows one to build ocfs2
> with kernels having/not having this change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> Signed-off-by: Joel Becker <joel.becker@oracle.com>
> ---
>  Config.make.in               |    1 +
>  Makefile                     |    3 +-
>  configure.in                 |    6 ++++
>  fs/ocfs2/Makefile            |    4 ++
>  fs/ocfs2/file.c              |    6 ++--
>  kapi-compat/include/aiovec.h |   68 ++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 84 insertions(+), 4 deletions(-)
>  create mode 100644 kapi-compat/include/aiovec.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index 4b2d1c5..c6deb57 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -72,6 +72,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@
>  NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@
>  SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@
>  IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@
> +NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/Makefile b/Makefile
> index 9427ce6..a3a0c9d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -27,7 +27,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/cap.h \
>  	kapi-compat/include/relatime.h \
>  	kapi-compat/include/should_remove_suid.h \
> -	kapi-compat/include/generic_segment_checks.h
> +	kapi-compat/include/generic_segment_checks.h \
> +	kapi-compat/include/aiovec.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index a6f4336..8c30910 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -285,6 +285,12 @@ OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h,
>    , IOP_IS_NOT_CONST=yes, [^.*const struct inode_operations.*\*i_op;])
>  AC_SUBST(IOP_IS_NOT_CONST)
>  
> +NO_VECTORIZED_AIO=
> +OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h,
> +  , NO_VECTORIZED_AIO=yes, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
> +AC_SUBST(NO_VECTORIZED_AIO)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS aiovec.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index a894c45..1646a9b 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -73,6 +73,10 @@ ifdef IOP_IS_NOT_CONST
>  EXTRA_CFLAGS += -DIOP_IS_NOT_CONST
>  endif
>  
> +ifdef NO_VECTORIZED_AIO
> +CFLAGS_file.o += -DNO_VECTORIZED_AIO
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index a19322e..62040aa 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -2017,7 +2017,7 @@ out:
>  	return total ? total : ret;
>  }
>  
> -static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
> +static ssize_t __ocfs2_file_aio_write(struct kiocb *iocb,
>  				    const struct iovec *iov,
>  				    unsigned long nr_segs,
>  				    loff_t pos)
> @@ -2322,7 +2322,7 @@ bail:
>  	return ret;
>  }
>  
> -static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
> +static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb,
>  				   const struct iovec *iov,
>  				   unsigned long nr_segs,
>  				   loff_t pos)
> @@ -2376,7 +2376,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
>  	}
>  	ocfs2_meta_unlock(inode, lock_level);
>  
> -	ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
> +	ret = kapi_generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
>  	if (ret == -EINVAL)
>  		mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n");
>  
> diff --git a/kapi-compat/include/aiovec.h b/kapi-compat/include/aiovec.h
> new file mode 100644
> index 0000000..e6cb3fb
> --- /dev/null
> +++ b/kapi-compat/include/aiovec.h
> @@ -0,0 +1,68 @@
> +#ifndef KAPI_AIOVEC_H
> +#define KAPI_AIOVEC_H
> +
> +#ifdef NO_VECTORIZED_AIO
> +
> +#include <linux/fs.h>
> +#include <linux/uio.h>
> +
> +static ssize_t kapi_generic_file_aio_read(struct kiocb *iocb,
> +					  const struct iovec *iov,
> +					  unsigned long nr_segs,
> +					  loff_t pos)
> +{
> +	BUG_ON(nr_segs != 1);
> +	return generic_file_aio_read(iocb, iov->iov_base, iov->iov_len, pos);
> +}
> +
> +static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb,
> +				     const struct iovec *iov,
> +				     unsigned long nr_segs,
> +				     loff_t pos);
> +
> +static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
> +				   char __user *buf,
> +				   size_t buflen,
> +				   loff_t pos)
> +{
> +	struct iovec iov_local = { .iov_base = (void __user *)buf,
> +				   .iov_len  = buflen };
> +	const struct iovec *iov = &iov_local;
> +	unsigned long nr_segs = 1;
> +
> +	return __ocfs2_file_aio_read(iocb, iov, nr_segs, pos);
> +}
> +
> +static ssize_t __ocfs2_file_aio_write(struct kiocb *iocb,
> +				      const struct iovec *iov,
> +				      unsigned long nr_segs,
> +				      loff_t pos);
> +
> +static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
> +				    const char __user *buf,
> +				    size_t buflen,
> +				    loff_t pos)
> +{
> +	struct iovec iov_local = { .iov_base = (void __user *)buf,
> +				   .iov_len  = buflen };
> +	const struct iovec *iov = &iov_local;
> +	unsigned long nr_segs = 1;
> +
> +	iocb->ki_left = buflen;
> +	return __ocfs2_file_aio_write(iocb, iov, nr_segs, pos);
> +}
> +
> +#else	/* ! NO_VECTORIZED_AIO */
> +
> +#define kapi_generic_file_aio_read(a, b, c, d) \
> +			generic_file_aio_read(a, b, c, d)
> +
> +#define ocfs2_file_aio_read(a, b, c, d) \
> +			__ocfs2_file_aio_read(a, b, c, d)
> +
> +#define ocfs2_file_aio_write(a, b, c, d) \
> +			__ocfs2_file_aio_write(a, b, c, d)

ocfs2_file_aio_read and ocfs2_file_aio_write are pointed to by the
operations struct. Does this still compile and work against a 2.6.24 kernel?
	--Mark

--
Mark Fasheh
Principal Software Developer, Oracle
mark.fasheh@oracle.com

  reply	other threads:[~2008-01-08 16:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03 11:22 [Ocfs2-devel] OCFS2 1.4 Repository Base (3rd attempt) Sunil Mushran
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
2008-01-08 16:20   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
2008-01-08 16:03   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
2008-01-08 13:16   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
2008-01-08 16:13   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
2008-01-08 16:22   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2008-01-08 16:17   ` Mark Fasheh [this message]
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
2008-01-08 15:43   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
2008-01-08 16:19   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
2008-01-08 16:05   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
2008-01-08 15:45   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
2008-01-08 13:20   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
2008-01-08 15:57   ` Mark Fasheh
2008-01-03 11:21 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
2008-01-08 13:22   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper inc_nlink Sunil Mushran
2008-01-08 13:24   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Define enum umh_wait Sunil Mushran
2008-01-08 13:25   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
2008-01-08 13:20   ` Mark Fasheh
2008-01-08 13:23     ` Sunil Mushran
2008-01-08 14:49       ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
2008-01-08 13:18   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
2008-01-08 15:45   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
2008-01-08 15:57   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle splice.h Sunil Mushran
2008-01-08 16:01   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
2008-01-08 16:15   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
2008-01-08 15:41   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Add helper drop_nlink Sunil Mushran
2008-01-08 13:24   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
2008-01-08 13:16   ` Mark Fasheh
2008-01-03 11:22 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
2008-01-08 15:45   ` Mark Fasheh
  -- strict thread matches above, loose matches on Subject: below --
2008-01-09 18:00 [Ocfs2-devel] OCFS2-1.4 Yet another drop Sunil Mushran
2008-01-09 18:00 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2007-12-31 14:25 [Ocfs2-devel] ocfs2-1.4: A new beginning - 2nd attempt Sunil Mushran
2007-12-31 14:25 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2007-12-24 13:28   ` Joel Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080109001715.GY23506@ca-server1.us.oracle.com \
    --to=mark.fasheh@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.