aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2012-02-20 15:53:28 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 10:58:31 -0500
commit9a51ab1c1b3c1e21f076cdd571bbe6ca7d1b504c (patch)
tree863ba573f9a803d5f64979dae566a89ea22bbe5f
parent26ec92871be1e6bd48d0be9ab38ee1ebbeea49f1 (diff)
drbd: New disk option al-updates
By disabling al-updates one might increase performace. The price for that is that in case a crashed primary (that had al-updates disabled) is reintegraded, it will receive a full-resync instead of a bitmap based resync. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_actlog.c12
-rw-r--r--drivers/block/drbd/drbd_nl.c17
-rw-r--r--include/linux/drbd.h1
-rw-r--r--include/linux/drbd_genl.h3
-rw-r--r--include/linux/drbd_limits.h1
5 files changed, 30 insertions, 4 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 9eae28944312..83d48d210b69 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -276,8 +276,16 @@ void drbd_al_begin_io(struct drbd_conf *mdev, struct drbd_interval *i)
276 /* Double check: it may have been committed by someone else, 276 /* Double check: it may have been committed by someone else,
277 * while we have been waiting for the lock. */ 277 * while we have been waiting for the lock. */
278 if (mdev->act_log->pending_changes) { 278 if (mdev->act_log->pending_changes) {
279 al_write_transaction(mdev); 279 bool write_al_updates;
280 mdev->al_writ_cnt++; 280
281 rcu_read_lock();
282 write_al_updates = rcu_dereference(mdev->ldev->disk_conf)->al_updates;
283 rcu_read_unlock();
284
285 if (write_al_updates) {
286 al_write_transaction(mdev);
287 mdev->al_writ_cnt++;
288 }
281 289
282 spin_lock_irq(&mdev->al_lock); 290 spin_lock_irq(&mdev->al_lock);
283 /* FIXME 291 /* FIXME
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index dc5bd6bbb280..c5d4fac1a111 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1230,6 +1230,11 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
1230 1230
1231 mutex_unlock(&mdev->tconn->conf_update); 1231 mutex_unlock(&mdev->tconn->conf_update);
1232 1232
1233 if (new_disk_conf->al_updates)
1234 mdev->ldev->md.flags &= MDF_AL_DISABLED;
1235 else
1236 mdev->ldev->md.flags |= MDF_AL_DISABLED;
1237
1233 drbd_bump_write_ordering(mdev->tconn, WO_bdev_flush); 1238 drbd_bump_write_ordering(mdev->tconn, WO_bdev_flush);
1234 1239
1235 drbd_md_sync(mdev); 1240 drbd_md_sync(mdev);
@@ -1545,7 +1550,9 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
1545 } else if (dd == grew) 1550 } else if (dd == grew)
1546 set_bit(RESYNC_AFTER_NEG, &mdev->flags); 1551 set_bit(RESYNC_AFTER_NEG, &mdev->flags);
1547 1552
1548 if (drbd_md_test_flag(mdev->ldev, MDF_FULL_SYNC)) { 1553 if (drbd_md_test_flag(mdev->ldev, MDF_FULL_SYNC) ||
1554 (test_bit(CRASHED_PRIMARY, &mdev->flags) &&
1555 drbd_md_test_flag(mdev->ldev, MDF_AL_DISABLED))) {
1549 dev_info(DEV, "Assuming that all blocks are out of sync " 1556 dev_info(DEV, "Assuming that all blocks are out of sync "
1550 "(aka FullSync)\n"); 1557 "(aka FullSync)\n");
1551 if (drbd_bitmap_io(mdev, &drbd_bmio_set_n_write, 1558 if (drbd_bitmap_io(mdev, &drbd_bmio_set_n_write,
@@ -1588,13 +1595,19 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
1588 if (ns.disk == D_CONSISTENT && 1595 if (ns.disk == D_CONSISTENT &&
1589 (ns.pdsk == D_OUTDATED || rcu_dereference(mdev->ldev->disk_conf)->fencing == FP_DONT_CARE)) 1596 (ns.pdsk == D_OUTDATED || rcu_dereference(mdev->ldev->disk_conf)->fencing == FP_DONT_CARE))
1590 ns.disk = D_UP_TO_DATE; 1597 ns.disk = D_UP_TO_DATE;
1591 rcu_read_unlock();
1592 1598
1593 /* All tests on MDF_PRIMARY_IND, MDF_CONNECTED_IND, 1599 /* All tests on MDF_PRIMARY_IND, MDF_CONNECTED_IND,
1594 MDF_CONSISTENT and MDF_WAS_UP_TO_DATE must happen before 1600 MDF_CONSISTENT and MDF_WAS_UP_TO_DATE must happen before
1595 this point, because drbd_request_state() modifies these 1601 this point, because drbd_request_state() modifies these
1596 flags. */ 1602 flags. */
1597 1603
1604 if (rcu_dereference(mdev->ldev->disk_conf)->al_updates)
1605 mdev->ldev->md.flags &= MDF_AL_DISABLED;
1606 else
1607 mdev->ldev->md.flags |= MDF_AL_DISABLED;
1608
1609 rcu_read_unlock();
1610
1598 /* In case we are C_CONNECTED postpone any decision on the new disk 1611 /* In case we are C_CONNECTED postpone any decision on the new disk
1599 state after the negotiation phase. */ 1612 state after the negotiation phase. */
1600 if (mdev->state.conn == C_CONNECTED) { 1613 if (mdev->state.conn == C_CONNECTED) {
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 1e86156c10f7..36ae7dd28d90 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -338,6 +338,7 @@ extern const char *drbd_set_st_err_str(enum drbd_state_rv);
338#define MDF_PEER_OUT_DATED (1 << 5) 338#define MDF_PEER_OUT_DATED (1 << 5)
339#define MDF_CRASHED_PRIMARY (1 << 6) 339#define MDF_CRASHED_PRIMARY (1 << 6)
340#define MDF_AL_CLEAN (1 << 7) 340#define MDF_AL_CLEAN (1 << 7)
341#define MDF_AL_DISABLED (1 << 8)
341 342
342enum drbd_uuid_index { 343enum drbd_uuid_index {
343 UI_CURRENT, 344 UI_CURRENT,
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index 826008f297fe..92ec4b50a885 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -130,6 +130,8 @@ GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
130 __flg_field_def(19, DRBD_GENLA_F_MANDATORY, md_flushes, DRBD_MD_FLUSHES_DEF) 130 __flg_field_def(19, DRBD_GENLA_F_MANDATORY, md_flushes, DRBD_MD_FLUSHES_DEF)
131 __u32_field_def(20, DRBD_GENLA_F_MANDATORY, disk_timeout, DRBD_DISK_TIMEOUT_DEF) 131 __u32_field_def(20, DRBD_GENLA_F_MANDATORY, disk_timeout, DRBD_DISK_TIMEOUT_DEF)
132 __u32_field_def(21, 0 /* OPTIONAL */, read_balancing, DRBD_READ_BALANCING_DEF) 132 __u32_field_def(21, 0 /* OPTIONAL */, read_balancing, DRBD_READ_BALANCING_DEF)
133 /* 9: __u32_field_def(22, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF) */
134 __flg_field_def(23, 0 /* OPTIONAL */, al_updates, DRBD_AL_UPDATES_DEF)
133) 135)
134 136
135GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts, 137GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts,
@@ -168,6 +170,7 @@ GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
168 __flg_field_def(27, DRBD_GENLA_F_MANDATORY, always_asbp, DRBD_ALWAYS_ASBP_DEF) 170 __flg_field_def(27, DRBD_GENLA_F_MANDATORY, always_asbp, DRBD_ALWAYS_ASBP_DEF)
169 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative) 171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative)
170 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF) 172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF)
173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */
171) 174)
172 175
173GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms, 176GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 17ef66a5c114..1fa19c5f5e64 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -210,6 +210,7 @@
210#define DRBD_DISK_DRAIN_DEF 1 210#define DRBD_DISK_DRAIN_DEF 1
211#define DRBD_MD_FLUSHES_DEF 1 211#define DRBD_MD_FLUSHES_DEF 1
212#define DRBD_TCP_CORK_DEF 1 212#define DRBD_TCP_CORK_DEF 1
213#define DRBD_AL_UPDATES_DEF 1
213 214
214#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0 215#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0
215#define DRBD_ALWAYS_ASBP_DEF 0 216#define DRBD_ALWAYS_ASBP_DEF 0