aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2011-01-13 14:59:52 -0500
committerAlasdair G Kergon <agk@redhat.com>2011-01-13 14:59:52 -0500
commit86a54a4802df10d23ccd655e2083e812fe990243 (patch)
tree168ccb5f1824e16fb55ac64e2d4754775aeaa958
parent085ae0651b2791f3a430ddb76da92925b9952e13 (diff)
dm log userspace: add version number to comms
This patch adds a 'version' field to the 'dm_ulog_request' structure. The 'version' field is taken from a portion of the unused 'padding' field in the 'dm_ulog_request' structure. This was done to avoid changing the size of the structure and possibly disrupting backwards compatibility. The version number will help notify user-space daemons when a change has been made to the kernel/userspace log API. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm-log-userspace-base.c6
-rw-r--r--drivers/md/dm-log-userspace-transfer.c1
-rw-r--r--include/linux/dm-log-userspace.h13
3 files changed, 17 insertions, 3 deletions
diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c
index 31e1687e7bf6..aa2e0c374ab3 100644
--- a/drivers/md/dm-log-userspace-base.c
+++ b/drivers/md/dm-log-userspace-base.c
@@ -12,6 +12,8 @@
12 12
13#include "dm-log-userspace-transfer.h" 13#include "dm-log-userspace-transfer.h"
14 14
15#define DM_LOG_USERSPACE_VSN "1.1.0"
16
15struct flush_entry { 17struct flush_entry {
16 int type; 18 int type;
17 region_t region; 19 region_t region;
@@ -765,7 +767,7 @@ static int __init userspace_dirty_log_init(void)
765 return r; 767 return r;
766 } 768 }
767 769
768 DMINFO("version 1.0.0 loaded"); 770 DMINFO("version " DM_LOG_USERSPACE_VSN " loaded");
769 return 0; 771 return 0;
770} 772}
771 773
@@ -775,7 +777,7 @@ static void __exit userspace_dirty_log_exit(void)
775 dm_ulog_tfr_exit(); 777 dm_ulog_tfr_exit();
776 mempool_destroy(flush_entry_pool); 778 mempool_destroy(flush_entry_pool);
777 779
778 DMINFO("version 1.0.0 unloaded"); 780 DMINFO("version " DM_LOG_USERSPACE_VSN " unloaded");
779 return; 781 return;
780} 782}
781 783
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
index 075cbcf8a9f5..049eaf12aaab 100644
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -198,6 +198,7 @@ resend:
198 198
199 memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - sizeof(struct cn_msg)); 199 memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - sizeof(struct cn_msg));
200 memcpy(tfr->uuid, uuid, DM_UUID_LEN); 200 memcpy(tfr->uuid, uuid, DM_UUID_LEN);
201 tfr->version = DM_ULOG_REQUEST_VERSION;
201 tfr->luid = luid; 202 tfr->luid = luid;
202 tfr->seq = dm_ulog_seq++; 203 tfr->seq = dm_ulog_seq++;
203 204
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h
index 0c3c3a2110c4..eeace7d3ff15 100644
--- a/include/linux/dm-log-userspace.h
+++ b/include/linux/dm-log-userspace.h
@@ -370,6 +370,16 @@
370#define DM_ULOG_REQUEST_TYPE(request_type) \ 370#define DM_ULOG_REQUEST_TYPE(request_type) \
371 (DM_ULOG_REQUEST_MASK & (request_type)) 371 (DM_ULOG_REQUEST_MASK & (request_type))
372 372
373/*
374 * DM_ULOG_REQUEST_VERSION is incremented when there is a
375 * change to the way information is passed between kernel
376 * and userspace. This could be a structure change of
377 * dm_ulog_request or a change in the way requests are
378 * issued/handled. Changes are outlined here:
379 * version 1: Initial implementation
380 */
381#define DM_ULOG_REQUEST_VERSION 1
382
373struct dm_ulog_request { 383struct dm_ulog_request {
374 /* 384 /*
375 * The local unique identifier (luid) and the universally unique 385 * The local unique identifier (luid) and the universally unique
@@ -383,8 +393,9 @@ struct dm_ulog_request {
383 */ 393 */
384 uint64_t luid; 394 uint64_t luid;
385 char uuid[DM_UUID_LEN]; 395 char uuid[DM_UUID_LEN];
386 char padding[7]; /* Padding because DM_UUID_LEN = 129 */ 396 char padding[3]; /* Padding because DM_UUID_LEN = 129 */
387 397
398 uint32_t version; /* See DM_ULOG_REQUEST_VERSION */
388 int32_t error; /* Used to report back processing errors */ 399 int32_t error; /* Used to report back processing errors */
389 400
390 uint32_t seq; /* Sequence number for request */ 401 uint32_t seq; /* Sequence number for request */