All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
To: dsterba-AlSwsSmVLrQ@public.gmane.org,
	Omar Sandoval <osandov-nWWhXC5lh1RBDgjK7y7TUQ@public.gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	osd-dev-yNzVSZO3znNg9hUCZPvPmw@public.gmane.org,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-f2fs-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	jfs-discussion-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	HPDD-discuss-y27Ovi1pjclAfugRpC6u6w@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ocfs2-devel-N0ozoZBvEnrZJqsBc5GL+g@public.gmane.org,
	reiserfs-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Chris Mason <clm-b10kYP2dOMg@public.gmane.org>,
	Josef Bacik <jbacik-b10kYP2dOMg@public.gmane.org>,
	Yan Zheng <zyan-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Sage Weil <sage-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	Boaz Harrosh <ooo-rh7Tgz9RNieUD9Wbbkgo/g@public.gmane.org>,
	Benny Halevy <bhalevy-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>,
	Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>
Subject: Re: [RFC PATCH 1/5] new helper: iov_iter_rw()
Date: Tue, 17 Mar 2015 18:19:15 +0000	[thread overview]
Message-ID: <20150317181910.GK29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150317093151.GS20767-1ReQVI26iDCaZKY3DrU6dA@public.gmane.org>

On Tue, Mar 17, 2015 at 10:31:51AM +0100, David Sterba wrote:

> Agreed, but the proposed define is rather cryptic and I was not able to
> understand the meaning on the first glance.
> 
> > #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
> 
> This worked for me, does not compile with anything else than
> 'struct iov_iter*' as i:
> 
> #define iov_iter_rw(i)	({			\
> 	struct iov_iter __iter = *(i);		\
> 	(i)->type & RW_MASK;			\
> 	})
> 
> The assignment is optimized out.

... and you are getting
	a) use of rather lousy gccism when plain C would do
	b) double evaluation since you've got it wrong (should've been
__iter.type & RW_MASK, if you do it that way).  As it is, if argument has
any side effects, your variant will trigger those twice - even if the
destination of the assignment is never used, the side effects remain.

I agree that it could use /* use ?: for typechecking */, but let's not go into
({...}) land unless we absolutely have to.
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [RFC PATCH 1/5] new helper: iov_iter_rw()
Date: Tue, 17 Mar 2015 18:19:15 +0000	[thread overview]
Message-ID: <20150317181910.GK29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150317093151.GS20767@twin.jikos.cz>

On Tue, Mar 17, 2015 at 10:31:51AM +0100, David Sterba wrote:

> Agreed, but the proposed define is rather cryptic and I was not able to
> understand the meaning on the first glance.
> 
> > #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
> 
> This worked for me, does not compile with anything else than
> 'struct iov_iter*' as i:
> 
> #define iov_iter_rw(i)	({			\
> 	struct iov_iter __iter = *(i);		\
> 	(i)->type & RW_MASK;			\
> 	})
> 
> The assignment is optimized out.

... and you are getting
	a) use of rather lousy gccism when plain C would do
	b) double evaluation since you've got it wrong (should've been
__iter.type & RW_MASK, if you do it that way).  As it is, if argument has
any side effects, your variant will trigger those twice - even if the
destination of the assignment is never used, the side effects remain.

I agree that it could use /* use ?: for typechecking */, but let's not go into
({...}) land unless we absolutely have to.



WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
To: dsterba-AlSwsSmVLrQ@public.gmane.org,
	Omar Sandoval <osandov-nWWhXC5lh1RBDgjK7y7TUQ@public.gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	osd-dev-yNzVSZO3znNg9hUCZPvPmw@public.gmane.org,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-f2fs-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	jfs-discussion-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	HPDD-discuss-y27Ovi1pjclAfugRpC6u6w@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ocfs2-devel-N0ozoZBvEnrZJqsBc5GL+g@public.gmane.org,
	reiserfs-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Chris Mason <clm-b10kYP2dOMg@public.gmane.org>,
	Josef Bacik <jbacik-b10kYP2dOMg@public.gmane.org>,
	Yan Zheng <zyan-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Sage Weil <sage-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	Boaz Harrosh <ooo-rh7Tgz9RNieUD9Wbbkgo/g@public.gmane.org>,
	Benny Halevy <bhalevy-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>,
	Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>,
	Andreas Dilger <
Subject: Re: [RFC PATCH 1/5] new helper: iov_iter_rw()
Date: Tue, 17 Mar 2015 18:19:15 +0000	[thread overview]
Message-ID: <20150317181910.GK29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150317093151.GS20767-1ReQVI26iDCaZKY3DrU6dA@public.gmane.org>

On Tue, Mar 17, 2015 at 10:31:51AM +0100, David Sterba wrote:

> Agreed, but the proposed define is rather cryptic and I was not able to
> understand the meaning on the first glance.
> 
> > #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
> 
> This worked for me, does not compile with anything else than
> 'struct iov_iter*' as i:
> 
> #define iov_iter_rw(i)	({			\
> 	struct iov_iter __iter = *(i);		\
> 	(i)->type & RW_MASK;			\
> 	})
> 
> The assignment is optimized out.

... and you are getting
	a) use of rather lousy gccism when plain C would do
	b) double evaluation since you've got it wrong (should've been
__iter.type & RW_MASK, if you do it that way).  As it is, if argument has
any side effects, your variant will trigger those twice - even if the
destination of the assignment is never used, the side effects remain.

I agree that it could use /* use ?: for typechecking */, but let's not go into
({...}) land unless we absolutely have to.
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: dsterba@suse.cz, Omar Sandoval <osandov@osandov.com>,
	linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org,
	osd-dev@open-osd.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	fuse-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	jfs-discussion@lists.sourceforge.net, HPDD-discuss@ml01.01.org,
	linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org,
	v9fs-developer@lists.sourceforge.net, xfs@oss.sgi.com,
	linux-kernel@vger.kernel.org, Chris Mason <clm@fb.com>,
	Josef Bacik <jbacik@fb.com>, Yan Zheng <zyan@redhat.com>,
	Sage Weil <sage@redhat.com>, Steve French <sfrench@samba.org>,
	Boaz Harrosh <ooo@electrozaur.com>,
	Benny Halevy <bhalevy@primarydata.com>, Jan Kara <jack@suse.cz>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Changman Lee <cm224.lee@samsung.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Steven Whitehouse <swhiteho@redhat.com>,
	Dave Kleikamp <shaggy@kernel.org>,
	Oleg Drokin <oleg.drokin@intel.com>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>,
	Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>,
	Eric Van Hensbergen <ericvh@gmail.com>,
	Ron Minnich <rminnich@sandia.gov>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Dave Chinner <david@fromorbit.com>
Subject: Re: [RFC PATCH 1/5] new helper: iov_iter_rw()
Date: Tue, 17 Mar 2015 18:19:15 +0000	[thread overview]
Message-ID: <20150317181910.GK29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150317093151.GS20767@twin.jikos.cz>

On Tue, Mar 17, 2015 at 10:31:51AM +0100, David Sterba wrote:

> Agreed, but the proposed define is rather cryptic and I was not able to
> understand the meaning on the first glance.
> 
> > #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
> 
> This worked for me, does not compile with anything else than
> 'struct iov_iter*' as i:
> 
> #define iov_iter_rw(i)	({			\
> 	struct iov_iter __iter = *(i);		\
> 	(i)->type & RW_MASK;			\
> 	})
> 
> The assignment is optimized out.

... and you are getting
	a) use of rather lousy gccism when plain C would do
	b) double evaluation since you've got it wrong (should've been
__iter.type & RW_MASK, if you do it that way).  As it is, if argument has
any side effects, your variant will trigger those twice - even if the
destination of the assignment is never used, the side effects remain.

