devlink: extract snapshot id allocation to helper function
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 26 Mar 2020 18:37:13 +0000 (11:37 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Mar 2020 02:39:26 +0000 (19:39 -0700)
commit7000108f27b1b421d388af0da0edc1d9cf13fd3c
treee2283eeececd884174542f5d5bbe123d813a7088
parent47a39f6105d360abc8409f31fc36fac3c0925a52
devlink: extract snapshot id allocation to helper function

A future change is going to implement a new devlink command to request
a snapshot on demand. As part of this, the logic for handling the
snapshot ids will be refactored. To simplify the snapshot id allocation
function, move it to a separate function prefixed by `__`. This helper
function will assume the lock is held.

While no other callers will exist, it simplifies refactoring the logic
because there is no need to complicate the function with gotos to handle
unlocking on failure.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/devlink.c