diff options
author | kib <kib@FreeBSD.org> | 2012-03-11 20:26:19 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-03-11 20:26:19 +0000 |
commit | 25c42ffbd20bd5c16bba7ebf2e4ec23bb605de6a (patch) | |
tree | 2b79b585270902424f0432b551f770db0e9a50f4 /sys/ufs/ffs/ffs_inode.c | |
parent | 9d90ef6ecfb0387f18364671cde9bac62ecabd06 (diff) | |
download | FreeBSD-src-25c42ffbd20bd5c16bba7ebf2e4ec23bb605de6a.zip FreeBSD-src-25c42ffbd20bd5c16bba7ebf2e4ec23bb605de6a.tar.gz |
Do schedule delayed writes for async mounts.
While there, make some style adjustments, like missed () around
return values.
Submitted by: bde
Reviewed by: mckusick
Tested by: pho
MFC after: 2 weeks
Diffstat (limited to 'sys/ufs/ffs/ffs_inode.c')
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 8d6105d..8abd456 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -244,7 +244,7 @@ ffs_truncate(vp, length, flags, cred, td) ip->i_din2->di_extb[i] = 0; } ip->i_flag |= IN_CHANGE; - if ((error = ffs_update(vp, 1))) + if ((error = ffs_update(vp, !DOINGASYNC(vp)))) return (error); for (i = 0; i < NXADDR; i++) { if (oldblks[i] == 0) @@ -270,13 +270,13 @@ ffs_truncate(vp, length, flags, cred, td) ip->i_flag |= IN_CHANGE | IN_UPDATE; if (needextclean) goto extclean; - return ffs_update(vp, 1); + return (ffs_update(vp, !DOINGASYNC(vp))); } if (ip->i_size == length) { ip->i_flag |= IN_CHANGE | IN_UPDATE; if (needextclean) goto extclean; - return ffs_update(vp, 0); + return (ffs_update(vp, 0)); } if (fs->fs_ronly) panic("ffs_truncate: read-only filesystem"); @@ -303,10 +303,12 @@ ffs_truncate(vp, length, flags, cred, td) bp->b_flags |= B_CLUSTEROK; if (flags & IO_SYNC) bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); else bawrite(bp); ip->i_flag |= IN_CHANGE | IN_UPDATE; - return ffs_update(vp, 1); + return (ffs_update(vp, !DOINGASYNC(vp))); } if (DOINGSOFTDEP(vp)) { if (softdeptrunc == 0 && journaltrunc == 0) { @@ -378,6 +380,8 @@ ffs_truncate(vp, length, flags, cred, td) bp->b_flags |= B_CLUSTEROK; if (flags & IO_SYNC) bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); else bawrite(bp); } @@ -411,7 +415,7 @@ ffs_truncate(vp, length, flags, cred, td) DIP_SET(ip, i_db[i], 0); } ip->i_flag |= IN_CHANGE | IN_UPDATE; - allerror = ffs_update(vp, 1); + allerror = ffs_update(vp, !DOINGASYNC(vp)); /* * Having written the new inode to disk, save its new configuration @@ -543,7 +547,7 @@ extclean: softdep_journal_freeblocks(ip, cred, length, IO_EXT); else softdep_setup_freeblocks(ip, length, IO_EXT); - return ffs_update(vp, MNT_WAIT); + return (ffs_update(vp, !DOINGASYNC(vp))); } /* @@ -624,7 +628,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) else bap2[i] = 0; if (DOINGASYNC(vp)) { - bawrite(bp); + bdwrite(bp); } else { error = bwrite(bp); if (error) |