From owner-svn-src-head@freebsd.org Tue Nov 1 00:02:54 2016 Return-Path: Delivered-To: svn-src-head@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 49FD7C28AF7; Tue, 1 Nov 2016 00:02:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 282A71214; Tue, 1 Nov 2016 00:02:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id uA102kQE021220 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 31 Oct 2016 17:02:46 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id uA102kfl021219; Mon, 31 Oct 2016 17:02:46 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 31 Oct 2016 17:02:46 -0700 From: Gleb Smirnoff To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308026 - in head/sys: kern sys ufs/ffs Message-ID: <20161101000246.GQ27748@FreeBSD.org> References: <201610281143.u9SBhxrN008547@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201610281143.u9SBhxrN008547@repo.freebsd.org> User-Agent: Mutt/1.7.0 (2016-08-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Nov 2016 00:02:54 -0000 Hi, On Fri, Oct 28, 2016 at 11:43:59AM +0000, Konstantin Belousov wrote: K> Author: kib K> Date: Fri Oct 28 11:43:59 2016 K> New Revision: 308026 K> URL: https://svnweb.freebsd.org/changeset/base/308026 K> K> Log: K> Generalize UFS buffer pager to allow it serving other filesystems K> which also use buffer cache. K> K> Most important addition to the code is the handling of filesystems K> where the block size is less than the machine page size, which might K> require reading several buffers to validate single page. K> K> Tested by: pho K> Sponsored by: The FreeBSD Foundation K> MFC after: 2 weeks K> K> Modified: K> head/sys/kern/vfs_bio.c K> head/sys/sys/buf.h K> head/sys/ufs/ffs/ffs_vnops.c K> K> Modified: head/sys/kern/vfs_bio.c K> ============================================================================== K> --- head/sys/kern/vfs_bio.c Fri Oct 28 11:35:06 2016 (r308025) K> +++ head/sys/kern/vfs_bio.c Fri Oct 28 11:43:59 2016 (r308026) K> @@ -75,9 +75,10 @@ __FBSDID("$FreeBSD$"); K> #include K> #include K> #include K> -#include K> -#include K> #include K> +#include K> +#include K> +#include K> #include K> #include K> #include K> @@ -4636,6 +4637,161 @@ bdata2bio(struct buf *bp, struct bio *bi K> } K> } K> K> +static int buf_pager_relbuf; K> +SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, K> + &buf_pager_relbuf, 0, K> + "Make buffer pager release buffers after reading"); K> + K> +/* K> + * The buffer pager. It uses buffer reads to validate pages. K> + * K> + * In contrast to the generic local pager from vm/vnode_pager.c, this K> + * pager correctly and easily handles volumes where the underlying K> + * device block size is greater than the machine page size. The K> + * buffer cache transparently extends the requested page run to be K> + * aligned at the block boundary, and does the necessary bogus page K> + * replacements in the addends to avoid obliterating already valid K> + * pages. K> + * K> + * The only non-trivial issue is that the exclusive busy state for K> + * pages, which is assumed by the vm_pager_getpages() interface, is K> + * incompatible with the VMIO buffer cache's desire to share-busy the K> + * pages. This function performs a trivial downgrade of the pages' K> + * state before reading buffers, and a less trivial upgrade from the K> + * shared-busy to excl-busy state after the read. IMHO, should be noted that the pager ignores requested rbehind and rahead values, and does the rbehind and rahead sizes that he prefers. -- Totus tuus, Glebius.