All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>
Subject: [PATCH v3 22/63] dm/core: Rename kcopyd_job.rw into kcopyd.op
Date: Thu, 14 Jul 2022 11:06:48 -0700	[thread overview]
Message-ID: <20220714180729.1065367-23-bvanassche@acm.org> (raw)
In-Reply-To: <20220714180729.1065367-1-bvanassche@acm.org>

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: Bart Van Assche <bvanassche@acm.org>
---
 drivers/md/dm-kcopyd.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
index a99b994e2b62..9c8f3544e99d 100644
--- a/drivers/md/dm-kcopyd.c
+++ b/drivers/md/dm-kcopyd.c
@@ -350,9 +350,9 @@ struct kcopyd_job {
 	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;
 
 	/*
@@ -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.
 	 */
 	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);
 			return job;
 		}
@@ -518,7 +519,7 @@ static void complete_io(unsigned long error, void *context)
 	io_job_finish(kc->throttle);
 
 	if (error) {
-		if (op_is_write(job->rw))
+		if (op_is_write(job->op))
 			job->write_err |= error;
 		else
 			job->read_err = 1;
@@ -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);
 
 	else {
-		job->rw = WRITE;
+		job->op = REQ_OP_WRITE;
 		push(&kc->io_jobs, job);
 	}
 
@@ -549,7 +550,7 @@ static int run_io_job(struct kcopyd_job *job)
 {
 	int r;
 	struct dm_io_request io_req = {
-		.bi_opf = job->rw,
+		.bi_opf = job->op,
 		.mem.type = DM_IO_PAGE_LIST,
 		.mem.ptr.pl = job->pages,
 		.mem.offset = 0,
@@ -570,7 +571,7 @@ static int run_io_job(struct kcopyd_job *job)
 
 	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);
 	else
 		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,
 
 		if (r < 0) {
 			/* error this rogue job */
-			if (op_is_write(job->rw))
+			if (op_is_write(job->op))
 				job->write_err = (unsigned long) -1L;
 			else
 				job->read_err = 1;
@@ -816,7 +817,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
 	if (from) {
 		job->source = *from;
 		job->pages = NULL;
-		job->rw = READ;
+		job->op = REQ_OP_READ;
 	} else {
 		memset(&job->source, 0, sizeof job->source);
 		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,
 		/*
 		 * 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++)
 			if (!bdev_write_zeroes_sectors(job->dests[i].bdev)) {
-				job->rw = WRITE;
+				job->op = REQ_OP_WRITE;
 				break;
 			}
 	}

  parent reply	other threads:[~2022-07-14 18:08 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 18:06 [PATCH v3 00/63] Improve static type checking for request flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 01/63] treewide: Rename enum req_opf into enum req_op Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 02/63] block: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 03/63] block: Change the type of the last .rw_page() argument Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 04/63] block: Change the type of req_op() and bio_op() into enum req_op Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 05/63] block: Introduce the type blk_opf_t Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 06/63] block: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 07/63] block/bfq: " Bart Van Assche
2022-07-15  9:41   ` Jan Kara
2022-07-14 18:06 ` [PATCH v3 08/63] block/mq-deadline: " Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 09/63] block/kyber: " Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 10/63] blktrace: Trace remapped requests correctly Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 11/63] blktrace: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 12/63] block/brd: Use the enum req_op type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 13/63] block/drbd: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 14/63] block/drbd: Combine two drbd_submit_peer_request() arguments Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 15/63] block/floppy: Fix a sparse warning Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 16/63] block/rnbd: Use blk_opf_t where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 17/63] xen-blkback: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 18/63] block/zram: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 19/63] nvdimm-btt: Use the enum req_op type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 20/63] um: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 21/63] dm/core: Reduce the size of struct dm_io_request Bart Van Assche
2022-07-14 18:06 ` Bart Van Assche [this message]
2022-07-14 18:06 ` [PATCH v3 23/63] dm/core: Combine request operation type and flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 24/63] dm/ebs: Change 'int rw' into 'enum req_op op' Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 25/63] dm/dm-flakey: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 26/63] dm/dm-integrity: Combine request operation and flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 27/63] dm mirror log: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 28/63] dm-snap: Combine request operation type and flags Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 29/63] dm/zone: Use the enum req_op type Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 30/63] dm/dm-zoned: " Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 31/63] md/core: Combine two sync_page_io() arguments Bart Van Assche
2022-07-14 18:06 ` [PATCH v3 32/63] md/bcache: Combine two uuid_io() arguments Bart Van Assche
2022-07-19  4:46   ` Coly Li
2022-07-14 18:06 ` [PATCH v3 33/63] md/bcache: Combine two prio_io() arguments Bart Van Assche
2022-07-19  4:43   ` Coly Li
2022-07-14 18:07 ` [PATCH v3 34/63] md/raid1: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 35/63] md/raid10: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 36/63] md/raid5: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 37/63] nvme/host: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 38/63] nvme/target: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 39/63] scsi/core: Improve static type checking Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 40/63] scsi/core: Change the return type of scsi_noretry_cmd() into bool Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 41/63] scsi/core: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 42/63] scsi/device_handlers: " Bart Van Assche
2022-07-14 18:27   ` Martin Wilck
2022-07-14 18:07 ` [PATCH v3 43/63] scsi/ufs: Rename a 'dir' argument into 'op' Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 44/63] scsi/target: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 45/63] mm: " Bart Van Assche
2022-07-15  9:39   ` Jan Kara
2022-07-14 18:07 ` [PATCH v3 46/63] fs/buffer: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 47/63] fs/buffer: Combine two submit_bh() and ll_rw_block() arguments Bart Van Assche
2022-07-15  9:38   ` Jan Kara
2022-07-14 18:07 ` [PATCH v3 48/63] fs/direct-io: Reduce the size of struct dio Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 49/63] fs/mpage: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 50/63] fs/btrfs: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 51/63] fs/ext4: Use the new blk_opf_t type Bart Van Assche
2022-07-15  1:09   ` Theodore Ts'o
2022-07-14 18:07 ` [PATCH v3 52/63] fs/f2fs: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 53/63] fs/gfs2: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 54/63] fs/hfsplus: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 55/63] fs/iomap: Use the new blk_opf_t type Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 56/63] fs/jbd2: Fix the documentation of the jbd2_write_superblock() callers Bart Van Assche
2022-07-15  1:10   ` Theodore Ts'o
2022-07-14 18:07 ` [PATCH v3 57/63] fs/nfs: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 58/63] fs/nilfs2: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 59/63] fs/ntfs3: Use enum req_op where appropriate Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 60/63] fs/ocfs2: Use the enum req_op and blk_opf_t types Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 61/63] PM: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 62/63] fs/xfs: " Bart Van Assche
2022-07-14 18:07 ` [PATCH v3 63/63] fs/zonefs: Use the enum req_op type for tracing request operations Bart Van Assche
2022-07-18 10:49   ` Damien Le Moal
2022-07-14 18:15 ` [PATCH v3 00/63] Improve static type checking for request flags Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220714180729.1065367-23-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.