HomeFreeBSD

MMP writes rotate over leaves

Description

MMP writes rotate over leaves

Instead of choosing a leaf vdev quasi-randomly, by starting at the root
vdev and randomly choosing children, rotate over leaves to issue MMP
writes. This fixes an issue in a pool whose top-level vdevs have
different numbers of leaves.

The issue is that the frequency at which individual leaves are chosen
for MMP writes is based not on the total number of leaves but based on
how many siblings the leaves have.

For example, in a pool like this:

    root-vdev
+------+---------------+

vdev1 vdev2

|                       |
|                +------+-----+-----+----+

disk1 disk2 disk3 disk4 disk5 disk6

vdev1 and vdev2 will each be chosen 50% of the time. Every time vdev1
is chosen, disk1 will be chosen. However, every time vdev2 is chosen,
disk2 is chosen 20% of the time. As a result, disk1 will be sent 5x as
many MMP writes as disk2.

This may create wear issues in the case of SSDs. It also reduces the
effectiveness of MMP as it depends on the writes being evenly
distributed for the case where some devices fail or are partitioned.

The new code maintains a list of leaf vdevs in the pool. MMP records
the last leaf used for an MMP write in mmp->mmp_last_leaf. To choose
the next leaf, MMP starts at mmp->mmp_last_leaf and traverses the list,
continuing from the head if the tail is reached. It stops when a
suitable leaf is found or all leaves have been examined.

Added a test to verify MMP write distribution is even.

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Kash Pande <kash@tripleback.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #7953

Details

Provenance
Olaf Faaland <faaland1@llnl.gov>Authored on Mar 12 2019, 5:37 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Mar 12 2019, 5:37 PM
Parents
rGb1b94e9644ee: zfs does not honor NFS sync write semantics
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG3d31aad83e64: MMP writes rotate over leaves (authored by Olaf Faaland <faaland1@llnl.gov>).Mar 12 2019, 5:37 PM