<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Thanks Brian.</span><div style="font-family:arial,sans-serif;font-size:13px"><br><div>I'm trying to understand how the internal XFS structures affect this mapping (<a href="http://oss.sgi.com/projects/xfs/papers/xfs_filesystem_structure.pdf" target="_blank">http://oss.sgi.com/projects/xfs/papers/xfs_filesystem_structure.pdf</a>)</div><div><br></div><div>xfs_bmap on the file matches that reported by extents in the file inode using xfs_db.</div><div><br></div><div>Other conversions under xfs_db</div><div><div>xfs_db> convert fsb 2621481 agno<br></div><div><div>0x0 (0)</div><div>xfs_db> convert fsb 2621481 agbno</div><div>0x280029 (2621481)</div><div>xfs_db> convert fsb 2621481 daddr</div><div>0x1400148 (20971848)</div></div><div><br></div></div></div><div style="font-family:arial,sans-serif;font-size:13px">I tried dd command with directio option and still blktrace reports the same raw block number as earlier.</div><div style="font-family:arial,sans-serif;font-size:13px">8,17   3        1     0.000000000  6999  D   R 20973896 + 1 [dd]<br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I'm using xfs_db with the partition i.e. "xfs_db -r /dev/sdb1"</div><div style="font-family:arial,sans-serif;font-size:13px">However, if I use it on the whole disk "xfs_db -r /dev/sdb", it gives the following error</div><div style="font-family:arial,sans-serif;font-size:13px">xfs_db: cannot init perag data (117)<br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Does this suggest something?</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks,</div><div style="font-family:arial,sans-serif;font-size:13px">Sushma</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 27, 2014 at 7:38 AM, Brian Foster <span dir="ltr"><<a href="mailto:bfoster@redhat.com" target="_blank">bfoster@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sat, Sep 27, 2014 at 12:32:21AM -0700, Sushma R wrote:<br>
> Hi,<br>
><br>
> I ran blktrace while reading a file on XFS partition and here's it's output.<br>
><br>
> 8,17   3        1    22.065944956  5489  D   R 20973896 + 8 [cat]<br>
><br>
> Using xfs_db, I dumped the inode for the same file and it shows the<br>
> following as its data extents.<br>
><br>
> u.bmx[0] = [startoff,startblock,blockcount,extentflag] 0:[0,2621481,1,0]<br>
><br>
> I understand that blktrace reports in 512-byte sectors while xfs_db in<br>
> filesystem block size (which is the default 4KB on my setup).<br>
> Converting blktrace offset to fs block = 2621737 which is close to the data<br>
> extent startblock (2621481), but still off by 256 fs blocks.<br>
><br>
> Could someone please help understand the reason for this mismatch?<br>
><br>
<br>
</div></div>I believe you are comparing a raw read of a device to an internal XFS<br>
fsb, the latter of which is encoded to account for the internal<br>
structure of XFS (e.g., allocation groups). You might want to take a<br>
look at xfs_bmap on the file to see the actual disk blocks.<br>
<br>
The fsb to daddr conversion depends on the geometry of the fs, but you<br>
can get the various values with xfs_db as well. E.g.:<br>
<br>
convert fsb 2621481 agno        # ag number<br>
convert fsb 2621481 agbno       # relative ag block nr<br>
convert fsb 2621481 daddr       # disk address<br>
<br>
Also, I'm not familiar enough with blktrace output off the top of my<br>
head so perhaps not an issue, but it's not clear to me whether the<br>
output above could have been converted/adjusted to a raw address based<br>
on a device partition.<br>
<br>
You might also want to verify you're looking at the actual file read vs.<br>
a directory/inode lookup or block mapping lookup or something else. I<br>
see you're running cat, a direct I/O read via dd might ensure you aren't<br>
just pulling file data from cache.<br>
<br>
Brian<br>
<br>
> Thanks,<br>
> Sushma<br>
<br>
> _______________________________________________<br>
> xfs mailing list<br>
> <a href="mailto:xfs@oss.sgi.com">xfs@oss.sgi.com</a><br>
> <a href="http://oss.sgi.com/mailman/listinfo/xfs" target="_blank">http://oss.sgi.com/mailman/listinfo/xfs</a><br>
<br>
</blockquote></div><br></div>