platform/upstream/kernel-adaptation-pc.git
12 years agodrbd: Converted drbd_nl_(net_conf|disconnect)() from mdev to tconn
Philipp Reisner [Fri, 18 Feb 2011 13:56:45 +0000 (14:56 +0100)]
drbd: Converted drbd_nl_(net_conf|disconnect)() from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Preparing the connector interface to operator on connections
Philipp Reisner [Mon, 21 Feb 2011 14:38:08 +0000 (15:38 +0100)]
drbd: Preparing the connector interface to operator on connections

Up to now it only operated on minor numbers. Now it can work also
on named connections.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Converted the transfer log from mdev to tconn
Philipp Reisner [Mon, 21 Feb 2011 13:29:27 +0000 (14:29 +0100)]
drbd: Converted the transfer log from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Improved the dec_*() macros
Philipp Reisner [Mon, 21 Feb 2011 13:19:44 +0000 (14:19 +0100)]
drbd: Improved the dec_*() macros

Now those can be used with a struct drbd_conf * that has an other
name than 'mdev'.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Removed the mdev parameter from the ..to_tags() and ...from_tags() functions
Philipp Reisner [Thu, 17 Feb 2011 21:50:23 +0000 (22:50 +0100)]
drbd: Removed the mdev parameter from the ..to_tags() and ...from_tags() functions

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Reworked the unconfiguring and thread stopping code
Philipp Reisner [Fri, 18 Feb 2011 13:23:11 +0000 (14:23 +0100)]
drbd: Reworked the unconfiguring and thread stopping code

* Moved CONFIG_PENDING and DEVICE_DYING from mdev to tconn.
* Renamed drbd_reconfig_start() and drbd_reconfig_done() to
  conn_reconfig_start() and conn_reconfig_done().

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove left-over function prototypes
Andreas Gruenbacher [Wed, 16 Mar 2011 13:23:53 +0000 (14:23 +0100)]
drbd: Remove left-over function prototypes

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Replace get_asender_cmd() with its implementation
Andreas Gruenbacher [Mon, 14 Mar 2011 17:23:00 +0000 (18:23 +0100)]
drbd: Replace get_asender_cmd() with its implementation

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Get rid of P_MAX_CMD
Andreas Gruenbacher [Mon, 14 Mar 2011 16:27:45 +0000 (17:27 +0100)]
drbd: Get rid of P_MAX_CMD

Instead of artificially enlarging the command decoding arrays to
P_MAX_CMD entries, check if an index is within the valid range using the
ARRAY_SIZE() macro.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove redundant check
Andreas Gruenbacher [Fri, 28 Jan 2011 12:28:51 +0000 (13:28 +0100)]
drbd: Remove redundant check

Opening a device only succeeds on a primary node, or when explicitly
setting the allow_oos module parameter to allow opening the device
read-only on a secondary node.  There is no other way that a request can
get into drbd_make_request(), so this code cannot trigger.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Improve how conflicting writes are handled
Andreas Gruenbacher [Tue, 22 Feb 2011 01:15:32 +0000 (02:15 +0100)]
drbd: Improve how conflicting writes are handled

The previous algorithm for dealing with overlapping concurrent writes
was generating unnecessary warnings for scenarios which could be
legitimate, and did not always handle partially overlapping requests
correctly.  Improve it algorithm as follows:

* While local or remote write requests are in progress, conflicting new
  local write requests will be delayed (commit 82172f7).

* When a conflict between a local and remote write request is detected,
  the node with the discard flag decides how to resolve the conflict: It
  will ask its peer to discard conflicting requests which are fully
  contained in the local request and retry requests which overlap only
  partially.  This involves a protocol change.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use ping-timeout when waiting for missing ack packets
Andreas Gruenbacher [Tue, 1 Mar 2011 14:40:43 +0000 (15:40 +0100)]
drbd: Use ping-timeout when waiting for missing ack packets

