Re: [PATCH v2 1/5] block: cleanup and export bdev IO inflight APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

在 2025/04/21 19:59, Christoph Hellwig 写道:
On Fri, Apr 18, 2025 at 09:09:37AM +0800, Yu Kuai wrote:
- remove unused blk_mq_in_flight

That should probably be a separate patch.
ok


- rename blk_mq_in_flight_rw to blk_mq_count_in_driver_rw, to distinguish
   from bdev_count_inflight_rw.

I'm not sure why this is needed or related, or even what additional
distinction is added here.

Because for rq-based device, there are two different stage,
blk_account_io_start() while allocating new rq, and
blk_mq_start_request() while issuing the rq to driver.

When will we think the reqeust is inflight? For iostat, my anser is the
former one, because rq->start_time_ns is set here as well. And noted in
iostats api diskstats_show(/proc/diskstats) and part_stat_show
(/sys/block/sda/stat), inflight is get by part_in_flight, which is
different from disk sysfs api(/sys/block/sda/inflight).


-
-void blk_mq_in_flight_rw(struct request_queue *q, struct block_device *part,
-		unsigned int inflight[2])
+void blk_mq_count_in_driver_rw(struct request_queue *q,
+			       struct block_device *part,
+			       unsigned int inflight[2])

Any reason to move away from two tab indents for the prototype
continuations in various places in this patch?

+ * Noted, for rq-based block device, use blk_mq_count_in_driver_rw() to get the
+ * number of requests issued to driver.

I'd just change this helper to call blk_mq_count_in_driver_rw for
blk-mq devices and remove the conditional from the sysfs code instead.
That gives us a much more robust and easier to understand API.

Ok, and another separate patch, right?

+void bdev_count_inflight_rw(struct block_device *bdev, unsigned int inflight[2]);

Overly long line.

+static inline unsigned int bdev_count_inflight(struct block_device *bdev)
+{
+	unsigned int inflight[2];
+
+	bdev_count_inflight_rw(bdev, inflight);
+
+	return inflight[0] + inflight[1];
+}
  #endif /* _LINUX_PART_STAT_H */

Maybe keep this inside of block as it should not not be used by
drivers?  Also the reimplementation should probably be a separate
patch from the public API change and exporting.

ok, and I should probably send the first set just related to this patch
first.

Thanks,
Kuai


.






[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux