Skip to content

Commit f5db4af

Browse files
jbrassowkergon
authored andcommitted
dm raid1: add userspace log
This patch contains a device-mapper mirror log module that forwards requests to userspace for processing. The structures used for communication between kernel and userspace are located in include/linux/dm-log-userspace.h. Due to the frequency, diversity, and 2-way communication nature of the exchanges between kernel and userspace, 'connector' was chosen as the interface for communication. The first log implementations written in userspace - "clustered-disk" and "clustered-core" - support clustered shared storage. A userspace daemon (in the LVM2 source code repository) uses openAIS/corosync to process requests in an ordered fashion with the rest of the nodes in the cluster so as to prevent log state corruption. Other implementations with no association to LVM or openAIS/corosync, are certainly possible. (Imagine if two machines are writing to the same region of a mirror. They would both mark the region dirty, but you need a cluster-aware entity that can handle properly marking the region clean when they are done. Otherwise, you might clear the region when the first machine is done, not the second.) Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
1 parent 754c5fc commit f5db4af

9 files changed

Lines changed: 1448 additions & 1 deletion

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Device-Mapper Logging
2+
=====================
3+
The device-mapper logging code is used by some of the device-mapper
4+
RAID targets to track regions of the disk that are not consistent.
5+
A region (or portion of the address space) of the disk may be
6+
inconsistent because a RAID stripe is currently being operated on or
7+
a machine died while the region was being altered. In the case of
8+
mirrors, a region would be considered dirty/inconsistent while you
9+
are writing to it because the writes need to be replicated for all
10+
the legs of the mirror and may not reach the legs at the same time.
11+
Once all writes are complete, the region is considered clean again.
12+
13+
There is a generic logging interface that the device-mapper RAID
14+
implementations use to perform logging operations (see
15+
dm_dirty_log_type in include/linux/dm-dirty-log.h). Various different
16+
logging implementations are available and provide different
17+
capabilities. The list includes:
18+
19+
Type Files
20+
==== =====
21+
disk drivers/md/dm-log.c
22+
core drivers/md/dm-log.c
23+
userspace drivers/md/dm-log-userspace* include/linux/dm-log-userspace.h
24+
25+
The "disk" log type
26+
-------------------
27+
This log implementation commits the log state to disk. This way, the
28+
logging state survives reboots/crashes.
29+
30+
The "core" log type
31+
-------------------
32+
This log implementation keeps the log state in memory. The log state
33+
will not survive a reboot or crash, but there may be a small boost in
34+
performance. This method can also be used if no storage device is
35+
available for storing log state.
36+
37+
The "userspace" log type
38+
------------------------
39+
This log type simply provides a way to export the log API to userspace,
40+
so log implementations can be done there. This is done by forwarding most
41+
logging requests to userspace, where a daemon receives and processes the
42+
request.
43+
44+
The structure used for communication between kernel and userspace are
45+
located in include/linux/dm-log-userspace.h. Due to the frequency,
46+
diversity, and 2-way communication nature of the exchanges between
47+
kernel and userspace, 'connector' is used as the interface for
48+
communication.
49+
50+
There are currently two userspace log implementations that leverage this
51+
framework - "clustered_disk" and "clustered_core". These implementations
52+
provide a cluster-coherent log for shared-storage. Device-mapper mirroring
53+
can be used in a shared-storage environment when the cluster log implementations
54+
are employed.

drivers/md/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,17 @@ config DM_MIRROR
231231
Allow volume managers to mirror logical volumes, also
232232
needed for live data migration tools such as 'pvmove'.
233233

234+
config DM_LOG_USERSPACE
235+
tristate "Mirror userspace logging (EXPERIMENTAL)"
236+
depends on DM_MIRROR && EXPERIMENTAL && NET
237+
select CONNECTOR
238+
---help---
239+
The userspace logging module provides a mechanism for
240+
relaying the dm-dirty-log API to userspace. Log designs
241+
which are more suited to userspace implementation (e.g.
242+
shared storage logs) or experimental logs can be implemented
243+
by leveraging this framework.
244+
234245
config DM_ZERO
235246
tristate "Zero target"
236247
depends on BLK_DEV_DM

drivers/md/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ dm-multipath-y += dm-path-selector.o dm-mpath.o
88
dm-snapshot-y += dm-snap.o dm-exception-store.o dm-snap-transient.o \
99
dm-snap-persistent.o
1010
dm-mirror-y += dm-raid1.o
11+
dm-log-userspace-y \
12+
+= dm-log-userspace-base.o dm-log-userspace-transfer.o
1113
md-mod-y += md.o bitmap.o
1214
raid456-y += raid5.o
1315
raid6_pq-y += raid6algos.o raid6recov.o raid6tables.o \
@@ -40,6 +42,7 @@ obj-$(CONFIG_DM_MULTIPATH_QL) += dm-queue-length.o
4042
obj-$(CONFIG_DM_MULTIPATH_ST) += dm-service-time.o
4143
obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o
4244
obj-$(CONFIG_DM_MIRROR) += dm-mirror.o dm-log.o dm-region-hash.o
45+
obj-$(CONFIG_DM_LOG_USERSPACE) += dm-log-userspace.o
4346
obj-$(CONFIG_DM_ZERO) += dm-zero.o
4447

4548
quiet_cmd_unroll = UNROLL $@

0 commit comments

Comments
 (0)