All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] md/raid10: Fix the data type of an r10_sync_page_io() argument
@ 2022-08-10 18:20 Bart Van Assche
  2022-08-11 17:46 ` Song Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2022-08-10 18:20 UTC (permalink / raw)
  To: Song Liu
  Cc: linux-raid, Bart Van Assche, Rong A Chen, Jens Axboe,
	Paul Menzel, kernel test robot

Fix the following sparse warning:

drivers/md/raid10.c:2647:60: sparse: sparse: incorrect type in argument 5 (different base types) @@     expected restricted blk_opf_t [usertype] opf @@     got int rw @@

This patch does not change any functionality since REQ_OP_READ = READ = 0
and since REQ_OP_WRITE = WRITE = 1.

Cc: Rong A Chen <rong.a.chen@intel.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>
Fixes: 4ce4c73f662b ("md/core: Combine two sync_page_io() arguments")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---

Changes compared to v1: made the patch subject more specific.

 drivers/md/raid10.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 9117fcdee1be..64d6e4cd8a3a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2639,18 +2639,18 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
 }
 
 static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector,
-			    int sectors, struct page *page, int rw)
+			    int sectors, struct page *page, enum req_op op)
 {
 	sector_t first_bad;
 	int bad_sectors;
 
 	if (is_badblock(rdev, sector, sectors, &first_bad, &bad_sectors)
-	    && (rw == READ || test_bit(WriteErrorSeen, &rdev->flags)))
+	    && (op == REQ_OP_READ || test_bit(WriteErrorSeen, &rdev->flags)))
 		return -1;
-	if (sync_page_io(rdev, sector, sectors << 9, page, rw, false))
+	if (sync_page_io(rdev, sector, sectors << 9, page, op, false))
 		/* success */
 		return 1;
-	if (rw == WRITE) {
+	if (op == REQ_OP_WRITE) {
 		set_bit(WriteErrorSeen, &rdev->flags);
 		if (!test_and_set_bit(WantReplacement, &rdev->flags))
 			set_bit(MD_RECOVERY_NEEDED,
@@ -2780,7 +2780,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
 			if (r10_sync_page_io(rdev,
 					     r10_bio->devs[sl].addr +
 					     sect,
-					     s, conf->tmppage, WRITE)
+					     s, conf->tmppage, REQ_OP_WRITE)
 			    == 0) {
 				/* Well, this device is dead */
 				pr_notice("md/raid10:%s: read correction write failed (%d sectors at %llu on %pg)\n",
@@ -2814,8 +2814,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
 			switch (r10_sync_page_io(rdev,
 					     r10_bio->devs[sl].addr +
 					     sect,
-					     s, conf->tmppage,
-						 READ)) {
+					     s, conf->tmppage, REQ_OP_READ)) {
 			case 0:
 				/* Well, this device is dead */
 				pr_notice("md/raid10:%s: unable to read back corrected sectors (%d sectors at %llu on %pg)\n",

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] md/raid10: Fix the data type of an r10_sync_page_io() argument
  2022-08-10 18:20 [PATCH v2] md/raid10: Fix the data type of an r10_sync_page_io() argument Bart Van Assche
@ 2022-08-11 17:46 ` Song Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Song Liu @ 2022-08-11 17:46 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-raid, Rong A Chen, Jens Axboe, Paul Menzel, kernel test robot

On Wed, Aug 10, 2022 at 11:20 AM Bart Van Assche <bvanassche@acm.org> wrote:
>
> Fix the following sparse warning:
>
> drivers/md/raid10.c:2647:60: sparse: sparse: incorrect type in argument 5 (different base types) @@     expected restricted blk_opf_t [usertype] opf @@     got int rw @@
>
> This patch does not change any functionality since REQ_OP_READ = READ = 0
> and since REQ_OP_WRITE = WRITE = 1.
>
> Cc: Rong A Chen <rong.a.chen@intel.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Paul Menzel <pmenzel@molgen.mpg.de>
> Fixes: 4ce4c73f662b ("md/core: Combine two sync_page_io() arguments")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Applied to md-fixes. Thanks!

Song

> ---
>
> Changes compared to v1: made the patch subject more specific.
>
>  drivers/md/raid10.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 9117fcdee1be..64d6e4cd8a3a 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2639,18 +2639,18 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
>  }
>
>  static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector,
> -                           int sectors, struct page *page, int rw)
> +                           int sectors, struct page *page, enum req_op op)
>  {
>         sector_t first_bad;
>         int bad_sectors;
>
>         if (is_badblock(rdev, sector, sectors, &first_bad, &bad_sectors)
> -           && (rw == READ || test_bit(WriteErrorSeen, &rdev->flags)))
> +           && (op == REQ_OP_READ || test_bit(WriteErrorSeen, &rdev->flags)))
>                 return -1;
> -       if (sync_page_io(rdev, sector, sectors << 9, page, rw, false))
> +       if (sync_page_io(rdev, sector, sectors << 9, page, op, false))
>                 /* success */
>                 return 1;
> -       if (rw == WRITE) {
> +       if (op == REQ_OP_WRITE) {
>                 set_bit(WriteErrorSeen, &rdev->flags);
>                 if (!test_and_set_bit(WantReplacement, &rdev->flags))
>                         set_bit(MD_RECOVERY_NEEDED,
> @@ -2780,7 +2780,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
>                         if (r10_sync_page_io(rdev,
>                                              r10_bio->devs[sl].addr +
>                                              sect,
> -                                            s, conf->tmppage, WRITE)
> +                                            s, conf->tmppage, REQ_OP_WRITE)
>                             == 0) {
>                                 /* Well, this device is dead */
>                                 pr_notice("md/raid10:%s: read correction write failed (%d sectors at %llu on %pg)\n",
> @@ -2814,8 +2814,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
>                         switch (r10_sync_page_io(rdev,
>                                              r10_bio->devs[sl].addr +
>                                              sect,
> -                                            s, conf->tmppage,
> -                                                READ)) {
> +                                            s, conf->tmppage, REQ_OP_READ)) {
>                         case 0:
>                                 /* Well, this device is dead */
>                                 pr_notice("md/raid10:%s: unable to read back corrected sectors (%d sectors at %llu on %pg)\n",

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-11 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 18:20 [PATCH v2] md/raid10: Fix the data type of an r10_sync_page_io() argument Bart Van Assche
2022-08-11 17:46 ` Song Liu

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.