I agree that it could use /* use ?: for typechecking */, but let's not go into
({...}) land unless we absolutely have to.

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
To: dsterba-AlSwsSmVLrQ@public.gmane.org,
	Omar Sandoval <osandov-nWWhXC5lh1RBDgjK7y7TUQ@public.gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	osd-dev-yNzVSZO3znNg9hUCZPvPmw@public.gmane.org,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-f2fs-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	jfs-discussion-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	HPDD-discuss-y27Ovi1pjclAfugRpC6u6w@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ocfs2-devel-N0ozoZBvEnrZJqsBc5GL+g@public.gmane.org,
	reiserfs-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Chris Mason <clm-b10kYP2dOMg@public.gmane.org>,
	Josef Bacik <jbacik-b10kYP2dOMg@public.gmane.org>,
	Yan Zheng <zyan-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Sage Weil <sage-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	Boaz Harrosh <ooo-rh7Tgz9RNieUD9Wbbkgo/g@public.gmane.org>,
	Benny Halevy <bhalevy-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>,
	Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>,
	Andreas Dilger <>
Subject: Re: [RFC PATCH 1/5] new helper: iov_iter_rw()
Date: Tue, 17 Mar 2015 18:19:15 +0000	[thread overview]
Message-ID: <20150317181910.GK29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150317093151.GS20767-1ReQVI26iDCaZKY3DrU6dA@public.gmane.org>

On Tue, Mar 17, 2015 at 10:31:51AM +0100, David Sterba wrote:

> Agreed, but the proposed define is rather cryptic and I was not able to
> understand the meaning on the first glance.
> 
> > #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
> 
> This worked for me, does not compile with anything else than
> 'struct iov_iter*' as i:
> 
> #define iov_iter_rw(i)	({			\
> 	struct iov_iter __iter = *(i);		\
> 	(i)->type & RW_MASK;			\
> 	})
> 
> The assignment is optimized out.

... and you are getting
	a) use of rather lousy gccism when plain C would do
	b) double evaluation since you've got it wrong (should've been
__iter.type & RW_MASK, if you do it that way).  As it is, if argument has
any side effects, your variant will trigger those twice - even if the
destination of the assignment is never used, the side effects remain.

I agree that it could use /* use ?: for typechecking */, but let's not go into
({...}) land unless we absolutely have to.
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: dsterba@suse.cz, Omar Sandoval <osandov@osandov.com>,
	linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org,
	osd-dev@open-osd.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	fuse-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	jfs-discussion@lists.sourceforge.net, HPDD-discuss@ml01.01.org,
	linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org,
	v9fs-developer@lists.sourceforge.net, xfs@oss.sgi.com,
	linux-kernel@vger.kernel.org, Chris Mason <clm@fb.com>,
	Josef Bacik <jbacik@fb.com>, Yan Zheng <zyan@redhat.com>,
	Sage Weil <sage@redhat.com>, Steve French <sfrench@samba.org>,
	Boaz Harrosh <ooo@electrozaur.com>,
	Benny Halevy <bhalevy@primarydata.com>, Jan Kara <jack@suse.cz>,
	Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Changman Lee <cm224.lee@samsung.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Steven Whitehouse <swhiteho@redhat.com>,
	Dave Kleikamp <shaggy@kernel.org>,
	Oleg Drokin <oleg.drokin@intel.com>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>,
	Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>,
	Eric Van Hensbergen <ericvh@gmail.com>,
	Ron Minnich <rminnich@sandia.gov>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Dave Chinner <david@fromorbit.com>
Subject: Re: [RFC PATCH 1/5] new helper: iov_iter_rw()
Date: Tue, 17 Mar 2015 18:19:15 +0000	[thread overview]
Message-ID: <20150317181910.GK29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150317093151.GS20767@twin.jikos.cz>

On Tue, Mar 17, 2015 at 10:31:51AM +0100, David Sterba wrote:

> Agreed, but the proposed define is rather cryptic and I was not able to
> understand the meaning on the first glance.
> 
> > #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
> 
> This worked for me, does not compile with anything else than
> 'struct iov_iter*' as i:
> 
> #define iov_iter_rw(i)	({			\
> 	struct iov_iter __iter = *(i);		\
> 	(i)->type & RW_MASK;			\
> 	})
> 
> The assignment is optimized out.

... and you are getting
	a) use of rather lousy gccism when plain C would do
	b) double evaluation since you've got it wrong (should've been
__iter.type & RW_MASK, if you do it that way).  As it is, if argument has
any side effects, your variant will trigger those twice - even if the
destination of the assignment is never used, the side effects remain.