When the node with the discard flag resolves write conflicts in
dual-primary mode, it may determine that its peer has sent ack packets
on the metadata socket which did not arrive, yet.  Wait for the next ack
with ping-timeout instead of a hard-coded 30 seconds.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Replace atomic_add_return with atomic_inc_return
Andreas Gruenbacher [Thu, 24 Feb 2011 10:35:43 +0000 (11:35 +0100)]
drbd: Replace atomic_add_return with atomic_inc_return

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Concurrent write detection fix
Andreas Gruenbacher [Sat, 26 Feb 2011 22:19:15 +0000 (23:19 +0100)]
drbd: Concurrent write detection fix

Commit 9b1e63e changed the concurrent write detection algorithm to only insert
peer requests into write_requests tree after determining that there is no
conflict.  With this change, new conflicting local requests could be added
while the algorithm runs, but this case was not handled correctly.  Instead of
making the algorithm deal with this case, switch back to adding peer requests
to the write_requests tree immediately: this improves fairness.

When a peer request is discarded, remove that request from the write_requests

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use container_of() instead of casting
Andreas Gruenbacher [Fri, 18 Feb 2011 15:12:48 +0000 (16:12 +0100)]
drbd: Use container_of() instead of casting

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: fix a wrong likely(), updated comments
Lars Ellenberg [Tue, 22 Feb 2011 13:02:31 +0000 (14:02 +0100)]
drbd: fix a wrong likely(), updated comments

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: silence some log messages on bitmap IO
Lars Ellenberg [Mon, 21 Feb 2011 14:10:23 +0000 (15:10 +0100)]
drbd: silence some log messages on bitmap IO

Summary log messages meant for global bitmap IO
should not be printed for bitmap IO caused by
activity log transactions.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: new on-disk activity log transaction format
Lars Ellenberg [Mon, 21 Feb 2011 12:21:03 +0000 (13:21 +0100)]
drbd: new on-disk activity log transaction format

Use a new on-disk transaction format for the activity log, which allows
for multiple changes to the active set per transaction.

Using 4k transaction blocks, we can now get rid of the work-around code
to deal with devices not supporting 512 byte logical block size.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agolru_cache: allow multiple changes per transaction
Lars Ellenberg [Mon, 21 Feb 2011 12:21:01 +0000 (13:21 +0100)]
lru_cache: allow multiple changes per transaction

Allow multiple changes to the active set of elements in lru_cache.
The only current user of lru_cache, drbd, is driving this generalisation.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: allow to select specific bitmap pages for writeout
Lars Ellenberg [Mon, 21 Feb 2011 12:21:00 +0000 (13:21 +0100)]
drbd: allow to select specific bitmap pages for writeout

We are about to allow several changes to the active set in one activity
log transaction. We have to write out the corresponding bitmap pages as
well, if changed.

Introduce drbd_bm_mark_for_writeout(), then re-use the existing bitmap
writeout path to submit all marked pages in one go.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agolru_cache: consolidate lc_get and lc_try_get
Lars Ellenberg [Mon, 21 Feb 2011 12:20:58 +0000 (13:20 +0100)]
lru_cache: consolidate lc_get and lc_try_get

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agolru_cache.h: fix comments referring to ts_ instead of lc_
Lars Ellenberg [Mon, 21 Feb 2011 12:20:57 +0000 (13:20 +0100)]
lru_cache.h: fix comments referring to ts_ instead of lc_

For some time we contemplated calling the "struct lru_cache"
a "struct tracked_set", and some comments kept the ts_ prefix.

