1/*-
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
--- 18 unchanged lines hidden (view full) ---
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
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
33 * SUCH DAMAGE.
34 *
35 * $FreeBSD: head/sys/geom/geom_disk.c 110119 2003-01-30 20:34:23Z phk $
36 */
37
38#include "opt_geom.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
--- 101 unchanged lines hidden (view full) ---
145 g_io_deliver(bp, error);
146}
147
148static void
149g_disk_done(struct bio *bp)
150{
151 struct disk *dp;
152
153 dp = bp->bio_caller1;
154 bp->bio_completed = bp->bio_length - bp->bio_resid;
155 if (!(dp->d_flags & DISKFLAG_NOGIANT)) {
156 DROP_GIANT();
157 g_std_done(bp);
158 PICKUP_GIANT();
159 } else {
160 g_std_done(bp);
161 }
--- 21 unchanged lines hidden (view full) ---
183 case BIO_READ:
184 case BIO_WRITE:
185 bp2 = g_clone_bio(bp);
186 bp2->bio_done = g_disk_done;
187 bp2->bio_blkno = bp2->bio_offset >> DEV_BSHIFT;
188 bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize;
189 bp2->bio_bcount = bp2->bio_length;
190 bp2->bio_dev = dev;
191 bp2->bio_caller1 = dp;
192 g_disk_lock_giant(dp);
193 dp->d_strategy(bp2);
194 g_disk_unlock_giant(dp);
195 break;
196 case BIO_GETATTR:
197 if (g_handleattr_int(bp, "GEOM::fwsectors", dp->d_fwsectors))
198 break;
199 else if (g_handleattr_int(bp, "GEOM::fwheads", dp->d_fwheads))
--- 158 unchanged lines hidden ---
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
--- 18 unchanged lines hidden (view full) ---
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
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
33 * SUCH DAMAGE.
34 *
35 * $FreeBSD: head/sys/geom/geom_disk.c 110119 2003-01-30 20:34:23Z phk $
36 */
37
38#include "opt_geom.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
--- 101 unchanged lines hidden (view full) ---
145 g_io_deliver(bp, error);
146}
147
148static void
149g_disk_done(struct bio *bp)
150{
151 struct disk *dp;
152
153 dp = bp->bio_caller1;
154 bp->bio_completed = bp->bio_length - bp->bio_resid;
155 if (!(dp->d_flags & DISKFLAG_NOGIANT)) {
156 DROP_GIANT();
157 g_std_done(bp);
158 PICKUP_GIANT();
159 } else {
160 g_std_done(bp);
161 }
--- 21 unchanged lines hidden (view full) ---
183 case BIO_READ:
184 case BIO_WRITE:
185 bp2 = g_clone_bio(bp);
186 bp2->bio_done = g_disk_done;
187 bp2->bio_blkno = bp2->bio_offset >> DEV_BSHIFT;
188 bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize;
189 bp2->bio_bcount = bp2->bio_length;
190 bp2->bio_dev = dev;
191 bp2->bio_caller1 = dp;
192 g_disk_lock_giant(dp);
193 dp->d_strategy(bp2);
194 g_disk_unlock_giant(dp);
195 break;
196 case BIO_GETATTR:
197 if (g_handleattr_int(bp, "GEOM::fwsectors", dp->d_fwsectors))
198 break;
199 else if (g_handleattr_int(bp, "GEOM::fwheads", dp->d_fwheads))
--- 158 unchanged lines hidden ---