I agree that it could use /* use ?: for typechecking */, but let's not go into
({...}) land unless we absolutely have to.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: dsterba-AlSwsSmVLrQ@public.gmane.org,
	Omar Sandoval <osandov-nWWhXC5lh1RBDgjK7y7TUQ@public.gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	osd-dev-yNzVSZO3znNg9hUCZPvPmw@public.gmane.org,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-f2fs-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	jfs-discussion-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	HPDD-discuss-y27Ovi1pjclAfugRpC6u6w@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ocfs2-devel-N0ozoZBvEnrZJqsBc5GL+g@public.gmane.org,
	reiserfs-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Chris Mason <clm-b10kYP2dOMg@public.gmane.org>,
	Josef Bacik <jbacik-b10kYP2dOMg@public.gmane.org>,
	Yan Zheng <zyan-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Sage Weil <sage-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	Boaz Harrosh <ooo-rh7Tgz9RNieUD9Wbbkgo/g@public.gmane.org>,
	Benny Halevy <bhalevy-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>,
	Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>
Subject: [Ocfs2-devel] [RFC PATCH 1/5] new helper: iov_iter_rw()
Date: Tue, 17 Mar 2015 18:19:15 +0000	[thread overview]
Message-ID: <20150317181910.GK29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150317093151.GS20767@twin.jikos.cz>

On Tue, Mar 17, 2015 at 10:31:51AM +0100, David Sterba wrote:

> Agreed, but the proposed define is rather cryptic and I was not able to
> understand the meaning on the first glance.
> 
> > #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
> 
> This worked for me, does not compile with anything else than
> 'struct iov_iter*' as i:
> 
> #define iov_iter_rw(i)	({			\
> 	struct iov_iter __iter = *(i);		\
> 	(i)->type & RW_MASK;			\
> 	})
> 
> The assignment is optimized out.

... and you are getting
	a) use of rather lousy gccism when plain C would do
	b) double evaluation since you've got it wrong (should've been
__iter.type & RW_MASK, if you do it that way).  As it is, if argument has
any side effects, your variant will trigger those twice - even if the
destination of the assignment is never used, the side effects remain.

