Skip to content

introduce list_for_each_entry_del

Joern Engel linux-btrfs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 23 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2list: add list_for_each_entry_delinclude/linux/list.h+33 -07 replies
1/2list: add while_list_drain_entryinclude/linux/list.h+18 -01 reply
1/2list: add list_del_each_entryinclude/linux/list.h+18 -02 replies
2/2btrfs: use list_for_each_entry_delfs/btrfs/backref.c fs/btrfs/compression.c fs/btrfs/disk-io.c +9 more+25 -1010 replies
2/2btrfs: use while_list_drain_entryfs/btrfs/backref.c fs/btrfs/compression.c fs/btrfs/disk-io.c +9 more+25 -1010 replies
2/2btrfs: use list_del_each_entryfs/btrfs/backref.c fs/btrfs/compression.c fs/btrfs/disk-io.c +9 more+25 -1010 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] introduce list_for_each_entry_del

A purely janitorial patchset. A fairly common pattern is to take a list, remove every object from it and do something with this object - usually kfree() some variant. A stupid grep identified roughly 300 instances, with many more hidden behind more complicated patterns to achieve the same end results.

This patchset moves the boilerplate code into list.h and uses it in a few example places. Diffstat is pretty clear and imo the code is improved as well.

Drawback is that object size is growing. I think an ideal compiler should be able to optimize all the overhead away, but 4.7 just isn't there yet. Or maybe I just messed up - patches are only compile-tested after all. Comments/ideas are welcome.

Joern Engel (2):
list: add list_for_each_entry_del
btrfs: use list_for_each_entry_del

 fs/btrfs/backref.c      |   15 +++------------
 fs/btrfs/compression.c  |    4 +---
 fs/btrfs/disk-io.c      |    6 +-----
 fs/btrfs/extent-tree.c  |   17 +++--------------
 fs/btrfs/extent_io.c    |    8 ++------
 fs/btrfs/inode.c        |   16 +++-------------
 fs/btrfs/ordered-data.c |    7 +------
 fs/btrfs/qgroup.c       |   22 ++++------------------
 fs/btrfs/relocation.c   |    6 +-----
 fs/btrfs/scrub.c        |    9 +++------
 fs/btrfs/transaction.c  |    5 +----
 fs/btrfs/volumes.c      |   11 ++---------
 include/linux/list.h    |   33 +++++++++++++++++++++++++++++++++
 13 files changed, 58 insertions(+), 101 deletions(-)
Signature · 1 line
1.7.10.4