Skip to content

Commit

Permalink
dm cache: replace memcpy with struct assignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joe Thornber authored and Alasdair G Kergon committed May 10, 2013
1 parent aeed142 commit 8c5008f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drivers/md/dm-cache-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,15 +1044,15 @@ 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);
}

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);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-cache-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8c5008f

Please sign in to comment.