drbd: Prepare epochs per connection
authorPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Nov 2011 13:56:07 +0000 (14:56 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:58:07 +0000 (16:58 +0100)
An epoch object needs a pointer to the mdev it was received for.
This is necessary to be able to send the barrier ack packet for
the same volume as the original barrier packet was assigned to.

This prepares the next step, in which the (receiver side)
epoch list is moved from the device (mdev) to the connection (tconn)
object.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_receiver.c

index 473694605da64c534421fb534b9b928ab361f7f0..0db20cbb4234429cde6b885b13b4c465f67d6c7f 100644 (file)
@@ -585,6 +585,7 @@ struct drbd_tl_epoch {
 };
 
 struct drbd_epoch {
+       struct drbd_conf *mdev;
        struct list_head list;
        unsigned int barrier_nr;
        atomic_t epoch_size; /* increased on every request added. */
index f6d1ff2e3ab9b7e05a7bd6bf2b62e0127b1799b9..cc5e0b6a88e97d6213ed7a0f1bc9aa08b40b64db 100644 (file)
@@ -1152,11 +1152,11 @@ static enum finish_epoch drbd_may_finish_epoch(struct drbd_conf *mdev,
                    (test_bit(DE_HAVE_BARRIER_NUMBER, &epoch->flags) || ev & EV_CLEANUP)) {
                        if (!(ev & EV_CLEANUP)) {
                                spin_unlock(&mdev->epoch_lock);
-                               drbd_send_b_ack(mdev, epoch->barrier_nr, epoch_size);
+                               drbd_send_b_ack(epoch->mdev, epoch->barrier_nr, epoch_size);
                                spin_lock(&mdev->epoch_lock);
                        }
                        if (test_bit(DE_HAVE_BARRIER_NUMBER, &epoch->flags))
-                               dec_unacked(mdev);
+                               dec_unacked(epoch->mdev);
 
                        if (mdev->current_epoch != epoch) {
                                next_epoch = list_entry(epoch->list.next, struct drbd_epoch, list);
@@ -1349,6 +1349,7 @@ static int receive_Barrier(struct drbd_tconn *tconn, struct packet_info *pi)
        inc_unacked(mdev);
 
        mdev->current_epoch->barrier_nr = p->barrier;
+       mdev->current_epoch->mdev = mdev;
        rv = drbd_may_finish_epoch(mdev, mdev->current_epoch, EV_GOT_BARRIER_NR);
 
        /* P_BARRIER_ACK may imply that the corresponding extent is dropped from
This page took 0.032157 seconds and 5 git commands to generate.