platform/kernel/linux-rpi.git
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>
12 years agodrbd: struct drbd_request: Introduce a new collision flag
Andreas Gruenbacher [Thu, 27 Jan 2011 13:12:23 +0000 (14:12 +0100)]
drbd: struct drbd_request: Introduce a new collision flag

This flag is set when a processes puts itself to sleep to wait for a
conflicting request to complete.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Move some functions to where they are used
Andreas Gruenbacher [Wed, 26 Jan 2011 17:45:11 +0000 (18:45 +0100)]
drbd: Move some functions to where they are used

Move drbd_update_congested() to drbd_main.c, and drbd_req_new() and
drbd_req_free() to drbd_req.c: those functions are not used anywhere
else.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Move sequence number logic into drbd_receiver.c and simplify it
Andreas Gruenbacher [Wed, 26 Jan 2011 17:36:55 +0000 (18:36 +0100)]
drbd: Move sequence number logic into drbd_receiver.c and simplify it

These things are only used there.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Initialize the sequence number sent over the network even when not used
Andreas Gruenbacher [Wed, 26 Jan 2011 17:01:50 +0000 (18:01 +0100)]
drbd: Initialize the sequence number sent over the network even when not used

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove redundant initialization
Andreas Gruenbacher [Wed, 26 Jan 2011 16:49:00 +0000 (17:49 +0100)]
drbd: Remove redundant initialization

packet_seq is initialized by both sides of a connection in
drbd_connect().

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Rename "enum drbd_packets" to "enum drbd_packet"
Andreas Gruenbacher [Wed, 26 Jan 2011 16:39:41 +0000 (17:39 +0100)]
drbd: Rename "enum drbd_packets" to "enum drbd_packet"

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Move cmdname() out of drbd_int.h
Andreas Gruenbacher [Wed, 26 Jan 2011 16:13:25 +0000 (17:13 +0100)]
drbd: Move cmdname() out of drbd_int.h

There is no good reason for cmdname() to be an inline function.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Do not access tconn after it was freed
Philipp Reisner [Thu, 27 Jan 2011 09:55:20 +0000 (10:55 +0100)]
drbd: Do not access tconn after it was freed

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Implemented receiving of new style packets on meta socket
Philipp Reisner [Wed, 26 Jan 2011 11:15:29 +0000 (12:15 +0100)]
drbd: Implemented receiving of new style packets on meta socket

Now drbd communication with protocol 100 actually works.
Replaced the remaining p_header80 with p_header where we
no longer know which header it is.

In the places where p_header80 is still in use, it is on
purpose, because we know that it is an old style header
there.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use new header layout
Philipp Reisner [Wed, 19 Jan 2011 15:57:39 +0000 (16:57 +0100)]
drbd: Use new header layout

The new header layout will only be used if the peer supports
it of course.

For the first packet and the handshake packet the old (h80)
layout is used for compatibility reasons.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Replaced all p_header80 with a generic p_header
Philipp Reisner [Wed, 19 Jan 2011 15:58:16 +0000 (16:58 +0100)]
drbd: Replaced all p_header80 with a generic p_header

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Preparing to use p_header96 for all packets
Philipp Reisner [Wed, 19 Jan 2011 15:13:06 +0000 (16:13 +0100)]
drbd: Preparing to use p_header96 for all packets

recv_bm_rle_bits() should not make any assumptions abou the layout
of the packet header

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Made drbd_flush_workqueue() to take a tconn instead of an mdev
Philipp Reisner [Wed, 19 Jan 2011 13:53:22 +0000 (14:53 +0100)]
drbd: Made drbd_flush_workqueue() to take a tconn instead of an mdev

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: moved crypto transformations and friends from mdev to tconn
Philipp Reisner [Wed, 19 Jan 2011 13:31:32 +0000 (14:31 +0100)]
drbd: moved crypto transformations and friends from mdev to tconn

