diff mbox

[05/33] block: Add bio_list_peek()

Message ID 1244644748-24211-6-git-send-email-Geert.Uytterhoeven@sonycom.com
State New
Headers show

Commit Message

Geert Uytterhoeven June 10, 2009, 2:38 p.m. UTC
Introduce bio_list_peek(), to obtain a pointer to the first bio on the bio_list
without actually removing it from the list. This is needed when you want to
serialize based on the list being empty or not.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Jens Axboe <axboe@kernel.dk>
---
 include/linux/bio.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Benjamin Herrenschmidt June 15, 2009, 1:39 a.m. UTC | #1
On Wed, 2009-06-10 at 16:38 +0200, Geert Uytterhoeven wrote:
> Introduce bio_list_peek(), to obtain a pointer to the first bio on the bio_list
> without actually removing it from the list. This is needed when you want to
> serialize based on the list being empty or not.

Leaving that one (and the next one) out for now until Jens Ack them.

Cheers,
Ben.

> Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> ---
>  include/linux/bio.h |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index 7b214fd..618bb7d 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -590,6 +590,11 @@ static inline void bio_list_merge_head(struct bio_list *bl,
>  	bl->head = bl2->head;
>  }
>  
> +static inline struct bio *bio_list_peek(struct bio_list *bl)
> +{
> +	return bl->head;
> +}
> +
>  static inline struct bio *bio_list_pop(struct bio_list *bl)
>  {
>  	struct bio *bio = bl->head;
Jens Axboe June 15, 2009, 5:56 a.m. UTC | #2
On Mon, Jun 15 2009, Benjamin Herrenschmidt wrote:
> On Wed, 2009-06-10 at 16:38 +0200, Geert Uytterhoeven wrote:
> > Introduce bio_list_peek(), to obtain a pointer to the first bio on the bio_list
> > without actually removing it from the list. This is needed when you want to
> > serialize based on the list being empty or not.
> 
> Leaving that one (and the next one) out for now until Jens Ack them.

You can add my acked-by, this one is trivial and a good addition.

> 
> Cheers,
> Ben.
> 
> > Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> > Cc: Jens Axboe <axboe@kernel.dk>
> > ---
> >  include/linux/bio.h |    5 +++++
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/linux/bio.h b/include/linux/bio.h
> > index 7b214fd..618bb7d 100644
> > --- a/include/linux/bio.h
> > +++ b/include/linux/bio.h
> > @@ -590,6 +590,11 @@ static inline void bio_list_merge_head(struct bio_list *bl,
> >  	bl->head = bl2->head;
> >  }
> >  
> > +static inline struct bio *bio_list_peek(struct bio_list *bl)
> > +{
> > +	return bl->head;
> > +}
> > +
> >  static inline struct bio *bio_list_pop(struct bio_list *bl)
> >  {
> >  	struct bio *bio = bl->head;
>
diff mbox

Patch

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7b214fd..618bb7d 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -590,6 +590,11 @@  static inline void bio_list_merge_head(struct bio_list *bl,
 	bl->head = bl2->head;
 }
 
+static inline struct bio *bio_list_peek(struct bio_list *bl)
+{
+	return bl->head;
+}
+
 static inline struct bio *bio_list_pop(struct bio_list *bl)
 {
 	struct bio *bio = bl->head;