From owner-cvs-all Mon Feb 24 23:20:29 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CF8E037B405; Mon, 24 Feb 2003 23:20:18 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7AEB243F75; Mon, 24 Feb 2003 23:20:18 -0800 (PST) (envelope-from mckusick@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h1P6ig0U056037; Mon, 24 Feb 2003 22:44:42 -0800 (PST) (envelope-from mckusick@repoman.freebsd.org) Received: (from mckusick@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h1P6igAv056036; Mon, 24 Feb 2003 22:44:42 -0800 (PST) Message-Id: <200302250644.h1P6igAv056036@repoman.freebsd.org> From: Kirk McKusick Date: Mon, 24 Feb 2003 22:44:42 -0800 (PST) To: src-committers@freebsd.org, cvs-src@freebsd.org, cvs-all@freebsd.org Subject: cvs commit: src/sys/sys vnode.h src/sys/kern vfs_bio.c vfs_subr.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG mckusick 2003/02/24 22:44:42 PST Modified files: sys/sys vnode.h sys/kern vfs_bio.c vfs_subr.c Log: Prevent large files from monopolizing the system buffers. Keep track of the number of dirty buffers held by a vnode. When a bdwrite is done on a buffer, check the existing number of dirty buffers associated with its vnode. If the number rises above vfs.dirtybufthresh (currently 90% of vfs.hidirtybuffers), one of the other (hopefully older) dirty buffers associated with the vnode is written (using bawrite). In the event that this approach fails to curb the growth in it the vnode's number of dirty buffers (due to soft updates rollback dependencies), the more drastic approach of doing a VOP_FSYNC on the vnode is used. This code primarily affects very large and actively written files such as snapshots. This change should eliminate hanging when taking snapshots or doing background fsck on very large filesystems. Hopefully, one day it will be possible to cache filesystem metadata in the VM cache as is done with file data. As it stands, only the buffer cache can be used which limits total metadata storage to about 20Mb no matter how much memory is available on the system. This rather small memory gets badly thrashed causing a lot of extra I/O. For example, taking a snapshot of a 1Tb filesystem minimally requires about 35,000 write operations, but because of the cache thrashing (we only have about 350 buffers at our disposal) ends up doing about 237,540 I/O's thus taking twenty-five minutes instead of four if it could run entirely in the cache. Reported by: Attila Nagy Sponsored by: DARPA & NAI Labs. Revision Changes Path 1.371 +56 -3 src/sys/kern/vfs_bio.c 1.431 +6 -0 src/sys/kern/vfs_subr.c 1.221 +2 -0 src/sys/sys/vnode.h To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message