dm cache: replace memcpy with struct assignment
authorJoe Thornber <ejt@redhat.com>
Fri, 10 May 2013 13:37:18 +0000 (14:37 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 10 May 2013 13:37:18 +0000 (14:37 +0100)
Use struct assignment rather than memcpy in dm cache.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-cache-metadata.c
drivers/md/dm-cache-target.c

index 83e995fece88c1330335c85a23ef42b2ed54a1f4..1af7255bbffb547aa67db8b1f38bf99b2ff87094 100644 (file)
@@ -1044,7 +1044,7 @@ void dm_cache_metadata_get_stats(struct dm_cache_metadata *cmd,
                                 struct dm_cache_statistics *stats)
 {
        down_read(&cmd->root_lock);
-       memcpy(stats, &cmd->stats, sizeof(*stats));
+       *stats = cmd->stats;
        up_read(&cmd->root_lock);
 }
 
@@ -1052,7 +1052,7 @@ void dm_cache_metadata_set_stats(struct dm_cache_metadata *cmd,
                                 struct dm_cache_statistics *stats)
 {
        down_write(&cmd->root_lock);
-       memcpy(&cmd->stats, stats, sizeof(*stats));
+       cmd->stats = *stats;
        up_write(&cmd->root_lock);
 }
 
index 004d7053a5b188d34a9dda6c53340049bacfbee8..2f3348c76267c879aba2a5a0b67d45eb67cf99cd 100644 (file)
@@ -1913,7 +1913,7 @@ static int cache_create(struct cache_args *ca, struct cache **result)
        ti->discards_supported = true;
        ti->discard_zeroes_data_unsupported = true;
 
-       memcpy(&cache->features, &ca->features, sizeof(cache->features));
+       cache->features = ca->features;
        ti->per_bio_data_size = get_per_bio_data_size(cache);
 
        cache->callbacks.congested_fn = cache_is_congested;