From owner-svn-src-all@freebsd.org Thu Feb 15 21:30:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEB64F1C08F; Thu, 15 Feb 2018 21:30:31 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D0C87167F; Thu, 15 Feb 2018 21:30:31 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DD3A2437C; Thu, 15 Feb 2018 21:30:31 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1FLUVZg005134; Thu, 15 Feb 2018 21:30:31 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1FLUVwU005130; Thu, 15 Feb 2018 21:30:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802152130.w1FLUVwU005130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 15 Feb 2018 21:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329344 - head/cddl/usr.sbin/zfsd X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/cddl/usr.sbin/zfsd X-SVN-Commit-Revision: 329344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 21:30:32 -0000 Author: asomers Date: Thu Feb 15 21:30:30 2018 New Revision: 329344 URL: https://svnweb.freebsd.org/changeset/base/329344 Log: 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 Modified: head/cddl/usr.sbin/zfsd/case_file.cc head/cddl/usr.sbin/zfsd/case_file.h head/cddl/usr.sbin/zfsd/zfsd_event.cc Modified: head/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/case_file.cc Thu Feb 15 21:27:24 2018 (r329343) +++ head/cddl/usr.sbin/zfsd/case_file.cc Thu Feb 15 21:30:30 2018 (r329344) @@ -186,6 +186,12 @@ CaseFile::DeSerialize() free(caseFiles); } +bool +CaseFile::Empty() +{ + return (s_activeCases.empty()); +} + void CaseFile::LogAll() { Modified: head/cddl/usr.sbin/zfsd/case_file.h ============================================================================== --- head/cddl/usr.sbin/zfsd/case_file.h Thu Feb 15 21:27:24 2018 (r329343) +++ head/cddl/usr.sbin/zfsd/case_file.h Thu Feb 15 21:30:30 2018 (r329344) @@ -135,6 +135,11 @@ class CaseFile (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(); Modified: head/cddl/usr.sbin/zfsd/zfsd_event.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/zfsd_event.cc Thu Feb 15 21:27:24 2018 (r329343) +++ head/cddl/usr.sbin/zfsd/zfsd_event.cc Thu Feb 15 21:30:30 2018 (r329344) @@ -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);