[Patch v2 10/10] drbd: Handle new-current-uuid --zap-devices

From: Nick Wang
Date: Mon Jul 13 2015 - 04:40:01 EST


Zap devices for zeroing out device on both side
instead of initial full sync.

Signed-off-by: Nick Wang <nwang@xxxxxxxx>
CC: Philipp Reisner <philipp.reisner@xxxxxxxxxx>
CC: Lars Ellenberg <lars.ellenberg@xxxxxxxxxx>
CC: drbd-dev@xxxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
---
drbd/drbd_nl.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
index 1d17663..131f112 100644
--- a/drbd/drbd_nl.c
+++ b/drbd/drbd_nl.c
@@ -4068,7 +4068,7 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
drbd_uuid_set(device, UI_BITMAP, 0); /* Rotate UI_BITMAP to History 1, etc... */
drbd_uuid_new_current(device); /* New current, previous to UI_BITMAP */

- if (args.clear_bm) {
+ if (args.clear_bm || args.zap_devices) {
err = drbd_bitmap_io(device, &drbd_bmio_clear_n_write,
"clear_n_write from new_c_uuid", BM_LOCKED_MASK);
if (err) {
@@ -4084,6 +4084,16 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
CS_VERBOSE, NULL);
spin_unlock_irq(&device->resource->req_lock);
}
+ if (zero_out_devices) {
+ drbd_send_zero_out_start(first_peer_device(device));
+ _drbd_uuid_set(device, UI_BITMAP, 0);
+ drbd_print_uuids(device, "cleared bitmap UUID for zeroing device");
+
+ /* CLear bit flag of zero out */
+ clear_bit(ZERO_DONE, &device->flags);
+ clear_bit(ZERO_FAIL, &device->flags);
+ drbd_device_post_work(device, P_ZERO_START);
+ }
}

drbd_md_sync(device);
--
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/