summaryrefslogtreecommitdiffstats
path: root/sys/dev/vn
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2000-07-11 22:07:57 +0000
committermckusick <mckusick@FreeBSD.org>2000-07-11 22:07:57 +0000
commita3d0c189ea25a7af3dfab30112f5d8d65e214e1c (patch)
treec84458dcf49aaf90ff010ebc108cb3b6ca3c2f4a /sys/dev/vn
parentc8c04452402a28eabd1ed8a1a06e0a14ac3d22c6 (diff)
downloadFreeBSD-src-a3d0c189ea25a7af3dfab30112f5d8d65e214e1c.zip
FreeBSD-src-a3d0c189ea25a7af3dfab30112f5d8d65e214e1c.tar.gz
Add snapshots to the fast filesystem. Most of the changes support
the gating of system calls that cause modifications to the underlying filesystem. The gating can be enabled by any filesystem that needs to consistently suspend operations by adding the vop_stdgetwritemount to their set of vnops. Once gating is enabled, the function vfs_write_suspend stops all new write operations to a filesystem, allows any filesystem modifying system calls already in progress to complete, then sync's the filesystem to disk and returns. The function vfs_write_resume allows the suspended write operations to begin again. Gating is not added by default for all filesystems as for SMP systems it adds two extra locks to such critical kernel paths as the write system call. Thus, gating should only be added as needed. Details on the use and current status of snapshots in FFS can be found in /sys/ufs/ffs/README.snapshot so for brevity and timelyness is not included here. Unless and until you create a snapshot file, these changes should have no effect on your system (famous last words).
Diffstat (limited to 'sys/dev/vn')
-rw-r--r--sys/dev/vn/vn.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 88e3801..efbc437 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -276,7 +276,6 @@ vnstrategy(struct bio *bp)
int unit;
struct vn_softc *vn;
int error;
- int isvplocked = 0;
unit = dkunit(bp->bio_dev);
vn = bp->bio_dev->si_drv1;
@@ -360,6 +359,7 @@ vnstrategy(struct bio *bp)
*/
struct uio auio;
struct iovec aiov;
+ struct mount *mp;
bzero(&auio, sizeof(auio));
@@ -375,18 +375,18 @@ vnstrategy(struct bio *bp)
auio.uio_rw = UIO_WRITE;
auio.uio_resid = bp->bio_bcount;
auio.uio_procp = curproc;
- if (!VOP_ISLOCKED(vn->sc_vp, NULL)) {
- isvplocked = 1;
+ if (VOP_ISLOCKED(vn->sc_vp, NULL))
+ vprint("unexpected vn driver lock", vn->sc_vp);
+ if (bp->bio_cmd == BIO_READ) {
vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc);
- }
- if(bp->bio_cmd == BIO_READ)
error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred);
- else
+ } else {
+ (void) vn_start_write(vn->sc_vp, &mp, V_WAIT);
+ vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc);
error = VOP_WRITE(vn->sc_vp, &auio, 0, vn->sc_cred);
- if (isvplocked) {
- VOP_UNLOCK(vn->sc_vp, 0, curproc);
- isvplocked = 0;
+ vn_finished_write(mp);
}
+ VOP_UNLOCK(vn->sc_vp, 0, curproc);
bp->bio_resid = auio.uio_resid;
if (error) {
OpenPOWER on IntegriCloud