On Wed, Oct 02, 2024 at 02:07:44PM -0700, Keith Busch wrote: > + accounting of the disk. Set to 0 to disable all stats. Set to 1 > + to enable block IO stats. Set to 2 to enable passthrough stats > + in addition to block IO. Jens' reply suggest he likes this interface, but I have to say I already hated it with a passion for the merges - overloading a previously boolean file with a numberic value is not exactly an intuitive interface. Is a new sysfs file for this really a problem? > + if (!bio) > + return false; > + if (!bio->bi_bdev) > + return false; > + if (blk_rq_bytes(req) & (bdev_logical_block_size(bio->bi_bdev) - 1)) > + return false; I understand why all these conditions are there, because basically they'd break the current code to collect stats. But I think this needs a comment explaining why they are there, and why the statistics are still useful without the requests matching them. > + lim = queue_limits_start_update(disk->queue); > + if (!ios) > + lim.features &= ~(BLK_FEAT_IO_STAT | BLK_FEAT_PASSTHROUGH_STAT); > + else if (ios == 2) > + lim.features |= BLK_FEAT_IO_STAT | BLK_FEAT_PASSTHROUGH_STAT; > + else if (ios == 1) { > + lim.features |= BLK_FEAT_IO_STAT; > + lim.features &= ~BLK_FEAT_PASSTHROUGH_STAT; BLK_FEAT_IO_STAT is in ->features because drivers need to opt into it, but BLK_FEAT_PASSTHROUGH_STAT is purely a flag triggered by sysfs and should go into ->flags.