Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2012 18:08:36 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r243678 - stable/9/sys/geom/raid
Message-ID:  <201211291808.qATI8a9M031211@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Nov 29 18:08:36 2012
New Revision: 243678
URL: http://svnweb.freebsd.org/changeset/base/243678

Log:
  MFC r242323, r242328:
  Add basic BIO_DELETE support to GEOM RAID class for all RAID levels.
  
  If at least one subdisk in the volume supports it, BIO_DELETE requests
  will be propagated down.  Unfortunatelly, for RAID levels with redundancy
  unmapped blocks will be mapped back during first rebuild/resync process.

Modified:
  stable/9/sys/geom/raid/g_raid.c
  stable/9/sys/geom/raid/g_raid.h
  stable/9/sys/geom/raid/md_ddf.c
  stable/9/sys/geom/raid/md_intel.c
  stable/9/sys/geom/raid/md_jmicron.c
  stable/9/sys/geom/raid/md_nvidia.c
  stable/9/sys/geom/raid/md_promise.c
  stable/9/sys/geom/raid/md_sii.c
  stable/9/sys/geom/raid/tr_concat.c
  stable/9/sys/geom/raid/tr_raid0.c
  stable/9/sys/geom/raid/tr_raid1.c
  stable/9/sys/geom/raid/tr_raid1e.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/g_raid.c
==============================================================================
--- stable/9/sys/geom/raid/g_raid.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/g_raid.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -499,6 +499,34 @@ g_raid_get_diskname(struct g_raid_disk *
 }
 
 void
