Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Aug 2015 20:23:00 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r286550 - vendor-sys/illumos/dist/uts/common/fs/zfs
Message-ID:  <201508092023.t79KN0GD019950@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Aug  9 20:22:59 2015
New Revision: 286550
URL: https://svnweb.freebsd.org/changeset/base/286550

Log:
  5694 traverse_prefetcher does not prefetch enough
  
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Reviewed by: Alex Reece <alex@delphix.com>
  Reviewed by: Christopher Siden <christopher.siden@delphix.com>
  Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
  Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
  Approved by: Garrett D'Amore <garrett@damore.org>
  Author: George Wilson <george.wilson@delphix.com>
  
  illumos/illumos-gate@34d7ce052c4565b078f73b95ccbd49274e98edaa

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c	Sun Aug  9 20:08:38 2015	(r286549)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c	Sun Aug  9 20:22:59 2015	(r286550)
@@ -38,13 +38,12 @@
 #include <sys/callb.h>
 #include <sys/zfeature.h>
 
-int zfs_pd_blks_max = 100;
+int32_t zfs_pd_bytes_max = 50 * 1024 * 1024;	/* 50MB */
 
 typedef struct prefetch_data {
 	kmutex_t pd_mtx;
 	kcondvar_t pd_cv;
-	int pd_blks_max;
-	int pd_blks_fetched;
+	int32_t pd_bytes_fetched;
 	int pd_flags;
 	boolean_t pd_cancel;
 	boolean_t pd_exited;
@@ -249,11 +248,12 @@ traverse_visitbp(traverse_data_t *td, co
 	}
 
 	if (pd != NULL && !pd->pd_exited && prefetch_needed(pd, bp)) {
+		uint64_t size = BP_GET_LSIZE(bp);
 		mutex_enter(&pd->pd_mtx);
-		ASSERT(pd->pd_blks_fetched >= 0);
-		while (pd->pd_blks_fetched == 0 && !pd->pd_exited)
+		ASSERT(pd->pd_bytes_fetched >= 0);
+		while (pd->pd_bytes_fetched < size && !pd->pd_exited)
 			cv_wait(&pd->pd_cv, &pd->pd_mtx);
-		pd->pd_blks_fetched--;
+		pd->pd_bytes_fetched -= size;
 		cv_broadcast(&pd->pd_cv);
 		mutex_exit(&pd->pd_mtx);
 	}
@@ -444,7 +444,7 @@ traverse_prefetcher(spa_t *spa, zilog_t 
 	prefetch_data_t *pfd = arg;
 	arc_flags_t aflags = ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH;
 
-	ASSERT(pfd->pd_blks_fetched >= 0);
+	ASSERT(pfd->pd_bytes_fetched >= 0);
 	if (pfd->pd_cancel)
 		return (SET_ERROR(EINTR));
 
@@ -452,9 +452,9 @@ traverse_prefetcher(spa_t *spa, zilog_t 
 		return (0);
 
 	mutex_enter(&pfd->pd_mtx);
-	while (!pfd->pd_cancel && pfd->pd_blks_fetched >= pfd->pd_blks_max)
+	while (!pfd->pd_cancel && pfd->pd_bytes_fetched >= zfs_pd_bytes_max)
 		cv_wait(&pfd->pd_cv, &pfd->pd_mtx);
-	pfd->pd_blks_fetched++;
+	pfd->pd_bytes_fetched += BP_GET_LSIZE(bp);
 	cv_broadcast(&pfd->pd_cv);
 	mutex_exit(&pfd->pd_mtx);
 
@@ -526,7 +526,6 @@ traverse_impl(spa_t *spa, dsl_dataset_t 
 		td.td_hole_birth_enabled_txg = 0;
 	}
 
-	pd.pd_blks_max = zfs_pd_blks_max;
 	pd.pd_flags = flags;
 	mutex_init(&pd.pd_mtx, NULL, MUTEX_DEFAULT, NULL);
 	cv_init(&pd.pd_cv, NULL, CV_DEFAULT, NULL);



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