Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Dec 2016 08:10:48 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310105 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201612150810.uBF8AmU0084895@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612150810.uBF8AmU0084895>