+g_raid_get_disk_info(struct g_raid_disk *disk)
+{
+	struct g_consumer *cp = disk->d_consumer;
+	int error, len;
+
+	/* Read kernel dumping information. */
+	disk->d_kd.offset = 0;
+	disk->d_kd.length = OFF_MAX;
+	len = sizeof(disk->d_kd);
+	error = g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
+	if (error)
+		disk->d_kd.di.dumper = NULL;
+	if (disk->d_kd.di.dumper == NULL)
+		G_RAID_DEBUG1(2, disk->d_softc,
+		    "Dumping not supported by %s: %d.", 
+		    cp->provider->name, error);
+
+	/* Read BIO_DELETE support. */
+	error = g_getattr("GEOM::candelete", cp, &disk->d_candelete);
+	if (error)
+		disk->d_candelete = 0;
+	if (!disk->d_candelete)
+		G_RAID_DEBUG1(2, disk->d_softc,
+		    "BIO_DELETE not supported by %s: %d.", 
+		    cp->provider->name, error);
+}
+
+void
 g_raid_report_disk_state(struct g_raid_disk *disk)
 {
 	struct g_raid_subdisk *sd;
@@ -1052,6 +1080,31 @@ g_raid_kerneldump(struct g_raid_softc *s
 }
 
 static void
+g_raid_candelete(struct g_raid_softc *sc, struct bio *bp)
+{
+	struct g_provider *pp;
+	struct g_raid_volume *vol;
+	struct g_raid_subdisk *sd;
+	int *val;
+	int i;
+
+	val = (int *)bp->bio_data;
+	pp = bp->bio_to;
+	vol = pp->private;
+	*val = 0;
+	for (i = 0; i < vol->v_disks_count; i++) {
+		sd = &vol->v_subdisks[i];
+		if (sd->sd_state == G_RAID_SUBDISK_S_NONE)
+			continue;
+		if (sd->sd_disk->d_candelete) {
+			*val = 1;
+			break;
+		}
+	}
+	g_io_deliver(bp, 0);
+}
+
+static void
 g_raid_start(struct bio *bp)
 {
 	struct g_raid_softc *sc;
@@ -1073,7 +1126,9 @@ g_raid_start(struct bio *bp)
 	case BIO_FLUSH:
 		break;
 	case BIO_GETATTR:
-		if (!strcmp(bp->bio_attribute, "GEOM::kerneldump"))
+		if (!strcmp(bp->bio_attribute, "GEOM::candelete"))
+			g_raid_candelete(sc, bp);
+		else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump"))
 			g_raid_kerneldump(sc, bp);
 		else
 			g_io_deliver(bp, EOPNOTSUPP);

Modified: stable/9/sys/geom/raid/g_raid.h
==============================================================================
--- stable/9/sys/geom/raid/g_raid.h	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/g_raid.h	Thu Nov 29 18:08:36 2012	(r243678)
@@ -153,6 +153,7 @@ struct g_raid_disk {
 	struct g_consumer	*d_consumer;	/* GEOM disk consumer. */
 	void			*d_md_data;	/* Disk's metadata storage. */
 	struct g_kerneldump	 d_kd;		/* Kernel dumping method/args. */
+	int			 d_candelete;	/* BIO_DELETE supported. */
 	uint64_t		 d_flags;	/* Additional flags. */
 	u_int			 d_state;	/* Disk state. */
 	u_int			 d_load;	/* Disk average load. */
@@ -418,6 +419,7 @@ struct g_raid_volume * g_raid_create_vol
     const char *name, int id);
 struct g_raid_disk * g_raid_create_disk(struct g_raid_softc *sc);
 const char * g_raid_get_diskname(struct g_raid_disk *disk);
+void g_raid_get_disk_info(struct g_raid_disk *disk);
 
 int g_raid_start_volume(struct g_raid_volume *vol);
 

Modified: stable/9/sys/geom/raid/md_ddf.c
==============================================================================
--- stable/9/sys/geom/raid/md_ddf.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/md_ddf.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -2087,7 +2087,7 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
 	struct g_raid_md_ddf_perdisk *pd;
 	struct g_raid_md_ddf_object *mdi;
 	struct g_geom *geom;
-	int error, result, len, be;
+	int error, result, be;
 	char name[16];
 
 	G_RAID_DEBUG(1, "Tasting DDF on %s", cp->provider->name);
@@ -2154,14 +2154,7 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
 	disk->d_consumer = rcp;
 	rcp->private = disk;
 
-	/* Read kernel dumping information. */
-	disk->d_kd.offset = 0;
-	disk->d_kd.length = OFF_MAX;
-	len = sizeof(disk->d_kd);
-	error = g_io_getattr("GEOM::kerneldump", rcp, &len, &disk->d_kd);
-	if (disk->d_kd.di.dumper == NULL)
-		G_RAID_DEBUG1(2, sc, "Dumping not supported by %s: %d.", 
-		    rcp->provider->name, error);
+	g_raid_get_disk_info(disk);
 
 	g_raid_md_ddf_new_disk(disk);
 
@@ -2348,15 +2341,7 @@ g_raid_md_ctl_ddf(struct g_raid_md_objec
 				ddf_meta_update(&mdi->mdio_meta, &pd->pd_meta);
 			g_topology_unlock();
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			/* Reserve some space for metadata. */
 			size = MIN(size, GET64(&pd->pd_meta,
@@ -2675,15 +2660,7 @@ g_raid_md_ctl_ddf(struct g_raid_md_objec
 			disk->d_md_data = (void *)pd;
 			cp->private = disk;
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			/* Welcome the "new" disk. */
 			g_raid_change_disk_state(disk, G_RAID_DISK_S_SPARE);

Modified: stable/9/sys/geom/raid/md_intel.c
==============================================================================
--- stable/9/sys/geom/raid/md_intel.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/md_intel.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -1369,14 +1369,7 @@ search:
 	disk->d_consumer = rcp;
 	rcp->private = disk;
 
-	/* Read kernel dumping information. */
-	disk->d_kd.offset = 0;
-	disk->d_kd.length = OFF_MAX;
-	len = sizeof(disk->d_kd);
-	error = g_io_getattr("GEOM::kerneldump", rcp, &len, &disk->d_kd);
-	if (disk->d_kd.di.dumper == NULL)
-		G_RAID_DEBUG1(2, sc, "Dumping not supported by %s: %d.", 
-		    rcp->provider->name, error);
+	g_raid_get_disk_info(disk);
 
 	g_raid_md_intel_new_disk(disk);
 
@@ -1556,15 +1549,7 @@ g_raid_md_ctl_intel(struct g_raid_md_obj
 				break;
 			}
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			intel_set_disk_sectors(&pd->pd_disk_meta,
 			    pp->mediasize / pp->sectorsize);
@@ -2080,15 +2065,7 @@ g_raid_md_ctl_intel(struct g_raid_md_obj
 			disk->d_md_data = (void *)pd;
 			cp->private = disk;
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			memcpy(&pd->pd_disk_meta.serial[0], &serial[0],
 			    INTEL_SERIAL_LEN);

Modified: stable/9/sys/geom/raid/md_jmicron.c
==============================================================================
--- stable/9/sys/geom/raid/md_jmicron.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/md_jmicron.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -826,7 +826,7 @@ g_raid_md_taste_jmicron(struct g_raid_md
 	struct jmicron_raid_conf *meta;
 	struct g_raid_md_jmicron_perdisk *pd;
 	struct g_geom *geom;
-	int error, disk_pos, result, spare, len;
+	int disk_pos, result, spare, len;
 	char name[16];
 	uint16_t vendor;
 
@@ -945,14 +945,7 @@ search:
 	disk->d_consumer = rcp;
 	rcp->private = disk;
 
-	/* Read kernel dumping information. */
-	disk->d_kd.offset = 0;
-	disk->d_kd.length = OFF_MAX;
-	len = sizeof(disk->d_kd);
-	error = g_io_getattr("GEOM::kerneldump", rcp, &len, &disk->d_kd);
-	if (disk->d_kd.di.dumper == NULL)
-		G_RAID_DEBUG1(2, sc, "Dumping not supported by %s: %d.", 
-		    rcp->provider->name, error);
+	g_raid_get_disk_info(disk);
 
 	g_raid_md_jmicron_new_disk(disk);
 
@@ -1115,15 +1108,7 @@ g_raid_md_ctl_jmicron(struct g_raid_md_o
 			cp->private = disk;
 			g_topology_unlock();
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			pd->pd_disk_size = pp->mediasize;
 			if (size > pp->mediasize)
@@ -1374,15 +1359,7 @@ g_raid_md_ctl_jmicron(struct g_raid_md_o
 			cp->private = disk;
 			g_topology_unlock();
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			/* Welcome the "new" disk. */
 			update += g_raid_md_jmicron_start_disk(disk);

Modified: stable/9/sys/geom/raid/md_nvidia.c
==============================================================================
--- stable/9/sys/geom/raid/md_nvidia.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/md_nvidia.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -830,7 +830,7 @@ g_raid_md_taste_nvidia(struct g_raid_md_
 	struct nvidia_raid_conf *meta;
 	struct g_raid_md_nvidia_perdisk *pd;
 	struct g_geom *geom;
-	int error, result, spare, len;
+	int result, spare, len;
 	char name[32];
 	uint16_t vendor;
 
@@ -939,14 +939,7 @@ search:
 	disk->d_consumer = rcp;
 	rcp->private = disk;
 
-	/* Read kernel dumping information. */
-	disk->d_kd.offset = 0;
-	disk->d_kd.length = OFF_MAX;
-	len = sizeof(disk->d_kd);
-	error = g_io_getattr("GEOM::kerneldump", rcp, &len, &disk->d_kd);
-	if (disk->d_kd.di.dumper == NULL)
-		G_RAID_DEBUG1(2, sc, "Dumping not supported by %s: %d.", 
-		    rcp->provider->name, error);
+	g_raid_get_disk_info(disk);
 
 	g_raid_md_nvidia_new_disk(disk);
 
@@ -1117,15 +1110,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob
 			cp->private = disk;
 			g_topology_unlock();
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			pd->pd_disk_size = pp->mediasize;
 			if (size > pp->mediasize)
@@ -1377,15 +1362,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob
 			cp->private = disk;
 			g_topology_unlock();
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			/* Welcome the "new" disk. */
 			update += g_raid_md_nvidia_start_disk(disk);

Modified: stable/9/sys/geom/raid/md_promise.c
==============================================================================
--- stable/9/sys/geom/raid/md_promise.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/md_promise.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -1046,7 +1046,7 @@ g_raid_md_taste_promise(struct g_raid_md
 	struct promise_raid_conf *meta, *metaarr[4];
 	struct g_raid_md_promise_perdisk *pd;
 	struct g_geom *geom;
-	int error, i, j, result, len, subdisks;
+	int i, j, result, len, subdisks;
 	char name[16];
 	uint16_t vendor;
 
@@ -1142,14 +1142,7 @@ search:
 	disk->d_consumer = rcp;
 	rcp->private = disk;
 
-	/* Read kernel dumping information. */
-	disk->d_kd.offset = 0;
-	disk->d_kd.length = OFF_MAX;
-	len = sizeof(disk->d_kd);
-	error = g_io_getattr("GEOM::kerneldump", rcp, &len, &disk->d_kd);
-	if (disk->d_kd.di.dumper == NULL)
-		G_RAID_DEBUG1(2, sc, "Dumping not supported by %s: %d.", 
-		    rcp->provider->name, error);
+	g_raid_get_disk_info(disk);
 
 	g_raid_md_promise_new_disk(disk);
 
@@ -1337,15 +1330,7 @@ g_raid_md_ctl_promise(struct g_raid_md_o
 				break;
 			}
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			/* Reserve some space for metadata. */
 			size = MIN(size, pp->mediasize - 131072llu * pp->sectorsize);
@@ -1659,15 +1644,7 @@ g_raid_md_ctl_promise(struct g_raid_md_o
 			disk->d_md_data = (void *)pd;
 			cp->private = disk;
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			/* Welcome the "new" disk. */
 			g_raid_change_disk_state(disk, G_RAID_DISK_S_SPARE);

Modified: stable/9/sys/geom/raid/md_sii.c
==============================================================================
--- stable/9/sys/geom/raid/md_sii.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/md_sii.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -912,7 +912,7 @@ g_raid_md_taste_sii(struct g_raid_md_obj
 	struct sii_raid_conf *meta;
 	struct g_raid_md_sii_perdisk *pd;
 	struct g_geom *geom;
-	int error, disk_pos, result, spare, len;
+	int disk_pos, result, spare, len;
 	char name[32];
 	uint16_t vendor;
 
@@ -1032,14 +1032,7 @@ search:
 	disk->d_consumer = rcp;
 	rcp->private = disk;
 
-	/* Read kernel dumping information. */
-	disk->d_kd.offset = 0;
-	disk->d_kd.length = OFF_MAX;
-	len = sizeof(disk->d_kd);
-	error = g_io_getattr("GEOM::kerneldump", rcp, &len, &disk->d_kd);
-	if (disk->d_kd.di.dumper == NULL)
-		G_RAID_DEBUG1(2, sc, "Dumping not supported by %s: %d.", 
-		    rcp->provider->name, error);
+	g_raid_get_disk_info(disk);
 
 	g_raid_md_sii_new_disk(disk);
 
@@ -1201,15 +1194,7 @@ g_raid_md_ctl_sii(struct g_raid_md_objec
 			cp->private = disk;
 			g_topology_unlock();
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			pd->pd_disk_size = pp->mediasize;
 			if (size > pp->mediasize)
@@ -1459,15 +1444,7 @@ g_raid_md_ctl_sii(struct g_raid_md_objec
 			cp->private = disk;
 			g_topology_unlock();
 
-			/* Read kernel dumping information. */
-			disk->d_kd.offset = 0;
-			disk->d_kd.length = OFF_MAX;
-			len = sizeof(disk->d_kd);
-			g_io_getattr("GEOM::kerneldump", cp, &len, &disk->d_kd);
-			if (disk->d_kd.di.dumper == NULL)
-				G_RAID_DEBUG1(2, sc,
-				    "Dumping not supported by %s.",
-				    cp->provider->name);
+			g_raid_get_disk_info(disk);
 
 			/* Welcome the "new" disk. */
 			update += g_raid_md_sii_start_disk(disk);

Modified: stable/9/sys/geom/raid/tr_concat.c
==============================================================================
--- stable/9/sys/geom/raid/tr_concat.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/tr_concat.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -248,7 +248,8 @@ g_raid_tr_iostart_concat(struct g_raid_t
 		cbp->bio_caller1 = sd;
 		bioq_insert_tail(&queue, cbp);
 		remain -= length;
-		addr += length;
+		if (bp->bio_cmd != BIO_DELETE)
+			addr += length;
 		offset = 0;
 		no++;
 		KASSERT(no < vol->v_disks_count || remain == 0,

Modified: stable/9/sys/geom/raid/tr_raid0.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid0.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/tr_raid0.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -234,7 +234,8 @@ g_raid_tr_iostart_raid0(struct g_raid_tr
 			offset += strip_size;
 		}
 		remain -= length;
-		addr += length;
+		if (bp->bio_cmd != BIO_DELETE)
+			addr += length;
 		start = 0;
 	} while (remain > 0);
 	for (cbp = bioq_first(&queue); cbp != NULL;

Modified: stable/9/sys/geom/raid/tr_raid1.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid1.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/tr_raid1.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -647,10 +647,8 @@ g_raid_tr_iostart_raid1(struct g_raid_tr
 		g_raid_tr_iostart_raid1_read(tr, bp);
 		break;
 	case BIO_WRITE:
-		g_raid_tr_iostart_raid1_write(tr, bp);
-		break;
 	case BIO_DELETE:
-		g_raid_iodone(bp, EIO);
+		g_raid_tr_iostart_raid1_write(tr, bp);
 		break;
 	case BIO_FLUSH:
 		g_raid_tr_flush_common(tr, bp);
@@ -896,7 +894,7 @@ rebuild_round_done:
 	if (pbp->bio_cmd != BIO_READ) {
 		if (pbp->bio_inbed == 1 || pbp->bio_error != 0)
 			pbp->bio_error = bp->bio_error;
-		if (bp->bio_error != 0) {
+		if (pbp->bio_cmd == BIO_WRITE && bp->bio_error != 0) {
 			G_RAID_LOGREQ(0, bp, "Write failed: failing subdisk.");
 			g_raid_tr_raid1_fail_disk(sd->sd_softc, sd, sd->sd_disk);
 		}

Modified: stable/9/sys/geom/raid/tr_raid1e.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid1e.c	Thu Nov 29 17:41:19 2012	(r243677)
+++ stable/9/sys/geom/raid/tr_raid1e.c	Thu Nov 29 18:08:36 2012	(r243678)
@@ -802,7 +802,8 @@ nextdisk:
 			}
 		}
 		remain -= length;
-		addr += length;
+		if (bp->bio_cmd != BIO_DELETE)
+			addr += length;
 		start = 0;
 	}
 	for (cbp = bioq_first(&queue); cbp != NULL;
@@ -858,10 +859,8 @@ g_raid_tr_iostart_raid1e(struct g_raid_t
 		g_raid_tr_iostart_raid1e_read(tr, bp);
 		break;
 	case BIO_WRITE:
-		g_raid_tr_iostart_raid1e_write(tr, bp);
-		break;
 	case BIO_DELETE:
-		g_raid_iodone(bp, EIO);
+		g_raid_tr_iostart_raid1e_write(tr, bp);
 		break;
 	case BIO_FLUSH:
 		g_raid_tr_flush_common(tr, bp);
@@ -1122,7 +1121,7 @@ rebuild_round_done:
 	if (pbp->bio_cmd != BIO_READ) {
 		if (pbp->bio_inbed == 1 || pbp->bio_error != 0)
 			pbp->bio_error = bp->bio_error;
-		if (bp->bio_error != 0) {
+		if (pbp->bio_cmd == BIO_WRITE && bp->bio_error != 0) {
 			G_RAID_LOGREQ(0, bp, "Write failed: failing subdisk.");
 			g_raid_tr_raid1e_fail_disk(sd->sd_softc, sd, sd->sd_disk);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211291808.qATI8a9M031211>