remarkable-linux/fs/ocfs2
Sasha Levin b67bfe0d42 hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived

        list_for_each_entry(pos, head, member)

The hlist ones were greedy and wanted an extra parameter:

        hlist_for_each_entry(tpos, pos, head, member)

Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.

Besides the semantic patch, there was some manual work required:

 - Fix up the actual hlist iterators in linux/list.h
 - Fix up the declaration of other iterators based on the hlist ones.
 - A very small amount of places were using the 'node' parameter, this
 was modified to use 'obj->member' instead.
 - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
 properly, so those had to be fixed up manually.

The semantic patch which is mostly the work of Peter Senna Tschudin is here:

@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

type T;
expression a,c,d,e;
identifier b;
statement S;
@@

-T b;
    <+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
    ...+>

[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:24 -08:00
..
cluster ocfs2: convert to idr_alloc() 2013-02-27 19:10:19 -08:00
dlm hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
dlmfs new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
acl.c ocfs2: Handle kuids and kgids in acl/xattr conversions. 2013-02-13 06:00:56 -08:00
acl.h fs: take the ACL checks to common code 2011-07-25 14:30:23 -04:00
alloc.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
alloc.h ocfs2: Add ocfs2_trim_fs for SSD trim support. 2011-05-23 23:37:18 -07:00
aops.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
aops.h ocfs2: serialize unaligned aio 2011-07-28 02:07:16 -07:00
blockcheck.c ocfs2: kill endianness abuses in blockcheck.c 2012-05-29 23:28:35 -04:00
blockcheck.h
buffer_head_io.c ocfs2: Remove masklog ML_UPTODATE. 2011-02-24 16:22:20 +08:00
buffer_head_io.h ocfs2: Take the inode out of the metadata read/write paths. 2009-09-04 16:07:48 -07:00
dcache.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
dcache.h Track negative entries v3 2010-09-10 09:18:15 -07:00
dir.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
dir.h
dlmglue.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2013-02-25 16:00:49 -08:00
dlmglue.h ocfs2: Fix lockdep warning in reflink. 2010-09-10 09:19:06 -07:00
export.c fs: encode_fh: return FILEID_INVALID if invalid fid_type 2013-02-26 02:46:10 -05:00
export.h
extent_map.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
extent_map.h ocfs2: Implement llseek() 2011-07-25 14:58:15 -07:00
file.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
file.h ->permission() sanitizing: don't pass flags to ->permission() 2011-07-20 01:43:24 -04:00
heartbeat.c ocfs2: Remove mlog(0) from fs/ocfs2/heartbeat.c 2011-02-23 21:17:39 +08:00
heartbeat.h
inode.c ocfs2: Convert uid and gids between in core and on disk inodes 2013-02-13 06:00:58 -08:00
inode.h ocfs2: serialize unaligned aio 2011-07-28 02:07:16 -07:00
ioctl.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
ioctl.h Ocfs2: Move ocfs2 ioctl definitions from ocfs2_fs.h to newly added ocfs2_ioctl.h 2010-03-02 14:10:20 -08:00
journal.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
journal.h ocfs2: Add a missing journal credit in ocfs2_link_credits() -v2 2011-11-17 01:46:48 -08:00
Kconfig ocfs2: Make OCFS2_FS depend on CONFIGFS_FS 2011-01-16 21:22:40 +00:00
localalloc.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
localalloc.h ocfs2: increase the default size of local alloc windows 2010-05-05 18:18:07 -07:00
locks.c ocfs2: remove INODE from unused files. 2011-02-21 11:18:23 +08:00
locks.h
Makefile Ocfs2/move_extents: Add basic framework and source files for extent moving. 2011-05-25 15:17:08 +08:00
mmap.c kill f_vfsmnt 2013-02-26 02:46:10 -05:00
mmap.h
move_extents.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
move_extents.h Ocfs2/move_extents: move/defrag extents within a certain range. 2011-05-25 15:17:12 +08:00
namei.c ocfs2: Convert uid and gids between in core and on disk inodes 2013-02-13 06:00:58 -08:00
namei.h ocfs2: Create reflinked file in orphan dir. 2009-09-22 20:09:48 -07:00
ocfs1_fs_compat.h
ocfs2.h ocfs2: avoid unaligned access to dqc_bitmap 2011-12-01 14:39:32 -08:00
ocfs2_fs.h Revert wrong fixes for common misspellings 2011-04-26 23:31:11 -07:00
ocfs2_ioctl.h Ocfs2/move_extents: Adding new ioctl code 'OCFS2_IOC_MOVE_EXT' to ocfs2. 2011-05-25 15:17:08 +08:00
ocfs2_lockid.h ocfs2: Add new refcount tree lock resource in dlmglue. 2009-09-22 20:09:28 -07:00
ocfs2_lockingver.h ocfs2_dlmfs: Enable the use of user cluster stacks. 2010-02-26 15:41:18 -08:00
ocfs2_trace.h ocfs2: Add trace event for trim. 2011-05-23 23:37:20 -07:00
quota.h ocfs2: use system_wq instead of ocfs2_quota_wq 2011-02-01 11:42:42 +01:00
quota_global.c userns: Convert struct dquot dq_id to be a struct kqid 2012-09-18 01:01:41 -07:00
quota_local.c userns: Convert struct dquot dq_id to be a struct kqid 2012-09-18 01:01:41 -07:00
refcounttree.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
refcounttree.h Ocfs2/refcounttree: Publicize couple of funcs from refcounttree.c 2011-05-25 15:17:08 +08:00
reservations.c ocfs2: Remove masklog ML_RESERVATIONS. 2011-02-23 22:10:56 +08:00
reservations.h Fix common misspellings 2011-03-31 11:26:23 -03:00
resize.c ocfs2: Remove mlog(0) from fs/ocfs2/suballoc.c 2011-02-22 08:24:01 +08:00
resize.h
slot_map.c ocfs2: Clean up messages in the fs 2011-07-24 10:34:54 -07:00
slot_map.h
stack_o2cb.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
stack_user.c dlm: add recovery callbacks 2012-01-04 08:56:31 -06:00
stackglue.c ocfs2_dlmfs: Enable the use of user cluster stacks. 2010-02-26 15:41:18 -08:00
stackglue.h Fix common misspellings 2011-03-31 11:26:23 -03:00
suballoc.c ocfs2: ac->ac_allow_chain_relink=0 won't disable group relink 2013-02-27 19:10:09 -08:00
suballoc.h ocfs2: ac->ac_allow_chain_relink=0 won't disable group relink 2013-02-27 19:10:09 -08:00
super.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
super.h treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
symlink.c ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path 2013-02-26 02:46:12 -05:00
symlink.h ocfs: simplify symlink handling 2012-05-29 23:28:40 -04:00
sysfile.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
sysfile.h
uptodate.c ocfs2: Remove masklog ML_UPTODATE. 2011-02-24 16:22:20 +08:00
uptodate.h ocfs2: Pass struct ocfs2_caching_info to the journal functions. 2009-09-04 16:07:50 -07:00
ver.c
ver.h
xattr.c ocfs2: fix ocfs2_init_security_and_acl() to initialize acl correctly 2013-02-27 19:10:09 -08:00
xattr.h ocfs2: propagate umode_t 2012-01-03 22:55:02 -05:00