[Drbd-dev] [PATCH v5 03/12] block: Add bio_reset()

Tejun Heo tj at kernel.org
Thu Aug 9 00:11:29 CEST 2012


Hello,

On Mon, Aug 06, 2012 at 03:08:32PM -0700, Kent Overstreet wrote:
> Reusing bios is something that's been highly frowned upon in the past,
> but driver code keeps doing it anyways. If it's going to happen anyways,
> we should provide a generic method.
> 
> This'll help with getting rid of bi_destructor - drivers/block/pktcdvd.c
> was open coding it, by doing a bio_init() and resetting bi_destructor.
> 
> v5: Add a define BIO_RESET_BITS, to be very explicit about what parts of
> bio->bi_flags are saved.
> 
> Signed-off-by: Kent Overstreet <koverstreet at google.com>
> Change-Id: I4eb2975bd678d3be811d5423d0620b08020be9ff

Please drop Change-Id.  Die gerrit die.

> +void bio_reset(struct bio *bio)
> +{
> +	unsigned long flags = bio->bi_flags & (~0UL << BIO_RESET_BITS);

How many flags are we talking about?  If there aren't too many, I'd
prefer explicit BIO_FLAGS_PRESERVED or whatever.

Thanks.

-- 
tejun


More information about the drbd-dev mailing list