* [PATCH] md: simplify code with bio_io_error
@ 2017-06-02 7:49 Guoqing Jiang
2017-06-02 16:29 ` Shaohua Li
0 siblings, 1 reply; 4+ messages in thread
From: Guoqing Jiang @ 2017-06-02 7:49 UTC (permalink / raw)
To: linux-raid; +Cc: shli, Guoqing Jiang
bio_io_error was introduced in the commit 4246a0b
("block: add a bi_error field to struct bio"), so
use it to simplify code.
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
---
drivers/md/raid1.c | 3 +--
drivers/md/raid10.c | 3 +--
drivers/md/raid5.c | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index af5056d..c20eb78 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -802,8 +802,7 @@ static void flush_bio_list(struct r1conf *conf, struct bio *bio)
bio->bi_next = NULL;
bio->bi_bdev = rdev->bdev;
if (test_bit(Faulty, &rdev->flags)) {
- bio->bi_error = -EIO;
- bio_endio(bio);
+ bio_io_error(bio);
} else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
!blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
/* Just ignore it */
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 4343d7f..ceb9709 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -913,8 +913,7 @@ static void flush_pending_writes(struct r10conf *conf)
bio->bi_next = NULL;
bio->bi_bdev = rdev->bdev;
if (test_bit(Faulty, &rdev->flags)) {
- bio->bi_error = -EIO;
- bio_endio(bio);
+ bio_io_error(bio);
} else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
!blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
/* Just ignore it */
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7220646..57aa044 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3429,8 +3429,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
struct bio *nextbi =
r5_next_bio(bi, sh->dev[i].sector);
- bi->bi_error = -EIO;
- bio_endio(bi);
+ bio_io_error(bi);
bi = nextbi;
}
}
--
2.10.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] md: simplify code with bio_io_error
2017-06-02 7:49 [PATCH] md: simplify code with bio_io_error Guoqing Jiang
@ 2017-06-02 16:29 ` Shaohua Li
2017-06-03 5:57 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2017-06-02 16:29 UTC (permalink / raw)
To: Guoqing Jiang; +Cc: linux-raid
On Fri, Jun 02, 2017 at 03:49:14PM +0800, Guoqing Jiang wrote:
> bio_io_error was introduced in the commit 4246a0b
> ("block: add a bi_error field to struct bio"), so
> use it to simplify code.
>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Applied, thanks! There are several other places which could use conversion, I added
too.
> ---
> drivers/md/raid1.c | 3 +--
> drivers/md/raid10.c | 3 +--
> drivers/md/raid5.c | 3 +--
> 3 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index af5056d..c20eb78 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -802,8 +802,7 @@ static void flush_bio_list(struct r1conf *conf, struct bio *bio)
> bio->bi_next = NULL;
> bio->bi_bdev = rdev->bdev;
> if (test_bit(Faulty, &rdev->flags)) {
> - bio->bi_error = -EIO;
> - bio_endio(bio);
> + bio_io_error(bio);
> } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
> !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
> /* Just ignore it */
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 4343d7f..ceb9709 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -913,8 +913,7 @@ static void flush_pending_writes(struct r10conf *conf)
> bio->bi_next = NULL;
> bio->bi_bdev = rdev->bdev;
> if (test_bit(Faulty, &rdev->flags)) {
> - bio->bi_error = -EIO;
> - bio_endio(bio);
> + bio_io_error(bio);
> } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
> !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
> /* Just ignore it */
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 7220646..57aa044 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -3429,8 +3429,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
> struct bio *nextbi =
> r5_next_bio(bi, sh->dev[i].sector);
>
> - bi->bi_error = -EIO;
> - bio_endio(bi);
> + bio_io_error(bi);
> bi = nextbi;
> }
> }
> --
> 2.10.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] md: simplify code with bio_io_error
2017-06-02 16:29 ` Shaohua Li
@ 2017-06-03 5:57 ` Christoph Hellwig
2017-06-05 3:11 ` Guoqing Jiang
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2017-06-03 5:57 UTC (permalink / raw)
To: Shaohua Li; +Cc: Guoqing Jiang, linux-raid
On Fri, Jun 02, 2017 at 09:29:26AM -0700, Shaohua Li wrote:
> On Fri, Jun 02, 2017 at 03:49:14PM +0800, Guoqing Jiang wrote:
> > bio_io_error was introduced in the commit 4246a0b
> > ("block: add a bi_error field to struct bio"), so
> > use it to simplify code.
> >
> > Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
>
> Applied, thanks! There are several other places which could use conversion, I added
Ugg. I have a massive series pending for the block layer that changes
the error values. Applying these cleanups now will just introduce
conflicts all over.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] md: simplify code with bio_io_error
2017-06-03 5:57 ` Christoph Hellwig
@ 2017-06-05 3:11 ` Guoqing Jiang
0 siblings, 0 replies; 4+ messages in thread
From: Guoqing Jiang @ 2017-06-05 3:11 UTC (permalink / raw)
To: Christoph Hellwig, Shaohua Li; +Cc: linux-raid
On 06/03/2017 01:57 PM, Christoph Hellwig wrote:
> On Fri, Jun 02, 2017 at 09:29:26AM -0700, Shaohua Li wrote:
>> On Fri, Jun 02, 2017 at 03:49:14PM +0800, Guoqing Jiang wrote:
>>> bio_io_error was introduced in the commit 4246a0b
>>> ("block: add a bi_error field to struct bio"), so
>>> use it to simplify code.
>>>
>>> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
>> Applied, thanks! There are several other places which could use conversion, I added
> Ugg. I have a massive series pending for the block layer that changes
> the error values. Applying these cleanups now will just introduce
> conflicts all over.
>
Hmm, I suppose you mean the thread with subject "dedicated error codes
for the block layer"
which replace bi_error with bi_status. I can resend it on top of the
thread, or maybe you can
add the changes in your patches directly.
Thanks,
Guoqing
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-05 3:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-02 7:49 [PATCH] md: simplify code with bio_io_error Guoqing Jiang
2017-06-02 16:29 ` Shaohua Li
2017-06-03 5:57 ` Christoph Hellwig
2017-06-05 3:11 ` Guoqing Jiang
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).