Commit 1ede2e87 authored by Kevin Corry's avatar Kevin Corry Committed by Linus Torvalds

[PATCH] dm: Use structure assignments instead of memcpy

Use structure assignments instead of memcpy's.
[Suggested by akpm during kcopyd review.]
Signed-off-by: default avatarKevin Corry <kevcorry@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 180a1218
...@@ -850,9 +850,9 @@ static void do_mirror(struct mirror_set *ms) ...@@ -850,9 +850,9 @@ static void do_mirror(struct mirror_set *ms)
struct bio_list reads, writes; struct bio_list reads, writes;
spin_lock(&ms->lock); spin_lock(&ms->lock);
memcpy(&reads, &ms->reads, sizeof(reads)); reads = ms->reads;
writes = ms->writes;
bio_list_init(&ms->reads); bio_list_init(&ms->reads);
memcpy(&writes, &ms->writes, sizeof(writes));
bio_list_init(&ms->writes); bio_list_init(&ms->writes);
spin_unlock(&ms->lock); spin_unlock(&ms->lock);
......
...@@ -612,7 +612,7 @@ static void pending_complete(struct pending_exception *pe, int success) ...@@ -612,7 +612,7 @@ static void pending_complete(struct pending_exception *pe, int success)
error_bios(bio_list_get(&pe->snapshot_bios)); error_bios(bio_list_get(&pe->snapshot_bios));
goto out; goto out;
} }
memcpy(e, &pe->e, sizeof(*e)); *e = pe->e;
/* /*
* Add a proper exception, and remove the * Add a proper exception, and remove the
......
...@@ -400,7 +400,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode) ...@@ -400,7 +400,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode)
struct dm_dev dd_copy; struct dm_dev dd_copy;
dev_t dev = dd->bdev->bd_dev; dev_t dev = dd->bdev->bd_dev;
memcpy(&dd_copy, dd, sizeof(dd_copy)); dd_copy = *dd;
dd->mode |= new_mode; dd->mode |= new_mode;
dd->bdev = NULL; dd->bdev = NULL;
...@@ -408,7 +408,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode) ...@@ -408,7 +408,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode)
if (!r) if (!r)
close_dev(&dd_copy); close_dev(&dd_copy);
else else
memcpy(dd, &dd_copy, sizeof(dd_copy)); *dd = dd_copy;
return r; return r;
} }
......
...@@ -394,7 +394,7 @@ static struct bio *split_bvec(struct bio *bio, sector_t sector, ...@@ -394,7 +394,7 @@ static struct bio *split_bvec(struct bio *bio, sector_t sector,
struct bio_vec *bv = bio->bi_io_vec + idx; struct bio_vec *bv = bio->bi_io_vec + idx;
clone = bio_alloc(GFP_NOIO, 1); clone = bio_alloc(GFP_NOIO, 1);
memcpy(clone->bi_io_vec, bv, sizeof(*bv)); *clone->bi_io_vec = *bv;
clone->bi_sector = sector; clone->bi_sector = sector;
clone->bi_bdev = bio->bi_bdev; clone->bi_bdev = bio->bi_bdev;
......
...@@ -476,7 +476,7 @@ static void segment_complete(int read_err, ...@@ -476,7 +476,7 @@ static void segment_complete(int read_err,
int i; int i;
struct kcopyd_job *sub_job = mempool_alloc(_job_pool, GFP_NOIO); struct kcopyd_job *sub_job = mempool_alloc(_job_pool, GFP_NOIO);
memcpy(sub_job, job, sizeof(*job)); *sub_job = *job;
sub_job->source.sector += progress; sub_job->source.sector += progress;
sub_job->source.count = count; sub_job->source.count = count;
...@@ -536,7 +536,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, ...@@ -536,7 +536,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from,
job->write_err = 0; job->write_err = 0;
job->rw = READ; job->rw = READ;
memcpy(&job->source, from, sizeof(*from)); job->source = *from;
job->num_dests = num_dests; job->num_dests = num_dests;
memcpy(&job->dests, dests, sizeof(*dests) * num_dests); memcpy(&job->dests, dests, sizeof(*dests) * num_dests);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment