Re: Partial direct-io loop regression in 5.17-rc

From: Milan Broz
Date: Fri Feb 04 2022 - 10:03:19 EST




On 04/02/2022 14:32, Jens Axboe wrote:
On 2/4/22 2:22 AM, Milan Broz wrote:
Hi Jens,

It seems that there is a regression in direct-io over loop for partial
direct-io reads (or perhaps even for other situations).

If I run this code (loop over 6M file, dd direct-io read with 4M blocks)

IMG=tst.img
LOOP=/dev/loop66

truncate -s 6M $IMG
losetup $LOOP $IMG
dd if=$LOOP of=/dev/null bs=4M iflag=direct
losetup -d $LOOP


on older kernel (<=5.16) it reads the whole file
6291456 bytes (6.3 MB, 6.0 MiB) copied, 0.201591 s, 31.2 MB/s


while on 5.17-rc (tested on today/s Linus' git) it reads only the full blocks:
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.201904 s, 20.8 MB/s

No error reported, exit code is 0.

Can you try:

https://git.kernel.dk/cgit/linux-block/commit/?h=block-5.17&id=3e1f941dd9f33776b3df4e30f741fe445ff773f3

Yes, it works now.
(Not sure why I did not check if this patch is mainline, as I know about it. My bad...)

So this is going to some next rc, right?

Thanks,
Milan