]> git.baikalelectronics.ru Git - kernel.git/commit
nbd: refactor device search and allocation in nbd_genl_connect
authorChristoph Hellwig <hch@lst.de>
Wed, 11 Aug 2021 12:44:27 +0000 (14:44 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 13 Aug 2021 20:17:39 +0000 (14:17 -0600)
commit38425c071578fa75d64549381838ddd526bcd5ea
tree37aa161a899ba695984ca13a3fc8d4ec0cc8382e
parentbcd0d10bb47d1151138aa779c0b8fb2971a69ebd
nbd: refactor device search and allocation in nbd_genl_connect

Use idr_for_each_entry instead of the awkward callback to find an
existing device for the index == -1 case, and de-duplicate the device
allocation if no existing device was found.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210811124428.2368491-6-hch@lst.de
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c