On Tue, 19 Feb 2013 16:22:40 -0800 Kent Overstreet <[email protected]> wrote:
> This is for the new bio splitting code. When we split a bio, if the
> split occured on a bvec boundry we reuse the bvec for the new bio. But
> that means bio_free() can't free it, hence the explicit flag.
>
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -117,6 +117,7 @@ struct bio {
> * BIO_POOL_IDX()
> */
> #define BIO_RESET_BITS 12
> +#define BIO_OWNS_VEC 12 /* bio_free() should free bvec */
>
> #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
The BIO_OWNS_VEC definition seems to be in the wrong place - it should
be grouped with the "bio flags" group above?
On Tue, Mar 26, 2013 at 11:11:06AM -0700, Andrew Morton wrote:
> On Tue, 19 Feb 2013 16:22:40 -0800 Kent Overstreet <[email protected]> wrote:
>
> > This is for the new bio splitting code. When we split a bio, if the
> > split occured on a bvec boundry we reuse the bvec for the new bio. But
> > that means bio_free() can't free it, hence the explicit flag.
> >
> > --- a/include/linux/blk_types.h
> > +++ b/include/linux/blk_types.h
> > @@ -117,6 +117,7 @@ struct bio {
> > * BIO_POOL_IDX()
> > */
> > #define BIO_RESET_BITS 12
> > +#define BIO_OWNS_VEC 12 /* bio_free() should free bvec */
> >
> > #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
>
> The BIO_OWNS_VEC definition seems to be in the wrong place - it should
> be grouped with the "bio flags" group above?
No - BIO_OWNS_VEC is set by bio_alloc_bioset() and is used by bio_free()
to determine if it should free the biovec, so it's something we don't
want cleared if driver code uses bio_reset().