提交 b9b98716 编写于 作者: P Philipp Reisner

drbd: Do not send two barriers without any writes between them

Signed-off-by: NPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: NLars Ellenberg <lars.ellenberg@linbit.com>
上级 11b58e73
...@@ -344,7 +344,7 @@ void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr, ...@@ -344,7 +344,7 @@ void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr,
static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
{ {
struct drbd_tl_epoch *b, *tmp, **pn; struct drbd_tl_epoch *b, *tmp, **pn;
struct list_head *le, *tle; struct list_head *le, *tle, carry_reads;
struct drbd_request *req; struct drbd_request *req;
int rv, n_writes, n_reads; int rv, n_writes, n_reads;
...@@ -353,6 +353,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) ...@@ -353,6 +353,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
while (b) { while (b) {
n_writes = 0; n_writes = 0;
n_reads = 0; n_reads = 0;
INIT_LIST_HEAD(&carry_reads);
list_for_each_safe(le, tle, &b->requests) { list_for_each_safe(le, tle, &b->requests) {
req = list_entry(le, struct drbd_request, tl_requests); req = list_entry(le, struct drbd_request, tl_requests);
rv = _req_mod(req, what); rv = _req_mod(req, what);
...@@ -362,7 +363,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) ...@@ -362,7 +363,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
} }
tmp = b->next; tmp = b->next;
if (n_writes + n_reads) { if (n_writes) {
if (what == resend) { if (what == resend) {
b->n_writes = n_writes; b->n_writes = n_writes;
if (b->w.cb == NULL) { if (b->w.cb == NULL) {
...@@ -375,6 +376,8 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) ...@@ -375,6 +376,8 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
} }
pn = &b->next; pn = &b->next;
} else { } else {
if (n_reads)
list_add(&carry_reads, &b->requests);
/* there could still be requests on that ring list, /* there could still be requests on that ring list,
* in case local io is still pending */ * in case local io is still pending */
list_del(&b->requests); list_del(&b->requests);
...@@ -389,6 +392,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) ...@@ -389,6 +392,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
/* recycle, but reinit! */ /* recycle, but reinit! */
D_ASSERT(tmp == NULL); D_ASSERT(tmp == NULL);
INIT_LIST_HEAD(&b->requests); INIT_LIST_HEAD(&b->requests);
list_splice(&carry_reads, &b->requests);
INIT_LIST_HEAD(&b->w.list); INIT_LIST_HEAD(&b->w.list);
b->w.cb = NULL; b->w.cb = NULL;
b->br_number = net_random(); b->br_number = net_random();
...@@ -401,6 +405,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) ...@@ -401,6 +405,7 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
kfree(b); kfree(b);
} }
b = tmp; b = tmp;
list_splice(&carry_reads, &b->requests);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册