sed -i \
       -e 's/mdev->cram_hmac_tfm/mdev->tconn->cram_hmac_tfm/g' \
       -e 's/mdev->integrity_w_tfm/mdev->tconn->integrity_w_tfm/g' \
       -e 's/mdev->integrity_r_tfm/mdev->tconn->integrity_r_tfm/g' \
       -e 's/mdev->int_dig_out/mdev->tconn->int_dig_out/g' \
       -e 's/mdev->int_dig_in/mdev->tconn->int_dig_in/g' \
       -e 's/mdev->int_dig_vv/mdev->tconn->int_dig_vv/g' \
       *.[ch]

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: moved req_lock and transfer log from mdev to tconn
Philipp Reisner [Wed, 19 Jan 2011 13:16:30 +0000 (14:16 +0100)]
drbd: moved req_lock and transfer log from mdev to tconn

sed -i \
       -e 's/mdev->req_lock/mdev->tconn->req_lock/g' \
       -e 's/mdev->unused_spare_tle/mdev->tconn->unused_spare_tle/g' \
       -e 's/mdev->newest_tle/mdev->tconn->newest_tle/g' \
       -e 's/mdev->oldest_tle/mdev->tconn->oldest_tle/g' \
       -e 's/mdev->out_of_sequence_requests/mdev->tconn->out_of_sequence_requests/g' \
       *.[ch]

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: moved agreed_pro_version, last_received and ko_count to tconn
Philipp Reisner [Wed, 19 Jan 2011 13:12:51 +0000 (14:12 +0100)]
drbd: moved agreed_pro_version, last_received and ko_count to tconn

sed -i \
       -e 's/mdev->agreed_pro_version/mdev->tconn->agreed_pro_version/g' \
       -e 's/mdev->last_received/mdev->tconn->last_received/g' \
       -e 's/mdev->ko_count/mdev->tconn->ko_count/g' \
       *.[ch]

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: moved receiver, worker and asender from mdev to tconn
Philipp Reisner [Wed, 19 Jan 2011 13:02:01 +0000 (14:02 +0100)]
drbd: moved receiver, worker and asender from mdev to tconn

Patch mostly:
sed -i -e 's/mdev->receiver/mdev->tconn->receiver/g' \
       -e 's/mdev->worker/mdev->tconn->worker/g' \
       -e 's/mdev->asender/mdev->tconn->asender/g' \
       *.[ch]

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: moved data and meta from mdev to tconn
Philipp Reisner [Wed, 19 Jan 2011 12:55:45 +0000 (13:55 +0100)]
drbd: moved data and meta from mdev to tconn

Patch mostly:

sed -i -e 's/mdev->data/mdev->tconn->data/g' \
       -e 's/mdev->meta/mdev->tconn->meta/g' \
       *.[ch]

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: moved net_cont and net_cnt_wait from mdev to tconn
Philipp Reisner [Wed, 19 Jan 2011 12:48:44 +0000 (13:48 +0100)]
drbd: moved net_cont and net_cnt_wait from mdev to tconn

Patch partly generated by:

sed -i -e 's/get_net_conf(mdev)/get_net_conf(mdev->tconn)/g' \
       -e 's/put_net_conf(mdev)/put_net_conf(mdev->tconn)/g' \
       -e 's/get_net_conf(odev)/get_net_conf(odev->tconn)/g' \
       -e 's/put_net_conf(odev)/put_net_conf(odev->tconn)/g' \
       *.[ch]

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: moved net_conf from mdev to tconn
Philipp Reisner [Wed, 19 Jan 2011 12:12:45 +0000 (13:12 +0100)]
drbd: moved net_conf from mdev to tconn

Besides moving the struct member, everything else is generated by:

sed -i -e 's/mdev->net_conf/mdev->tconn->net_conf/g' \
       -e 's/odev->net_conf/odev->tconn->net_conf/g' \
       *.[ch]

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Minimal struct drbd_tconn
Philipp Reisner [Wed, 19 Jan 2011 11:26:59 +0000 (12:26 +0100)]
drbd: Minimal struct drbd_tconn

Starting to dissolve the network connection from the actual
block devices.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agoidr: idr_for_each_entry() macro
Philipp Reisner [Wed, 20 Jul 2011 12:59:37 +0000 (14:59 +0200)]
idr: idr_for_each_entry() macro

Inspired by the list_for_each_entry() macro

12 years agodrbd: Interval tree bugfix
Andreas Gruenbacher [Wed, 26 Jan 2011 12:06:08 +0000 (13:06 +0100)]
drbd: Interval tree bugfix

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Inline function overlaps() is now unused
Andreas Gruenbacher [Tue, 25 Jan 2011 15:36:10 +0000 (16:36 +0100)]
drbd: Inline function overlaps() is now unused

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove some useless paranoia code
Andreas Gruenbacher [Tue, 21 Dec 2010 13:46:57 +0000 (14:46 +0100)]
drbd: Remove some useless paranoia code

The open_cnt check is an open-coded D_ASSERT() check.

In case the data.work queue is not empty, it does not really help to
know which drbd_work elements remained on that list: they will be freed
immediately afterwards, anyway.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Replace the ERR_IF macro with an assert-like macro
Andreas Gruenbacher [Wed, 15 Dec 2010 18:31:20 +0000 (19:31 +0100)]
drbd: Replace the ERR_IF macro with an assert-like macro

Remove the file name and line number from the syslog messages generated:
we have no duplicate function names, and no function contains the same
assertion more than once.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Convert all constants in enum drbd_thread_state to upper case
Andreas Gruenbacher [Tue, 25 Jan 2011 14:43:39 +0000 (15:43 +0100)]
drbd: Convert all constants in enum drbd_thread_state to upper case

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Convert all constants in enum drbd_req_event to upper case
Andreas Gruenbacher [Tue, 25 Jan 2011 14:37:43 +0000 (15:37 +0100)]
drbd: Convert all constants in enum drbd_req_event to upper case

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove the unused hash tables
Andreas Gruenbacher [Fri, 21 Jan 2011 14:59:23 +0000 (15:59 +0100)]
drbd: Remove the unused hash tables

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use interval tree for overlapping epoch entry detection
Andreas Gruenbacher [Thu, 20 Jan 2011 14:23:07 +0000 (15:23 +0100)]
drbd: Use interval tree for overlapping epoch entry detection

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Put sector and size in struct drbd_epoch_entry into struct drbd_interval
Andreas Gruenbacher [Fri, 14 Jan 2011 19:59:35 +0000 (20:59 +0100)]
drbd: Put sector and size in struct drbd_epoch_entry into struct drbd_interval

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use the read and write request trees for request lookups
Andreas Gruenbacher [Fri, 21 Jan 2011 17:00:55 +0000 (18:00 +0100)]
drbd: Use the read and write request trees for request lookups

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Add read_requests tree
Andreas Gruenbacher [Fri, 21 Jan 2011 16:18:39 +0000 (17:18 +0100)]
drbd: Add read_requests tree

We do not do collision detection for read requests, but we still need to
look up the request objects when we receive a package over the network.
Using the same data structure for read and write requests results in
simpler code once the tl_hash and app_reads_hash tables are removed.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use interval tree for overlapping write request detection
Andreas Gruenbacher [Thu, 20 Jan 2011 14:00:24 +0000 (15:00 +0100)]
drbd: Use interval tree for overlapping write request detection

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Put sector and size in struct drbd_request into struct drbd_interval
Andreas Gruenbacher [Mon, 3 Jan 2011 16:09:58 +0000 (17:09 +0100)]
drbd: Put sector and size in struct drbd_request into struct drbd_interval

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Add interval tree data structure
Andreas Gruenbacher [Mon, 3 Jan 2011 16:42:00 +0000 (17:42 +0100)]
drbd: Add interval tree data structure

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Request lookup code cleanup (4)
Andreas Gruenbacher [Thu, 20 Jan 2011 21:25:40 +0000 (22:25 +0100)]
drbd: Request lookup code cleanup (4)

Factor out duplicate code in got_NegAck().

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Request lookup code cleanup (3)
Andreas Gruenbacher [Thu, 20 Jan 2011 16:23:59 +0000 (17:23 +0100)]
drbd: Request lookup code cleanup (3)

Get rid of the ar_id_to_req() and ack_id_to_req() wrappers.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Request lookup code cleanup (2)
Andreas Gruenbacher [Thu, 20 Jan 2011 16:14:26 +0000 (17:14 +0100)]
drbd: Request lookup code cleanup (2)

Unify the ar_id_to_req() and ack_id_to_req() functions: make both fail
if the consistency check fails.  Move the request lookup code now
duplicated in both functions into its own function.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Request lookup code cleanup (1)
Andreas Gruenbacher [Wed, 5 Jan 2011 22:27:02 +0000 (23:27 +0100)]
drbd: Request lookup code cleanup (1)

