Skip to content

idr: add idr_alloc_cyclic and convert existing cyclic users

Jeff Layton linux-nfs linux-rdma linux-sctp lkml netdev 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 8 repliesIn review
  2. v16 patches 7 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6idr: introduce idr_alloc_cyclicinclude/linux/idr.h lib/idr.c+29 -00 replies
2/6amso1100: convert to using idr_alloc_cyclicdrivers/infiniband/hw/amso1100/c2.h drivers/infiniband/hw/amso1100/c2_qp.c+1 -31 reply
3/6mlx4: convert to using idr_alloc_cyclicdrivers/infiniband/hw/mlx4/cm.c+1 -30 replies
4/6nfsd: convert nfs4_alloc_stid to use idr_alloc_cyclicfs/nfsd/nfs4state.c+1 -61 reply
5/6inotify: convert inotify_add_to_idr to use idr_alloc_cyclicfs/notify/inotify/inotify_user.c include/linux/fsnotify_backend.h+2 -70 replies
6/6sctp: convert sctp_assoc_set_id to use idr_alloc_cyclicnet/sctp/associola.c+2 -143 replies

Reviews trailers per patch

3 of 6 patches have a Reviewed-by or Acked-by.

PatchTejun HeoNeil Horman
1/6R-b
2/6R-b
3/6
4/6
5/6
6/6A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/6] idr: add idr_alloc_cyclic and convert existing cyclic users

(Andrew, I think this is probably best routed via -mm since it touches several different places)

This is the second version of this patchset. The main changes are:

- removed an incorrect comment on the new allocator function that stemmed from a misunderstanding of the IDR code. Also fixed up the kerneldoc comment.

- the idr_init_cyclic function has been removed, since it doesn't add any benefit over a "normal" idr_init.

- minor change to the caller in inotify code to make it not allocate an ID of 0. The existing code starts at 1, so this seems like a reasonable precaution.

Original cover letter follows:

As Tejun points out, there are several users of the IDR facility that attempt to use it in a cyclic fashion. These users are likely to see -ENOSPC errors after the counter wraps one or more times however.

This patchset adds a new idr_alloc_cyclic routine and converts several of these users to it. Many of these users are in obscure parts of the kernel, and I don't have a good way to test some of them. The change is pretty straightforward though, so hopefully it won't be an issue.

There is one other cyclic user of idr_alloc that I didn't touch in ipc/util.c. That one is doing some strange stuff that I didn't quite understand, but it looks like it should probably be converted later somehow.

Jeff Layton (6):
idr: introduce idr_alloc_cyclic
amso1100: convert to using idr_alloc_cyclic
mlx4: convert to using idr_alloc_cyclic
nfsd: convert nfs4_alloc_stid to use idr_alloc_cyclic
inotify: convert inotify_add_to_idr to use idr_alloc_cyclic
sctp: convert sctp_assoc_set_id to use idr_alloc_cyclic

 drivers/infiniband/hw/amso1100/c2.h    |  1 -
 drivers/infiniband/hw/amso1100/c2_qp.c |  3 +--
 drivers/infiniband/hw/mlx4/cm.c        |  4 +---
 fs/nfsd/nfs4state.c                    |  7 +------
 fs/notify/inotify/inotify_user.c       |  8 ++------
 include/linux/fsnotify_backend.h       |  1 -
 include/linux/idr.h                    |  2 ++
 lib/idr.c                              | 27 +++++++++++++++++++++++++++
 net/sctp/associola.c                   | 16 ++--------------
 9 files changed, 36 insertions(+), 33 deletions(-)
Signature · 1 line
1.7.11.7