summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-10-27 13:44:13 +0000
committerkib <kib@FreeBSD.org>2015-10-27 13:44:13 +0000
commite768957c56d836213255ba306a14e71b3fa8a9b6 (patch)
treed9b11a50f68a0afdb31db34bb6032e173c4f436d /sys/ufs
parente32aa1469896352c1631c8a96d334b2b8e9ea94b (diff)
downloadFreeBSD-src-e768957c56d836213255ba306a14e71b3fa8a9b6.zip
FreeBSD-src-e768957c56d836213255ba306a14e71b3fa8a9b6.tar.gz
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
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_balloc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c
index 9c33a7f..8551085 100644
--- a/sys/ufs/ffs/ffs_balloc.c
+++ b/sys/ufs/ffs/ffs_balloc.c
@@ -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);
OpenPOWER on IntegriCloud