svn commit: r290047 - head/sys/ufs/ffs

Konstantin Belousov kib at FreeBSD.org
Tue Oct 27 13:44:15 UTC 2015


Author: kib
Date: Tue Oct 27 13:44:13 2015
New Revision: 290047
URL: https://svnweb.freebsd.org/changeset/base/290047

Log:
  Do not perform read-ahead for BA_CLRBUF request when we are low on
  memory or when dirty buffer queue is too large.
  
  Reported and tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/ufs/ffs/ffs_balloc.c

Modified: head/sys/ufs/ffs/ffs_balloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_balloc.c	Tue Oct 27 12:42:27 2015	(r290046)
+++ head/sys/ufs/ffs/ffs_balloc.c	Tue Oct 27 13:44:13 2015	(r290047)
@@ -429,7 +429,9 @@ retry:
 	brelse(bp);
 	if (flags & BA_CLRBUF) {
 		int seqcount = (flags & BA_SEQMASK) >> BA_SEQSHIFT;
-		if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
+		if (seqcount != 0 &&
+		    (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0 &&
+		    !(vm_page_count_severe() || buf_dirty_count_severe())) {
 			error = cluster_read(vp, ip->i_size, lbn,
 			    (int)fs->fs_bsize, NOCRED,
 			    MAXBSIZE, seqcount, gbflags, &nbp);
@@ -998,7 +1000,9 @@ retry:
 	 */
 	if (flags & BA_CLRBUF) {
 		int seqcount = (flags & BA_SEQMASK) >> BA_SEQSHIFT;
-		if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
+		if (seqcount != 0 &&
+		    (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0 &&
+		    !(vm_page_count_severe() || buf_dirty_count_severe())) {
 			error = cluster_read(vp, ip->i_size, lbn,
 			    (int)fs->fs_bsize, NOCRED,
 			    MAXBSIZE, seqcount, gbflags, &nbp);


More information about the svn-src-all mailing list