When block allocation fails in UFS_BALLOC(), and the volume does not

have SU enabled, there is no point in calling softdep_request_cleanup().

The call cannot produce free blocks, but we unecessarily lock ufsmount
and do inode block write.  Usual point of not doing optimizations for
the corner case of the full volume is not applicable there, the work
is easily avoidable, and the addition CPU and disk io load do not lead
to succeeding retry.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
kib 2016-08-16 16:50:48 +00:00
parent 03c6968a37
commit 4e01efcc0c

View File

@ -311,7 +311,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags | IO_BUFLOCKED, cred, &newb)) != 0) {
brelse(bp);
if (++reclaimed == 1) {
if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);
@ -390,7 +390,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
flags | IO_BUFLOCKED, cred, &newb);
if (error) {
brelse(bp);
if (++reclaimed == 1) {
if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);
@ -881,7 +881,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags | IO_BUFLOCKED, cred, &newb)) != 0) {
brelse(bp);
if (++reclaimed == 1) {
if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);
@ -961,7 +961,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
flags | IO_BUFLOCKED, cred, &newb);
if (error) {
brelse(bp);
if (++reclaimed == 1) {
if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);