On Mon, Jan 16, 2017 at 3:29 PM, Sagi Grimberg <sagi@xxxxxxxxxxx> wrote:
Hey Josef,
I'm going to use it the same way loop does, there will be a
/dev/nbd-control where you can say ADD, REMOVE, and GET_NEXT. I need
the
search functionality to see if we are adding something that already
exists, and to see what is the next unused device that can be used
for a
connection. Looking at the ida api it does not appear I can do
that. If
I'm wrong then please point out an example I can look at, because I
haven't been able to find one. Thanks,
Nope, ida doesn't have search functionality. Having said that, will it
suffice to have the idr tree without a separate data structure?
because
the tree mutation under idr_for_each is not allowed. For example,
I'd expect that nbd module unload will iterate over the existing
devices and destroy them which requires a separate tracking of
them, also, I think that the idr user needs to take care of locking
(unlike ida).
So I don't plan on messing with it under idr_for_each. I'm basically
copying+pasting what loop is doing and doing :1,$s/loop/nbd/g and
hoping for the best. I'm going to add reference counting to the nbd
devices obviously to keep us from removing in use nbd devices. The
idr_for_each in the unload doesn't actually remove the devices from the
idr, it just free's them.
Also so I don't have to find the other thread I did manage to test with
per-device workqueues and a global workqueue and the performance was
the same, I'll make that change to the other patch and resend it when I
finish all this work so you can see the full picture. Thanks!
Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html