Fix those to match the member field names.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: use clear_bit_unlock() where appropriate
Lars Ellenberg [Mon, 21 Feb 2011 12:20:55 +0000 (13:20 +0100)]
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>
12 years agodrbd: in drbd_suspend_al, set AL_SUSPENDED before unlocking the activity log
Lars Ellenberg [Mon, 21 Feb 2011 12:20:54 +0000 (13:20 +0100)]
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>
12 years agodrbd: fix typo in comment
Lars Ellenberg [Mon, 21 Feb 2011 12:20:53 +0000 (13:20 +0100)]
drbd: fix typo in comment

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: simplify condition in drbd_may_do_local_read()
Lars Ellenberg [Fri, 18 Feb 2011 13:13:07 +0000 (14:13 +0100)]
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>
12 years agodrbd: Use the IS_ALIGNED() macro in some more places
Andreas Gruenbacher [Mon, 21 Feb 2011 11:41:39 +0000 (12:41 +0100)]
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>
12 years agodrbd: Remove obsolete comment
Andreas Gruenbacher [Mon, 21 Feb 2011 11:34:58 +0000 (12:34 +0100)]
drbd: Remove obsolete comment

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Iterate over all overlapping intervals in a tree
Andreas Gruenbacher [Thu, 17 Feb 2011 17:11:24 +0000 (18:11 +0100)]
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>
12 years agodrbd: Rename drbd_endio_{pri,sec} -> drbd_{,peer_}request_endio
Andreas Gruenbacher [Thu, 17 Feb 2011 15:46:59 +0000 (16:46 +0100)]
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>
12 years agodrbd: Rename drbd_submit_ee -> drbd_submit_peer_request
Andreas Gruenbacher [Thu, 17 Feb 2011 15:38:35 +0000 (16:38 +0100)]
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>
12 years agodrbd: Implemented connection wide state changes
Philipp Reisner [Tue, 15 Feb 2011 10:14:44 +0000 (11:14 +0100)]
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>
12 years agodrbd: implemented receiving of P_CONN_ST_CHG_REQ
Philipp Reisner [Tue, 15 Feb 2011 10:09:33 +0000 (11:09 +0100)]
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>
12 years agodrbd: Implemented receiving of P_CONN_ST_CHG_REPLY
Philipp Reisner [Tue, 15 Feb 2011 10:07:59 +0000 (11:07 +0100)]
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>
12 years agodrbd: Global_state_lock not necessary here...
Philipp Reisner [Thu, 10 Feb 2011 19:27:54 +0000 (20:27 +0100)]
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>
12 years agodrbd: Implemented conn_send_state_req()
Philipp Reisner [Fri, 11 Feb 2011 14:11:24 +0000 (15:11 +0100)]
drbd: Implemented conn_send_state_req()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Introduced tconn->cstate_mutex
Philipp Reisner [Fri, 11 Feb 2011 19:11:10 +0000 (20:11 +0100)]
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>
12 years agodrbd: Removed drbd_state_lock() and drbd_state_unlock()
Philipp Reisner [Fri, 11 Feb 2011 18:43:55 +0000 (19:43 +0100)]
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>
12 years agodrbd: Killed volume0; last step of multi-volume-enablement
Philipp Reisner [Thu, 10 Feb 2011 12:45:46 +0000 (13:45 +0100)]
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>
12 years agodrbd: Code de-duplication; new function apply_mask_val()
Philipp Reisner [Wed, 16 Feb 2011 13:57:50 +0000 (14:57 +0100)]
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>
12 years agodrbd: Removed the os parameter form sanitize_state()
Philipp Reisner [Thu, 10 Feb 2011 10:24:38 +0000 (11:24 +0100)]
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>
12 years agodrbd: Extracted is_valid_conn_transition() out of is_valid_transition()
Philipp Reisner [Thu, 10 Feb 2011 09:38:06 +0000 (10:38 +0100)]
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>
12 years agodrbd: Extracted is_valid_transition() out of sanitize_state()
Philipp Reisner [Wed, 9 Feb 2011 15:29:33 +0000 (16:29 +0100)]
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>
12 years agodrbd: Renamed is_valid_state_transition() to is_valid_soft_transition()
Philipp Reisner [Wed, 9 Feb 2011 14:10:33 +0000 (15:10 +0100)]
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>
12 years agodrbd: Extracted after_conn_state_ch() out of after_state_ch()
Philipp Reisner [Wed, 9 Feb 2011 13:38:52 +0000 (14:38 +0100)]
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>
12 years agodrbd: Converted drbd_send_ping() and related functions from mdev to tconn
Philipp Reisner [Wed, 9 Feb 2011 13:10:32 +0000 (14:10 +0100)]
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>
12 years agodrbd: Generalized the work callbacks
Philipp Reisner [Wed, 9 Feb 2011 17:09:48 +0000 (18:09 +0100)]
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>
12 years agodrbd: Moved some initializing code into drbd_new_tconn()
Philipp Reisner [Wed, 9 Feb 2011 10:10:24 +0000 (11:10 +0100)]
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>
12 years agodrbd: drbd_thread has now a pointer to a tconn instead of to a mdev
Philipp Reisner [Wed, 9 Feb 2011 09:33:31 +0000 (10:33 +0100)]
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>
12 years agodrbd: Converted drbd_worker() from mdev to tconn
Philipp Reisner [Wed, 9 Feb 2011 09:09:07 +0000 (10:09 +0100)]
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>
12 years agodrbd: Converted drbd_asender() from mdev to tconn
Philipp Reisner [Tue, 8 Feb 2011 15:41:01 +0000 (16:41 +0100)]
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>
12 years agodrbd: Converted drbdd_init() from mdev to tconn
Philipp Reisner [Tue, 8 Feb 2011 14:40:24 +0000 (15:40 +0100)]
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>
12 years agodrbd: Consolidated the setup of the thread name into the framework
Philipp Reisner [Tue, 8 Feb 2011 14:35:58 +0000 (15:35 +0100)]
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>
12 years agodrbd: Moved the mdev member into drbd_work (from drbd_request and drbd_peer_request)
Philipp Reisner [Tue, 8 Feb 2011 14:08:49 +0000 (15:08 +0100)]
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>
12 years agodrbd: Converted drbd_free_sock() and drbd_disconnect() from mdev to tconn
Philipp Reisner [Tue, 8 Feb 2011 13:29:53 +0000 (14:29 +0100)]
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>
12 years agodrbd: Converted drbdd() from mdev to tconn
Philipp Reisner [Tue, 8 Feb 2011 11:55:24 +0000 (12:55 +0100)]
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>
12 years agodrbd: Converted drbd_calc_cpu_mask() and drbd_thread_current_set_cpu() from mdev...
Philipp Reisner [Tue, 8 Feb 2011 11:46:30 +0000 (12:46 +0100)]
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>
12 years agodrbd: Converted drbd_connect() from mdev to tconn
Philipp Reisner [Tue, 8 Feb 2011 10:25:37 +0000 (11:25 +0100)]
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>
12 years agodrbd: Use and idr data structure to map volume numbers to mdev pointers
Philipp Reisner [Tue, 8 Feb 2011 10:09:18 +0000 (11:09 +0100)]
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>
12 years agodrbd: Converted drbd_send_protocol() from mdev to tconn
Philipp Reisner [Tue, 8 Feb 2011 09:13:15 +0000 (10:13 +0100)]
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>
12 years agodrbd: Converted drbd_do_auth() from mdev to tconn
Philipp Reisner [Tue, 8 Feb 2011 08:54:40 +0000 (09:54 +0100)]
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>
12 years agodrbd: Converted drbd_(get|put)_data_sock() and drbd_send_cmd2() to tconn
Philipp Reisner [Tue, 8 Feb 2011 08:50:54 +0000 (09:50 +0100)]
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>
12 years agodrbd: Converted drbd_do_handshake() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 16:35:59 +0000 (17:35 +0100)]
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>
12 years agodrbd: Converted drbd_recv_header() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 16:32:41 +0000 (17:32 +0100)]
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>
12 years agodrbd: Converted decode_header() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 16:27:47 +0000 (17:27 +0100)]
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>
12 years agodrbd: struct packet_info to hold information of decoded packets
Philipp Reisner [Mon, 7 Feb 2011 16:24:26 +0000 (17:24 +0100)]
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>
12 years agodrbd: Converted drbd_recv() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 15:56:20 +0000 (16:56 +0100)]
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>
12 years agodrbd: Converted drbd_send_handshake() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 15:47:12 +0000 (16:47 +0100)]
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>
12 years agodrbd: Converted drbd_recv_fp() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 14:43:45 +0000 (15:43 +0100)]
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>
12 years agodrbd: Removed unused mdev argument from drbd_recv_short() and drbd_socket_okay()
Philipp Reisner [Mon, 7 Feb 2011 14:34:16 +0000 (15:34 +0100)]
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>
12 years agodrbd: Converted drbd_send_fp() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 14:32:04 +0000 (15:32 +0100)]
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>
12 years agodrbd: Converted drbd_send() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 14:08:48 +0000 (15:08 +0100)]
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>
12 years agodrbd: Converted helper functions for drbd_send() to tconn
Philipp Reisner [Mon, 7 Feb 2011 13:56:02 +0000 (14:56 +0100)]
drbd: Converted helper functions for drbd_send() to tconn

