On Wed, Jun 19, 2019 at 10:02:53AM +0300, Nikolay Borisov wrote: > > > On 18.06.19 г. 21:00 ч., David Sterba wrote: > > The block device is passed around for the only purpose to set it in new > > bios. Move the assignment one level up. This is a preparatory patch for > > further bdev cleanups. > > > > Signed-off-by: David Sterba <dsterba@xxxxxxxx> > > Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx> > > Albeit I'd go as far as suggesting to make btrfs_bio_alloc a void > function similar to the generic bio alloc functions. It should be up to > the callers of bio alloc functions to initialize the bio in one place. > Even after your patch initialization is split across btrfs_bio_alloc and > its caller which seems a bit idiosyncratic. The bio_set_dev will go away (device for a bio is set right before it's submitted), so there will be only the allocation and the code as before. Some kind of split is probably inevitable, btrfs_bio_alloc needs the bioset that's private to extent_io.c and the callers know what to set to bi_opf etc. Maybe, as I'm looking at it now, btrfs_bio_alloc can take the value for opf, private and end_io as argument. All the callsites fill these three. That would make it consistent.
