From 9f4107b07b17b5ee68af680150f91227bea2df6f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 14 Apr 2023 07:32:02 -0600 Subject: block: store bdev->bd_disk->fops->submit_bio state in bdev We have a long chain of memory dereferencing just to whether or not this disk has a special submit_bio helper. As that's not necessarily the common case, add a bd_has_submit_bio state in the bdev to avoid traversing this memory dependency chain if we don't need to. Signed-off-by: Jens Axboe --- block/genhd.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'block/genhd.c') diff --git a/block/genhd.c b/block/genhd.c index 02d9cfb9e077..cadcb472dfc3 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -420,6 +420,9 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, */ elevator_init_mq(disk->queue); + /* Mark bdev as having a submit_bio, if needed */ + disk->part0->bd_has_submit_bio = disk->fops->submit_bio != NULL; + /* * If the driver provides an explicit major number it also must provide * the number of minors numbers supported, and those will be used to -- cgit v1.2.3