Sun Jun 3 10:20:55 2018 UTC ()
Whitespace


(martin)
diff -r1.44 -r1.45 src/sys/dev/ata/ld_ataraid.c

cvs diff -r1.44 -r1.45 src/sys/dev/ata/ld_ataraid.c (expand / switch to context diff)
--- src/sys/dev/ata/ld_ataraid.c 2016/09/27 08:05:34 1.44
+++ src/sys/dev/ata/ld_ataraid.c 2018/06/03 10:20:54 1.45
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_ataraid.c,v 1.44 2016/09/27 08:05:34 pgoyette Exp $	*/
+/*	$NetBSD: ld_ataraid.c,v 1.45 2018/06/03 10:20:54 martin Exp $ */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -42,12 +42,12 @@
  * controllers we're dealing with (Promise, etc.) only support
  * configuration data on the component disks, with the BIOS supporting
  * booting from the RAID volumes.
- *            
+ *	      
  * bio(4) support was written by Juan Romero Pardines <xtraeme@gmail.com>.
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.44 2016/09/27 08:05:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.45 2018/06/03 10:20:54 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "bio.h"
@@ -92,11 +92,11 @@
 
 	void	(*sc_iodone)(struct buf *);
 
-       pool_cache_t sc_cbufpool;
+	pool_cache_t sc_cbufpool;
 
-       SIMPLEQ_HEAD(, cbuf) sc_cbufq;
+	SIMPLEQ_HEAD(, cbuf) sc_cbufq;
 
-       void    *sc_sih_cookie;
+	void	*sc_sih_cookie;
 };
 
 static int	ld_ataraid_match(device_t, cfdata_t, void *);
@@ -125,14 +125,14 @@
     ld_ataraid_match, ld_ataraid_attach, NULL, NULL);
 
 struct cbuf {
-	struct buf	cb_buf;		/* new I/O buf */
+	struct buf	cb_buf; 	/* new I/O buf */
 	struct buf	*cb_obp;	/* ptr. to original I/O buf */
-	struct ld_ataraid_softc *cb_sc;	/* pointer to ld softc */
+	struct ld_ataraid_softc *cb_sc; /* pointer to ld softc */
 	u_int		cb_comp;	/* target component */
 	SIMPLEQ_ENTRY(cbuf) cb_q;	/* fifo of component buffers */
 	struct cbuf	*cb_other;	/* other cbuf in case of mirror */
 	int		cb_flags;
-#define	CBUF_IODONE	0x00000001	/* I/O is already successfully done */
+#define CBUF_IODONE	0x00000001	/* I/O is already successfully done */
 };
 
 #define        CBUF_GET()      pool_cache_get(sc->sc_cbufpool, PR_NOWAIT);
@@ -159,10 +159,10 @@
 
 	ld->sc_dv = self;
 
-       sc->sc_cbufpool = pool_cache_init(sizeof(struct cbuf), 0,
-           0, 0, "ldcbuf", NULL, IPL_BIO, cbufpool_ctor, cbufpool_dtor, sc);
-       sc->sc_sih_cookie = softint_establish(SOFTINT_BIO,
-           ld_ataraid_start_vstrategy, sc);
+	sc->sc_cbufpool = pool_cache_init(sizeof(struct cbuf), 0,
+	    0, 0, "ldcbuf", NULL, IPL_BIO, cbufpool_ctor, cbufpool_dtor, sc);
+	sc->sc_sih_cookie = softint_establish(SOFTINT_BIO,
+	    ld_ataraid_start_vstrategy, sc);
 
 	sc->sc_aai = aai;	/* this data persists */
 
