aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_req.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-11-10 06:08:37 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:35:06 -0500
commit3719094ec2dec411b3151f10048316d787e086f9 (patch)
tree4be7bd2bb31612e8210665b9e20985de7deb30e4 /drivers/block/drbd/drbd_req.c
parentab17b68f4579b460753a416b0afc4446381d876f (diff)
drbd: Starting with protocol 96 we can allow app-IO while receiving the bitmap
* C_STARTING_SYNC_S, C_STARTING_SYNC_T In these states the bitmap gets written to disk. Locking out of app-IO is done by using the drbd_queue_bitmap_io() and drbd_bitmap_io() functions these days. It is no longer necessary to lock out app-IO based on the connection state. App-IO that may come in after the BITMAP_IO flag got cleared before the state transition to C_SYNC_(SOURCE|TARGET) does not get mirrored, sets a bit in the local bitmap, that is already set, therefore changes nothing. * C_WF_BITMAP_S In this state we send updates (P_OUT_OF_SYNC packets). With that we make sure they have the same number of bits when going into the C_SYNC_(SOURCE|TARGET) connection state. * C_UNCONNECTED: The receiver starts, no need to lock out IO. * C_DISCONNECTING: in drbd_disconnect() we had a wait_event() to wait until ap_bio_cnt reaches 0. Removed that. * C_TIMEOUT, C_BROKEN_PIPE, C_NETWORK_FAILURE C_PROTOCOL_ERROR, C_TEAR_DOWN: Same as C_DISCONNECTING * C_WF_REPORT_PARAMS: IO still possible since that is still like C_WF_CONNECTION. And we do not need to send barriers in C_WF_BITMAP_S connection state. Allow concurrent accesses to the bitmap when receiving the bitmap. Everything gets ORed anyways. A drbd_free_tl_hash() is in after_state_chg_work(). At that point all the work items of the last connections must have been processed. Introduced a call to drbd_free_tl_hash() into drbd_free_mdev() for paranoia reasons. 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_req.c')
-rw-r--r--drivers/block/drbd/drbd_req.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index eff0fbf69dd4..4cb8247d83c9 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -142,7 +142,7 @@ static void _about_to_complete_local_write(struct drbd_conf *mdev,
142 142
143 /* before we can signal completion to the upper layers, 143 /* before we can signal completion to the upper layers,
144 * we may need to close the current epoch */ 144 * we may need to close the current epoch */
145 if (mdev->state.conn >= C_CONNECTED && mdev->state.conn < C_AHEAD && 145 if (mdev->state.conn >= C_WF_BITMAP_T && mdev->state.conn < C_AHEAD &&
146 req->epoch == mdev->newest_tle->br_number) 146 req->epoch == mdev->newest_tle->br_number)
147 queue_barrier(mdev); 147 queue_barrier(mdev);
148 148
@@ -757,6 +757,23 @@ static int drbd_may_do_local_read(struct drbd_conf *mdev, sector_t sector, int s
757 return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr); 757 return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr);
758} 758}
759 759
760static int drbd_should_do_remote(struct drbd_conf *mdev)
761{
762 union drbd_state s = mdev->state;
763
764 return s.pdsk == D_UP_TO_DATE ||
765 (s.pdsk >= D_INCONSISTENT &&
766 s.conn >= C_WF_BITMAP_T &&
767 s.conn < C_AHEAD);
768}
769static int drbd_should_send_oos(struct drbd_conf *mdev)
770{
771 union drbd_state s = mdev->state;
772
773 return s.pdsk >= D_INCONSISTENT &&
774 (s.conn == C_AHEAD || s.conn == C_WF_BITMAP_S);
775}
776
760static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time) 777static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time)
761{ 778{
762 const int rw = bio_rw(bio); 779 const int rw = bio_rw(bio);
@@ -828,12 +845,9 @@ static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, uns
828 drbd_al_begin_io(mdev, sector); 845 drbd_al_begin_io(mdev, sector);
829 } 846 }
830 847
831 remote = remote && (mdev->state.pdsk == D_UP_TO_DATE || 848 remote = remote && drbd_should_do_remote(mdev);
832 (mdev->state.pdsk >= D_INCONSISTENT && 849 send_oos = rw == WRITE && drbd_should_send_oos(mdev);
833 mdev->state.conn >= C_CONNECTED && 850 D_ASSERT(!(remote && send_oos));
834 mdev->state.conn < C_AHEAD));
835 send_oos = (rw == WRITE && mdev->state.conn == C_AHEAD &&
836 mdev->state.pdsk >= D_INCONSISTENT);
837 851
838 if (!(local || remote) && !is_susp(mdev->state)) { 852 if (!(local || remote) && !is_susp(mdev->state)) {
839 if (__ratelimit(&drbd_ratelimit_state)) 853 if (__ratelimit(&drbd_ratelimit_state))
@@ -873,12 +887,9 @@ allocate_barrier:
873 } 887 }
874 888
875 if (remote || send_oos) { 889 if (remote || send_oos) {
876 remote = (mdev->state.pdsk == D_UP_TO_DATE || 890 remote = drbd_should_do_remote(mdev);
877 (mdev->state.pdsk >= D_INCONSISTENT && 891 send_oos = rw == WRITE && drbd_should_send_oos(mdev);
878 mdev->state.conn >= C_CONNECTED && 892 D_ASSERT(!(remote && send_oos));
879 mdev->state.conn < C_AHEAD));
880 send_oos = (rw == WRITE && mdev->state.conn == C_AHEAD &&
881 mdev->state.pdsk >= D_INCONSISTENT);
882 893
883 if (!(remote || send_oos)) 894 if (!(remote || send_oos))
884 dev_warn(DEV, "lost connection while grabbing the req_lock!\n"); 895 dev_warn(DEV, "lost connection while grabbing the req_lock!\n");