On 5/11/21 3:10 PM, Christoph Hellwig wrote:
On Mon, May 10, 2021 at 11:58:32PM -0700, Song Liu wrote:
IIUC, the sysfs node is needed to get better performance (by disabling
accounting)?
FYI, we already have that sysfs file in the block layer
("queue/iostats"), please just observe QUEUE_FLAG_IO_STAT flag.
Seems only nvdimm observe the flag before call bio_{start,end}_io_acct.
Does it make sense to make the checking mandatory? Something like.
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1315,6 +1315,9 @@ static unsigned long __part_start_io_acct(struct
block_device *part,
const int sgrp = op_stat_group(op);
unsigned long now = READ_ONCE(jiffies);
+ if (!blk_queue_io_stat(part->bd_disk->queue))
+ return 0;
+
part_stat_lock();
update_io_ticks(part, now, false);
part_stat_inc(part, ios[sgrp]);
@@ -1351,6 +1354,9 @@ static void __part_end_io_acct(struct block_device
*part, unsigned int op,
unsigned long now = READ_ONCE(jiffies);
unsigned long duration = now - start_time;
+ if (!blk_queue_io_stat(part->bd_disk->queue))
+ return;
+
Thanks,
Guoqing