| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ffs_snapshot.c,v 1.112 2011/04/18 07:36:13 hannken Exp $ */ | | 1 | /* $NetBSD: ffs_snapshot.c,v 1.113 2011/04/23 08:23:52 hannken Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. | | 4 | * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Further information about snapshots can be obtained from: | | 6 | * Further information about snapshots can be obtained from: |
7 | * | | 7 | * |
8 | * Marshall Kirk McKusick http://www.mckusick.com/softdep/ | | 8 | * Marshall Kirk McKusick http://www.mckusick.com/softdep/ |
9 | * 1614 Oxford Street mckusick@mckusick.com | | 9 | * 1614 Oxford Street mckusick@mckusick.com |
10 | * Berkeley, CA 94709-1608 +1-510-843-9542 | | 10 | * Berkeley, CA 94709-1608 +1-510-843-9542 |
11 | * USA | | 11 | * USA |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -28,27 +28,27 @@ | | | @@ -28,27 +28,27 @@ |
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
33 | * SUCH DAMAGE. | | 33 | * SUCH DAMAGE. |
34 | * | | 34 | * |
35 | * @(#)ffs_snapshot.c 8.11 (McKusick) 7/23/00 | | 35 | * @(#)ffs_snapshot.c 8.11 (McKusick) 7/23/00 |
36 | * | | 36 | * |
37 | * from FreeBSD: ffs_snapshot.c,v 1.79 2004/02/13 02:02:06 kuriyama Exp | | 37 | * from FreeBSD: ffs_snapshot.c,v 1.79 2004/02/13 02:02:06 kuriyama Exp |
38 | */ | | 38 | */ |
39 | | | 39 | |
40 | #include <sys/cdefs.h> | | 40 | #include <sys/cdefs.h> |
41 | __KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.112 2011/04/18 07:36:13 hannken Exp $"); | | 41 | __KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.113 2011/04/23 08:23:52 hannken Exp $"); |
42 | | | 42 | |
43 | #if defined(_KERNEL_OPT) | | 43 | #if defined(_KERNEL_OPT) |
44 | #include "opt_ffs.h" | | 44 | #include "opt_ffs.h" |
45 | #include "opt_quota.h" | | 45 | #include "opt_quota.h" |
46 | #endif | | 46 | #endif |
47 | | | 47 | |
48 | #include <sys/param.h> | | 48 | #include <sys/param.h> |
49 | #include <sys/kernel.h> | | 49 | #include <sys/kernel.h> |
50 | #include <sys/systm.h> | | 50 | #include <sys/systm.h> |
51 | #include <sys/conf.h> | | 51 | #include <sys/conf.h> |
52 | #include <sys/buf.h> | | 52 | #include <sys/buf.h> |
53 | #include <sys/proc.h> | | 53 | #include <sys/proc.h> |
54 | #include <sys/namei.h> | | 54 | #include <sys/namei.h> |
| @@ -187,27 +187,29 @@ ffs_snapshot(struct mount *mp, struct vn | | | @@ -187,27 +187,29 @@ ffs_snapshot(struct mount *mp, struct vn |
187 | struct inode *ip = VTOI(vp); | | 187 | struct inode *ip = VTOI(vp); |
188 | struct lwp *l = curlwp; | | 188 | struct lwp *l = curlwp; |
189 | struct snap_info *si = VFSTOUFS(mp)->um_snapinfo; | | 189 | struct snap_info *si = VFSTOUFS(mp)->um_snapinfo; |
190 | struct timespec ts; | | 190 | struct timespec ts; |
191 | struct timeval starttime; | | 191 | struct timeval starttime; |
192 | #ifdef DEBUG | | 192 | #ifdef DEBUG |
193 | struct timeval endtime; | | 193 | struct timeval endtime; |
194 | #endif | | 194 | #endif |
195 | struct vnode *devvp = ip->i_devvp; | | 195 | struct vnode *devvp = ip->i_devvp; |
196 | | | 196 | |
197 | /* | | 197 | /* |
198 | * If the vnode already is a snapshot, return. | | 198 | * If the vnode already is a snapshot, return. |
199 | */ | | 199 | */ |
200 | if ((VTOI(vp)->i_flags & (SF_SNAPSHOT | SF_SNAPINVAL)) == SF_SNAPSHOT) { | | 200 | if ((VTOI(vp)->i_flags & SF_SNAPSHOT)) { |
| | | 201 | if ((VTOI(vp)->i_flags & SF_SNAPINVAL)) |
| | | 202 | return EINVAL; |
201 | if (ctime) { | | 203 | if (ctime) { |
202 | ctime->tv_sec = DIP(VTOI(vp), mtime); | | 204 | ctime->tv_sec = DIP(VTOI(vp), mtime); |
203 | ctime->tv_nsec = DIP(VTOI(vp), mtimensec); | | 205 | ctime->tv_nsec = DIP(VTOI(vp), mtimensec); |
204 | } | | 206 | } |
205 | return 0; | | 207 | return 0; |
206 | } | | 208 | } |
207 | /* | | 209 | /* |
208 | * Check for free snapshot slot in the superblock. | | 210 | * Check for free snapshot slot in the superblock. |
209 | */ | | 211 | */ |
210 | for (snaploc = 0; snaploc < FSMAXSNAP; snaploc++) | | 212 | for (snaploc = 0; snaploc < FSMAXSNAP; snaploc++) |
211 | if (fs->fs_snapinum[snaploc] == 0) | | 213 | if (fs->fs_snapinum[snaploc] == 0) |
212 | break; | | 214 | break; |
213 | if (snaploc == FSMAXSNAP) | | 215 | if (snaploc == FSMAXSNAP) |