zhihui Chen
2009-Jun-25 11:05 UTC
[zfs-discuss] how to convert zio->io_offset to disk block number?
I use following dtrace script to trace the postion of one file on zfs: #!/usr/sbin/dtrace -qs zio_done:entry /((zio_t *)(arg0))->io_vd/ { zio=(zio_t *)arg0; printf("Offset:%x and Size:%x\n",zio->io_offset,zio->io_size); printf("vd:%x\n",(unsigned long)(zio->io_vd)); printf("process name:%s\n",execname); tracemem(zio->io_data,40); stack(); } and I run dd command: "dd if=/export/dsk1/test1 bs=512 count=1", the dtrace script will generate following it output: Offset:657800 and Size:200 vd:ffffff02d6a1a700 process name:sched aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa zfs`zio_execute+0xa0 genunix`taskq_thread+0x193 unix`thread_start+0x8 ^C The tracemem output is the right context of file test1, which is a 512-byte text file. "zpool status" has following output: pool: tpool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM tpool ONLINE 0 0 0 c2t0d0 ONLINE 0 0 0 errors: No known data errors My question is how to translate zio->io_offset (0x657800, equal to decimal number 6649856) outputed by dtace to block number on disk c2t0d0? I tried to use "dd if=/dev/dsk/c2t0d0 of=text iseek=6650112 bs=512 count=1" for a check,but the result is not right. Thanks Zhihui -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20090625/c5251783/attachment.html>
zhihui Chen
2009-Jun-26 02:40 UTC
[zfs-discuss] how to convert zio->io_offset to disk block number?
Find that zio->io_offset is the absolute offset of device, not in sector unit. And If we need use zdb -R to dump the block, we should use the offset (zio->io_offset-0x400000). 2009/6/25 zhihui Chen <zhchen3 at gmail.com>> I use following dtrace script to trace the postion of one file on zfs: > > #!/usr/sbin/dtrace -qs > zio_done:entry > /((zio_t *)(arg0))->io_vd/ > { > zio=(zio_t *)arg0; > printf("Offset:%x and Size:%x\n",zio->io_offset,zio->io_size); > printf("vd:%x\n",(unsigned long)(zio->io_vd)); > printf("process name:%s\n",execname); > tracemem(zio->io_data,40); > stack(); > } > > and I run dd command: "dd if=/export/dsk1/test1 bs=512 count=1", the > dtrace script will generate following it output: > > Offset:657800 and Size:200 > vd:ffffff02d6a1a700 > process name:sched > aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > zfs`zio_execute+0xa0 > genunix`taskq_thread+0x193 > unix`thread_start+0x8 > ^C > > The tracemem output is the right context of file test1, which is a 512-byte > text file. "zpool status" has following output: > > pool: tpool > state: ONLINE > scrub: none requested > config: > NAME STATE READ WRITE CKSUM > tpool ONLINE 0 0 0 > c2t0d0 ONLINE 0 0 0 > errors: No known data errors > > My question is how to translate zio->io_offset (0x657800, equal to decimal > number 6649856) outputed by dtace to block number on disk c2t0d0? > I tried to use "dd if=/dev/dsk/c2t0d0 of=text iseek=6650112 bs=512 count=1" > for a check,but the result is not right. > > Thanks > Zhihui > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20090626/9a438d67/attachment.html>
zhihui Chen
2009-Jun-26 06:10 UTC
[zfs-discuss] how to convert zio->io_offset to disk block number?
Thanks, fixes following two issues, I can get the right value:(1) Dividing offset 0x657800(6649856) by 512 and take it as the iseek value. (2) Run the dd command on device c2t0d0s0, not c2t0d0. Zhihui 2009/6/26 max at bruningsystems.com <max at bruningsystems.com>> Hi Zhihui Chen, > > zhihui Chen wrote: > >> Find that zio->io_offset is the absolute offset of device, not in sector >> unit. And If we need use zdb -R to dump the block, we should use the offset >> (zio->io_offset-0x400000). >> >> 2009/6/25 zhihui Chen <zhchen3 at gmail.com <mailto:zhchen3 at gmail.com>> >> >> >> I use following dtrace script to trace the postion of one file on zfs: >> #!/usr/sbin/dtrace -qs >> zio_done:entry >> /((zio_t *)(arg0))->io_vd/ >> { >> zio=(zio_t *)arg0; >> printf("Offset:%x and Size:%x\n",zio->io_offset,zio->io_size); >> printf("vd:%x\n",(unsigned long)(zio->io_vd)); >> printf("process name:%s\n",execname); >> tracemem(zio->io_data,40); >> stack(); >> } >> and I run dd command: "dd if=/export/dsk1/test1 bs=512 count=1", >> the dtrace script will generate following it output: >> >> Offset:657800 and Size:200 >> vd:ffffff02d6a1a700 >> process name:sched >> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >> zfs`zio_execute+0xa0 >> genunix`taskq_thread+0x193 >> unix`thread_start+0x8 >> ^C >> The tracemem output is the right context of file test1, which is a >> 512-byte text file. "zpool status" has following output: >> pool: tpool >> state: ONLINE >> scrub: none requested >> config: >> NAME STATE READ WRITE CKSUM >> tpool ONLINE 0 0 0 >> c2t0d0 ONLINE 0 0 0 >> errors: No known data errors >> My question is how to translate zio->io_offset (0x657800, equal to >> decimal number 6649856) outputed by dtace to block number on disk >> c2t0d0? >> I tried to use "dd if=/dev/dsk/c2t0d0 of=text iseek=6650112 bs=512 >> count=1" for a check,but the result is not right. >> >> I assume that 6650112 is offset plus 0x400000? Try dividing 6650112 by > 512 and using that > as the iseek value. > max > > Thanks >> Zhihui >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> zfs-discuss mailing list >> zfs-discuss at opensolaris.org >> http://mail.opensolaris.org/mailman/listinfo/zfs-discuss >> >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20090626/77fdac06/attachment.html>