aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2009-09-04 15:40:30 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-09-04 15:40:30 -0400
commitb8313b6da7e2e7c7f47d93d8561969a3ff9ba0ea (patch)
treec605b02cb6ad5c4b68d4066eca4aac6c4747e839 /drivers/md
parent4142a969175302bc843d1505133488bfdbfa4732 (diff)
dm log: remove incorrect field from userspace table output
The output of 'dmsetup table' includes an internal field that should not be there. This patch removes it. To make the fix simpler, we first reorder a constructor argument The 'device size' argument is generated internally. Currently it is placed as the last space-separated word of the constructor string. However, we need to use a version of the string without this word, so we move it to the beginning instead so it is trivial to skip past it. We keep a copy of the arguments passed to userspace for creating a log, just in case we need to resend them. These are the same arguments that are desired in the STATUSTYPE_TABLE request, except for one. When creating the userspace log, the userspace daemon must know the size of the mirror, so that is added to the arguments given in the constructor table. We were printing this extra argument out as well, which is a mistake. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-log-userspace-base.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c
index 2f2a244e1109..c49da0a41c8e 100644
--- a/drivers/md/dm-log-userspace-base.c
+++ b/drivers/md/dm-log-userspace-base.c
@@ -111,10 +111,9 @@ static int build_constructor_string(struct dm_target *ti,
111 return -ENOMEM; 111 return -ENOMEM;
112 } 112 }
113 113
114 for (i = 0, str_size = 0; i < argc; i++) 114 str_size = sprintf(str, "%llu", (unsigned long long)ti->len);
115 str_size += sprintf(str + str_size, "%s ", argv[i]); 115 for (i = 0; i < argc; i++)
116 str_size += sprintf(str + str_size, "%llu", 116 str_size += sprintf(str + str_size, " %s", argv[i]);
117 (unsigned long long)ti->len);
118 117
119 *ctr_str = str; 118 *ctr_str = str;
120 return str_size; 119 return str_size;
@@ -561,6 +560,7 @@ static int userspace_status(struct dm_dirty_log *log, status_type_t status_type,
561 char *result, unsigned maxlen) 560 char *result, unsigned maxlen)
562{ 561{
563 int r = 0; 562 int r = 0;
563 char *table_args;
564 size_t sz = (size_t)maxlen; 564 size_t sz = (size_t)maxlen;
565 struct log_c *lc = log->context; 565 struct log_c *lc = log->context;
566 566
@@ -577,8 +577,12 @@ static int userspace_status(struct dm_dirty_log *log, status_type_t status_type,
577 break; 577 break;
578 case STATUSTYPE_TABLE: 578 case STATUSTYPE_TABLE:
579 sz = 0; 579 sz = 0;
580 DMEMIT("%s %u %s %s ", log->type->name, lc->usr_argc + 1, 580 table_args = strstr(lc->usr_argv_str, " ");
581 lc->uuid, lc->usr_argv_str); 581 BUG_ON(!table_args); /* There will always be a ' ' */
582 table_args++;
583
584 DMEMIT("%s %u %s %s ", log->type->name, lc->usr_argc,
585 lc->uuid, table_args);
582 break; 586 break;
583 } 587 }
584 return (r) ? 0 : (int)sz; 588 return (r) ? 0 : (int)sz;