| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fss.c,v 1.60 2008/10/01 10:45:11 hannken Exp $ */ | | 1 | /* $NetBSD: fss.c,v 1.61 2008/11/05 19:30:57 hannken Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Juergen Hannken-Illjes. | | 8 | * by Juergen Hannken-Illjes. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * File system snapshot disk driver. | | 33 | * File system snapshot disk driver. |
34 | * | | 34 | * |
35 | * Block/character interface to the snapshot of a mounted file system. | | 35 | * Block/character interface to the snapshot of a mounted file system. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.60 2008/10/01 10:45:11 hannken Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.61 2008/11/05 19:30:57 hannken Exp $"); |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/namei.h> | | 43 | #include <sys/namei.h> |
44 | #include <sys/proc.h> | | 44 | #include <sys/proc.h> |
45 | #include <sys/errno.h> | | 45 | #include <sys/errno.h> |
46 | #include <sys/malloc.h> | | 46 | #include <sys/malloc.h> |
47 | #include <sys/buf.h> | | 47 | #include <sys/buf.h> |
48 | #include <sys/ioctl.h> | | 48 | #include <sys/ioctl.h> |
49 | #include <sys/disklabel.h> | | 49 | #include <sys/disklabel.h> |
50 | #include <sys/device.h> | | 50 | #include <sys/device.h> |
51 | #include <sys/disk.h> | | 51 | #include <sys/disk.h> |
52 | #include <sys/stat.h> | | 52 | #include <sys/stat.h> |
| @@ -1122,26 +1122,28 @@ fss_bs_thread(void *arg) | | | @@ -1122,26 +1122,28 @@ fss_bs_thread(void *arg) |
1122 | } | | 1122 | } |
1123 | | | 1123 | |
1124 | disk_busy(sc->sc_dkdev); | | 1124 | disk_busy(sc->sc_dkdev); |
1125 | | | 1125 | |
1126 | /* | | 1126 | /* |
1127 | * First read from the snapshotted block device unless | | 1127 | * First read from the snapshotted block device unless |
1128 | * this request is completely covered by backing store. | | 1128 | * this request is completely covered by backing store. |
1129 | */ | | 1129 | */ |
1130 | | | 1130 | |
1131 | cl = FSS_BTOCL(sc, dbtob(bp->b_blkno)); | | 1131 | cl = FSS_BTOCL(sc, dbtob(bp->b_blkno)); |
1132 | off = FSS_CLOFF(sc, dbtob(bp->b_blkno)); | | 1132 | off = FSS_CLOFF(sc, dbtob(bp->b_blkno)); |
1133 | ch = FSS_BTOCL(sc, dbtob(bp->b_blkno)+bp->b_bcount-1); | | 1133 | ch = FSS_BTOCL(sc, dbtob(bp->b_blkno)+bp->b_bcount-1); |
1134 | error = 0; | | 1134 | error = 0; |
| | | 1135 | bp->b_resid = 0; |
| | | 1136 | bp->b_error = 0; |
1135 | for (c = cl; c <= ch; c++) { | | 1137 | for (c = cl; c <= ch; c++) { |
1136 | if (isset(sc->sc_copied, c)) | | 1138 | if (isset(sc->sc_copied, c)) |
1137 | continue; | | 1139 | continue; |
1138 | mutex_exit(&sc->sc_slock); | | 1140 | mutex_exit(&sc->sc_slock); |
1139 | | | 1141 | |
1140 | /* Not on backing store, read from device. */ | | 1142 | /* Not on backing store, read from device. */ |
1141 | nbp = getiobuf(NULL, true); | | 1143 | nbp = getiobuf(NULL, true); |
1142 | nbp->b_flags = B_READ; | | 1144 | nbp->b_flags = B_READ; |
1143 | nbp->b_resid = nbp->b_bcount = bp->b_bcount; | | 1145 | nbp->b_resid = nbp->b_bcount = bp->b_bcount; |
1144 | nbp->b_bufsize = bp->b_bcount; | | 1146 | nbp->b_bufsize = bp->b_bcount; |
1145 | nbp->b_data = bp->b_data; | | 1147 | nbp->b_data = bp->b_data; |
1146 | nbp->b_blkno = bp->b_blkno; | | 1148 | nbp->b_blkno = bp->b_blkno; |
1147 | nbp->b_lblkno = 0; | | 1149 | nbp->b_lblkno = 0; |