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
This commit is contained in:
Konstantin Belousov 2015-10-27 13:44:13 +00:00
parent 2c8d721186
commit fe920528c1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290047

View File

@ -429,7 +429,9 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
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 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
*/
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);