Lars Ellenberg
4738fa1690
drbd: use clear_bit_unlock() where appropriate
...
Some open-coded clear_bit(); smp_mb__after_clear_bit();
should in fact have been smp_mb__before_clear_bit(); clear_bit();
Instead, use clear_bit_unlock() to annotate the intention,
and have it do the right thing.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:42 +02:00
Lars Ellenberg
61610420f7
drbd: in drbd_suspend_al, set AL_SUSPENDED before unlocking the activity log
...
As using an empty activity log is the whole point of the excercise,
make sure it is still empty when setting AL_SUSPENDED.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:41 +02:00
Lars Ellenberg
867f57483b
drbd: fix typo in comment
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:40 +02:00
Lars Ellenberg
8c387def58
drbd: simplify condition in drbd_may_do_local_read()
...
fold
if (x >= (N+1))
return 0;
if (x < N)
return 0;
into
if (x != N)
return 0;
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:39 +02:00
Andreas Gruenbacher
c670a39867
drbd: Use the IS_ALIGNED() macro in some more places
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:39 +02:00
Andreas Gruenbacher
8ca9844f10
drbd: Remove obsolete comment
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:38 +02:00
Andreas Gruenbacher
d0e22a260c
drbd: Iterate over all overlapping intervals in a tree
...
Add a macro and helper function for doing that.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:37 +02:00
Andreas Gruenbacher
fcefa62e4c
drbd: Rename drbd_endio_{pri,sec} -> drbd_{,peer_}request_endio
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:36 +02:00
Andreas Gruenbacher
fbe29dec98
drbd: Rename drbd_submit_ee -> drbd_submit_peer_request
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:35 +02:00
Philipp Reisner
df24aa45f4
drbd: Implemented connection wide state changes
...
That is used for graceful disconnect only
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:47:32 +02:00
Philipp Reisner
047cd4a682
drbd: implemented receiving of P_CONN_ST_CHG_REQ
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:45:05 +02:00
Philipp Reisner
fc3b10a45f
drbd: Implemented receiving of P_CONN_ST_CHG_REPLY
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:45:04 +02:00
Philipp Reisner
5aabf467e3
drbd: Global_state_lock not necessary here...
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:45:03 +02:00
Philipp Reisner
cf29c9d8c8
drbd: Implemented conn_send_state_req()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:45:02 +02:00
Philipp Reisner
8410da8f0e
drbd: Introduced tconn->cstate_mutex
...
In compatibility mode with old DRBDs, use that as the state_mutex
as well.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:45:01 +02:00
Philipp Reisner
dad2055481
drbd: Removed drbd_state_lock() and drbd_state_unlock()
...
The lock they constructed is only taken when the state_mutex
was already taken. It is superficial.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:45:01 +02:00
Philipp Reisner
bbeb641c3e
drbd: Killed volume0; last step of multi-volume-enablement
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-10-14 16:44:58 +02:00
Philipp Reisner
56707f9e87
drbd: Code de-duplication; new function apply_mask_val()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:22 +02:00
Philipp Reisner
4308a0a390
drbd: Removed the os parameter form sanitize_state()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:21 +02:00
Philipp Reisner
fda74117dc
drbd: Extracted is_valid_conn_transition() out of is_valid_transition()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:20 +02:00
Philipp Reisner
3509502dc8
drbd: Extracted is_valid_transition() out of sanitize_state()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:19 +02:00
Philipp Reisner
a75f34ad0c
drbd: Renamed is_valid_state_transition() to is_valid_soft_transition()
...
And removed the unused mdev parameter, and made the order of
the state parameters: os, ns
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:18 +02:00
Philipp Reisner
d50eee21c4
drbd: Extracted after_conn_state_ch() out of after_state_ch()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:17 +02:00
Philipp Reisner
2a67d8b93b
drbd: Converted drbd_send_ping() and related functions from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:16 +02:00
Philipp Reisner
00d56944ff
drbd: Generalized the work callbacks
...
No longer work callbacks must operate on a mdev. From now on they
can also operate on a tconn.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:15 +02:00
Philipp Reisner
6699b65533
drbd: Moved some initializing code into drbd_new_tconn()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:14 +02:00
Philipp Reisner
392c880192
drbd: drbd_thread has now a pointer to a tconn instead of to a mdev
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:13 +02:00
Philipp Reisner
19393e105f
drbd: Converted drbd_worker() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:12 +02:00
Philipp Reisner
32862ec705
drbd: Converted drbd_asender() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:11 +02:00
Philipp Reisner
4d641dd7b0
drbd: Converted drbdd_init() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:10 +02:00
Philipp Reisner
f1b3a6ec7d
drbd: Consolidated the setup of the thread name into the framework
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:09 +02:00
Philipp Reisner
a21e929827
drbd: Moved the mdev member into drbd_work (from drbd_request and drbd_peer_request)
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:08 +02:00
Philipp Reisner
360cc74052
drbd: Converted drbd_free_sock() and drbd_disconnect() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:06 +02:00
Philipp Reisner
eefc2f7de2
drbd: Converted drbdd() from mdev to tconn
...
The drbd_md_sync(mdev) happens in the after state change anyways...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:05 +02:00
Philipp Reisner
808222845d
drbd: Converted drbd_calc_cpu_mask() and drbd_thread_current_set_cpu() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:04 +02:00
Philipp Reisner
907599e044
drbd: Converted drbd_connect() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:03 +02:00
Philipp Reisner
062e879c8b
drbd: Use and idr data structure to map volume numbers to mdev pointers
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:02 +02:00
Philipp Reisner
dc8228d107
drbd: Converted drbd_send_protocol() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:01 +02:00
Philipp Reisner
13e6037dc9
drbd: Converted drbd_do_auth() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:33:00 +02:00
Philipp Reisner
611208706f
drbd: Converted drbd_(get|put)_data_sock() and drbd_send_cmd2() to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:32:59 +02:00
Philipp Reisner
65d11ed6f2
drbd: Converted drbd_do_handshake() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:32:58 +02:00
Philipp Reisner
9ba7aa00ae
drbd: Converted drbd_recv_header() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:32:57 +02:00
Philipp Reisner
ce24385342
drbd: Converted decode_header() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:32:56 +02:00
Philipp Reisner
77351055b5
drbd: struct packet_info to hold information of decoded packets
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:32:50 +02:00
Philipp Reisner
de0ff338d6
drbd: Converted drbd_recv() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:29:52 +02:00
Philipp Reisner
8a22cccc20
drbd: Converted drbd_send_handshake() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:29:50 +02:00
Philipp Reisner
a25b63f1e7
drbd: Converted drbd_recv_fp() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:29:49 +02:00
Philipp Reisner
dbd9eea094
drbd: Removed unused mdev argument from drbd_recv_short() and drbd_socket_okay()
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:29:48 +02:00
Philipp Reisner
d38e787ecc
drbd: Converted drbd_send_fp() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:29:45 +02:00
Philipp Reisner
bedbd2a53a
drbd: Converted drbd_send() from mdev to tconn
...
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2011-09-28 10:27:00 +02:00