Add ffs_inode_bwrite() helper.

In collaboration with:	pho
Reviewed by:	mckusick (previous version), markj
Tested by:	markj (syzkaller), pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D26136
This commit is contained in:
Konstantin Belousov 2020-11-14 05:19:59 +00:00
parent 7b795aa3c0
commit 738ea0010b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367671

View File

@ -67,6 +67,17 @@ __FBSDID("$FreeBSD$");
static int ffs_indirtrunc(struct inode *, ufs2_daddr_t, ufs2_daddr_t,
ufs2_daddr_t, int, ufs2_daddr_t *);
static void
ffs_inode_bwrite(struct vnode *vp, struct buf *bp, int flags)
{
if ((flags & IO_SYNC) != 0)
bwrite(bp);
else if (DOINGASYNC(vp))
bdwrite(bp);
else
bawrite(bp);
}
/*
* Update the access, modified, and inode change times as specified by the
* IN_ACCESS, IN_UPDATE, and IN_CHANGE flags respectively. Write the inode
@ -357,12 +368,7 @@ ffs_truncate(vp, length, flags, cred)
DIP_SET(ip, i_size, length);
if (bp->b_bufsize == fs->fs_bsize)
bp->b_flags |= B_CLUSTEROK;
if (flags & IO_SYNC)
bwrite(bp);
else if (DOINGASYNC(vp))
bdwrite(bp);
else
bawrite(bp);
ffs_inode_bwrite(vp, bp, flags);
UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE);
return (ffs_update(vp, waitforupdate));
}
@ -478,12 +484,7 @@ ffs_truncate(vp, length, flags, cred)
allocbuf(bp, size);
if (bp->b_bufsize == fs->fs_bsize)
bp->b_flags |= B_CLUSTEROK;
if (flags & IO_SYNC)
bwrite(bp);
else if (DOINGASYNC(vp))
bdwrite(bp);
else
bawrite(bp);
ffs_inode_bwrite(vp, bp, flags);
UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE);
}
/*