* drbd_update_congested()
* we_should_drop_the_connection()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Converted wake_asender() and request_ping() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 13:49:19 +0000 (14:49 +0100)]
drbd: Converted wake_asender() and request_ping() from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Moved SIGNAL_ASENDER to the per connection (tconn) flags
Philipp Reisner [Mon, 7 Feb 2011 13:44:14 +0000 (14:44 +0100)]
drbd: Moved SIGNAL_ASENDER to the per connection (tconn) flags

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Moved SEND_PING to the per connection (tconn) flags
Philipp Reisner [Mon, 7 Feb 2011 13:40:40 +0000 (14:40 +0100)]
drbd: Moved SEND_PING to the per connection (tconn) flags

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Moved DISCARD_CONCURRENT to the per connection (tconn) flags
Philipp Reisner [Mon, 7 Feb 2011 13:35:25 +0000 (14:35 +0100)]
drbd: Moved DISCARD_CONCURRENT to the per connection (tconn) flags

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Started to separated connection flags (tconn) from block device flags (mdev)
Philipp Reisner [Mon, 7 Feb 2011 13:30:33 +0000 (14:30 +0100)]
drbd: Started to separated connection flags (tconn) from block device flags (mdev)

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Converted drbd_wait_for_connect() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 13:09:54 +0000 (14:09 +0100)]
drbd: Converted drbd_wait_for_connect() from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Converted drbd_try_connect() from mdev to tconn
Philipp Reisner [Mon, 7 Feb 2011 13:05:07 +0000 (14:05 +0100)]
drbd: Converted drbd_try_connect() from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: conn_printk() a dev_printk() alike for drbd's connections
Philipp Reisner [Mon, 7 Feb 2011 13:01:51 +0000 (14:01 +0100)]
drbd: conn_printk() a dev_printk() alike for drbd's connections

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Moving state related macros to drbd_state.h
Philipp Reisner [Thu, 27 Jan 2011 13:37:23 +0000 (14:37 +0100)]
drbd: Moving state related macros to drbd_state.h

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Revert "Make sure we dont send state if a cluster wide state change is in progress"
Philipp Reisner [Sat, 5 Feb 2011 16:56:05 +0000 (17:56 +0100)]
drbd: Revert "Make sure we dont send state if a cluster wide state change is in progress"

