On Wed, 2015-07-08 at 06:57 -0700, Ming Lin wrote:
> On Wed, 2015-07-08 at 10:53 +0200, Christoph Hellwig wrote:
> > On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
> > > Hi list,
> > >
> > > I am testing some direct-io patches.
> > > xfs_tests/xfs/080 failed.
> > >
> > > It's strange.
> > > There is no hole in "rwtest.file",
> > > but when read it at some offset it returns zero because of hole.
> > >
> > > root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
> > > /mnt/test/rwtest.file:
> > > 0: [0..125671]: 160..125831
> >
> > Sounds like you see an unwritten extent. What does xfs_bmap -pv show on
> > the file?
>
> root@block:~# xfs_bmap -pv /mnt/test/rwtest.file
> /mnt/test/rwtest.file:
> EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
> 0: [0..743]: 160..903 0 (160..903) 744 00000
> 1: [744..783]: 904..943 0 (904..943) 40 10000
> 2: [784..951]: 944..1111 0 (944..1111) 168 00000
> 3: [952..1023]: 1112..1183 0 (1112..1183) 72 10000
> 4: [1024..1287]: 1184..1447 0 (1184..1447) 264 00000
> 5: [1288..1383]: 1448..1543 0 (1448..1543) 96 10000
file offset 659456 is in EXT 5.
I guess FLAGS 1 means it's an unwritten extent, right?
xfs_tests/xfs/080 basically does:
1. direct io write
2. then buffered read to check the previous dio write
Here is an example of error logs.
doio ( 3626) 16:13:23
---------------------
*** DATA COMPARISON ERROR ***
check_file(/mnt/test/rwtest.file, 239616, 81408, H:3626:block:doio*,
18, 0) failed
Comparison fd is 5, with open flags 0
Corrupt regions follow - unprintable chars are represented as '.'
-----------------------------------------------------------------
corrupt bytes starting at file offset 241664
1st 32 expected bytes: oio*H:3626:block:doio*H:3626:blo
1st 32 actual bytes: ................................
Request number 981
fd 4 is file /mnt/test/rwtest.file - open flags are 040001
O_WRONLY,O_DIRECT,
write done at file offset 239616 - pattern is H (0110)
number of requests is 1, strides per request is 1
i/o byte count = 81408
memory alignment is aligned
DIRECT I/O: offset % 512 = 0 length % 81408 = 0
mem alignment 0x200 xfer size: small: 512 large: 2147483136
syscall: writev(4, (iov on stack), 1)
The "expected bytes" was actually written to the disk successfully,
but for some bug the xfs extent flag was not set correctly.
The flag should be "XFS_EXT_NORM", but now it's "XFS_EXT_UNWRITTEN".
Could you share the code path the extent flag was updated?
Is it also updated through direct io?
Thanks.
|