On Mon, Apr 18, 2022 at 07:12:34AM +0200, Christoph Hellwig wrote: > On Sat, Apr 16, 2022 at 05:03:35PM +0800, Ming Lei wrote: > > > Yes. But not doing this automatically also means you keep easily > > > forgetting callsites. For example iomap still does not flush the plug > > > in your patch. > > > > It is reasonable for flush user(usually submission) to be responsible > > for finishing/flushing plug. > > Well, I very much disagree here. blk_flush_plug is not a publіc, > exported API, and that is for a reason. A bio submission interface > that requires flushing the plug to be useful is rather broken. But there isn't any such users from module now. Maybe never, since sync polled dio becomes legacy after io_uring is invented. Do we have such potential use case in which explicit flush plug is needed except for polled io in __blkdev_direct_IO_simple() and swap_readpage()? If there is, I am happy to add one flag for bypassing plug in blk core code. > > > iomap is one good example to show this point, since it does flush the plug > > before call bio_poll(), see __iomap_dio_rw(). > > iomap does not do a manual plug flush anywhere. > > iomap does finish the plug before polling, which makes sense. > > Now of course __blkdev_direct_IO_simple doesn't even use a plug > to start with, so I'm wondering what plug this patch even tries > to flush? At least blkdev_write_iter(), and __swap_writepage() might call into ->direct_IO with one plug too. Not mention loop driver can call into ->direct_IO directly, and we should have applied plug for batching submission in loop_process_work(). Thanks, Ming