Page MenuHomeFreeBSD

Make ZFS indirect (removed) vdevs support TRIM

Authored by mav on Oct 11 2018, 9:06 PM.



Without this change with TRIM enabled first free for block residing on removed vdev causes either assertion "zio->io_type == ZIO_TYPE_WRITE (0x3 == 0x2)" as in bug report 229007 if built with debug, or NULL dereference as in 228750 otherwise. Both cases are caused by the fact that vdev_indirect_io_start() has no idea about ZIO_TYPE_FREE, and also about the fact that such ZIOs have no data buffer.

This patch does two things:

  • removes assertion that there are only ZIO_TYPE_READ and ZIO_TYPE_WRITE are possible;
  • adds handling for NULL data pointers in case of ZIO_TYPE_FREE.
Test Plan

Remove vdev(s) from the pool, wait for completion, delete some large files, observe BIO_DELETE's on remaining vdevs and no crash.

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable

Event Timeline

1270 ↗(On Diff #49031)

Placing the open brace in an ifdef, but not the closing brace, break auto-formatting and brace-detection.

mav marked an inline comment as done.Oct 11 2018, 9:15 PM
mav added inline comments.
1270 ↗(On Diff #49031)

That may be true, but I attempted to minimize code divergence.

1270 ↗(On Diff #49031)

I agree with mav, this ifdef is done the way that works best for future merges

This revision is now accepted and ready to land.Oct 12 2018, 2:00 AM
This revision was automatically updated to reflect the committed changes.