1139778Simp/*-
2190507Slulf * Copyright (c) 2004, 2007 Lukas Ertl
3130389Sle * All rights reserved.
4130389Sle *
5130389Sle * Redistribution and use in source and binary forms, with or without
6130389Sle * modification, are permitted provided that the following conditions
7130389Sle * are met:
8130389Sle * 1. Redistributions of source code must retain the above copyright
9130389Sle *    notice, this list of conditions and the following disclaimer.
10130389Sle * 2. Redistributions in binary form must reproduce the above copyright
11130389Sle *    notice, this list of conditions and the following disclaimer in the
12130389Sle *    documentation and/or other materials provided with the distribution.
13130389Sle *
14130389Sle * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15130389Sle * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16130389Sle * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17130389Sle * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18130389Sle * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19130389Sle * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20130389Sle * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21130389Sle * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22130389Sle * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23130389Sle * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24130389Sle * SUCH DAMAGE.
25130389Sle *
26130389Sle * $FreeBSD$
27130389Sle */
28130389Sle
29130389Sle#ifndef _GEOM_VINUM_RAID5_H_
30130389Sle#define	_GEOM_VINUM_RAID5_H_
31130389Sle
32130389Sle/*
33130389Sle * A single RAID5 request usually needs more than one I/O transaction,
34130389Sle * depending on the state of the associated subdisks and the direction of the
35135426Sle * transaction (read or write).
36130389Sle */
37130389Sle
38130389Slestruct gv_raid5_packet {
39135426Sle	caddr_t	data;		/* Data buffer of this sub-request- */
40130389Sle	off_t	length;		/* Size of data buffer. */
41130389Sle	off_t	lockbase;	/* Deny access to our plex offset. */
42130389Sle
43130389Sle	struct bio	*bio;	/* Pointer to the original bio. */
44135426Sle	struct bio	*parity;  /* The bio containing the parity data. */
45135426Sle	struct bio	*waiting; /* A bio that need to wait for other bios. */
46130389Sle
47135426Sle	TAILQ_HEAD(,gv_bioq)		bits; /* List of subrequests. */
48135426Sle	TAILQ_ENTRY(gv_raid5_packet)	list; /* Entry in plex's packet list. */
49130389Sle};
50130389Sle
51190507Slulfstruct gv_raid5_packet * gv_raid5_start(struct gv_plex *, struct bio *,
52190507Slulf		caddr_t, off_t, off_t);
53135426Sleint	gv_stripe_active(struct gv_plex *, struct bio *);
54130389Sle
55130389Sle#endif /* !_GEOM_VINUM_RAID5_H_ */
56