Skip to content

Commit

Permalink
drbd: Keep a reference to barrier acked requests
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Reisner <[email protected]>
Signed-off-by: Lars Ellenberg <[email protected]>
  • Loading branch information
Philipp-Reisner committed May 9, 2012
1 parent 6809384 commit 6d7e32f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ struct drbd_conf {
struct drbd_tl_epoch *newest_tle;
struct drbd_tl_epoch *oldest_tle;
struct list_head out_of_sequence_requests;
struct list_head barrier_acked_requests;
struct hlist_head *tl_hash;
unsigned int tl_hash_s;

Expand Down
23 changes: 21 additions & 2 deletions drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ static int tl_init(struct drbd_conf *mdev)
mdev->oldest_tle = b;
mdev->newest_tle = b;
INIT_LIST_HEAD(&mdev->out_of_sequence_requests);
INIT_LIST_HEAD(&mdev->barrier_acked_requests);

mdev->tl_hash = NULL;
mdev->tl_hash_s = 0;
Expand Down Expand Up @@ -311,7 +312,7 @@ void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr,
These have been list_move'd to the out_of_sequence_requests list in
_req_mod(, barrier_acked) above.
*/
list_del_init(&b->requests);
list_splice_init(&b->requests, &mdev->barrier_acked_requests);

nob = b->next;
if (test_and_clear_bit(CREATE_BARRIER, &mdev->flags)) {
Expand Down Expand Up @@ -343,7 +344,7 @@ void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr,
* @what: The action/event to perform with all request objects
*
* @what might be one of connection_lost_while_pending, resend, fail_frozen_disk_io,
* restart_frozen_disk_io.
* restart_frozen_disk_io, abort_disk_io.
*/
static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
{
Expand Down Expand Up @@ -411,6 +412,24 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what)
b = tmp;
list_splice(&carry_reads, &b->requests);
}

/* Actions operating on the disk state, also want to work on
requests that got barrier acked. */
switch (what) {
case abort_disk_io:
case fail_frozen_disk_io:
case restart_frozen_disk_io:
list_for_each_safe(le, tle, &mdev->barrier_acked_requests) {
req = list_entry(le, struct drbd_request, tl_requests);
_req_mod(req, what);
}

case connection_lost_while_pending:
case resend:
break;
default:
dev_err(DEV, "what = %d in _tl_restart()\n", what);
}
}


Expand Down
1 change: 1 addition & 0 deletions drivers/block/drbd/drbd_req.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ enum drbd_req_event {
read_completed_with_error,
read_ahead_completed_with_error,
write_completed_with_error,
abort_disk_io,
completed_ok,
resend,
fail_frozen_disk_io,
Expand Down

0 comments on commit 6d7e32f

Please sign in to comment.