Commit 71f7113d authored by Bart Van Assche's avatar Bart Van Assche Committed by Jens Axboe

dm/core: Rename kcopyd_job.rw into kcopyd.op

The member name 'rw' suggests that this member either has the value 'READ'
or 'WRITE' and no other values. Since that member also can have the value
REQ_OP_WRITE_ZEROES, rename 'rw' into 'op'. This patch does not change any
functionality since REQ_OP_READ = READ = 0 and REQ_OP_WRITE = WRITE = 1.

Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@kernel.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220714180729.1065367-23-bvanassche@acm.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 581075e4
...@@ -350,9 +350,9 @@ struct kcopyd_job { ...@@ -350,9 +350,9 @@ struct kcopyd_job {
unsigned long write_err; unsigned long write_err;
/* /*
* Either READ or WRITE * REQ_OP_READ, REQ_OP_WRITE or REQ_OP_WRITE_ZEROES.
*/ */
int rw; enum req_op op;
struct dm_io_region source; struct dm_io_region source;
/* /*
...@@ -418,7 +418,8 @@ static struct kcopyd_job *pop_io_job(struct list_head *jobs, ...@@ -418,7 +418,8 @@ static struct kcopyd_job *pop_io_job(struct list_head *jobs,
* constraint and sequential writes that are at the right position. * constraint and sequential writes that are at the right position.
*/ */
list_for_each_entry(job, jobs, list) { list_for_each_entry(job, jobs, list) {
if (job->rw == READ || !(job->flags & BIT(DM_KCOPYD_WRITE_SEQ))) { if (job->op == REQ_OP_READ ||
!(job->flags & BIT(DM_KCOPYD_WRITE_SEQ))) {
list_del(&job->list); list_del(&job->list);
return job; return job;
} }
...@@ -518,7 +519,7 @@ static void complete_io(unsigned long error, void *context) ...@@ -518,7 +519,7 @@ static void complete_io(unsigned long error, void *context)
io_job_finish(kc->throttle); io_job_finish(kc->throttle);
if (error) { if (error) {
if (op_is_write(job->rw)) if (op_is_write(job->op))
job->write_err |= error; job->write_err |= error;
else else
job->read_err = 1; job->read_err = 1;
...@@ -530,11 +531,11 @@ static void complete_io(unsigned long error, void *context) ...@@ -530,11 +531,11 @@ static void complete_io(unsigned long error, void *context)
} }
} }
if (op_is_write(job->rw)) if (op_is_write(job->op))
push(&kc->complete_jobs, job); push(&kc->complete_jobs, job);
else { else {
job->rw = WRITE; job->op = REQ_OP_WRITE;
push(&kc->io_jobs, job); push(&kc->io_jobs, job);
} }
...@@ -549,7 +550,7 @@ static int run_io_job(struct kcopyd_job *job) ...@@ -549,7 +550,7 @@ static int run_io_job(struct kcopyd_job *job)
{ {
int r; int r;
struct dm_io_request io_req = { struct dm_io_request io_req = {
.bi_opf = job->rw, .bi_opf = job->op,
.mem.type = DM_IO_PAGE_LIST, .mem.type = DM_IO_PAGE_LIST,
.mem.ptr.pl = job->pages, .mem.ptr.pl = job->pages,
.mem.offset = 0, .mem.offset = 0,
...@@ -570,7 +571,7 @@ static int run_io_job(struct kcopyd_job *job) ...@@ -570,7 +571,7 @@ static int run_io_job(struct kcopyd_job *job)
io_job_start(job->kc->throttle); io_job_start(job->kc->throttle);
if (job->rw == READ) if (job->op == REQ_OP_READ)
r = dm_io(&io_req, 1, &job->source, NULL); r = dm_io(&io_req, 1, &job->source, NULL);
else else
r = dm_io(&io_req, job->num_dests, job->dests, NULL); r = dm_io(&io_req, job->num_dests, job->dests, NULL);
...@@ -613,7 +614,7 @@ static int process_jobs(struct list_head *jobs, struct dm_kcopyd_client *kc, ...@@ -613,7 +614,7 @@ static int process_jobs(struct list_head *jobs, struct dm_kcopyd_client *kc,
if (r < 0) { if (r < 0) {
/* error this rogue job */ /* error this rogue job */
if (op_is_write(job->rw)) if (op_is_write(job->op))
job->write_err = (unsigned long) -1L; job->write_err = (unsigned long) -1L;
else else
job->read_err = 1; job->read_err = 1;
...@@ -816,7 +817,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, ...@@ -816,7 +817,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
if (from) { if (from) {
job->source = *from; job->source = *from;
job->pages = NULL; job->pages = NULL;
job->rw = READ; job->op = REQ_OP_READ;
} else { } else {
memset(&job->source, 0, sizeof job->source); memset(&job->source, 0, sizeof job->source);
job->source.count = job->dests[0].count; job->source.count = job->dests[0].count;
...@@ -825,10 +826,10 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, ...@@ -825,10 +826,10 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
/* /*
* Use WRITE ZEROES to optimize zeroing if all dests support it. * Use WRITE ZEROES to optimize zeroing if all dests support it.
*/ */
job->rw = REQ_OP_WRITE_ZEROES; job->op = REQ_OP_WRITE_ZEROES;
for (i = 0; i < job->num_dests; i++) for (i = 0; i < job->num_dests; i++)
if (!bdev_write_zeroes_sectors(job->dests[i].bdev)) { if (!bdev_write_zeroes_sectors(job->dests[i].bdev)) {
job->rw = WRITE; job->op = REQ_OP_WRITE;
break; break;
} }
} }
......
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