Updated cluster log patch (take 6)
Subsystems (3)
I've renamed things (s/clustered/userspace/) to more accurately reflect the possible uses of the kernel module. The 'cluster log kernel module' isn't specifically tied to cluster logging, any userspace log can be implemented.... it just so happens that cluster-aware logs were the first.
This is a repost with those changes.
brassow
This patch contains the cluster-aware device-mapper log module.
The log types contained herein ("clustered-disk" and "clustered-core") operate in the same way as their single machine counterparts (dm-log.c), but they are cluster coherent. This is done by forwarding most logging requests to userspace, where a daemon processes the request in an ordered fashion with the rest of the nodes in the cluster. This is necessary to prevent log state corruption. (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.)
The structure used for communication between kernel and userspace are located in include/linux/dm-log-cluster.h. Due to the frequency, diversity, and 2-way communication nature of the exchanges between kernel and userspace, 'connector' is used as the interface for communication. One existing userspace implementation of the daemon uses openAIS/corosync in order to communicate with guaranteed ordering and delivery. This daemon, which is capable of coherently managing log state from multiple cluster machines, can be found in the LVM2 code repository. Other implementations of the daemon, with no association to LVM or openAIS/corosync, are certainly possible.
Providing a cluster-aware logging type gives device-mapper RAID1 (and potentially other RAIDs) the ability to operate in a cluster-coherent fashion.
drivers/md/Kconfig +11 -0
@@ -231,6 +231,17 @@ config DM_MIRROR Allow volume managers to mirror logical volumes, also needed for live data migration tools such as 'pvmove'. +config DM_LOG_USERSPACE + tristate "Mirror userspace logging (EXPERIMENTAL)" + depends on DM_MIRROR && EXPERIMENTAL + select CONNECTOR + ---help--- + The userspace logging module provides a mechanism for + relaying the dm-dirty-log API to userspace. Log designs + which are more suited to userspace implementation (e.g. + shared storage logs) or experimental logs can be implemented + by leveraging this framework. + config DM_ZERO tristate "Zero target" depends on BLK_DEV_DM
drivers/md/Makefile +2 -0
@@ -8,6 +8,7 @@ dm-multipath-y += dm-path-selector.o dm- dm-snapshot-y += dm-snap.o dm-exception-store.o dm-snap-transient.o \ dm-snap-persistent.o dm-mirror-y += dm-raid1.o +dm-log-userspace-y += dm-log-usr.o dm-log-usr-transfer.o md-mod-y += md.o bitmap.o raid456-y += raid5.o raid6_pq-y += raid6algos.o raid6recov.o raid6tables.o \
@@ -38,6 +39,7 @@ obj-$(CONFIG_DM_DELAY) += dm-delay.o obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR) += dm-mirror.o dm-log.o dm-region-hash.o +obj-$(CONFIG_DM_LOG_USERSPACE) += dm-log-userspace.o obj-$(CONFIG_DM_ZERO) += dm-zero.o quiet_cmd_unroll = UNROLL $@
Documentation/dm-log.txt new file +54 -0
54 lines not on this page · raw message
include/linux/connector.h +3 -1
@@ -41,8 +41,10 @@#define CN_IDX_BB 0x5/* BlackBoard, from the TSP GPL sampling framework */ #define CN_DST_IDX 0x6#define CN_DST_VAL 0x1 +#define CN_IDX_DM 0x7/* Device Mapper */ +#define CN_VAL_DM_USERSPACE_LOG 0x1 -#define CN_NETLINK_USERS 7 +#define CN_NETLINK_USERS 8/* * Maximum connector's message size.
include/linux/Kbuild +1 -0
@@ -57,6 +57,7 @@ header-y += dlmconstants.h header-y += dlm_device.h header-y += dlm_netlink.h header-y += dm-ioctl.h +header-y += dm-log-userspace.h header-y += dn.h header-y += dqblk_xfs.h header-y += efs_fs_sb.h
include/linux/dm-log-userspace.h new file +306 -0
306 lines not on this page · raw message
drivers/md/dm-log-usr-transfer.c new file +273 -0
273 lines not on this page · raw message
drivers/md/dm-log-usr-transfer.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Copyright (C) 2006-2009 Red Hat, Inc. +* +* This file is released under the LGPL. +*/ + +#ifndef __DM_LOG_USERSPACE_TRANSFER_H__ +#define __DM_LOG_USERSPACE_TRANSFER_H__ + +#define DM_MSG_PREFIX "dm-log-userspace" + +int dm_ulog_tfr_init (void ); +void dm_ulog_tfr_exit (void ); +int dm_consult_userspace (const char *uuid,int request_type, +char *data,size_t data_size, +char *rdata,size_t *rdata_size); + +#endif /* __DM_LOG_USERSPACE_TRANSFER_H__ */
drivers/md/dm-log-usr.c new file +697 -0
697 lines not on this page · raw message