From: Vasily Tarasov Date: Tue, 3 Feb 2015 17:42:47 +0000 (-0800) Subject: 'dmsetup table' now returns the string required by 'dmsetup create' X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=20a3265a51ba39e72db4e0e1ad96849d962f8548;p=linux-dmdedup.git 'dmsetup table' now returns the string required by 'dmsetup create' 'dmsetup table' should return the string that can be directly fed to 'dmsetup create' and related commands. This patch makes it happen. --- diff --git a/drivers/md/dm-dedup-target.c b/drivers/md/dm-dedup-target.c index 8aeb3b4abd9..dc766c1dade 100644 --- a/drivers/md/dm-dedup-target.c +++ b/drivers/md/dm-dedup-target.c @@ -21,7 +21,6 @@ #include "dm-dedup-kvstore.h" #define MAX_DEV_NAME_LEN (64) -#define MAX_BACKEND_NAME_LEN (64) #define MIN_DATA_DEV_BLOCK_SIZE (4 * 1024) #define MAX_DATA_DEV_BLOCK_SIZE (1024 * 1024) @@ -431,6 +430,7 @@ struct dedup_args { char hash_algo[CRYPTO_ALG_NAME_LEN]; enum backend backend; + char backend_str[MAX_BACKEND_NAME_LEN]; uint32_t flushrq; }; @@ -516,6 +516,8 @@ static int parse_backend(struct dedup_args *da, struct dm_arg_set *as, return -EINVAL; } + strlcpy(da->backend_str, backend, MAX_BACKEND_NAME_LEN); + return 0; } @@ -666,6 +668,8 @@ static int dm_dedup_ctr(struct dm_target *ti, unsigned int argc, char **argv) iparam = &iparam_cowbtree; } + strcpy(dc->backend_str, da.backend_str); + md = dc->mdops->init_meta(iparam, &unformatted); if (IS_ERR(md)) { ti->error = "failed to initialize backend metadata"; @@ -813,7 +817,6 @@ static void dm_dedup_status(struct dm_target *ti, status_type_t status_type, switch (status_type) { case STATUSTYPE_INFO: - case STATUSTYPE_TABLE: data_used_block_count = dc->physical_block_counter; data_actual_block_count = dc->logical_block_counter; data_total_block_count = dc->pblocks; @@ -831,6 +834,11 @@ static void dm_dedup_status(struct dm_target *ti, status_type_t status_type, DMEMIT("%llu %llu %llu %llu %llu %llu", dc->writes, dc->uniqwrites, dc->dupwrites, dc->reads_on_writes, dc->overwrites, dc->newwrites); + break; + case STATUSTYPE_TABLE: + DMEMIT("%s %s %u %s %s %u", + dc->metadata_dev->name, dc->data_dev->name, dc->block_size, + dc->crypto_alg, dc->backend_str, dc->flushrq); } } diff --git a/drivers/md/dm-dedup-target.h b/drivers/md/dm-dedup-target.h index 703ad04851e..dea8eacd82d 100644 --- a/drivers/md/dm-dedup-target.h +++ b/drivers/md/dm-dedup-target.h @@ -43,6 +43,8 @@ #define CRYPTO_ALG_NAME_LEN 16 #define MAX_DIGEST_SIZE SHA256_DIGEST_SIZE +#define MAX_BACKEND_NAME_LEN (64) + #define MIN_DEDUP_WORK_IO 16 /* Per target instance structure */ @@ -73,6 +75,7 @@ struct dedup_config { struct dm_io_client *io_client; /* used for read-on-write of misaligned requests */ + char backend_str[MAX_BACKEND_NAME_LEN]; struct metadata_ops *mdops; struct metadata *bmd; struct kvstore *kvs_hash_pbn;