Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs Add layerfs_snapshot() as a handler routine for V...



details:   https://anonhg.NetBSD.org/src/rev/2ca3fc9eba1b
branches:  trunk
changeset: 567049:2ca3fc9eba1b
user:      wrstuden <wrstuden%NetBSD.org@localhost>
date:      Sat May 29 23:48:08 2004 +0000

description:
Add layerfs_snapshot() as a handler routine for VFS_SNAPSHOT() calls
through a layered file system.

Note: we don't actually support snapshots through a layered file system,
and this routine returns an error. However we: 1) have clearly documented
what needs fixing (which isn't trivial to fix) and 2) if we do fix
this, all layered file systems can take advantage of it at once.

diffstat:

 sys/miscfs/genfs/layer_extern.h     |   4 +++-
 sys/miscfs/genfs/layer_vfsops.c     |  23 +++++++++++++++++++++--
 sys/miscfs/nullfs/null_vfsops.c     |   6 +++---
 sys/miscfs/overlay/overlay_vfsops.c |   6 +++---
 sys/miscfs/umapfs/umap_vfsops.c     |   6 +++---
 5 files changed, 33 insertions(+), 12 deletions(-)

diffs (140 lines):

diff -r 364a8bb113ab -r 2ca3fc9eba1b sys/miscfs/genfs/layer_extern.h
--- a/sys/miscfs/genfs/layer_extern.h   Sat May 29 14:28:41 2004 +0000
+++ b/sys/miscfs/genfs/layer_extern.h   Sat May 29 23:48:08 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: layer_extern.h,v 1.14 2004/05/28 18:55:20 wrstuden Exp $       */
+/*     $NetBSD: layer_extern.h,v 1.15 2004/05/29 23:48:08 wrstuden Exp $       */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -93,6 +93,8 @@
 int    layerfs_checkexp __P((struct mount *, struct mbuf *, int *,
                           struct ucred **));
 int    layerfs_vptofh __P((struct vnode *, struct fid *));
+int    layerfs_snapshot __P((struct mount *, struct vnode *,
+                           struct timespec *));
 
 /* VOP routines */
 int    layer_bypass __P((void *));
diff -r 364a8bb113ab -r 2ca3fc9eba1b sys/miscfs/genfs/layer_vfsops.c
--- a/sys/miscfs/genfs/layer_vfsops.c   Sat May 29 14:28:41 2004 +0000
+++ b/sys/miscfs/genfs/layer_vfsops.c   Sat May 29 23:48:08 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: layer_vfsops.c,v 1.18 2004/05/25 04:44:44 atatat Exp $ */
+/*     $NetBSD: layer_vfsops.c,v 1.19 2004/05/29 23:48:08 wrstuden Exp $       */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.18 2004/05/25 04:44:44 atatat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.19 2004/05/29 23:48:08 wrstuden Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -271,6 +271,25 @@
        return (VFS_VPTOFH(LAYERVPTOLOWERVP(vp), fhp));
 }
 
+/*
+ * layerfs_snapshot - handle a snapshot through a layered file system
+ *
+ * At present, we do NOT support snapshotting through a layered file
+ * system as the ffs implementation changes v_vnlock of the snapshot
+ * vnodes to point to one common lock. As there is no way for us to
+ * absolutely pass this change up the stack, a layered file system
+ * would end up referencing the wrong lock.
+ *
+ * This routine serves as a central resource for this behavior; all
+ * layered file systems don't need to worry about the above. Also, if
+ * things get fixed, all layers get the benefit.
+ */
+int
+layerfs_snapshot(struct mount *mp, struct vnode *vp, struct timespec *ts)
+{
+       return (EOPNOTSUPP);
+}
+
 SYSCTL_SETUP(sysctl_vfs_layerfs_setup, "sysctl vfs.layerfs subtree setup")
 {
 
diff -r 364a8bb113ab -r 2ca3fc9eba1b sys/miscfs/nullfs/null_vfsops.c
--- a/sys/miscfs/nullfs/null_vfsops.c   Sat May 29 14:28:41 2004 +0000
+++ b/sys/miscfs/nullfs/null_vfsops.c   Sat May 29 23:48:08 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: null_vfsops.c,v 1.50 2004/05/25 14:54:57 hannken Exp $ */
+/*     $NetBSD: null_vfsops.c,v 1.51 2004/05/29 23:48:08 wrstuden Exp $        */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.50 2004/05/25 14:54:57 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.51 2004/05/29 23:48:08 wrstuden Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -319,6 +319,6 @@
        NULL,
        NULL,                           /* vfs_mountroot */
        layerfs_checkexp,
-       (int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
+       layerfs_snapshot,
        nullfs_vnodeopv_descs,
 };
diff -r 364a8bb113ab -r 2ca3fc9eba1b sys/miscfs/overlay/overlay_vfsops.c
--- a/sys/miscfs/overlay/overlay_vfsops.c       Sat May 29 14:28:41 2004 +0000
+++ b/sys/miscfs/overlay/overlay_vfsops.c       Sat May 29 23:48:08 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: overlay_vfsops.c,v 1.25 2004/05/25 14:54:57 hannken Exp $      */
+/*     $NetBSD: overlay_vfsops.c,v 1.26 2004/05/29 23:48:08 wrstuden Exp $     */
 
 /*
  * Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.25 2004/05/25 14:54:57 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.26 2004/05/29 23:48:08 wrstuden Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -302,6 +302,6 @@
        NULL,
        NULL,                           /* vfs_mountroot */
        layerfs_checkexp,
-       (int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
+       layerfs_snapshot,
        ov_vnodeopv_descs,
 };
diff -r 364a8bb113ab -r 2ca3fc9eba1b sys/miscfs/umapfs/umap_vfsops.c
--- a/sys/miscfs/umapfs/umap_vfsops.c   Sat May 29 14:28:41 2004 +0000
+++ b/sys/miscfs/umapfs/umap_vfsops.c   Sat May 29 23:48:08 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umap_vfsops.c,v 1.47 2004/05/25 14:54:58 hannken Exp $ */
+/*     $NetBSD: umap_vfsops.c,v 1.48 2004/05/29 23:48:08 wrstuden Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.47 2004/05/25 14:54:58 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.48 2004/05/29 23:48:08 wrstuden Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -336,6 +336,6 @@
        NULL,
        NULL,                           /* vfs_mountroot */
        layerfs_checkexp,
-       (int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
+       layerfs_snapshot,
        umapfs_vnodeopv_descs,
 };



Home | Main Index | Thread Index | Old Index