@@ -260,24 +260,24 @@
 static int
 cbufpool_ctor(void *arg, void *obj, int flags)
 {
-       struct ld_ataraid_softc *sc = arg;
-       struct ld_softc *ld = &sc->sc_ld;
-       struct cbuf *cbp = obj;
+	struct ld_ataraid_softc *sc = arg;
+	struct ld_softc *ld = &sc->sc_ld;
+	struct cbuf *cbp = obj;
 
-       /* We release/reacquire the spinlock before calling buf_init() */
-       mutex_exit(&ld->sc_mutex);
-       buf_init(&cbp->cb_buf);
-       mutex_enter(&ld->sc_mutex);
+	/* We release/reacquire the spinlock before calling buf_init() */
+	mutex_exit(&ld->sc_mutex);
+	buf_init(&cbp->cb_buf);
+	mutex_enter(&ld->sc_mutex);
 
-       return 0;
+	return 0;
 }
 
 static void
 cbufpool_dtor(void *arg, void *obj)
 {
-       struct cbuf *cbp = obj;
+	struct cbuf *cbp = obj;
 
-       buf_destroy(&cbp->cb_buf);
+	buf_destroy(&cbp->cb_buf);
 }
 
 static struct cbuf *
@@ -288,7 +288,7 @@
 
 	cbp = CBUF_GET();
 	if (cbp == NULL)
-               return NULL;
+		return NULL;
 	cbp->cb_buf.b_flags = bp->b_flags;
 	cbp->cb_buf.b_oflags = bp->b_oflags;
 	cbp->cb_buf.b_cflags = bp->b_cflags;
@@ -307,24 +307,24 @@
 	cbp->cb_other = NULL;
 	cbp->cb_flags = 0;
 
-       return cbp;
+	return cbp;
 }
 
 static void
 ld_ataraid_start_vstrategy(void *arg)
 {
-       struct ld_ataraid_softc *sc = arg;
-       struct cbuf *cbp;
+	struct ld_ataraid_softc *sc = arg;
+	struct cbuf *cbp;
 
-       while ((cbp = SIMPLEQ_FIRST(&sc->sc_cbufq)) != NULL) {
-               SIMPLEQ_REMOVE_HEAD(&sc->sc_cbufq, cb_q);
-               if ((cbp->cb_buf.b_flags & B_READ) == 0) {
-                       mutex_enter(cbp->cb_buf.b_vp->v_interlock);
-                       cbp->cb_buf.b_vp->v_numoutput++;
-                       mutex_exit(cbp->cb_buf.b_vp->v_interlock);
-               }
-               VOP_STRATEGY(cbp->cb_buf.b_vp, &cbp->cb_buf);
-       }
+	while ((cbp = SIMPLEQ_FIRST(&sc->sc_cbufq)) != NULL) {
+	    SIMPLEQ_REMOVE_HEAD(&sc->sc_cbufq, cb_q);
+		if ((cbp->cb_buf.b_flags & B_READ) == 0) {
+			mutex_enter(cbp->cb_buf.b_vp->v_interlock);
+			cbp->cb_buf.b_vp->v_numoutput++;
+			mutex_exit(cbp->cb_buf.b_vp->v_interlock);
+		}
+		VOP_STRATEGY(cbp->cb_buf.b_vp, &cbp->cb_buf);
+	}
 }
 
 static int
