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
--- 20 unchanged lines hidden (view full) ---
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
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 125975 2004-02-18 21:36:53Z phk $");
38
39#include "opt_geom.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
44#include <sys/sysctl.h>
45#include <sys/bio.h>
--- 138 unchanged lines hidden (view full) ---
184 struct disk *dp;
185
186 /* See "notes" for why we need a mutex here */
187 /* XXX: will witness accept a mix of Giant/unGiant drivers here ? */
188 mtx_lock(&g_disk_done_mtx);
189 bp->bio_completed = bp->bio_length - bp->bio_resid;
190
191 bp2 = bp->bio_parent;
192 dp = bp2->bio_to->geom->softc;
193 if (bp2->bio_error == 0)
194 bp2->bio_error = bp->bio_error;
195 bp2->bio_completed += bp->bio_completed;
196 g_destroy_bio(bp);
197 bp2->bio_inbed++;
198 if (bp2->bio_children == bp2->bio_inbed) {
199 bp2->bio_resid = bp2->bio_bcount - bp2->bio_completed;
200 devstat_end_transaction_bio(dp->d_devstat, bp2);
201 g_io_deliver(bp2, bp2->bio_error);
202 }
203 mtx_unlock(&g_disk_done_mtx);
204}
205
206static int
207g_disk_ioctl(struct g_provider *pp, u_long cmd, void * data, struct thread *td)
208{
--- 234 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
--- 20 unchanged lines hidden (view full) ---
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
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 125975 2004-02-18 21:36:53Z phk $");
38
39#include "opt_geom.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
44#include <sys/sysctl.h>
45#include <sys/bio.h>
--- 138 unchanged lines hidden (view full) ---
184 struct disk *dp;
185
186 /* See "notes" for why we need a mutex here */
187 /* XXX: will witness accept a mix of Giant/unGiant drivers here ? */
188 mtx_lock(&g_disk_done_mtx);
189 bp->bio_completed = bp->bio_length - bp->bio_resid;
190
191 bp2 = bp->bio_parent;
192 dp = bp2->bio_to->geom->softc;
193 if (bp2->bio_error == 0)
194 bp2->bio_error = bp->bio_error;
195 bp2->bio_completed += bp->bio_completed;
196 g_destroy_bio(bp);
197 bp2->bio_inbed++;
198 if (bp2->bio_children == bp2->bio_inbed) {
199 bp2->bio_resid = bp2->bio_bcount - bp2->bio_completed;
200 devstat_end_transaction_bio(dp->d_devstat, bp2);
201 g_io_deliver(bp2, bp2->bio_error);
202 }
203 mtx_unlock(&g_disk_done_mtx);
204}
205
206static int
207g_disk_ioctl(struct g_provider *pp, u_long cmd, void * data, struct thread *td)
208{
--- 234 unchanged lines hidden ---