aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2013-11-22 09:53:41 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2014-07-10 09:22:19 -0400
commite952658020c5150ad4987d313e25e8e2fb38d529 (patch)
tree2854dd350aa75ce6fbb8b491346d27dff6ff14e0 /drivers/block/drbd
parent6a27b656fc0210e976db362e1368c56db05c8f08 (diff)
drbd: Move write_ordering from connection to resource
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r--drivers/block/drbd/drbd_int.h5
-rw-r--r--drivers/block/drbd/drbd_main.c2
-rw-r--r--drivers/block/drbd/drbd_nl.c4
-rw-r--r--drivers/block/drbd/drbd_proc.c2
-rw-r--r--drivers/block/drbd/drbd_receiver.c25
5 files changed, 19 insertions, 19 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index a76ceb344d64..1ef2474e8f11 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -594,6 +594,8 @@ struct drbd_resource {
594 unsigned susp_nod:1; /* IO suspended because no data */ 594 unsigned susp_nod:1; /* IO suspended because no data */
595 unsigned susp_fen:1; /* IO suspended because fence peer handler runs */ 595 unsigned susp_fen:1; /* IO suspended because fence peer handler runs */
596 596
597 enum write_ordering_e write_ordering;
598
597 cpumask_var_t cpu_mask; 599 cpumask_var_t cpu_mask;
598}; 600};
599 601
@@ -636,7 +638,6 @@ struct drbd_connection {
636 struct drbd_epoch *current_epoch; 638 struct drbd_epoch *current_epoch;
637 spinlock_t epoch_lock; 639 spinlock_t epoch_lock;
638 unsigned int epochs; 640 unsigned int epochs;
639 enum write_ordering_e write_ordering;
640 atomic_t current_tle_nr; /* transfer log epoch number */ 641 atomic_t current_tle_nr; /* transfer log epoch number */
641 unsigned current_tle_writes; /* writes seen within this tl epoch */ 642 unsigned current_tle_writes; /* writes seen within this tl epoch */
642 643
@@ -1478,7 +1479,7 @@ static inline void drbd_generic_make_request(struct drbd_device *device,
1478 generic_make_request(bio); 1479 generic_make_request(bio);
1479} 1480}
1480 1481
1481void drbd_bump_write_ordering(struct drbd_connection *connection, enum write_ordering_e wo); 1482void drbd_bump_write_ordering(struct drbd_resource *resource, enum write_ordering_e wo);
1482 1483
1483/* drbd_proc.c */ 1484/* drbd_proc.c */
1484extern struct proc_dir_entry *drbd_proc; 1485extern struct proc_dir_entry *drbd_proc;
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 960645c26e6f..17b9a237f2e6 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2579,6 +2579,7 @@ struct drbd_resource *drbd_create_resource(const char *name)
2579 kref_init(&resource->kref); 2579 kref_init(&resource->kref);
2580 idr_init(&resource->devices); 2580 idr_init(&resource->devices);
2581 INIT_LIST_HEAD(&resource->connections); 2581 INIT_LIST_HEAD(&resource->connections);
2582 resource->write_ordering = WO_bdev_flush;
2582 list_add_tail_rcu(&resource->resources, &drbd_resources); 2583 list_add_tail_rcu(&resource->resources, &drbd_resources);
2583 mutex_init(&resource->conf_update); 2584 mutex_init(&resource->conf_update);
2584 mutex_init(&resource->adm_mutex); 2585 mutex_init(&resource->adm_mutex);
@@ -2617,7 +2618,6 @@ struct drbd_connection *conn_create(const char *name, struct res_opts *res_opts)
2617 INIT_LIST_HEAD(&connection->current_epoch->list); 2618 INIT_LIST_HEAD(&connection->current_epoch->list);
2618 connection->epochs = 1; 2619 connection->epochs = 1;
2619 spin_lock_init(&connection->epoch_lock); 2620 spin_lock_init(&connection->epoch_lock);
2620 connection->write_ordering = WO_bdev_flush;
2621 2621
2622 connection->send.seen_any_write_yet = false; 2622 connection->send.seen_any_write_yet = false;
2623 connection->send.current_epoch_nr = 0; 2623 connection->send.current_epoch_nr = 0;
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 1b35c45c92b7..43fad2c1ba01 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1399,7 +1399,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
1399 else 1399 else
1400 set_bit(MD_NO_FUA, &device->flags); 1400 set_bit(MD_NO_FUA, &device->flags);
1401 1401
1402 drbd_bump_write_ordering(first_peer_device(device)->connection, WO_bdev_flush); 1402 drbd_bump_write_ordering(device->resource, WO_bdev_flush);
1403 1403
1404 drbd_md_sync(device); 1404 drbd_md_sync(device);
1405 1405
@@ -1704,7 +1704,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
1704 new_disk_conf = NULL; 1704 new_disk_conf = NULL;
1705 new_plan = NULL; 1705 new_plan = NULL;
1706 1706
1707 drbd_bump_write_ordering(first_peer_device(device)->connection, WO_bdev_flush); 1707 drbd_bump_write_ordering(device->resource, WO_bdev_flush);
1708 1708
1709 if (drbd_md_test_flag(device->ldev, MDF_CRASHED_PRIMARY)) 1709 if (drbd_md_test_flag(device->ldev, MDF_CRASHED_PRIMARY))
1710 set_bit(CRASHED_PRIMARY, &device->flags); 1710 set_bit(CRASHED_PRIMARY, &device->flags);
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c
index 89736bdbbc70..f11e57308104 100644
--- a/drivers/block/drbd/drbd_proc.c
+++ b/drivers/block/drbd/drbd_proc.c
@@ -281,7 +281,7 @@ static int drbd_seq_show(struct seq_file *seq, void *v)
281 atomic_read(&device->unacked_cnt), 281 atomic_read(&device->unacked_cnt),
282 atomic_read(&device->ap_bio_cnt), 282 atomic_read(&device->ap_bio_cnt),
283 first_peer_device(device)->connection->epochs, 283 first_peer_device(device)->connection->epochs,
284 write_ordering_chars[first_peer_device(device)->connection->write_ordering] 284 write_ordering_chars[device->resource->write_ordering]
285 ); 285 );
286 seq_printf(seq, " oos:%llu\n", 286 seq_printf(seq, " oos:%llu\n",
287 Bit2KB((unsigned long long) 287 Bit2KB((unsigned long long)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 5b17ec88ea05..c7084188c2ae 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1151,7 +1151,7 @@ static void drbd_flush(struct drbd_connection *connection)
1151 struct drbd_peer_device *peer_device; 1151 struct drbd_peer_device *peer_device;
1152 int vnr; 1152 int vnr;
1153 1153
1154 if (connection->write_ordering >= WO_bdev_flush) { 1154 if (connection->resource->write_ordering >= WO_bdev_flush) {
1155 rcu_read_lock(); 1155 rcu_read_lock();
1156 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) { 1156 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
1157 struct drbd_device *device = peer_device->device; 1157 struct drbd_device *device = peer_device->device;
@@ -1168,7 +1168,7 @@ static void drbd_flush(struct drbd_connection *connection)
1168 /* would rather check on EOPNOTSUPP, but that is not reliable. 1168 /* would rather check on EOPNOTSUPP, but that is not reliable.
1169 * don't try again for ANY return value != 0 1169 * don't try again for ANY return value != 0
1170 * if (rv == -EOPNOTSUPP) */ 1170 * if (rv == -EOPNOTSUPP) */
1171 drbd_bump_write_ordering(connection, WO_drain_io); 1171 drbd_bump_write_ordering(connection->resource, WO_drain_io);
1172 } 1172 }
1173 put_ldev(device); 1173 put_ldev(device);
1174 kref_put(&device->kref, drbd_destroy_device); 1174 kref_put(&device->kref, drbd_destroy_device);
@@ -1262,10 +1262,10 @@ static enum finish_epoch drbd_may_finish_epoch(struct drbd_connection *connectio
1262 * @connection: DRBD connection. 1262 * @connection: DRBD connection.
1263 * @wo: Write ordering method to try. 1263 * @wo: Write ordering method to try.
1264 */ 1264 */
1265void drbd_bump_write_ordering(struct drbd_connection *connection, enum write_ordering_e wo) 1265void drbd_bump_write_ordering(struct drbd_resource *resource, enum write_ordering_e wo)
1266{ 1266{
1267 struct disk_conf *dc; 1267 struct disk_conf *dc;
1268 struct drbd_peer_device *peer_device; 1268 struct drbd_device *device;
1269 enum write_ordering_e pwo; 1269 enum write_ordering_e pwo;
1270 int vnr; 1270 int vnr;
1271 static char *write_ordering_str[] = { 1271 static char *write_ordering_str[] = {
@@ -1274,12 +1274,10 @@ void drbd_bump_write_ordering(struct drbd_connection *connection, enum write_ord
1274 [WO_bdev_flush] = "flush", 1274 [WO_bdev_flush] = "flush",
1275 }; 1275 };
1276 1276
1277 pwo = connection->write_ordering; 1277 pwo = resource->write_ordering;
1278 wo = min(pwo, wo); 1278 wo = min(pwo, wo);
1279 rcu_read_lock(); 1279 rcu_read_lock();
1280 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) { 1280 idr_for_each_entry(&resource->devices, device, vnr) {
1281 struct drbd_device *device = peer_device->device;
1282
1283 if (!get_ldev_if_state(device, D_ATTACHING)) 1281 if (!get_ldev_if_state(device, D_ATTACHING))
1284 continue; 1282 continue;
1285 dc = rcu_dereference(device->ldev->disk_conf); 1283 dc = rcu_dereference(device->ldev->disk_conf);
@@ -1291,9 +1289,9 @@ void drbd_bump_write_ordering(struct drbd_connection *connection, enum write_ord
1291 put_ldev(device); 1289 put_ldev(device);
1292 } 1290 }
1293 rcu_read_unlock(); 1291 rcu_read_unlock();
1294 connection->write_ordering = wo; 1292 resource->write_ordering = wo;
1295 if (pwo != connection->write_ordering || wo == WO_bdev_flush) 1293 if (pwo != resource->write_ordering || wo == WO_bdev_flush)
1296 drbd_info(connection, "Method to ensure write ordering: %s\n", write_ordering_str[connection->write_ordering]); 1294 drbd_info(resource, "Method to ensure write ordering: %s\n", write_ordering_str[resource->write_ordering]);
1297} 1295}
1298 1296
1299/** 1297/**
@@ -1471,7 +1469,7 @@ static int receive_Barrier(struct drbd_connection *connection, struct packet_inf
1471 * R_PRIMARY crashes now. 1469 * R_PRIMARY crashes now.
1472 * Therefore we must send the barrier_ack after the barrier request was 1470 * Therefore we must send the barrier_ack after the barrier request was
1473 * completed. */ 1471 * completed. */
1474 switch (connection->write_ordering) { 1472 switch (connection->resource->write_ordering) {
1475 case WO_none: 1473 case WO_none:
1476 if (rv == FE_RECYCLED) 1474 if (rv == FE_RECYCLED)
1477 return 0; 1475 return 0;
@@ -1498,7 +1496,8 @@ static int receive_Barrier(struct drbd_connection *connection, struct packet_inf
1498 1496
1499 return 0; 1497 return 0;
1500 default: 1498 default:
1501 drbd_err(connection, "Strangeness in connection->write_ordering %d\n", connection->write_ordering); 1499 drbd_err(connection, "Strangeness in connection->write_ordering %d\n",
1500 connection->resource->write_ordering);
1502 return -EIO; 1501 return -EIO;
1503 } 1502 }
1504 1503