Re: [RFC PATCH 01/37] block: introduce bio_init_fields() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't think a helper just to initialize a few fields is very useful.
But there is something in this area I've wanted to do for a while:

> +static inline void bio_init_fields(struct bio *bio, struct block_device *bdev,
> +				   sector_t sect, void *priv,
> +				   bio_end_io_t *end_io,
> +				   unsigned short prio, unsigned short whint)
> +{
> +	bio_set_dev(bio, bdev);
> +	bio->bi_iter.bi_sector = sect;
> +	bio->bi_private = priv;
> +	bio->bi_end_io = end_io;
> +	bio->bi_ioprio = prio;
> +	bio->bi_write_hint = whint;

Ensuring that the device, sector and op are always initialized would
really helper some of the bio mapping helpers, so I'd rather
add a new

struct bio *bio_new(struct block_device *bdev, sector_t sector,
		unsigned int op, unsigned int max_bvecs, gfp_t gfp_mask)

helper, where max_bvecs is clamped to BIO_MAX_PAGES.

bi_private, bi_end_io, bi_ioprio and bi_write_hint on the other hand
are purely optional and can be easily set just by the users that care.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux