Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2019 17:38:47 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r342890 - in stable/12/sys/geom: concat mirror raid
Message-ID:  <201901091738.x09HclkR073204@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Jan  9 17:38:47 2019
New Revision: 342890
URL: https://svnweb.freebsd.org/changeset/base/342890

Log:
  MFC r342687:
  Use g_handleattr() to reply to GEOM::candelete queries.

Modified:
  stable/12/sys/geom/concat/g_concat.c
  stable/12/sys/geom/mirror/g_mirror.c
  stable/12/sys/geom/raid/g_raid.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/geom/concat/g_concat.c
==============================================================================
--- stable/12/sys/geom/concat/g_concat.c	Wed Jan  9 17:23:59 2019	(r342889)
+++ stable/12/sys/geom/concat/g_concat.c	Wed Jan  9 17:38:47 2019	(r342890)
@@ -210,20 +210,16 @@ g_concat_candelete(struct bio *bp)
 {
 	struct g_concat_softc *sc;
 	struct g_concat_disk *disk;
-	int i, *val;
+	int i, val;
 
-	val = (int *)bp->bio_data;
-	*val = 0;
-
 	sc = bp->bio_to->geom->softc;
 	for (i = 0; i < sc->sc_ndisks; i++) {
 		disk = &sc->sc_disks[i];
-		if (!disk->d_removed && disk->d_candelete) {
-			*val = 1;
+		if (!disk->d_removed && disk->d_candelete)
 			break;
-		}
 	}
-	g_io_deliver(bp, 0);
+	val = i < sc->sc_ndisks;
+	g_handleattr(bp, "GEOM::candelete", &val, sizeof(val));
 }
 
 static void

Modified: stable/12/sys/geom/mirror/g_mirror.c
==============================================================================
--- stable/12/sys/geom/mirror/g_mirror.c	Wed Jan  9 17:23:59 2019	(r342889)
+++ stable/12/sys/geom/mirror/g_mirror.c	Wed Jan  9 17:38:47 2019	(r342890)
@@ -1075,16 +1075,15 @@ g_mirror_candelete(struct bio *bp)
 {
 	struct g_mirror_softc *sc;
 	struct g_mirror_disk *disk;
-	int *val;
+	int val;
 
 	sc = bp->bio_to->private;
 	LIST_FOREACH(disk, &sc->sc_disks, d_next) {
 		if (disk->d_flags & G_MIRROR_DISK_FLAG_CANDELETE)
 			break;
 	}
-	val = (int *)bp->bio_data;
-	*val = (disk != NULL);
-	g_io_deliver(bp, 0);
+	val = disk != NULL;
+	g_handleattr(bp, "GEOM::candelete", &val, sizeof(val));
 }
 
 static void

Modified: stable/12/sys/geom/raid/g_raid.c
==============================================================================
--- stable/12/sys/geom/raid/g_raid.c	Wed Jan  9 17:23:59 2019	(r342889)
+++ stable/12/sys/geom/raid/g_raid.c	Wed Jan  9 17:38:47 2019	(r342890)
@@ -1075,23 +1075,19 @@ g_raid_candelete(struct g_raid_softc *sc, struct bio *
 	struct g_provider *pp;
 	struct g_raid_volume *vol;
 	struct g_raid_subdisk *sd;
-	int *val;
-	int i;
+	int i, val;
 
-	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;
+		if (sd->sd_disk->d_candelete)
 			break;
-		}
 	}
-	g_io_deliver(bp, 0);
+	val = i < vol->v_disks_count;
+	g_handleattr(bp, "GEOM::candelete", &val, sizeof(val));
 }
 
 static void



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