* [PATCH] md/raid1: Use blk_opf_t for read and write operations
@ 2024-01-08 0:12 Bart Van Assche
2024-01-10 0:22 ` Song Liu
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2024-01-08 0:12 UTC (permalink / raw)
To: Song Liu; +Cc: linux-raid, Bart Van Assche, Jens Axboe, kernel test robot
Use the type blk_opf_t for read and write operations instead of int. This
patch does not affect the generated code but fixes the following sparse
warning:
drivers/md/raid1.c:1993:60: sparse: sparse: incorrect type in argument 5 (different base types)
expected restricted blk_opf_t [usertype] opf
got int rw
Cc: Song Liu <song@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Fixes: 3c5e514db58f ("md/raid1: Use the new blk_opf_t type")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401080657.UjFnvQgX-lkp@intel.com/
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/md/raid1.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 35d12948e0a9..e138922d5129 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1984,12 +1984,12 @@ static void end_sync_write(struct bio *bio)
}
static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector,
- int sectors, struct page *page, int rw)
+ int sectors, struct page *page, blk_opf_t rw)
{
if (sync_page_io(rdev, sector, sectors << 9, page, rw, false))
/* success */
return 1;
- if (rw == WRITE) {
+ if (rw == REQ_OP_WRITE) {
set_bit(WriteErrorSeen, &rdev->flags);
if (!test_and_set_bit(WantReplacement,
&rdev->flags))
@@ -2106,7 +2106,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
rdev = conf->mirrors[d].rdev;
if (r1_sync_page_io(rdev, sect, s,
pages[idx],
- WRITE) == 0) {
+ REQ_OP_WRITE) == 0) {
r1_bio->bios[d]->bi_end_io = NULL;
rdev_dec_pending(rdev, mddev);
}
@@ -2121,7 +2121,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
rdev = conf->mirrors[d].rdev;
if (r1_sync_page_io(rdev, sect, s,
pages[idx],
- READ) != 0)
+ REQ_OP_READ) != 0)
atomic_add(s, &rdev->corrected_errors);
}
sectors -= s;
@@ -2333,7 +2333,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
atomic_inc(&rdev->nr_pending);
rcu_read_unlock();
r1_sync_page_io(rdev, sect, s,
- conf->tmppage, WRITE);
+ conf->tmppage, REQ_OP_WRITE);
rdev_dec_pending(rdev, mddev);
} else
rcu_read_unlock();
@@ -2350,7 +2350,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
atomic_inc(&rdev->nr_pending);
rcu_read_unlock();
if (r1_sync_page_io(rdev, sect, s,
- conf->tmppage, READ)) {
+ conf->tmppage, REQ_OP_READ)) {
atomic_add(s, &rdev->corrected_errors);
pr_info("md/raid1:%s: read error corrected (%d sectors at %llu on %pg)\n",
mdname(mddev), s,
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] md/raid1: Use blk_opf_t for read and write operations
2024-01-08 0:12 [PATCH] md/raid1: Use blk_opf_t for read and write operations Bart Van Assche
@ 2024-01-10 0:22 ` Song Liu
0 siblings, 0 replies; 2+ messages in thread
From: Song Liu @ 2024-01-10 0:22 UTC (permalink / raw)
To: Bart Van Assche; +Cc: linux-raid, Jens Axboe, kernel test robot
On Sun, Jan 7, 2024 at 4:12 PM Bart Van Assche <bvanassche@acm.org> wrote:
>
> Use the type blk_opf_t for read and write operations instead of int. This
> patch does not affect the generated code but fixes the following sparse
> warning:
>
> drivers/md/raid1.c:1993:60: sparse: sparse: incorrect type in argument 5 (different base types)
> expected restricted blk_opf_t [usertype] opf
> got int rw
>
> Cc: Song Liu <song@kernel.org>
> Cc: Jens Axboe <axboe@kernel.dk>
> Fixes: 3c5e514db58f ("md/raid1: Use the new blk_opf_t type")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202401080657.UjFnvQgX-lkp@intel.com/
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Applied to md-6.8.
Thanks,
Song
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-10 0:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-08 0:12 [PATCH] md/raid1: Use blk_opf_t for read and write operations Bart Van Assche
2024-01-10 0:22 ` Song Liu
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).