From owner-svn-src-all@freebsd.org Wed Dec 16 13:56:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD900A49BDA; Wed, 16 Dec 2015 13:56:29 +0000 (UTC) (envelope-from kib@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 mx1.freebsd.org (Postfix) with ESMTPS id 6AE661B12; Wed, 16 Dec 2015 13:56:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBG8dplv037810; Wed, 16 Dec 2015 08:39:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBG8dpI1037809; Wed, 16 Dec 2015 08:39:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512160839.tBG8dpI1037809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Dec 2015 08:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292325 - head/sys/kern X-SVN-Group: head 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.20 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: Wed, 16 Dec 2015 13:56:29 -0000 Author: kib Date: Wed Dec 16 08:39:51 2015 New Revision: 292325 URL: https://svnweb.freebsd.org/changeset/base/292325 Log: Simplify the loop step in the flushbuflist() and make it independed on the type stability of the buffers memory. Instead of memoizing pointer to the next buffer and validating it, remember the next logical block number in the bo list and re-lookup. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Dec 16 08:25:12 2015 (r292324) +++ head/sys/kern/vfs_subr.c Wed Dec 16 08:39:51 2015 (r292325) @@ -1652,10 +1652,9 @@ flushbuflist(struct bufv *bufv, int flag bp->b_flags &= ~B_ASYNC; brelse(bp); BO_LOCK(bo); - if (nbp != NULL && - (nbp->b_bufobj != bo || - nbp->b_lblkno != lblkno || - (nbp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) != xflags)) + nbp = gbincore(bo, lblkno); + if (nbp == NULL || (nbp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) + != xflags) break; /* nbp invalid */ } return (retval);