svn commit: r310105 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Alexander Motin mav at FreeBSD.org
Thu Dec 15 08:10:49 UTC 2016


Author: mav
Date: Thu Dec 15 08:10:47 2016
New Revision: 310105
URL: https://svnweb.freebsd.org/changeset/base/310105

Log:
  MFC 309714: Fix spa_alloc_tree sorting by offset in r305331.
  
  Original commit "7090 zfs should improve allocation order" declares alloc
  queue sorted by time and offset.  But in practice io_offset is always zero,
  so sorting happened only by time, while order of writes with equal time was
  completely random.  On Illumos this did not affected much thanks to using
  high resolution timestamps.  On FreeBSD due to using much faster but low
  resolution timestamps it caused bad data placement on disks, affecting
  further read performance.
  
  This change switches zio_timestamp_compare() from comparing uninitialized
  io_offset to really populated io_bookmark values.  I haven't decided yet
  what to do with timestampts, but on simple tests this change gives the
  same peformance results by just making code to work as declared.

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Dec 15 08:03:16 2016	(r310104)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Dec 15 08:10:47 2016	(r310105)
@@ -563,9 +563,24 @@ zio_timestamp_compare(const void *x1, co
 	if (z1->io_queued_timestamp > z2->io_queued_timestamp)
 		return (1);
 
-	if (z1->io_offset < z2->io_offset)
+	if (z1->io_bookmark.zb_objset < z2->io_bookmark.zb_objset)
 		return (-1);
-	if (z1->io_offset > z2->io_offset)
+	if (z1->io_bookmark.zb_objset > z2->io_bookmark.zb_objset)
+		return (1);
+
+	if (z1->io_bookmark.zb_object < z2->io_bookmark.zb_object)
+		return (-1);
+	if (z1->io_bookmark.zb_object > z2->io_bookmark.zb_object)
+		return (1);
+
+	if (z1->io_bookmark.zb_level < z2->io_bookmark.zb_level)
+		return (-1);
+	if (z1->io_bookmark.zb_level > z2->io_bookmark.zb_level)
+		return (1);
+
+	if (z1->io_bookmark.zb_blkid < z2->io_bookmark.zb_blkid)
+		return (-1);
+	if (z1->io_bookmark.zb_blkid > z2->io_bookmark.zb_blkid)
 		return (1);
 
 	if (z1 < z2)


More information about the svn-src-all mailing list