Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH 2/2] use bio_endio instead of a call to bi_end_io
@ 2008-06-24  5:28 Mikulas Patocka
  2008-06-24  6:10 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2008-06-24  5:28 UTC (permalink / raw)
  To: linux-kernel, linux-raid; +Cc: axboe, mingo

Hi

The is sequel to my previous patch to avoid bio_endio recursion. raid5 
bypasses bio_endio and calls the method directly (although it does the 
same as bio_endio). I changed bio_endio to avoid recursion, so it should 
be used instead of calling the method.

Mikulas

--

Turn calls to bi->bi_end_io() into bio_endio(). Apparently bio_endio does
exactly the same error processing as is hardcoded at these places.

bio_endio() avoids recursion, so it should be used.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

Index: linux-2.6.26-rc7-devel/drivers/md/raid5.c
===================================================================
--- linux-2.6.26-rc7-devel.orig/drivers/md/raid5.c	2008-06-24 07:28:15.000000000 +0200
+++ linux-2.6.26-rc7-devel/drivers/md/raid5.c	2008-06-24 07:28:53.000000000 +0200
@@ -115,9 +115,7 @@
  		return_bi = bi->bi_next;
  		bi->bi_next = NULL;
  		bi->bi_size = 0;
-		bi->bi_end_io(bi,
-			      test_bit(BIO_UPTODATE, &bi->bi_flags)
-			        ? 0 : -EIO);
+		bio_endio(bi, 0);
  		bi = return_bi;
  	}
  }
@@ -3689,9 +3687,7 @@
  		if ( rw == WRITE )
  			md_write_end(mddev);

-		bi->bi_end_io(bi,
-			      test_bit(BIO_UPTODATE, &bi->bi_flags)
-			        ? 0 : -EIO);
+		bio_endio(bi, 0);
  	}
  	return 0;
  }
@@ -3994,12 +3990,8 @@
  	spin_lock_irq(&conf->device_lock);
  	remaining = --raid_bio->bi_phys_segments;
  	spin_unlock_irq(&conf->device_lock);
-	if (remaining == 0) {
-
-		raid_bio->bi_end_io(raid_bio,
-			      test_bit(BIO_UPTODATE, &raid_bio->bi_flags)
-			        ? 0 : -EIO);
-	}
+	if (remaining == 0)
+		bio_endio(raid_bio, 0);
  	if (atomic_dec_and_test(&conf->active_aligned_reads))
  		wake_up(&conf->wait_for_stripe);
  	return handled;

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

* Re: [PATCH 2/2] use bio_endio instead of a call to bi_end_io
  2008-06-24  5:28 [PATCH 2/2] use bio_endio instead of a call to bi_end_io Mikulas Patocka
@ 2008-06-24  6:10 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2008-06-24  6:10 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: linux-kernel, linux-raid, axboe, mingo

On Tuesday June 24, mpatocka@redhat.com wrote:
> Hi
> 
> The is sequel to my previous patch to avoid bio_endio recursion. raid5 
> bypasses bio_endio and calls the method directly (although it does the 
> same as bio_endio). I changed bio_endio to avoid recursion, so it should 
> be used instead of calling the method.
> 
> Mikulas
> 

Thanks.  I'll add that to my queue.

NeilBrown

> --
> 
> Turn calls to bi->bi_end_io() into bio_endio(). Apparently bio_endio does
> exactly the same error processing as is hardcoded at these places.
> 
> bio_endio() avoids recursion, so it should be used.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> Index: linux-2.6.26-rc7-devel/drivers/md/raid5.c
> ===================================================================
> --- linux-2.6.26-rc7-devel.orig/drivers/md/raid5.c	2008-06-24 07:28:15.000000000 +0200
> +++ linux-2.6.26-rc7-devel/drivers/md/raid5.c	2008-06-24 07:28:53.000000000 +0200
> @@ -115,9 +115,7 @@
>   		return_bi = bi->bi_next;
>   		bi->bi_next = NULL;
>   		bi->bi_size = 0;
> -		bi->bi_end_io(bi,
> -			      test_bit(BIO_UPTODATE, &bi->bi_flags)
> -			        ? 0 : -EIO);
> +		bio_endio(bi, 0);
>   		bi = return_bi;
>   	}
>   }
> @@ -3689,9 +3687,7 @@
>   		if ( rw == WRITE )
>   			md_write_end(mddev);
> 
> -		bi->bi_end_io(bi,
> -			      test_bit(BIO_UPTODATE, &bi->bi_flags)
> -			        ? 0 : -EIO);
> +		bio_endio(bi, 0);
>   	}
>   	return 0;
>   }
> @@ -3994,12 +3990,8 @@
>   	spin_lock_irq(&conf->device_lock);
>   	remaining = --raid_bio->bi_phys_segments;
>   	spin_unlock_irq(&conf->device_lock);
> -	if (remaining == 0) {
> -
> -		raid_bio->bi_end_io(raid_bio,
> -			      test_bit(BIO_UPTODATE, &raid_bio->bi_flags)
> -			        ? 0 : -EIO);
> -	}
> +	if (remaining == 0)
> +		bio_endio(raid_bio, 0);
>   	if (atomic_dec_and_test(&conf->active_aligned_reads))
>   		wake_up(&conf->wait_for_stripe);
>   	return handled;
> --
> 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] 2+ messages in thread

end of thread, other threads:[~2008-06-24  6:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24  5:28 [PATCH 2/2] use bio_endio instead of a call to bi_end_io Mikulas Patocka
2008-06-24  6:10 ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox