Commit 93e4bf7a authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: Minor cleanup in conn_new_minor()

Signed-off-by: default avatarAndreas Gruenbacher <agruen@linbit.com>
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
parent d8628a86
...@@ -2662,8 +2662,7 @@ enum drbd_ret_code drbd_create_minor(struct drbd_connection *connection, unsigne ...@@ -2662,8 +2662,7 @@ enum drbd_ret_code drbd_create_minor(struct drbd_connection *connection, unsigne
struct drbd_peer_device *peer_device; struct drbd_peer_device *peer_device;
struct gendisk *disk; struct gendisk *disk;
struct request_queue *q; struct request_queue *q;
int vnr_got = vnr; int id;
int minor_got = minor;
enum drbd_ret_code err = ERR_NOMEM; enum drbd_ret_code err = ERR_NOMEM;
device = minor_to_device(minor); device = minor_to_device(minor);
...@@ -2735,18 +2734,18 @@ enum drbd_ret_code drbd_create_minor(struct drbd_connection *connection, unsigne ...@@ -2735,18 +2734,18 @@ enum drbd_ret_code drbd_create_minor(struct drbd_connection *connection, unsigne
device->read_requests = RB_ROOT; device->read_requests = RB_ROOT;
device->write_requests = RB_ROOT; device->write_requests = RB_ROOT;
minor_got = idr_alloc(&drbd_devices, device, minor, minor + 1, GFP_KERNEL); id = idr_alloc(&drbd_devices, device, minor, minor + 1, GFP_KERNEL);
if (minor_got < 0) { if (id < 0) {
if (minor_got == -ENOSPC) { if (id == -ENOSPC) {
err = ERR_MINOR_EXISTS; err = ERR_MINOR_EXISTS;
drbd_msg_put_info("requested minor exists already"); drbd_msg_put_info("requested minor exists already");
} }
goto out_no_minor_idr; goto out_no_minor_idr;
} }
vnr_got = idr_alloc(&connection->volumes, device, vnr, vnr + 1, GFP_KERNEL); id = idr_alloc(&connection->volumes, device, vnr, vnr + 1, GFP_KERNEL);
if (vnr_got < 0) { if (id < 0) {
if (vnr_got == -ENOSPC) { if (id == -ENOSPC) {
err = ERR_INVALID_REQUEST; err = ERR_INVALID_REQUEST;
drbd_msg_put_info("requested volume exists already"); drbd_msg_put_info("requested volume exists already");
} }
...@@ -2770,9 +2769,9 @@ enum drbd_ret_code drbd_create_minor(struct drbd_connection *connection, unsigne ...@@ -2770,9 +2769,9 @@ enum drbd_ret_code drbd_create_minor(struct drbd_connection *connection, unsigne
return NO_ERROR; return NO_ERROR;
out_idr_remove_vol: out_idr_remove_vol:
idr_remove(&connection->volumes, vnr_got); idr_remove(&connection->volumes, vnr);
out_idr_remove_minor: out_idr_remove_minor:
idr_remove(&drbd_devices, minor_got); idr_remove(&drbd_devices, minor);
synchronize_rcu(); synchronize_rcu();
out_no_minor_idr: out_no_minor_idr:
drbd_bm_cleanup(device); drbd_bm_cleanup(device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment