aboutsummaryrefslogtreecommitdiff
path: root/cddl
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2018-02-15 21:30:30 +0000
committerAlan Somers <asomers@FreeBSD.org>2018-02-15 21:30:30 +0000
commitd727d8b0b1a42c774f28ee21f71d42733f1a63a0 (patch)
treee74492670b1c3495498a9580832718e6b7a497e5 /cddl
parentaff4f2d31521a674570143706741972efe864301 (diff)
downloadsrc-d727d8b0b1a42c774f28ee21f71d42733f1a63a0.tar.gz
src-d727d8b0b1a42c774f28ee21f71d42733f1a63a0.zip
Optimize zfsd for the happy case
If there are no damaged pools, then ignore all GEOM events. We only use them to fix damaged pools. However, still pay attention to ZFS events. MFC after: 20 days X-MFC-With: 329284 Sponsored by: Spectra Logic Corp
Notes
Notes: svn path=/head/; revision=329344
Diffstat (limited to 'cddl')
-rw-r--r--cddl/usr.sbin/zfsd/case_file.cc6
-rw-r--r--cddl/usr.sbin/zfsd/case_file.h5
-rw-r--r--cddl/usr.sbin/zfsd/zfsd_event.cc12
3 files changed, 21 insertions, 2 deletions
diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc
index 1ddffae8a884..c14009bdf678 100644
--- a/cddl/usr.sbin/zfsd/case_file.cc
+++ b/cddl/usr.sbin/zfsd/case_file.cc
@@ -186,6 +186,12 @@ CaseFile::DeSerialize()
free(caseFiles);
}
+bool
+CaseFile::Empty()
+{
+ return (s_activeCases.empty());
+}
+
void
CaseFile::LogAll()
{
diff --git a/cddl/usr.sbin/zfsd/case_file.h b/cddl/usr.sbin/zfsd/case_file.h
index fcb1261f2a67..b4dc2dee5d96 100644
--- a/cddl/usr.sbin/zfsd/case_file.h
+++ b/cddl/usr.sbin/zfsd/case_file.h
@@ -135,6 +135,11 @@ public:
static void DeSerialize();
/**
+ * \brief returns true if there are no CaseFiles
+ */
+ static bool Empty();
+
+ /**
* \brief Emit syslog data on all active CaseFile%%s in the system.
*/
static void LogAll();
diff --git a/cddl/usr.sbin/zfsd/zfsd_event.cc b/cddl/usr.sbin/zfsd/zfsd_event.cc
index 50da07631d5a..707a868c67e8 100644
--- a/cddl/usr.sbin/zfsd/zfsd_event.cc
+++ b/cddl/usr.sbin/zfsd/zfsd_event.cc
@@ -98,8 +98,16 @@ bool
GeomEvent::Process() const
{
/*
- * We are only concerned with create arrivals and physical path changes,
- * because those can be used to satisfy online and autoreplace operations
+ * We only use GEOM events to repair damaged pools. So return early if
+ * there are no damaged pools
+ */
+ if (CaseFile::Empty())
+ return (false);
+
+ /*
+ * We are only concerned with arrivals and physical path changes,
+ * because those can be used to satisfy online and autoreplace
+ * operations
*/
if (Value("type") != "GEOM::physpath" && Value("type") != "CREATE")
return (false);