Changeset View
Changeset View
Standalone View
Standalone View
sys/ufs/ffs/ffs_vnops.c
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | if (ap->a_waitfor == MNT_WAIT && DOINGSOFTDEP(vp)) { | ||||
BO_LOCK(bo); | BO_LOCK(bo); | ||||
if ((vp->v_type == VREG || vp->v_type == VDIR) && | if ((vp->v_type == VREG || vp->v_type == VDIR) && | ||||
(bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0)) { | (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0)) { | ||||
BO_UNLOCK(bo); | BO_UNLOCK(bo); | ||||
goto retry; | goto retry; | ||||
} | } | ||||
BO_UNLOCK(bo); | BO_UNLOCK(bo); | ||||
} | } | ||||
if (ffs_fsfail_cleanup(VFSTOUFS(vp->v_mount), 0)) | |||||
return (ENXIO); | |||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
ffs_syncvnode(struct vnode *vp, int waitfor, int flags) | ffs_syncvnode(struct vnode *vp, int waitfor, int flags) | ||||
{ | { | ||||
struct inode *ip; | struct inode *ip; | ||||
struct bufobj *bo; | struct bufobj *bo; | ||||
struct ufsmount *ump; | |||||
struct buf *bp, *nbp; | struct buf *bp, *nbp; | ||||
ufs_lbn_t lbn; | ufs_lbn_t lbn; | ||||
int error, passes; | int error, passes; | ||||
bool still_dirty, wait; | bool still_dirty, wait; | ||||
ip = VTOI(vp); | ip = VTOI(vp); | ||||
ip->i_flag &= ~IN_NEEDSYNC; | ip->i_flag &= ~IN_NEEDSYNC; | ||||
bo = &vp->v_bufobj; | bo = &vp->v_bufobj; | ||||
ump = VFSTOUFS(vp->v_mount); | |||||
/* | /* | ||||
* When doing MNT_WAIT we must first flush all dependencies | * When doing MNT_WAIT we must first flush all dependencies | ||||
* on the inode. | * on the inode. | ||||
*/ | */ | ||||
if (DOINGSOFTDEP(vp) && waitfor == MNT_WAIT && | if (DOINGSOFTDEP(vp) && waitfor == MNT_WAIT && | ||||
(error = softdep_sync_metadata(vp)) != 0) | (error = softdep_sync_metadata(vp)) != 0) { | ||||
if (ffs_fsfail_cleanup(ump, error)) | |||||
error = 0; | |||||
return (error); | return (error); | ||||
} | |||||
/* | /* | ||||
* Flush all dirty buffers associated with a vnode. | * Flush all dirty buffers associated with a vnode. | ||||
*/ | */ | ||||
error = 0; | error = 0; | ||||
passes = 0; | passes = 0; | ||||
wait = false; /* Always do an async pass first. */ | wait = false; /* Always do an async pass first. */ | ||||
lbn = lblkno(ITOFS(ip), (ip->i_size + ITOFS(ip)->fs_bsize - 1)); | lbn = lblkno(ITOFS(ip), (ip->i_size + ITOFS(ip)->fs_bsize - 1)); | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | if (!LIST_EMPTY(&bp->b_dep) && | ||||
if ((bp->b_flags & B_DEFERRED) == 0) { | if ((bp->b_flags & B_DEFERRED) == 0) { | ||||
bp->b_flags |= B_DEFERRED; | bp->b_flags |= B_DEFERRED; | ||||
BUF_UNLOCK(bp); | BUF_UNLOCK(bp); | ||||
goto next; | goto next; | ||||
} | } | ||||
} | } | ||||
if (wait) { | if (wait) { | ||||
bremfree(bp); | bremfree(bp); | ||||
if ((error = bwrite(bp)) != 0) | error = bwrite(bp); | ||||
if (ffs_fsfail_cleanup(ump, error)) | |||||
error = 0; | |||||
if (error != 0) | |||||
return (error); | return (error); | ||||
} else if ((bp->b_flags & B_CLUSTEROK)) { | } else if ((bp->b_flags & B_CLUSTEROK)) { | ||||
(void) vfs_bio_awrite(bp); | (void) vfs_bio_awrite(bp); | ||||
} else { | } else { | ||||
bremfree(bp); | bremfree(bp); | ||||
(void) bawrite(bp); | (void) bawrite(bp); | ||||
} | } | ||||
next: | next: | ||||
▲ Show 20 Lines • Show All 1,462 Lines • Show Last 20 Lines |