This reverts commit 6e9fdc92b77915d5c7ab8fea751f48378f8b0080.

1) This did not fixed the issue
2) Long sleeping work items can cause IO requests to take as long as
   the longest work item

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Do no sleep long in drbd_start_resync
Philipp Reisner [Sat, 5 Feb 2011 16:34:11 +0000 (17:34 +0100)]
drbd: Do no sleep long in drbd_start_resync

Work items that sleep too long can cause requests to take as
long as the longest sleeping work item.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Moved code
Philipp Reisner [Mon, 7 Feb 2011 10:33:59 +0000 (11:33 +0100)]
drbd: Moved code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Eliminated the user of drbd_task_to_thread()
Philipp Reisner [Mon, 7 Feb 2011 10:14:38 +0000 (11:14 +0100)]
drbd: Eliminated the user of drbd_task_to_thread()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Moved the thread name into the data structure
Philipp Reisner [Fri, 4 Feb 2011 13:00:37 +0000 (14:00 +0100)]
drbd: Moved the thread name into the data structure

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Moved the state functions into its own source file
Philipp Reisner [Thu, 27 Jan 2011 13:07:51 +0000 (14:07 +0100)]
drbd: Moved the state functions into its own source file

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Local variable renames: e -> peer_req
Andreas Gruenbacher [Fri, 4 Feb 2011 14:57:48 +0000 (15:57 +0100)]
drbd: Local variable renames: e -> peer_req

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Update some comments
Andreas Gruenbacher [Fri, 4 Feb 2011 14:38:52 +0000 (15:38 +0100)]
drbd: Update some comments

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Clean up some left-overs
Andreas Gruenbacher [Fri, 4 Feb 2011 14:36:22 +0000 (15:36 +0100)]
drbd: Clean up some left-overs

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Rename struct drbd_epoch_entry to struct drbd_peer_request
Andreas Gruenbacher [Fri, 4 Feb 2011 14:30:34 +0000 (15:30 +0100)]
drbd: Rename struct drbd_epoch_entry to struct drbd_peer_request

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove unused variable in struct drbd_conf
Andreas Gruenbacher [Fri, 4 Feb 2011 14:10:57 +0000 (15:10 +0100)]
drbd: Remove unused variable in struct drbd_conf

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Improve the drbd_find_overlap() documentation
Andreas Gruenbacher [Fri, 4 Feb 2011 11:11:05 +0000 (12:11 +0100)]
drbd: Improve the drbd_find_overlap() documentation

