From: Joel Becker <jlbec@evilplan.org>
To: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Zach Brown <zab@zabbo.net>,
"Maxim V. Patlasov" <mpatlasov@parallels.com>,
Mark Fasheh <mfasheh@suse.com>,
ocfs2-devel@oss.oracle.com
Subject: Re: [PATCH V6 19/30] ocfs2: add support for read_iter, write_iter, and direct_IO_bvec
Date: Tue, 29 Jan 2013 16:59:16 -0800 [thread overview]
Message-ID: <20130130005915.GK26439@localhost> (raw)
In-Reply-To: <1359476623-10544-20-git-send-email-dave.kleikamp@oracle.com>
Acked-by: Joel Becker <jlbec@evilplan.org>
On Tue, Jan 29, 2013 at 10:23:32AM -0600, Dave Kleikamp wrote:
> From: Zach Brown <zab@zabbo.net>
>
> ocfs2's .aio_read and .aio_write methods are changed to take
> iov_iter and pass it to generic functions. Wrappers are made to pack
> the iovecs into iters and call these new functions.
>
> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> Cc: Zach Brown <zab@zabbo.net>
> Cc: Mark Fasheh <mfasheh@suse.com>
> Cc: Joel Becker <jlbec@evilplan.org>
> Cc: ocfs2-devel@oss.oracle.com
> ---
> fs/ocfs2/aops.h | 2 +-
> fs/ocfs2/file.c | 53 ++++++++++++++++++++++----------------------------
> fs/ocfs2/inode.h | 2 --
> fs/ocfs2/ocfs2_trace.h | 6 +++---
> 4 files changed, 27 insertions(+), 36 deletions(-)
>
> diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h
> index ffb2da3..bd0425a 100644
> --- a/fs/ocfs2/aops.h
> +++ b/fs/ocfs2/aops.h
> @@ -72,7 +72,7 @@ static inline void ocfs2_iocb_set_rw_locked(struct kiocb *iocb, int level)
> /*
> * Using a named enum representing lock types in terms of #N bit stored in
> * iocb->private, which is going to be used for communication between
> - * ocfs2_dio_end_io() and ocfs2_file_aio_write/read().
> + * ocfs2_dio_end_io() and ocfs2_file_write/read_iter().
> */
> enum ocfs2_iocb_lock_bits {
> OCFS2_IOCB_RW_LOCK = 0,
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 37d313e..94fc309 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -2219,15 +2219,13 @@ out:
> return ret;
> }
>
> -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_write_iter(struct kiocb *iocb,
> + struct iov_iter *iter,
> + loff_t pos)
> {
> int ret, direct_io, appending, rw_level, have_alloc_sem = 0;
> int can_do_direct, has_refcount = 0;
> ssize_t written = 0;
> - size_t ocount; /* original count */
> size_t count; /* after file limit checks */
> loff_t old_size, *ppos = &iocb->ki_pos;
> u32 old_clusters;
> @@ -2238,11 +2236,11 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
> OCFS2_MOUNT_COHERENCY_BUFFERED);
> int unaligned_dio = 0;
>
> - trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry,
> + trace_ocfs2_file_write_iter(inode, file, file->f_path.dentry,
> (unsigned long long)OCFS2_I(inode)->ip_blkno,
> file->f_path.dentry->d_name.len,
> file->f_path.dentry->d_name.name,
> - (unsigned int)nr_segs);
> + (unsigned long long)pos);
>
> if (iocb->ki_left == 0)
> return 0;
> @@ -2344,28 +2342,24 @@ relock:
> /* communicate with ocfs2_dio_end_io */
> ocfs2_iocb_set_rw_locked(iocb, rw_level);
>
> - ret = generic_segment_checks(iov, &nr_segs, &ocount,
> - VERIFY_READ);
> - if (ret)
> - goto out_dio;
>
> - count = ocount;
> + count = iov_iter_count(iter);
> ret = generic_write_checks(file, ppos, &count,
> S_ISBLK(inode->i_mode));
> if (ret)
> goto out_dio;
>
> if (direct_io) {
> - written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos,
> - ppos, count, ocount);
> + written = generic_file_direct_write_iter(iocb, iter, *ppos,
> + ppos, count);
> if (written < 0) {
> ret = written;
> goto out_dio;
> }
> } else {
> current->backing_dev_info = file->f_mapping->backing_dev_info;
> - written = generic_file_buffered_write(iocb, iov, nr_segs, *ppos,
> - ppos, count, 0);
> + written = generic_file_buffered_write_iter(iocb, iter, *ppos,
> + ppos, count, 0);
> current->backing_dev_info = NULL;
> }
>
> @@ -2524,7 +2518,7 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
> in->f_path.dentry->d_name.name, len);
>
> /*
> - * See the comment in ocfs2_file_aio_read()
> + * See the comment in ocfs2_file_read_iter()
> */
> ret = ocfs2_inode_lock_atime(inode, in->f_vfsmnt, &lock_level);
> if (ret < 0) {
> @@ -2539,19 +2533,18 @@ bail:
> return ret;
> }
>
> -static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
> - const struct iovec *iov,
> - unsigned long nr_segs,
> +static ssize_t ocfs2_file_read_iter(struct kiocb *iocb,
> + struct iov_iter *iter,
> loff_t pos)
> {
> int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
> struct file *filp = iocb->ki_filp;
> struct inode *inode = filp->f_path.dentry->d_inode;
>
> - trace_ocfs2_file_aio_read(inode, filp, filp->f_path.dentry,
> + trace_ocfs2_file_read_iter(inode, filp, filp->f_path.dentry,
> (unsigned long long)OCFS2_I(inode)->ip_blkno,
> filp->f_path.dentry->d_name.len,
> - filp->f_path.dentry->d_name.name, nr_segs);
> + filp->f_path.dentry->d_name.name, pos);
>
>
> if (!inode) {
> @@ -2587,7 +2580,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
> *
> * Take and drop the meta data lock to update inode fields
> * like i_size. This allows the checks down below
> - * generic_file_aio_read() a chance of actually working.
> + * generic_file_read_iter() a chance of actually working.
> */
> ret = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level);
> if (ret < 0) {
> @@ -2596,13 +2589,13 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
> }
> ocfs2_inode_unlock(inode, lock_level);
>
> - ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
> - trace_generic_file_aio_read_ret(ret);
> + ret = generic_file_read_iter(iocb, iter, iocb->ki_pos);
> + trace_generic_file_read_iter_ret(ret);
>
> /* buffered aio wouldn't have proper lock coverage today */
> BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT));
>
> - /* see ocfs2_file_aio_write */
> + /* see ocfs2_file_write_iter */
> if (ret == -EIOCBQUEUED || !ocfs2_iocb_is_rw_locked(iocb)) {
> rw_level = -1;
> have_alloc_sem = 0;
> @@ -2700,8 +2693,8 @@ const struct file_operations ocfs2_fops = {
> .fsync = ocfs2_sync_file,
> .release = ocfs2_file_release,
> .open = ocfs2_file_open,
> - .aio_read = ocfs2_file_aio_read,
> - .aio_write = ocfs2_file_aio_write,
> + .read_iter = ocfs2_file_read_iter,
> + .write_iter = ocfs2_file_write_iter,
> .unlocked_ioctl = ocfs2_ioctl,
> #ifdef CONFIG_COMPAT
> .compat_ioctl = ocfs2_compat_ioctl,
> @@ -2748,8 +2741,8 @@ const struct file_operations ocfs2_fops_no_plocks = {
> .fsync = ocfs2_sync_file,
> .release = ocfs2_file_release,
> .open = ocfs2_file_open,
> - .aio_read = ocfs2_file_aio_read,
> - .aio_write = ocfs2_file_aio_write,
> + .read_iter = ocfs2_file_read_iter,
> + .write_iter = ocfs2_file_write_iter,
> .unlocked_ioctl = ocfs2_ioctl,
> #ifdef CONFIG_COMPAT
> .compat_ioctl = ocfs2_compat_ioctl,
> diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
> index 88924a3..621fc73 100644
> --- a/fs/ocfs2/inode.h
> +++ b/fs/ocfs2/inode.h
> @@ -147,8 +147,6 @@ void ocfs2_refresh_inode(struct inode *inode,
> int ocfs2_mark_inode_dirty(handle_t *handle,
> struct inode *inode,
> struct buffer_head *bh);
> -int ocfs2_aio_read(struct file *file, struct kiocb *req, struct iocb *iocb);
> -int ocfs2_aio_write(struct file *file, struct kiocb *req, struct iocb *iocb);
> struct buffer_head *ocfs2_bread(struct inode *inode,
> int block, int *err, int reada);
>
> diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h
> index 3b481f4..1c5018c 100644
> --- a/fs/ocfs2/ocfs2_trace.h
> +++ b/fs/ocfs2/ocfs2_trace.h
> @@ -1310,13 +1310,13 @@ DEFINE_OCFS2_FILE_OPS(ocfs2_file_release);
>
> DEFINE_OCFS2_FILE_OPS(ocfs2_sync_file);
>
> -DEFINE_OCFS2_FILE_OPS(ocfs2_file_aio_write);
> +DEFINE_OCFS2_FILE_OPS(ocfs2_file_write_iter);
>
> DEFINE_OCFS2_FILE_OPS(ocfs2_file_splice_write);
>
> DEFINE_OCFS2_FILE_OPS(ocfs2_file_splice_read);
>
> -DEFINE_OCFS2_FILE_OPS(ocfs2_file_aio_read);
> +DEFINE_OCFS2_FILE_OPS(ocfs2_file_read_iter);
>
> DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_truncate_file);
>
> @@ -1474,7 +1474,7 @@ TRACE_EVENT(ocfs2_prepare_inode_for_write,
> __entry->direct_io, __entry->has_refcount)
> );
>
> -DEFINE_OCFS2_INT_EVENT(generic_file_aio_read_ret);
> +DEFINE_OCFS2_INT_EVENT(generic_file_read_iter_ret);
>
> /* End of trace events for fs/ocfs2/file.c. */
>
> --
> 1.8.1.1
>
--
"Win95 file and print sharing are for relatively friendly nets."
- Paul Leach, Microsoft
http://www.jlbec.org/
jlbec@evilplan.org
next prev parent reply other threads:[~2013-01-30 0:59 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 16:23 [PATCH V6 00/30] loop: Issue O_DIRECT aio using bio_vec Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 01/30] iov_iter: move into its own file Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 02/30] iov_iter: iov_iter_copy_from_user() should use non-atomic copy Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 03/30] iov_iter: add copy_to_user support Dave Kleikamp
[not found] ` <1359476623-10544-1-git-send-email-dave.kleikamp-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-01-29 16:23 ` [PATCH V6 04/30] fuse: convert fuse to use iov_iter_copy_[to|from]_user Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 05/30] iov_iter: hide iovec details behind ops function pointers Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 06/30] iov_iter: add bvec support Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 07/30] iov_iter: add a shorten call Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 08/30] iov_iter: let callers extract iovecs and bio_vecs Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 09/30] dio: Convert direct_IO to use iov_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 10/30] dio: add bio_vec support to __blockdev_direct_IO() Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 11/30] fs: pull iov_iter use higher up the stack Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 12/30] aio: add aio_kernel_() interface Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 13/30] aio: add aio support for iov_iter arguments Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 14/30] bio: add bvec_length(), like iov_length() Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 15/30] loop: use aio to perform io on the underlying file Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 16/30] fs: create file_readable() and file_writable() functions Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 17/30] fs: use read_iter and write_iter rather than aio_read and aio_write Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 18/30] fs: add read_iter and write_iter to several file systems Dave Kleikamp
2013-02-01 7:51 ` Artem Bityutskiy
2013-02-01 20:40 ` Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 19/30] ocfs2: add support for read_iter, write_iter, and direct_IO_bvec Dave Kleikamp
2013-01-30 0:59 ` Joel Becker [this message]
2013-01-29 16:23 ` [PATCH V6 20/30] ext4: add support for read_iter and write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 21/30] nfs: add support for read_iter, write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 22/30] nfs: simplify swap Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 23/30] btrfs: add support for read_iter and write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 24/30] block_dev: add support for read_iter, write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 25/30] xfs: add support for read_iter and write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 26/30] gfs2: Convert aio_read/write ops to read/write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 27/30] udf: convert file ops from aio_read/write " Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 28/30] afs: add support for read_iter and write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 29/30] ecrpytfs: Convert aio_read/write ops to read/write_iter Dave Kleikamp
2013-01-29 16:23 ` [PATCH V6 30/30] ubifs: convert file ops from aio_read/write " Dave Kleikamp
2013-01-29 18:42 ` [PATCH V6 00/30] loop: Issue O_DIRECT aio using bio_vec Jeff Moyer
2013-01-29 18:45 ` Dave Kleikamp
2013-01-30 3:22 ` Dave Kleikamp
2013-01-30 19:23 ` Jeff Moyer
2013-01-30 19:26 ` Dave Kleikamp
2013-02-18 21:42 ` Sedat Dilek
2013-02-18 22:14 ` Dave Kleikamp
2013-01-29 23:38 ` [PATCH V6 18/30] fs: add read_iter and write_iter to several file systems Dave Kleikamp
2013-01-30 0:52 ` Dave Kleikamp
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=20130130005915.GK26439@localhost \
--to=jlbec@evilplan.org \
--cc=dave.kleikamp@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=mpatlasov@parallels.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=viro@zeniv.linux.org.uk \
--cc=zab@zabbo.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).