All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: David Howells <dhowells@redhat.com>, viro@zeniv.linux.org.uk
Cc: dhowells@redhat.com, linux-afs@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/25] iov_iter: Use accessor function [ver #2]
Date: Wed, 28 Nov 2018 12:39:38 +1100	[thread overview]
Message-ID: <87efb6ou91.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <154033907731.12041.15677154092495801379.stgit@warthog.procyon.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2675 bytes --]

On Wed, Oct 24 2018, David Howells wrote:

> Use accessor functions to access an iterator's type and direction.  This
> allows for the possibility of using some other method of determining the
> type of iterator than if-chains with bitwise-AND conditions.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
....
> @@ -74,7 +104,8 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
>  }
>  
>  #define iov_for_each(iov, iter, start)				\
> -	if (!((start).type & (ITER_BVEC | ITER_PIPE)))		\
> +	if (iov_iter_type(start) == ITER_IOVEC ||		\
> +	    iov_iter_type(start) == ITER_KVEC)			\
>  	for (iter = (start);					\
>  	     (iter).count &&					\
>  	     ((iov = iov_iter_iovec(&(iter))), 1);		\

BTW this breaks iov_for_each().
'start' is a struct, but iov_iter_type() requires a pointer to a struct.
You could fix it with
> +	if (iov_iter_type(&start) == ITER_IOVEC ||		\
> +	    iov_iter_type(&start) == ITER_KVEC)			\

but as there are no users it is probably best to discard it.
I discovered this because lustre uses (or rather "used") it.

NeilBrown

From: NeilBrown <neilb@suse.com>
Date: Wed, 28 Nov 2018 12:38:30 +1100
Subject: [PATCH] iov_iter: discard iov_for_each()

iov_for_each has no users and cannot compile
as 'start' is treated sometimes like a struct
and sometimes like a pointer to a struct.

So discard it.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 .clang-format       | 1 -
 include/linux/uio.h | 8 --------
 2 files changed, 9 deletions(-)

diff --git a/.clang-format b/.clang-format
index e6080f5834a3..c144d9c24d5d 100644
--- a/.clang-format
+++ b/.clang-format
@@ -259,7 +259,6 @@ ForEachMacros:
   - 'idr_for_each_entry_ul'
   - 'inet_bind_bucket_for_each'
   - 'inet_lhash2_for_each_icsk_rcu'
-  - 'iov_for_each'
   - 'key_for_each'
   - 'key_for_each_safe'
   - 'klp_for_each_func'
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 55ce99ddb912..a2b2109838b0 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -109,14 +109,6 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
 	};
 }
 
-#define iov_for_each(iov, iter, start)				\
-	if (iov_iter_type(start) == ITER_IOVEC ||		\
-	    iov_iter_type(start) == ITER_KVEC)			\
-	for (iter = (start);					\
-	     (iter).count &&					\
-	     ((iov = iov_iter_iovec(&(iter))), 1);		\
-	     iov_iter_advance(&(iter), (iov).iov_len))
-
 size_t iov_iter_copy_from_user_atomic(struct page *page,
 		struct iov_iter *i, unsigned long offset, size_t bytes);
 void iov_iter_advance(struct iov_iter *i, size_t bytes);
-- 
2.14.0.rc0.dirty


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2018-11-28  1:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 23:57 [PATCH 00/25] AFS development [ver #2] David Howells
2018-10-23 23:57 ` [PATCH 01/25] amd-gpu: Don't undefine READ and WRITE " David Howells
2018-11-01 22:06   ` Pavel Machek
2018-10-23 23:57 ` [PATCH 02/25] iov_iter: Use accessor function " David Howells
2018-11-28  1:39   ` NeilBrown [this message]
2018-10-23 23:58 ` [PATCH 03/25] iov_iter: Separate type from direction and use accessor functions " David Howells
2018-10-23 23:58 ` [PATCH 04/25] iov_iter: Add I/O discard iterator " David Howells
2018-10-23 23:58 ` [PATCH 05/25] afs: Better tracing of protocol errors " David Howells
2018-10-23 23:58 ` [PATCH 06/25] afs: Set up the iov_iter before calling afs_extract_data() " David Howells
2018-10-23 23:58 ` [PATCH 07/25] afs: Improve FS server rotation error handling " David Howells
2018-10-23 23:58 ` [PATCH 08/25] afs: Implement VL server rotation " David Howells
2018-10-23 23:58 ` [PATCH 09/25] afs: Fix TTL on VL server and address lists " David Howells
2018-10-23 23:59 ` [PATCH 10/25] afs: Handle EIO from delivery function " David Howells
2018-10-23 23:59 ` [PATCH 11/25] afs: Add a couple of tracepoints to log I/O errors " David Howells
2018-10-23 23:59 ` [PATCH 12/25] afs: Don't invoke the server to read data beyond EOF " David Howells
2018-10-23 23:59 ` [PATCH 13/25] afs: Increase to 64-bit volume ID and 96-bit vnode ID for YFS " David Howells
2018-10-23 23:59 ` [PATCH 14/25] afs: Commit the status on a new file/dir/symlink " David Howells
2018-10-23 23:59 ` [PATCH 15/25] afs: Remove callback details from afs_callback_break struct " David Howells
2018-10-23 23:59 ` [PATCH 16/25] afs: Implement the YFS cache manager service " David Howells
2018-10-23 23:59 ` [PATCH 17/25] afs: Fix FS.FetchStatus delivery from updating wrong vnode " David Howells
2018-10-23 23:59 ` [PATCH 18/25] afs: Calc callback expiry in op reply delivery " David Howells
2018-10-24  0:00 ` [PATCH 19/25] afs: Get the target vnode in afs_rmdir() and get a callback on it " David Howells
2018-10-24  0:00 ` [PATCH 20/25] afs: Expand data structure fields to support YFS " David Howells
2018-10-24  0:00 ` [PATCH 21/25] afs: Implement YFS support in the fs client " David Howells
2018-10-24  0:00 ` [PATCH 22/25] afs: Allow dumping of server cursor on operation failure " David Howells
2018-10-24  0:00 ` [PATCH 23/25] afs: Eliminate the address pointer from the address list cursor " David Howells
2018-10-24  0:00 ` [PATCH 24/25] afs: Fix callback handling " David Howells
2018-10-24  0:00 ` [PATCH 25/25] afs: Probe multiple fileservers simultaneously " David Howells

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=87efb6ou91.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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.