From: Roman Pen <r.peniaev@xxxxxxxxx> Hi all, This is an attempt to make a device pool API out of a common code, which caches pair of ib_device and ib_pd pointers. I found 4 places, where this common functionality can be replaced by some lib calls: nvme, nvmet, iser and isert. Total deduplication gain in loc is not quite significant, but eventually new ULP IB code can also require the same device/pd pair cache, e.g. in our IBTRS module the same code has to be repeated again, which was observed by Sagi and he suggested to make a common helper function instead of producing another copy. Diff v1..v2: 1. Add pool->deinit callback in order to make code symmetric with init procedure and to handle error paths correctly. 2. Avoid BUG_ON, replaced with WARN_ON. 3. Rename ib_dev_pool_find_get_or_create() on ib_dev_pool_find_or_add() to make the name a bit shorter and nicer. 4. Return proper value from ib_pool_dev_exists(). Roman Pen (5): IB/core: introduce an IB device pool nvme-rdma: switch on IB pool device interface nvmet-rdma: switch on IB pool device interface IB/iser: switch on IB pool device interface IB/isert: switch on IB pool device interface drivers/infiniband/core/Makefile | 2 +- drivers/infiniband/core/dev_pool.c | 131 ++++++++++++++++++ drivers/infiniband/ulp/iser/iscsi_iser.c | 68 ++++++++-- drivers/infiniband/ulp/iser/iscsi_iser.h | 21 ++- drivers/infiniband/ulp/iser/iser_initiator.c | 42 +++--- drivers/infiniband/ulp/iser/iser_memory.c | 18 +-- drivers/infiniband/ulp/iser/iser_verbs.c | 102 +++----------- drivers/infiniband/ulp/isert/ib_isert.c | 185 ++++++++++++------------- drivers/infiniband/ulp/isert/ib_isert.h | 7 +- drivers/nvme/host/rdma.c | 187 +++++++++---------------- drivers/nvme/target/rdma.c | 196 ++++++++++++--------------- include/rdma/dev_pool.h | 58 ++++++++ 12 files changed, 547 insertions(+), 470 deletions(-) create mode 100644 drivers/infiniband/core/dev_pool.c create mode 100644 include/rdma/dev_pool.h Signed-off-by: Roman Pen <roman.penyaev@xxxxxxxxxxxxxxxx> Cc: Keith Busch <keith.busch@xxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx> Cc: Bart Van Assche <bart.vanassche@xxxxxxxxxxx> Cc: Sagi Grimberg <sagi@xxxxxxxxxxx> Cc: Doug Ledford <dledford@xxxxxxxxxx> Cc: Or Gerlitz <ogerlitz@xxxxxxxxxxxx> -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html