From owner-svn-src-all@freebsd.org Fri Jan 17 01:16:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A353E1FC153; Fri, 17 Jan 2020 01:16:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47zNS83BmBz3NVQ; Fri, 17 Jan 2020 01:16:24 +0000 (UTC) (envelope-from imp@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 60C29AE4; Fri, 17 Jan 2020 01:16:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00H1GOBB082512; Fri, 17 Jan 2020 01:16:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00H1GOOt082510; Fri, 17 Jan 2020 01:16:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202001170116.00H1GOOt082510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 17 Jan 2020 01:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356820 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 356820 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.29 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: Fri, 17 Jan 2020 01:16:24 -0000 Author: imp Date: Fri Jan 17 01:16:23 2020 New Revision: 356820 URL: https://svnweb.freebsd.org/changeset/base/356820 Log: We only want to send the speedup to the lower layers when there's a shortage. Only send a speedup when there's a shortage. While this is a little racy, lost races aren't a big deal for this function. If there's a shorage just popping up after we check these values, then we'll catch it next time. If there's a shortage that's just clearing up, we may do some work at the lower layers a little sooner than we otherwise would have. Sicne shortages are relatively rare events, both races are acceptable. Reviewed by: chs Differential Revision: https://reviews.freebsd.org/D23182 Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Jan 17 01:16:19 2020 (r356819) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Jan 17 01:16:23 2020 (r356820) @@ -13771,23 +13771,28 @@ check_clear_deps(mp) struct mount *mp; { struct ufsmount *ump; + bool suj_susp; /* - * Tell the lower layers that any TRIM or WRITE transactions - * that have been delayed for performance reasons should - * proceed to help alleviate the shortage faster. + * Tell the lower layers that any TRIM or WRITE transactions that have + * been delayed for performance reasons should proceed to help alleviate + * the shortage faster. The race between checking req_* and the softdep + * mutex (lk) is fine since this is an advisory operation that at most + * causes deferred work to be done sooner. */ ump = VFSTOUFS(mp); - FREE_LOCK(ump); - softdep_send_speedup(ump, 0, BIO_SPEEDUP_TRIM | BIO_SPEEDUP_WRITE); - ACQUIRE_LOCK(ump); + suj_susp = MOUNTEDSUJ(mp) && ump->softdep_jblocks->jb_suspended; + if (req_clear_remove || req_clear_inodedeps || suj_susp) { + FREE_LOCK(ump); + softdep_send_speedup(ump, 0, BIO_SPEEDUP_TRIM | BIO_SPEEDUP_WRITE); + ACQUIRE_LOCK(ump); + } - /* * If we are suspended, it may be because of our using * too many inodedeps, so help clear them out. */ - if (MOUNTEDSUJ(mp) && VFSTOUFS(mp)->softdep_jblocks->jb_suspended) + if (suj_susp) clear_inodedeps(mp); /*