diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-07-07 19:19:44 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-02-17 10:46:47 -0500 |
commit | 6bbf53ca6269353c1d8174678b15aa4288a9cdb0 (patch) | |
tree | 0853697b0875051683d35b828e298a8e27f3293f /drivers/block/drbd | |
parent | 0500813fe0c9a617ace86d91344e36839050dad6 (diff) |
drbd: Move susp, susp_nod, susp_fen from connection to resource
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 18 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 3 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_state.c | 17 |
4 files changed, 21 insertions, 19 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 3f379ff779b2..af68d64a0faf 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -580,6 +580,10 @@ struct drbd_resource { | |||
580 | struct res_opts res_opts; | 580 | struct res_opts res_opts; |
581 | struct mutex conf_update; /* mutex for ready-copy-update of net_conf and disk_conf */ | 581 | struct mutex conf_update; /* mutex for ready-copy-update of net_conf and disk_conf */ |
582 | spinlock_t req_lock; | 582 | spinlock_t req_lock; |
583 | |||
584 | unsigned susp:1; /* IO suspended by user */ | ||
585 | unsigned susp_nod:1; /* IO suspended because no data */ | ||
586 | unsigned susp_fen:1; /* IO suspended because fence peer handler runs */ | ||
583 | }; | 587 | }; |
584 | 588 | ||
585 | struct drbd_connection { | 589 | struct drbd_connection { |
@@ -588,9 +592,6 @@ struct drbd_connection { | |||
588 | struct kref kref; | 592 | struct kref kref; |
589 | struct idr peer_devices; /* volume number to peer device mapping */ | 593 | struct idr peer_devices; /* volume number to peer device mapping */ |
590 | enum drbd_conns cstate; /* Only C_STANDALONE to C_WF_REPORT_PARAMS */ | 594 | enum drbd_conns cstate; /* Only C_STANDALONE to C_WF_REPORT_PARAMS */ |
591 | unsigned susp:1; /* IO suspended by user */ | ||
592 | unsigned susp_nod:1; /* IO suspended because no data */ | ||
593 | unsigned susp_fen:1; /* IO suspended because fence peer handler runs */ | ||
594 | struct mutex cstate_mutex; /* Protects graceful disconnects */ | 595 | struct mutex cstate_mutex; /* Protects graceful disconnects */ |
595 | unsigned int connect_cnt; /* Inc each time a connection is established */ | 596 | unsigned int connect_cnt; /* Inc each time a connection is established */ |
596 | 597 | ||
@@ -1507,12 +1508,13 @@ _drbd_set_state(struct drbd_device *device, union drbd_state ns, | |||
1507 | 1508 | ||
1508 | static inline union drbd_state drbd_read_state(struct drbd_device *device) | 1509 | static inline union drbd_state drbd_read_state(struct drbd_device *device) |
1509 | { | 1510 | { |
1511 | struct drbd_resource *resource = device->resource; | ||
1510 | union drbd_state rv; | 1512 | union drbd_state rv; |
1511 | 1513 | ||
1512 | rv.i = device->state.i; | 1514 | rv.i = device->state.i; |
1513 | rv.susp = first_peer_device(device)->connection->susp; | 1515 | rv.susp = resource->susp; |
1514 | rv.susp_nod = first_peer_device(device)->connection->susp_nod; | 1516 | rv.susp_nod = resource->susp_nod; |
1515 | rv.susp_fen = first_peer_device(device)->connection->susp_fen; | 1517 | rv.susp_fen = resource->susp_fen; |
1516 | 1518 | ||
1517 | return rv; | 1519 | return rv; |
1518 | } | 1520 | } |
@@ -2033,9 +2035,9 @@ static inline int drbd_state_is_stable(struct drbd_device *device) | |||
2033 | 2035 | ||
2034 | static inline int drbd_suspended(struct drbd_device *device) | 2036 | static inline int drbd_suspended(struct drbd_device *device) |
2035 | { | 2037 | { |
2036 | struct drbd_connection *connection = first_peer_device(device)->connection; | 2038 | struct drbd_resource *resource = device->resource; |
2037 | 2039 | ||
2038 | return connection->susp || connection->susp_fen || connection->susp_nod; | 2040 | return resource->susp || resource->susp_fen || resource->susp_nod; |
2039 | } | 2041 | } |
2040 | 2042 | ||
2041 | static inline bool may_inc_ap_bio(struct drbd_device *device) | 2043 | static inline bool may_inc_ap_bio(struct drbd_device *device) |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index fc439605aa69..e07446e19c74 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2534,7 +2534,7 @@ struct drbd_resource *drbd_create_resource(const char *name) | |||
2534 | { | 2534 | { |
2535 | struct drbd_resource *resource; | 2535 | struct drbd_resource *resource; |
2536 | 2536 | ||
2537 | resource = kmalloc(sizeof(struct drbd_resource), GFP_KERNEL); | 2537 | resource = kzalloc(sizeof(struct drbd_resource), GFP_KERNEL); |
2538 | if (!resource) | 2538 | if (!resource) |
2539 | return NULL; | 2539 | return NULL; |
2540 | resource->name = kstrdup(name, GFP_KERNEL); | 2540 | resource->name = kstrdup(name, GFP_KERNEL); |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 684be38932e3..5ed169d6cf5a 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -1665,8 +1665,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1665 | clear_bit(CRASHED_PRIMARY, &device->flags); | 1665 | clear_bit(CRASHED_PRIMARY, &device->flags); |
1666 | 1666 | ||
1667 | if (drbd_md_test_flag(device->ldev, MDF_PRIMARY_IND) && | 1667 | if (drbd_md_test_flag(device->ldev, MDF_PRIMARY_IND) && |
1668 | !(device->state.role == R_PRIMARY && | 1668 | !(device->state.role == R_PRIMARY && device->resource->susp_nod)) |
1669 | first_peer_device(device)->connection->susp_nod)) | ||
1670 | set_bit(CRASHED_PRIMARY, &device->flags); | 1669 | set_bit(CRASHED_PRIMARY, &device->flags); |
1671 | 1670 | ||
1672 | device->send_cnt = 0; | 1671 | device->send_cnt = 0; |
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index 10c89314ff2b..fbff4bf6dbc2 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c | |||
@@ -1008,9 +1008,9 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns, | |||
1008 | did_remote = drbd_should_do_remote(device->state); | 1008 | did_remote = drbd_should_do_remote(device->state); |
1009 | device->state.i = ns.i; | 1009 | device->state.i = ns.i; |
1010 | should_do_remote = drbd_should_do_remote(device->state); | 1010 | should_do_remote = drbd_should_do_remote(device->state); |
1011 | first_peer_device(device)->connection->susp = ns.susp; | 1011 | device->resource->susp = ns.susp; |
1012 | first_peer_device(device)->connection->susp_nod = ns.susp_nod; | 1012 | device->resource->susp_nod = ns.susp_nod; |
1013 | first_peer_device(device)->connection->susp_fen = ns.susp_fen; | 1013 | device->resource->susp_fen = ns.susp_fen; |
1014 | 1014 | ||
1015 | /* put replicated vs not-replicated requests in seperate epochs */ | 1015 | /* put replicated vs not-replicated requests in seperate epochs */ |
1016 | if (did_remote != should_do_remote) | 1016 | if (did_remote != should_do_remote) |
@@ -1219,6 +1219,7 @@ int drbd_bitmap_io_from_worker(struct drbd_device *device, | |||
1219 | static void after_state_ch(struct drbd_device *device, union drbd_state os, | 1219 | static void after_state_ch(struct drbd_device *device, union drbd_state os, |
1220 | union drbd_state ns, enum chg_state_flags flags) | 1220 | union drbd_state ns, enum chg_state_flags flags) |
1221 | { | 1221 | { |
1222 | struct drbd_resource *resource = device->resource; | ||
1222 | struct sib_info sib; | 1223 | struct sib_info sib; |
1223 | 1224 | ||
1224 | sib.sib_reason = SIB_STATE_CHANGE; | 1225 | sib.sib_reason = SIB_STATE_CHANGE; |
@@ -1253,7 +1254,7 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os, | |||
1253 | conn_lowest_disk(connection) > D_NEGOTIATING) | 1254 | conn_lowest_disk(connection) > D_NEGOTIATING) |
1254 | what = RESTART_FROZEN_DISK_IO; | 1255 | what = RESTART_FROZEN_DISK_IO; |
1255 | 1256 | ||
1256 | if (connection->susp_nod && what != NOTHING) { | 1257 | if (resource->susp_nod && what != NOTHING) { |
1257 | _tl_restart(connection, what); | 1258 | _tl_restart(connection, what); |
1258 | _conn_request_state(connection, | 1259 | _conn_request_state(connection, |
1259 | (union drbd_state) { { .susp_nod = 1 } }, | 1260 | (union drbd_state) { { .susp_nod = 1 } }, |
@@ -1267,7 +1268,7 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os, | |||
1267 | struct drbd_connection *connection = first_peer_device(device)->connection; | 1268 | struct drbd_connection *connection = first_peer_device(device)->connection; |
1268 | 1269 | ||
1269 | spin_lock_irq(&device->resource->req_lock); | 1270 | spin_lock_irq(&device->resource->req_lock); |
1270 | if (connection->susp_fen && conn_lowest_conn(connection) >= C_CONNECTED) { | 1271 | if (resource->susp_fen && conn_lowest_conn(connection) >= C_CONNECTED) { |
1271 | /* case2: The connection was established again: */ | 1272 | /* case2: The connection was established again: */ |
1272 | struct drbd_peer_device *peer_device; | 1273 | struct drbd_peer_device *peer_device; |
1273 | int vnr; | 1274 | int vnr; |
@@ -1750,9 +1751,9 @@ conn_set_state(struct drbd_connection *connection, union drbd_state mask, union | |||
1750 | } }; | 1751 | } }; |
1751 | } | 1752 | } |
1752 | 1753 | ||
1753 | ns_min.susp = ns_max.susp = connection->susp; | 1754 | ns_min.susp = ns_max.susp = connection->resource->susp; |
1754 | ns_min.susp_nod = ns_max.susp_nod = connection->susp_nod; | 1755 | ns_min.susp_nod = ns_max.susp_nod = connection->resource->susp_nod; |
1755 | ns_min.susp_fen = ns_max.susp_fen = connection->susp_fen; | 1756 | ns_min.susp_fen = ns_max.susp_fen = connection->resource->susp_fen; |
1756 | 1757 | ||
1757 | *pns_min = ns_min; | 1758 | *pns_min = ns_min; |
1758 | *pns_max = ns_max; | 1759 | *pns_max = ns_max; |