xref: /netbsd-src/sys/ufs/lfs/ulfs_snapshot.c (revision 9fc453562f6ebe8eabdfd51e21ae0a0058906d4f)
1 /*	$NetBSD: ulfs_snapshot.c,v 1.4 2020/09/05 16:30:13 riastradh Exp $	*/
2 /*  from ffs_snapshot.c,v 1.122 2013/05/07 09:40:54 hannken Exp  */
3 
4 /*
5  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
6  *
7  * Further information about snapshots can be obtained from:
8  *
9  *	Marshall Kirk McKusick		http://www.mckusick.com/softdep/
10  *	1614 Oxford Street		mckusick@mckusick.com
11  *	Berkeley, CA 94709-1608		+1-510-843-9542
12  *	USA
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  *
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer.
20  * 2. Redistributions in binary form must reproduce the above copyright
21  *    notice, this list of conditions and the following disclaimer in the
22  *    documentation and/or other materials provided with the distribution.
23  *
24  * THIS SOFTWARE IS PROVIDED BY MARSHALL KIRK MCKUSICK ``AS IS'' AND ANY
25  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  * DISCLAIMED.  IN NO EVENT SHALL MARSHALL KIRK MCKUSICK BE LIABLE FOR
28  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *	@(#)ffs_snapshot.c	8.11 (McKusick) 7/23/00
37  *
38  *	from FreeBSD: ffs_snapshot.c,v 1.79 2004/02/13 02:02:06 kuriyama Exp
39  */
40 
41 #include <sys/cdefs.h>
42 __KERNEL_RCSID(0, "$NetBSD: ulfs_snapshot.c,v 1.4 2020/09/05 16:30:13 riastradh Exp $");
43 
44 #if defined(_KERNEL_OPT)
45 #include "opt_lfs.h"
46 #endif
47 
48 #include <sys/param.h>
49 #include <sys/kernel.h>
50 #include <sys/systm.h>
51 #include <sys/conf.h>
52 #include <sys/buf.h>
53 #include <sys/proc.h>
54 #include <sys/namei.h>
55 #include <sys/sched.h>
56 #include <sys/stat.h>
57 #include <sys/malloc.h>
58 #include <sys/mount.h>
59 #include <sys/resource.h>
60 #include <sys/resourcevar.h>
61 #include <sys/vnode.h>
62 #include <sys/kauth.h>
63 #include <sys/fstrans.h>
64 
65 #include <miscfs/specfs/specdev.h>
66 
67 #include <ufs/lfs/ulfs_quotacommon.h>
68 #include <ufs/lfs/ulfsmount.h>
69 #include <ufs/lfs/ulfs_inode.h>
70 #include <ufs/lfs/ulfs_extern.h>
71 #include <ufs/lfs/ulfs_bswap.h>
72 
73 #include <ufs/lfs/lfs.h>
74 #include <ufs/lfs/lfs_extern.h>
75 
76 /*
77  * Decrement extra reference on snapshot when last name is removed.
78  * It will not be freed until the last open reference goes away.
79  */
80 void
ulfs_snapgone(struct inode * ip)81 ulfs_snapgone(struct inode *ip)
82 {
83 	(void)ip;
84 	/* just panic */
85 	panic("reached ulfs_snapgone\n");
86 }
87