2005-09-08 13:17:39

by David Howells

[permalink] [raw]
Subject: Reuse of BIOs


Hi Jens,

Is it possible to reuse a BIO once the callback on it has been invoked to
indicate final completion? Or does it have to be released and another one
allocated?

David


2005-09-08 13:19:21

by Jens Axboe

[permalink] [raw]
Subject: Re: Reuse of BIOs

On Thu, Sep 08 2005, David Howells wrote:
>
> Hi Jens,
>
> Is it possible to reuse a BIO once the callback on it has been invoked to
> indicate final completion? Or does it have to be released and another one
> allocated?

If you reuse it indefinitely, you violate the principles that make the
mempool work. So the answer is 'yes' if you only reuse it a little, 'no'
if you want to hang on to it forever.

--
Jens Axboe

2005-09-08 13:32:22

by Fawad Lateef

[permalink] [raw]
Subject: Re: Reuse of BIOs

On 9/8/05, David Howells <[email protected]> wrote:
>
>
> Is it possible to reuse a BIO once the callback on it has been invoked to
> indicate final completion? Or does it have to be released and another one
> allocated?
>

The thing which I did in my virtual caching device driver is I keeps
the pointer of BIO got from the kernel in my locally created BIO's
private field (and fill other fields with the original BIO's Data) and
sends it to other caching device and when got the end_io for that BIO
(like in read from caching device and writing to target device) I put
that in the queue and one of my thread directly sends that to the
target device without changed except replacing the sector of caching
device to the target device sector and after getting completion signal
from target device, I just freed that BIO or move it to my free pool
of BIOs and just call the completion for the original BIO taken back
from the private field of local BIO ..........

This means we can reuse BIO sended to one device and then sending that
to other device after getting completion signal from first device
......... But I can't say this about the original kernel BIO b/c I m
not sending it to any of my devices !!!!

--
Fawad Lateef