Commit 9ca170a3c0cbb0d5251cef6f5a3300fa436ba8ec
Committed by
Alasdair G Kergon
1 parent
c26655ca3c
Exists in
master
and in
7 other branches
dm kcopyd: accept zero size jobs
dm-kcopyd: accept zero-size jobs This patch changes dm-kcopyd so that it accepts zero-size jobs and completes them immediatelly via its completion thread. It is needed for multisnapshots snapshot resizing. When we are writing to a chunk beyond origin end, no copying is done. To simplify the code, we submit an empty request to kcopyd and let kcopyd complete it. If we didn't submit a request to kcopyd and called the completion routine immediatelly, it would violate the principle that completion is called only from one thread and it would need additional locking. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff
drivers/md/dm-kcopyd.c
... | ... | @@ -450,7 +450,10 @@ |
450 | 450 | { |
451 | 451 | struct dm_kcopyd_client *kc = job->kc; |
452 | 452 | atomic_inc(&kc->nr_jobs); |
453 | - push(&kc->pages_jobs, job); | |
453 | + if (unlikely(!job->source.count)) | |
454 | + push(&kc->complete_jobs, job); | |
455 | + else | |
456 | + push(&kc->pages_jobs, job); | |
454 | 457 | wake(kc); |
455 | 458 | } |
456 | 459 |