Describe how to reach any further overlapping intervals from the first
overlap found.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Make the peer_seq updating code more obvious
Andreas Gruenbacher [Thu, 3 Feb 2011 17:42:08 +0000 (18:42 +0100)]
drbd: Make the peer_seq updating code more obvious

Make it more clear that update_peer_seq() is supposed to wake up the
seq_wait queue whenever the sequence number changes.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Defer new writes when detecting conflicting writes
Andreas Gruenbacher [Fri, 28 Jan 2011 14:53:51 +0000 (15:53 +0100)]
drbd: Defer new writes when detecting conflicting writes

Before submitting a new local write request, wait for any conflicting
local or remote requests to complete.

We could assume that the new request occurred first and that the
conflicting requests overwrote it (and therefore discard the new
reques), but we know for sure that the new request occurred after the
conflicting requests and so this behavior would we weird.  We would also
end up with the wrong result if the new request is not fully contained
within the conflicting requests.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove unnecessary reference counting left-over
Andreas Gruenbacher [Fri, 28 Jan 2011 13:24:05 +0000 (14:24 +0100)]
drbd: Remove unnecessary reference counting left-over

Nothing in this function accesses mdev->tconn->net_conf, so there is no
need for get_net_conf() / put_net_conf() anymore.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: _req_conflicts(): Get rid of the epoch_entries tree
Andreas Gruenbacher [Thu, 27 Jan 2011 13:42:51 +0000 (14:42 +0100)]
drbd: _req_conflicts(): Get rid of the epoch_entries tree

Instead of keeping a separate tree for local and remote write requests
for finding requests and for conflict detection, use the same tree for
both purposes.  Introduce a flag to allow distinguishing the two
possible types of entries in this tree.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Allow to wait for the completion of an epoch entry as well
Andreas Gruenbacher [Fri, 28 Jan 2011 09:31:04 +0000 (10:31 +0100)]
drbd: Allow to wait for the completion of an epoch entry as well

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove redundant check from drbd_contains_interval()
Andreas Gruenbacher [Thu, 27 Jan 2011 15:20:57 +0000 (16:20 +0100)]
drbd: Remove redundant check from drbd_contains_interval()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>