Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm cache: replace memcpy with struct assignment

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>

authored by

Joe Thornber and committed by
Alasdair G Kergon
8c5008fa aeed1420

+3 -3
+2 -2
drivers/md/dm-cache-metadata.c
··· 1044 1044 struct dm_cache_statistics *stats) 1045 1045 { 1046 1046 down_read(&cmd->root_lock); 1047 - memcpy(stats, &cmd->stats, sizeof(*stats)); 1047 + *stats = cmd->stats; 1048 1048 up_read(&cmd->root_lock); 1049 1049 } 1050 1050 ··· 1052 1052 struct dm_cache_statistics *stats) 1053 1053 { 1054 1054 down_write(&cmd->root_lock); 1055 - memcpy(&cmd->stats, stats, sizeof(*stats)); 1055 + cmd->stats = *stats; 1056 1056 up_write(&cmd->root_lock); 1057 1057 } 1058 1058
+1 -1
drivers/md/dm-cache-target.c
··· 1913 1913 ti->discards_supported = true; 1914 1914 ti->discard_zeroes_data_unsupported = true; 1915 1915 1916 - memcpy(&cache->features, &ca->features, sizeof(cache->features)); 1916 + cache->features = ca->features; 1917 1917 ti->per_bio_data_size = get_per_bio_data_size(cache); 1918 1918 1919 1919 cache->callbacks.congested_fn = cache_is_congested;