Date: Mon, 24 Feb 2003 22:44:42 -0800 (PST) From: Kirk McKusick <mckusick@FreeBSD.org> 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 Message-ID: <200302250644.h1P6igAv056036@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <bra@fsn.hu> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302250644.h1P6igAv056036>