aboutsummaryrefslogtreecommitdiff
path: root/module/zfs/vdev_raidz.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/vdev_raidz.c')
-rw-r--r--module/zfs/vdev_raidz.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c
index 5941e645e750..71c4bfbdaf00 100644
--- a/module/zfs/vdev_raidz.c
+++ b/module/zfs/vdev_raidz.c
@@ -2257,6 +2257,14 @@ vdev_raidz_asize_to_psize(vdev_t *vd, uint64_t asize, uint64_t txg)
ASSERT0(asize % (1 << ashift));
psize = (asize >> ashift);
+ /*
+ * If the roundup to nparity + 1 caused us to spill into a new row, we
+ * need to ignore that row entirely (since it can't store data or
+ * parity).
+ */
+ uint64_t rows = psize / cols;
+ psize = psize - (rows * cols) <= nparity ? rows * cols : psize;
+ /* Subtract out parity sectors for each row storing data. */
psize -= nparity * DIV_ROUND_UP(psize, cols);
psize <<= ashift;