* [PATCH] md: use BLK_STS_OK instead of hardcode
@ 2021-06-22 15:54 Xianting Tian
2021-06-22 16:10 ` Coly Li
0 siblings, 1 reply; 2+ messages in thread
From: Xianting Tian @ 2021-06-22 15:54 UTC (permalink / raw)
To: colyli, kent.overstreet, agk, snitzer, dm-devel, song
Cc: linux-bcache, linux-kernel, linux-raid, Xianting Tian
When setting io status, sometimes it uses BLK_STS_*, sometimes,
it uses hardcode 0.
Use the macro to replace hardcode in multiple places.
Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
---
drivers/md/bcache/request.c | 2 +-
drivers/md/dm-clone-target.c | 2 +-
drivers/md/dm-integrity.c | 2 +-
drivers/md/dm-mpath.c | 2 +-
drivers/md/dm-raid1.c | 2 +-
drivers/md/dm.c | 2 +-
drivers/md/raid1.c | 4 ++--
drivers/md/raid10.c | 2 +-
8 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 6d1de88..73ba5a6 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -790,7 +790,7 @@ static void cached_dev_read_error(struct closure *cl)
/* Retry from the backing device: */
trace_bcache_read_retry(s->orig_bio);
- s->iop.status = 0;
+ s->iop.status = BLK_STS_OK;
do_bio_hook(s, s->orig_bio, backing_request_endio);
/* XXX: invalidate cache */
diff --git a/drivers/md/dm-clone-target.c b/drivers/md/dm-clone-target.c
index a90bdf9..d3f1c67 100644
--- a/drivers/md/dm-clone-target.c
+++ b/drivers/md/dm-clone-target.c
@@ -684,7 +684,7 @@ static void hydration_init(struct dm_clone_region_hydration *hd, unsigned long r
hd->region_nr = region_nr;
hd->overwrite_bio = NULL;
bio_list_init(&hd->deferred_bios);
- hd->status = 0;
+ hd->status = BLK_STS_OK;
INIT_LIST_HEAD(&hd->list);
INIT_HLIST_NODE(&hd->h);
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 20f2510..179e126 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -1848,7 +1848,7 @@ static int dm_integrity_map(struct dm_target *ti, struct bio *bio)
sector_t area, offset;
dio->ic = ic;
- dio->bi_status = 0;
+ dio->bi_status = BLK_STS_OK;
dio->op = bio_op(bio);
if (unlikely(dio->op == REQ_OP_DISCARD)) {
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index bced42f..50f5945 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -648,7 +648,7 @@ static int __multipath_map_bio(struct multipath *m, struct bio *bio,
mpio->pgpath = pgpath;
- bio->bi_status = 0;
+ bio->bi_status = BLK_STS_OK;
bio_set_dev(bio, pgpath->path.dev->bdev);
bio->bi_opf |= REQ_FAILFAST_TRANSPORT;
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index b0a82f2..bf4d875 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1283,7 +1283,7 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio,
dm_bio_restore(bd, bio);
bio_record->details.bi_bdev = NULL;
- bio->bi_status = 0;
+ bio->bi_status = BLK_STS_OK;
queue_bio(ms, bio, rw);
return DM_ENDIO_INCOMPLETE;
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index ca2aedd..3d2fe23 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -649,7 +649,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
io = container_of(tio, struct dm_io, tio);
io->magic = DM_IO_MAGIC;
- io->status = 0;
+ io->status = BLK_STS_OK;
atomic_set(&io->io_count, 1);
io->orig_bio = bio;
io->md = md;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ced076b..418d789 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2081,7 +2081,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
idx ++;
}
set_bit(R1BIO_Uptodate, &r1_bio->state);
- bio->bi_status = 0;
+ bio->bi_status = BLK_STS_OK;
return 1;
}
@@ -2144,7 +2144,7 @@ static void process_checks(struct r1bio *r1_bio)
if (sbio->bi_end_io != end_sync_read)
continue;
/* Now we can 'fixup' the error value */
- sbio->bi_status = 0;
+ sbio->bi_status = BLK_STS_OK;
bio_for_each_segment_all(bi, sbio, iter_all)
page_len[j++] = bi->bv_len;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 13f5e6b..c9a146b 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3797,7 +3797,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
if (bio->bi_end_io == end_sync_read) {
md_sync_acct_bio(bio, nr_sectors);
- bio->bi_status = 0;
+ bio->bi_status = BLK_STS_OK;
submit_bio_noacct(bio);
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] md: use BLK_STS_OK instead of hardcode
2021-06-22 15:54 [PATCH] md: use BLK_STS_OK instead of hardcode Xianting Tian
@ 2021-06-22 16:10 ` Coly Li
0 siblings, 0 replies; 2+ messages in thread
From: Coly Li @ 2021-06-22 16:10 UTC (permalink / raw)
To: Xianting Tian
Cc: linux-bcache, agk, snitzer, kent.overstreet, linux-kernel,
linux-raid, Xianting Tian, song, dm-devel
On 6/22/21 11:54 PM, Xianting Tian wrote:
> When setting io status, sometimes it uses BLK_STS_*, sometimes,
> it uses hardcode 0.
> Use the macro to replace hardcode in multiple places.
>
> Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
> ---
> drivers/md/bcache/request.c | 2 +-
> drivers/md/dm-clone-target.c | 2 +-
> drivers/md/dm-integrity.c | 2 +-
> drivers/md/dm-mpath.c | 2 +-
> drivers/md/dm-raid1.c | 2 +-
> drivers/md/dm.c | 2 +-
> drivers/md/raid1.c | 4 ++--
> drivers/md/raid10.c | 2 +-
> 8 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 6d1de88..73ba5a6 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -790,7 +790,7 @@ static void cached_dev_read_error(struct closure *cl)
> /* Retry from the backing device: */
> trace_bcache_read_retry(s->orig_bio);
>
> - s->iop.status = 0;
> + s->iop.status = BLK_STS_OK;
> do_bio_hook(s, s->orig_bio, backing_request_endio);
>
> /* XXX: invalidate cache */
Hi Xianting,
NACK for bcache part.
The change is incomplete, if you want to replace 0 by BLK_STS_OK, you
should check all locations
where s->iop.status is checked and replace with BLK_STS_OK when necessary.
One but not the only one example is,
871 if (s->iop.status)
872 continue_at_nobarrier(cl, cached_dev_read_error,
bcache_wq);
Maybe you should change to
if (s->iop.status != BLK_STS_OK)
continue_at_nobarrier(cl, cached_dev_read_error,
bcache_wq);
Just FYI.
Coly Li
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-22 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 15:54 [PATCH] md: use BLK_STS_OK instead of hardcode Xianting Tian
2021-06-22 16:10 ` Coly Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).