I agree that it could use /* use ?: for typechecking */, but let's not go into
({...}) land unless we absolutely have to.

  parent reply	other threads:[~2015-03-17 18:19 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 11:33 [RFC PATCH 0/5] Remove rw parameter from direct_IO() Omar Sandoval
2015-03-16 11:33 ` [Ocfs2-devel] " Omar Sandoval
2015-03-16 11:33 ` Omar Sandoval
2015-03-16 11:33 ` Omar Sandoval
2015-03-16 11:33 ` Omar Sandoval
2015-03-16 11:33 ` [Cluster-devel] " Omar Sandoval
2015-03-16 11:33 ` [RFC PATCH 1/5] new helper: iov_iter_rw() Omar Sandoval
2015-03-16 11:33   ` [Ocfs2-devel] " Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` [Cluster-devel] " Omar Sandoval
2015-03-16 17:36   ` Al Viro
2015-03-16 17:36     ` [Ocfs2-devel] " Al Viro
2015-03-16 17:36     ` Al Viro
2015-03-16 17:36     ` Al Viro
2015-03-16 17:36     ` Al Viro
2015-03-16 17:36     ` [Cluster-devel] " Al Viro
2015-03-17  1:20     ` [RFC PATCH v2 " Omar Sandoval
2015-03-17  9:31     ` [RFC PATCH " David Sterba
2015-03-17  9:31       ` [Ocfs2-devel] " David Sterba
2015-03-17  9:31       ` David Sterba
2015-03-17  9:31       ` David Sterba
2015-03-17  9:31       ` [Cluster-devel] " David Sterba
2015-03-17 10:18       ` Omar Sandoval
2015-03-17 10:18         ` [Ocfs2-devel] " Omar Sandoval
2015-03-17 10:18         ` Omar Sandoval
2015-03-17 10:18         ` [Cluster-devel] " Omar Sandoval
     [not found]       ` <20150317093151.GS20767-1ReQVI26iDCaZKY3DrU6dA@public.gmane.org>
2015-03-17 18:19         ` Al Viro [this message]
2015-03-17 18:19           ` [Ocfs2-devel] " Al Viro
2015-03-17 18:19           ` Al Viro
2015-03-17 18:19           ` Al Viro
2015-03-17 18:19           ` Al Viro
2015-03-17 18:19           ` Al Viro
2015-03-17 18:19           ` [Cluster-devel] " Al Viro
2015-03-17 21:04           ` [RFC PATCH v3 " Omar Sandoval
2015-03-18 13:42             ` David Sterba
2015-03-16 11:33 ` [RFC PATCH 2/5] Remove rw from {,__,do_}blockdev_direct_IO() Omar Sandoval
2015-03-16 11:33   ` [Ocfs2-devel] [RFC PATCH 2/5] Remove rw from {, __, do_}blockdev_direct_IO() Omar Sandoval
2015-03-16 11:33   ` [RFC PATCH 2/5] Remove rw from {,__,do_}blockdev_direct_IO() Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` [Cluster-devel] [RFC PATCH 2/5] Remove rw from {, __, do_}blockdev_direct_IO() Omar Sandoval
2015-03-16 11:33 ` [RFC PATCH 3/5] Remove rw from dax_{do_,}io() Omar Sandoval
2015-03-16 11:33   ` [Ocfs2-devel] " Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` [Cluster-devel] " Omar Sandoval
2015-03-16 11:33 ` [RFC PATCH 5/5] direct_IO: remove rw from a_ops->direct_IO() Omar Sandoval
2015-03-16 11:33   ` [Ocfs2-devel] " Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` Omar Sandoval
2015-03-16 11:33   ` [Cluster-devel] " Omar Sandoval
     [not found] ` <cover.1426502566.git.osandov-nWWhXC5lh1RBDgjK7y7TUQ@public.gmane.org>
2015-03-16 11:33   ` [RFC PATCH 4/5] direct_IO: use iov_iter_rw() instead of rw everywhere Omar Sandoval
2015-03-16 11:33     ` [Ocfs2-devel] " Omar Sandoval
2015-03-16 11:33     ` Omar Sandoval
2015-03-16 11:33     ` Omar Sandoval
2015-03-16 11:33     ` Omar Sandoval
2015-03-16 11:33     ` [Cluster-devel] " Omar Sandoval
2015-03-16 18:15   ` [RFC PATCH 0/5] Remove rw parameter from direct_IO() Al Viro
2015-03-16 18:15     ` [Ocfs2-devel] " Al Viro
2015-03-16 18:15     ` Al Viro
2015-03-16 18:15     ` Al Viro
2015-03-16 18:15     ` Al Viro
2015-03-16 18:15     ` [Cluster-devel] " Al Viro
2015-04-05 16:27   ` Al Viro
2015-04-05 16:27     ` [Ocfs2-devel] " Al Viro
2015-04-05 16:27     ` Al Viro
2015-04-05 16:27     ` Al Viro
2015-04-05 16:27     ` Al Viro
2015-04-05 16:27     ` [Cluster-devel] " Al Viro

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=20150317181910.GK29656@ZenIV.linux.org.uk \
    --to=viro-3bdd1+5odreifsdqtta3olvcufugdwfn@public.gmane.org \
    --cc=HPDD-discuss-y27Ovi1pjclAfugRpC6u6w@public.gmane.org \
    --cc=bhalevy-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org \
    --cc=ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=clm-b10kYP2dOMg@public.gmane.org \
    --cc=cluster-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dsterba-AlSwsSmVLrQ@public.gmane.org \
    --cc=fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=jack-AlSwsSmVLrQ@public.gmane.org \
    --cc=jbacik-b10kYP2dOMg@public.gmane.org \
    --cc=jfs-discussion-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-f2fs-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ocfs2-devel-N0ozoZBvEnrZJqsBc5GL+g@public.gmane.org \
    --cc=ooo-rh7Tgz9RNieUD9Wbbkgo/g@public.gmane.org \
    --cc=osandov-nWWhXC5lh1RBDgjK7y7TUQ@public.gmane.org \
    --cc=osd-dev-yNzVSZO3znNg9hUCZPvPmw@public.gmane.org \
    --cc=reiserfs-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sage-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=tytso-3s7WtUTddSA@public.gmane.org \
    --cc=v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org \
    --cc=zyan-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /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.