@@ -361,11 +361,11 @@
 		cbp = ld_ataraid_make_cbuf(sc, bp, comp, bn, addr, rcount);
 		if (cbp == NULL) {
 			/* Free the already allocated component buffers. */
-                       while ((cbp = SIMPLEQ_FIRST(&sc->sc_cbufq)) != NULL) {
-                               SIMPLEQ_REMOVE_HEAD(&sc->sc_cbufq, cb_q);
+		       while ((cbp = SIMPLEQ_FIRST(&sc->sc_cbufq)) != NULL) {
+			       SIMPLEQ_REMOVE_HEAD(&sc->sc_cbufq, cb_q);
 				CBUF_PUT(cbp);
 			}
-                       return EAGAIN;
+		       return EAGAIN;
 		}
 
 		/*
@@ -375,20 +375,20 @@
 		adi = &aai->aai_disks[++comp];
 		bn = 0;
 
-               SIMPLEQ_INSERT_TAIL(&sc->sc_cbufq, cbp, cb_q);
+	       SIMPLEQ_INSERT_TAIL(&sc->sc_cbufq, cbp, cb_q);
 		addr += rcount;
 	}
 
 	/* Now fire off the requests. */
-       softint_schedule(sc->sc_sih_cookie);
+	softint_schedule(sc->sc_sih_cookie);
 
-       return 0;
+	return 0;
 }
 
 static int
 ld_ataraid_start_raid0(struct ld_softc *ld, struct buf *bp)
 {
-       struct ld_ataraid_softc *sc = (void *)ld;
+	struct ld_ataraid_softc *sc = (void *)ld;
 	struct ataraid_array_info *aai = sc->sc_aai;
 	struct ataraid_disk_info *adi;
 	struct cbuf *cbp, *other_cbp;
@@ -398,7 +398,7 @@
 	u_int comp;
 	const int read = bp->b_flags & B_READ;
 	const int mirror = aai->aai_level & AAI_L_RAID1;
-       int error = 0;
+	int error = 0;
 
 	/* Allocate component buffers. */
 	addr = bp->b_data;
@@ -451,13 +451,13 @@
 			error = EAGAIN;
 free_and_exit:
 			/* Free the already allocated component buffers. */
-                       while ((cbp = SIMPLEQ_FIRST(&sc->sc_cbufq)) != NULL) {
-                               SIMPLEQ_REMOVE_HEAD(&sc->sc_cbufq, cb_q);
+		       while ((cbp = SIMPLEQ_FIRST(&sc->sc_cbufq)) != NULL) {
+			       SIMPLEQ_REMOVE_HEAD(&sc->sc_cbufq, cb_q);
 				CBUF_PUT(cbp);
 			}
-                       return error;
+		       return error;
 		}
-               SIMPLEQ_INSERT_TAIL(&sc->sc_cbufq, cbp, cb_q);
+	       SIMPLEQ_INSERT_TAIL(&sc->sc_cbufq, cbp, cb_q);
 		if (mirror && !read && comp < aai->aai_width) {
 			comp += aai->aai_width;
 			adi = &aai->aai_disks[comp];
@@ -466,8 +466,8 @@
 				    comp, cbn, addr, rcount);
 				if (other_cbp == NULL)
 					goto resource_shortage;
-                               SIMPLEQ_INSERT_TAIL(&sc->sc_cbufq,
-                                   other_cbp, cb_q);
+			       SIMPLEQ_INSERT_TAIL(&sc->sc_cbufq,
+				   other_cbp, cb_q);
 				other_cbp->cb_other = cbp;
 				cbp->cb_other = other_cbp;
 			}
@@ -477,9 +477,9 @@
 	}
 
 	/* Now fire off the requests. */
-       softint_schedule(sc->sc_sih_cookie);
+	softint_schedule(sc->sc_sih_cookie);
 
-       return error;
+	return error;
 }
 
 /*
@@ -622,7 +622,7 @@
 {
 	struct ataraid_array_info *aai = sc->sc_aai;
 	struct ld_softc *ld = &sc->sc_ld;
-#define	to_kibytes(ld,s)	(ld->sc_secsize*(s)/1024)
+#define to_kibytes(ld,s)	(ld->sc_secsize*(s)/1024)
 
 	/* Fill in data for _this_ volume */
 	bv->bv_percent = -1;
@@ -723,7 +723,7 @@
  * XXX Don't allow ioconf.c to redefine the "struct cfdriver ld_ataraid"
  * XXX it will be defined in the common-code module
  */     
-#undef  CFDRIVER_DECL
+#undef	CFDRIVER_DECL
 #define CFDRIVER_DECL(name, class, attr)
 #include "ioconf.c"
 #endif