Commit ff370e5a authored by Philipp Reisner's avatar Philipp Reisner

drbd: drbd_delete_device() takes a struct drbd_conf * now

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 5cc287e0
...@@ -1367,7 +1367,7 @@ extern rwlock_t global_state_lock; ...@@ -1367,7 +1367,7 @@ extern rwlock_t global_state_lock;
extern int conn_lowest_minor(struct drbd_tconn *tconn); extern int conn_lowest_minor(struct drbd_tconn *tconn);
enum drbd_ret_code conn_new_minor(struct drbd_tconn *tconn, unsigned int minor, int vnr); enum drbd_ret_code conn_new_minor(struct drbd_tconn *tconn, unsigned int minor, int vnr);
extern void drbd_free_mdev(struct drbd_conf *mdev); extern void drbd_free_mdev(struct drbd_conf *mdev);
extern void drbd_delete_device(unsigned int minor); extern void drbd_delete_device(struct drbd_conf *mdev);
struct drbd_tconn *drbd_new_tconn(const char *name); struct drbd_tconn *drbd_new_tconn(const char *name);
extern void drbd_free_tconn(struct drbd_tconn *tconn); extern void drbd_free_tconn(struct drbd_tconn *tconn);
......
...@@ -2204,15 +2204,10 @@ static void drbd_release_all_peer_reqs(struct drbd_conf *mdev) ...@@ -2204,15 +2204,10 @@ static void drbd_release_all_peer_reqs(struct drbd_conf *mdev)
} }
/* caution. no locking. */ /* caution. no locking. */
void drbd_delete_device(unsigned int minor) void drbd_delete_device(struct drbd_conf *mdev)
{ {
struct drbd_conf *mdev = minor_to_mdev(minor);
if (!mdev)
return;
idr_remove(&mdev->tconn->volumes, mdev->vnr); idr_remove(&mdev->tconn->volumes, mdev->vnr);
idr_remove(&minors, minor); idr_remove(&minors, mdev_to_minor(mdev));
synchronize_rcu(); synchronize_rcu();
/* paranoia asserts */ /* paranoia asserts */
...@@ -2265,7 +2260,8 @@ static void drbd_cleanup(void) ...@@ -2265,7 +2260,8 @@ static void drbd_cleanup(void)
drbd_genl_unregister(); drbd_genl_unregister();
idr_for_each_entry(&minors, mdev, i) idr_for_each_entry(&minors, mdev, i)
drbd_delete_device(i); drbd_delete_device(mdev);
drbd_destroy_mempools(); drbd_destroy_mempools();
unregister_blkdev(DRBD_MAJOR, "drbd"); unregister_blkdev(DRBD_MAJOR, "drbd");
......
...@@ -2861,7 +2861,7 @@ static enum drbd_ret_code adm_delete_minor(struct drbd_conf *mdev) ...@@ -2861,7 +2861,7 @@ static enum drbd_ret_code adm_delete_minor(struct drbd_conf *mdev)
* we may want to delete a minor from a live replication group. * we may want to delete a minor from a live replication group.
*/ */
mdev->state.role == R_SECONDARY) { mdev->state.role == R_SECONDARY) {
drbd_delete_device(mdev_to_minor(mdev)); drbd_delete_device(mdev);
return NO_ERROR; return NO_ERROR;
} else } else
return ERR_MINOR_CONFIGURED; return ERR_MINOR_CONFIGURED;
......
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