Hi Duff,
> ... I expect vdev selection is a simple algorithm
> that rotates through vdevs with some additional logic to handle the case
> where the vdev is full.
The vdev selection policy is in metaslab_alloc_dva(). You are right that
it is a simple algorithm that rotates through the vdevs. Apart from the
additional logic to handle the obvious case of a vdev being full, there
is logic to handle ditto blocks and gang blocks. For ditto blocks, we try
to spread them across consecutive vdevs or atleast try to spread them out
on that vdev as much as possible and for gang blocks, we try to keep them
on the same vdev as the gang block header. While you look at this piece of
code, it would help if you remember that vdevs are akin to metaslab groups.
ZFS also tries to figure out whether the corresponding vdev is
over- or under-used relative to the pool, and set an allocation bias
to even it out.
- Vidya Sakar
Jill Duff wrote:> Hi All,
>
>
>
> I?m interested in exploring the logic that selects the vdev for a newly
> created file. I''ve spent some time in the metaslab.c file but this
> appears to be weighting slab selection within a vdev ?not really the
> logic I?m looking for. I expect vdev selection is a simple algorithm
> that rotates through vdevs with some additional logic to handle the case
> where the vdev is full. However, I have not yet been able to locate this
> logic within the ZFS code. I''m hoping someone can point me to the
> correct file(s) where I can study this logic.
>
>
>
> Thanks,
>
> Duff
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> zfs-discuss mailing list
> zfs-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/zfs-discuss