[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210119062753.GA21413@lst.de>
Date: Tue, 19 Jan 2021 07:27:53 +0100
From: Christoph Hellwig <hch@....de>
To: Chaitanya Kulkarni <chaitanya.kulkarni@....com>
Cc: linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, axboe@...nel.dk,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [RFC PATCH 01/37] block: introduce bio_init_fields() helper
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.
Powered by blists - more mailing lists