On Mon, Jan 17, 2022 at 09:13:21AM +0100, Christoph Hellwig wrote: > On Sun, Jan 16, 2022 at 12:18:12PM +0800, Ming Lei wrote: > > Hello, > > > > Draining FS I/O on del_gendisk() is added for just avoiding to refer to > > recently added q->disk in IO path, and it isn't actually needed. > > We need it to have proper life times in the block layer. Everything only > needed for file system I/O and not blk-mq specific should slowly move > from the request_queue to the gendisk and I have patches going in > that direction. In the end only the SCSI discovery code and the case > of /dev/sg without SCSI ULP will ever do passthrough I/O purely on the > gendisk. > > So I think this series is moving in the wrong direction. If you care > about no doing two freeze cycles the right thing to do is to record I just think that the extra draining point in del_gendisk() isn't useful, can you share any use case with this change? > if we ever did non-disk based passthrough I/O on a requeue_queue and > if not simplify the request_queue cleanup. Doing this is on my TODO > list but I haven't look into the details yet. > > > 1) queue freezing can't drain FS I/O for bio based driver > > This is something I've started looking into it. But that is one big problem, not sure you can solve it in short time, also not sure if it is useful, cause FS already guaranteed that every IO is drained before releasing disk, or IOs in the submission task are drained when exiting the task. > > > 2) it isn't easy to move elevator/cgroup/throttle shutdown during > > del_gendisk, and q->disk can still be referred in these code paths > > I've also done some prep work to land this cycle here, as all that > code is only used for FS I/O. IMO, Firstly, FS layer has already guaranteed that every FS IO is done before releasing disk, so no need to take so much effort and make code more fragile to add one extra FS IO draining point in del_gendisk(). Also the above two things aren't trivial enough to solve in short time, so can we delay the FS draining in del_gendisk() until the two are done? Thanks, Ming