diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2011-11-17 05:49:46 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:58:33 -0500 |
commit | b379c41ed78e83c4443fca4dbfbc358c19e4f24c (patch) | |
tree | 4e5a3d472c67835406e4c511ada0277b97798c26 /drivers/block/drbd/drbd_main.c | |
parent | 9d05e7c4e7069180370ce9c2c121fd6f7810c5a3 (diff) |
drbd: transfer log epoch numbers are now per resource
cherry-picked from drbd 9 devel branch.
In preparation of multiple connections, the "barrier number" or
"epoch number" needs to be tracked per-resource, not per connection.
The sequence number space will not be reset anymore.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 843d0af68f96..bfe6975ef94c 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -208,7 +208,7 @@ static int tl_init(struct drbd_tconn *tconn) | |||
208 | INIT_LIST_HEAD(&b->requests); | 208 | INIT_LIST_HEAD(&b->requests); |
209 | INIT_LIST_HEAD(&b->w.list); | 209 | INIT_LIST_HEAD(&b->w.list); |
210 | b->next = NULL; | 210 | b->next = NULL; |
211 | b->br_number = 4711; | 211 | b->br_number = atomic_inc_return(&tconn->current_tle_nr); |
212 | b->n_writes = 0; | 212 | b->n_writes = 0; |
213 | b->w.cb = NULL; /* if this is != NULL, we need to dec_ap_pending in tl_clear */ | 213 | b->w.cb = NULL; /* if this is != NULL, we need to dec_ap_pending in tl_clear */ |
214 | 214 | ||
@@ -241,16 +241,13 @@ static void tl_cleanup(struct drbd_tconn *tconn) | |||
241 | */ | 241 | */ |
242 | void _tl_add_barrier(struct drbd_tconn *tconn, struct drbd_tl_epoch *new) | 242 | void _tl_add_barrier(struct drbd_tconn *tconn, struct drbd_tl_epoch *new) |
243 | { | 243 | { |
244 | struct drbd_tl_epoch *newest_before; | ||
245 | |||
246 | INIT_LIST_HEAD(&new->requests); | 244 | INIT_LIST_HEAD(&new->requests); |
247 | INIT_LIST_HEAD(&new->w.list); | 245 | INIT_LIST_HEAD(&new->w.list); |
248 | new->w.cb = NULL; /* if this is != NULL, we need to dec_ap_pending in tl_clear */ | 246 | new->w.cb = NULL; /* if this is != NULL, we need to dec_ap_pending in tl_clear */ |
249 | new->next = NULL; | 247 | new->next = NULL; |
250 | new->n_writes = 0; | 248 | new->n_writes = 0; |
251 | 249 | ||
252 | newest_before = tconn->newest_tle; | 250 | new->br_number = atomic_inc_return(&tconn->current_tle_nr); |
253 | new->br_number = newest_before->br_number+1; | ||
254 | if (tconn->newest_tle != new) { | 251 | if (tconn->newest_tle != new) { |
255 | tconn->newest_tle->next = new; | 252 | tconn->newest_tle->next = new; |
256 | tconn->newest_tle = new; | 253 | tconn->newest_tle = new; |
@@ -406,7 +403,7 @@ void _tl_restart(struct drbd_tconn *tconn, enum drbd_req_event what) | |||
406 | list_splice(&carry_reads, &b->requests); | 403 | list_splice(&carry_reads, &b->requests); |
407 | INIT_LIST_HEAD(&b->w.list); | 404 | INIT_LIST_HEAD(&b->w.list); |
408 | b->w.cb = NULL; | 405 | b->w.cb = NULL; |
409 | b->br_number = net_random(); | 406 | b->br_number = atomic_inc_return(&tconn->current_tle_nr); |
410 | b->n_writes = 0; | 407 | b->n_writes = 0; |
411 | 408 | ||
412 | *pn = b; | 409 | *pn = b; |