Deleted Added
full compact
geom_disk.c (124864) geom_disk.c (125539)
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>
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 124864 2004-01-23 10:56:16Z phk $");
37__FBSDID("$FreeBSD: head/sys/geom/geom_disk.c 125539 2004-02-06 23:10:49Z pjd $");
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>

--- 58 unchanged lines hidden (view full) ---

104g_disk_access(struct g_provider *pp, int r, int w, int e)
105{
106 struct disk *dp;
107 int error;
108
109 g_trace(G_T_ACCESS, "g_disk_access(%s, %d, %d, %d)",
110 pp->name, r, w, e);
111 g_topology_assert();
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>

--- 58 unchanged lines hidden (view full) ---

104g_disk_access(struct g_provider *pp, int r, int w, int e)
105{
106 struct disk *dp;
107 int error;
108
109 g_trace(G_T_ACCESS, "g_disk_access(%s, %d, %d, %d)",
110 pp->name, r, w, e);
111 g_topology_assert();
112 dp = pp->geom->softc;
113 if (dp == NULL) {
114 /*
115 * Allow decreasing access count even if disk is not
116 * avaliable anymore.
117 */
118 if (r <= 0 && w <= 0 && e <= 0)
119 return (0);
120 else
121 return (ENXIO);
122 }
112 r += pp->acr;
113 w += pp->acw;
114 e += pp->ace;
123 r += pp->acr;
124 w += pp->acw;
125 e += pp->ace;
115 dp = pp->geom->softc;
116 if (dp == NULL)
117 return (ENXIO);
118 error = 0;
119 if ((pp->acr + pp->acw + pp->ace) == 0 && (r + w + e) > 0) {
120 if (dp->d_open != NULL) {
121 g_disk_lock_giant(dp);
122 error = dp->d_open(dp);
123 if (error != 0)
124 printf("Opened disk %s -> %d\n",
125 pp->name, error);

--- 302 unchanged lines hidden ---
126 error = 0;
127 if ((pp->acr + pp->acw + pp->ace) == 0 && (r + w + e) > 0) {
128 if (dp->d_open != NULL) {
129 g_disk_lock_giant(dp);
130 error = dp->d_open(dp);
131 if (error != 0)
132 printf("Opened disk %s -> %d\n",
133 pp->name, error);

--- 302 unchanged lines hidden ---