Move _ar_id_to_req() to drbd_receiver.c and mark it non-inline.  Remove
the leading underscores from _ar_id_to_req() and _ack_id_to_req().  Mark
ar_hash_slot() inline.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Update outdated comment
Andreas Gruenbacher [Fri, 14 Jan 2011 20:19:36 +0000 (21:19 +0100)]
drbd: Update outdated comment

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Move drbd_free_tl_hash() to drbd_main()
Andreas Gruenbacher [Thu, 13 Jan 2011 22:05:39 +0000 (23:05 +0100)]
drbd: Move drbd_free_tl_hash() to drbd_main()

This is the only place where this function is used.  Make it static.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Magic reserved block_id value cleanup
Andreas Gruenbacher [Thu, 13 Jan 2011 17:40:57 +0000 (18:40 +0100)]
drbd: Magic reserved block_id value cleanup

The ID_VACANT definition has become entirely irrelevant by now.

The is_syncer_block_id() macro does not improve the code, so eliminated
it.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Endianness convert the constants instead of the variables
Andreas Gruenbacher [Tue, 11 Jan 2011 12:54:02 +0000 (13:54 +0100)]
drbd: Endianness convert the constants instead of the variables

Converting the constants happens at compile time.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Get rid of BE_DRBD_MAGIC and BE_DRBD_MAGIC_BIG
Andreas Gruenbacher [Tue, 11 Jan 2011 12:47:24 +0000 (13:47 +0100)]
drbd: Get rid of BE_DRBD_MAGIC and BE_DRBD_MAGIC_BIG

Converting the constants happens at compile time.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Consistently use block_id == ID_SYNCER for checksum based resync and online...
Andreas Gruenbacher [Tue, 11 Jan 2011 13:04:09 +0000 (14:04 +0100)]
drbd: Consistently use block_id == ID_SYNCER for checksum based resync and online verify

DRBD_MAGIC has nothing to do with block ids and the funny values
computed were not actually used, anyway.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove superfluous declaration
Andreas Gruenbacher [Tue, 11 Jan 2011 11:25:21 +0000 (12:25 +0100)]
drbd: Remove superfluous declaration

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Get rid of req_validator_fn typedef
Andreas Gruenbacher [Sun, 9 Jan 2011 16:52:09 +0000 (17:52 +0100)]
drbd: Get rid of req_validator_fn typedef

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agoloop: always allow userspace partitions and optionally support automatic scanning
Kay Sievers [Tue, 23 Aug 2011 18:12:04 +0000 (20:12 +0200)]
loop: always allow userspace partitions and optionally support automatic scanning

Automatic partition scanning can be requested individually per loop
device during its setup by setting LO_FLAGS_PARTSCAN. By default, no
partition tables are scanned.

Userspace can now always add and remove partitions from all loop
devices, regardless if the in-kernel partition scanner is enabled or
not.

The needed partition minor numbers are allocated from the extended
minors space, the main loop device numbers will continue to match the
loop minors, regardless of the number of partitions used.

  # grep . /sys/class/block/loop1/loop/*
  /sys/block/loop1/loop/autoclear:0
  /sys/block/loop1/loop/backing_file:/home/kay/data/stuff/part.img
  /sys/block/loop1/loop/offset:0
  /sys/block/loop1/loop/partscan:1
  /sys/block/loop1/loop/sizelimit:0

  # ls -l /dev/loop*
  brw-rw---- 1 root disk   7,   0 Aug 14 20:22 /dev/loop0
  brw-rw---- 1 root disk   7,   1 Aug 14 20:23 /dev/loop1
  brw-rw---- 1 root disk 259,   0 Aug 14 20:23 /dev/loop1p1
  brw-rw---- 1 root disk 259,   1 Aug 14 20:23 /dev/loop1p2
  brw-rw---- 1 root disk   7,  99 Aug 14 20:23 /dev/loop99
  brw-rw---- 1 root disk 259,   2 Aug 14 20:23 /dev/loop99p1
  brw-rw---- 1 root disk 259,   3 Aug 14 20:23 /dev/loop99p2
  crw------T 1 root root  10, 237 Aug 14 20:22 /dev/loop-control

Cc: Karel Zak <kzak@redhat.com>
Cc: Davidlohr Bueso <dave@gnu.org>
Acked-By: Tejun Heo <tj@kernel.org>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>