Subject: Re: FFS_SNAPSHOT change
To: None <tech-kern@netbsd.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: tech-kern
Date: 02/14/2005 10:48:32
On Thu, Feb 10, 2005 at 06:18:29PM -0800, Jason Thorpe wrote:
> 
> On Feb 10, 2005, at 2:23 PM, David Laight wrote:
> 
> >Module Name:	src
> >Committed By:	dsl
> >Date:		Thu Feb 10 22:23:19 UTC 2005
> >
> >Modified Files:
> >	src/sys/ufs: files.ufs
> >
> >Log Message:
> >Make ffs snapshots be enabled by 'option FFS_SNAPSHOT'
> 
> PLEASE reverse the sense of this flag ... FFS_NO_SNAPSHOT.

Yes -- Please. And while we're on it I propose the attached diff.

It will only disable snapshot creation while not trashing existing
snapshots.

For i386/INSTALL_TINY the size will go down from 18013 bytes to 5446 bytes.
This is just 0.5 % of the kernel.
-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)

===================================================================

Sizes with / without FFS_NO_SNAPSHOT:

   text    data     bss     dec     hex filename
1081990 1615056   62036 2759082  2a19aa netbsd
  18013       0       0   18013    465d ffs_snapshot.o

1069432 1615056   62036 2746524  29e89c netbsd
   5446       0       0    5446    1546 ffs_snapshot.o

===================================================================

Index: files.ufs
@@ -6,5 +6,5 @@
 deffs	fs_lfs.h			LFS		# XXX
 
-defflag	opt_ffs.h			FFS_EI APPLE_UFS
+defflag	opt_ffs.h			FFS_EI FFS_NO_SNAPSHOT APPLE_UFS
 
 file	ufs/ext2fs/ext2fs_alloc.c	ext2fs

===================================================================

Index: ffs_snapshot.c
@@ -80,4 +81,5 @@
 #define MNT_IUNLOCK(v)	simple_unlock(&mntvnode_slock)
 
+#if !defined(FFS_NO_SNAPSHOT)
 static int cgaccount(int, struct vnode *, caddr_t, int);
 static int expunge_ufs1(struct vnode *, struct inode *, struct fs *,
@@ -107,7 +109,9 @@
 static int mapacct_ufs2(struct vnode *, ufs2_daddr_t *, ufs2_daddr_t *,
     struct fs *, ufs_lbn_t, int);
+#endif
+
 static int ffs_copyonwrite(void *, struct buf *);
 static int readfsblk(struct vnode *, caddr_t, ufs2_daddr_t);
-static int readvnblk(struct vnode *, caddr_t, ufs2_daddr_t);
+static int __unused readvnblk(struct vnode *, caddr_t, ufs2_daddr_t);
 static int writevnblk(struct vnode *, caddr_t, ufs2_daddr_t);
 static inline int cow_enter(void);
@@ -132,4 +136,8 @@
 	struct timespec *ctime;
 {
+#if defined(FFS_NO_SNAPSHOT)
+	return EOPNOTSUPP;
+}
+#else /* defined(FFS_NO_SNAPSHOT) */
 	ufs2_daddr_t numblks, blkno, *blkp, snaplistsize = 0, *snapblklist;
 	int error, ns, cg, snaploc;
@@ -1301,4 +1312,5 @@
 	return (0);
 }
+#endif /* defined(FFS_NO_SNAPSHOT) */
 
 /*