On Sat, May 7, 2022 at 12:28 PM Dave Chinner <david@xxxxxxxxxxxxx> wrote: > > On Sat, May 07, 2022 at 12:10:33PM +0800, Liang Chen wrote: > > From: Liang Chen <liangchen.linux@xxxxxxxxx> > > > > As pointed out in commit 332391a, mixing buffered reads and asynchronous > > direct writes risks ending up with a situation where stale data is left > > in page cache while new data is already written to disk. The same problem > > hits block dev fs too. A similar approach needs to be taken here. > > > > Signed-off-by: Liang Chen <liangchen.linux@xxxxxxxxx> > > --- > > V2: declare blkdev_sb_init_dio_done_wq static > > --- > > block/fops.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 87 insertions(+) > > Rather than copying functionality from the two other generic DIO > paths (which we really want to get down to 1!) into this cut down, > less functional DIO path, shouldn't we be spending the effort to > convert the blkdev device to use one of the other generic DIO paths > that already solves this problem and likely gets a lot more test > coverage? Yeah, that would be better for sure. In fact I just realized the patch introduces a performance drawback compared to the two other DIO paths. Making use of the well tested code path would avoid such a mistake. I will take a look on converting blkdev device to use __blockdev_direct_IO (seems requiring less effort).