Assume starting one disk write action, the vdev_disk_io_start will be called from zio_execute. static int vdev_disk_io_start(zio_t *zio) { ...... bp->b_lblkno = lbtodb(zio->io_offset); ...... } After scaning over the zfs source, I find the zio->io_offset is only set value in zio_create by the parameter offset. zio_write calls zio_create with the value 0 for the parameter offset. I can''t find anywhere else the zio->io_offset being set. After the new block born, the correct offset has been filled in bp->blk_dva (see metaslab_alloc), when and where the correct value set to zio->io_offset? Who can tell me? thanks -- This message posted from opensolaris.org
Jeff Bonwick
2009-Jan-24 23:05 UTC
[zfs-discuss] Where does set the value to zio->io_offset?
Each ZFS block pointer contains up to three DVAs (data virtual addresses), to implement ''ditto blocks'' (multiple copies of the data, above and beyond any replication provided by mirroring or RAID-Z). Semantically, ditto blocks are a lot like mirrors, so we actually use the mirror code to read them. We do this even in the degenerate single-copy case because it makes a bunch of other simplifications possible. Each DVA contains a vdev and offset, which are extracted by DVA_GET_VDEV() and DVA_GET_OFFSET() for each DVA in vdev_mirror_map_alloc(), and stored in the mirror map''s mc_vd and mc_offset fields. We then pass these values to zio_vdev_child_io(), which zio_create()s a dependent child zio to read or write the data. Jeff On Fri, Jan 23, 2009 at 10:53:35PM -0800, Jin wrote:> Assume starting one disk write action, the vdev_disk_io_start will be called from zio_execute. > > static int vdev_disk_io_start(zio_t *zio) > { > ...... > bp->b_lblkno = lbtodb(zio->io_offset); > ...... > } > > After scaning over the zfs source, I find the zio->io_offset is only set value in zio_create by the parameter offset. > > zio_write calls zio_create with the value 0 for the parameter offset. I can''t find anywhere else the zio->io_offset being set. > > After the new block born, the correct offset has been filled in bp->blk_dva (see metaslab_alloc), when and where the correct value set to zio->io_offset? > > Who can tell me? > > thanks > -- > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss