Subject: Re: How to capture all file system writes
To: None <tech-kern@netbsd.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: tech-kern
Date: 10/21/2003 18:09:52
On Mon, Oct 20, 2003 at 03:45:03PM -0400, Stephan Uphoff wrote:
> 
> 
> 
> > I'm looking for possible strategies for file system snapshots.  Will this
> > addition to `sys/kern/vfs_bio.c::bwrite(struct buf *bp)' catch all writes
> > from a mounted file system to the block device it is mounted on?
> 
> No
> 
> Take a look at genfs_gop_write() used (indirectly) by ffs and others to write 
> out
> dirty file pages.
> 
> Using a swap-file or using vnd(4) also bypasses the classical block layer.

And what about 'sys/miscfs/specfs/spec_vnops.c::spec_strategy(void *v)'?

 int
 spec_strategy(v)
 	void *v;
 {
 	struct vop_strategy_args /* {
 		struct buf *a_bp;
 	} */ *ap = v;
 	struct buf *bp;
 	const struct bdevsw *bdev;
 
 	bp = ap->a_bp;
 	if (!(bp->b_flags & B_READ) &&
 	    (LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
 		(*bioops.io_start)(bp);
 	bdev = bdevsw_lookup(bp->b_dev);
-	if (bdev != NULL)
+	if (bdev != NULL) {
+#if NFSSNAP > 0
+		if (FSSNAP_ACTIVE(bp)) {
+			fssnap_lookup(bp);
+		}
+#endif
 		(*bdev->d_strategy)(bp);
+	}
 	return (0);
 }

-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)