提交 79a30d2d 编写于 作者: L Lars Ellenberg 提交者: Philipp Reisner

drbd: queue bitmap writeout more intelligently

The "lazy writeout" of cleared bitmap pages happens during resync, and
should happen again once the resync finishes cleanly, or is aborted.

If resync finished cleanly, or was aborted because of peer disk
failure, we trigger the writeout from worker context in the after
state change work.

If resync was aborted because of connection failure, we should not
immediately trigger bitmap writeout, but rather postpone the
writeout to after the connection cleanup happened.  We now do it
in the receiver context from drbd_disconnect().

If resync was aborted because of local disk failure, well, there
is nothing to write to anymore.
Signed-off-by: NPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: NLars Ellenberg <lars.ellenberg@linbit.com>
上级 54b956ab
...@@ -1593,8 +1593,18 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, ...@@ -1593,8 +1593,18 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
if (os.disk < D_UP_TO_DATE && os.conn >= C_SYNC_SOURCE && ns.conn == C_CONNECTED) if (os.disk < D_UP_TO_DATE && os.conn >= C_SYNC_SOURCE && ns.conn == C_CONNECTED)
drbd_send_state(mdev); drbd_send_state(mdev);
if (os.conn > C_CONNECTED && ns.conn <= C_CONNECTED) /* This triggers bitmap writeout of potentially still unwritten pages
* if the resync finished cleanly, or aborted because of peer disk
* failure. Resync aborted because of connection failure does bitmap
* writeout from drbd_disconnect.
* For resync aborted because of local disk failure, we cannot do
* any bitmap writeout anymore.
*/
if (os.conn > C_CONNECTED && ns.conn == C_CONNECTED &&
mdev->state.conn == C_CONNECTED && get_ldev(mdev)) {
drbd_queue_bitmap_io(mdev, &drbd_bm_write, NULL, "write from resync_finished"); drbd_queue_bitmap_io(mdev, &drbd_bm_write, NULL, "write from resync_finished");
put_ldev(mdev);
}
/* free tl_hash if we Got thawed and are C_STANDALONE */ /* free tl_hash if we Got thawed and are C_STANDALONE */
if (ns.conn == C_STANDALONE && !is_susp(ns) && mdev->tl_hash) if (ns.conn == C_STANDALONE && !is_susp(ns) && mdev->tl_hash)
......
...@@ -3811,6 +3811,7 @@ static void drbd_disconnect(struct drbd_conf *mdev) ...@@ -3811,6 +3811,7 @@ static void drbd_disconnect(struct drbd_conf *mdev)
fp = FP_DONT_CARE; fp = FP_DONT_CARE;
if (get_ldev(mdev)) { if (get_ldev(mdev)) {
drbd_bitmap_io(mdev, &drbd_bm_write, "write from disconnect");
fp = mdev->ldev->dc.fencing; fp = mdev->ldev->dc.fencing;
put_ldev(mdev); put_ldev(mdev);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册