aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_int.h
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-05-17 10:10:43 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2010-05-17 20:03:49 -0400
commit0c3f34516e8c5a1a0ba3585a7777d32bbbdf4ecb (patch)
treebb61a6235de8a6a87ebc4d4f39630d17e3c9a3de /drivers/block/drbd/drbd_int.h
parent9a25a04c8079725c1b1ab756694a8e0757844b40 (diff)
drbd: Create new current UUID as late as possible
The choice was to either delay creation of the new UUID until IO got thawed or to delay it until the first IO request. Both are correct, the later is more friendly to users of dual-primary setups, that actually only write on one side. 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_int.h')
-rw-r--r--drivers/block/drbd/drbd_int.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index c194348a46ed..e9654c8d5b62 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -943,7 +943,8 @@ struct drbd_conf {
943 struct drbd_work resync_work, 943 struct drbd_work resync_work,
944 unplug_work, 944 unplug_work,
945 md_sync_work, 945 md_sync_work,
946 delay_probe_work; 946 delay_probe_work,
947 uuid_work;
947 struct timer_list resync_timer; 948 struct timer_list resync_timer;
948 struct timer_list md_sync_timer; 949 struct timer_list md_sync_timer;
949 struct timer_list delay_probe_timer; 950 struct timer_list delay_probe_timer;
@@ -1068,6 +1069,7 @@ struct drbd_conf {
1068 struct timeval dps_time; /* delay-probes-start-time */ 1069 struct timeval dps_time; /* delay-probes-start-time */
1069 unsigned int dp_volume_last; /* send_cnt of last delay probe */ 1070 unsigned int dp_volume_last; /* send_cnt of last delay probe */
1070 int c_sync_rate; /* current resync rate after delay_probe magic */ 1071 int c_sync_rate; /* current resync rate after delay_probe magic */
1072 atomic_t new_c_uuid;
1071}; 1073};
1072 1074
1073static inline struct drbd_conf *minor_to_mdev(unsigned int minor) 1075static inline struct drbd_conf *minor_to_mdev(unsigned int minor)
@@ -2217,6 +2219,8 @@ static inline int __inc_ap_bio_cond(struct drbd_conf *mdev)
2217 return 0; 2219 return 0;
2218 if (test_bit(BITMAP_IO, &mdev->flags)) 2220 if (test_bit(BITMAP_IO, &mdev->flags))
2219 return 0; 2221 return 0;
2222 if (atomic_read(&mdev->new_c_uuid))
2223 return 0;
2220 return 1; 2224 return 1;
2221} 2225}
2222 2226
@@ -2237,6 +2241,9 @@ static inline void inc_ap_bio(struct drbd_conf *mdev, int count)
2237 * to avoid races with the reconnect code, 2241 * to avoid races with the reconnect code,
2238 * we need to atomic_inc within the spinlock. */ 2242 * we need to atomic_inc within the spinlock. */
2239 2243
2244 if (atomic_read(&mdev->new_c_uuid) && atomic_add_unless(&mdev->new_c_uuid, -1, 1))
2245 drbd_queue_work_front(&mdev->data.work, &mdev->uuid_work);
2246
2240 spin_lock_irq(&mdev->req_lock); 2247 spin_lock_irq(&mdev->req_lock);
2241 while (!__inc_ap_bio_cond(mdev)) { 2248 while (!__inc_ap_bio_cond(mdev)) {
2242 prepare_to_wait(&mdev->misc_wait, &wait, TASK_UNINTERRUPTIBLE); 2249 prepare_to_wait(&mdev->misc_wait, &wait, TASK_UNINTERRUPTIBLE);