Lines Matching defs:pbp

133 static int g_raid3_register_request(struct bio *pbp);
924 #define G_RAID3_HEAD_BIO(pbp) (pbp)->bio_driver1
928 #define G_RAID3_FOREACH_BIO(pbp, bp) \
929 for ((bp) = G_RAID3_HEAD_BIO(pbp); (bp) != NULL; \
932 #define G_RAID3_FOREACH_SAFE_BIO(pbp, bp, tmpbp) \
933 for ((bp) = G_RAID3_HEAD_BIO(pbp); \
938 g_raid3_init_bio(struct bio *pbp)
941 G_RAID3_HEAD_BIO(pbp) = NULL;
947 struct bio *pbp, *bp;
949 pbp = cbp->bio_parent;
950 if (G_RAID3_HEAD_BIO(pbp) == cbp)
951 G_RAID3_HEAD_BIO(pbp) = G_RAID3_NEXT_BIO(cbp);
953 G_RAID3_FOREACH_BIO(pbp, bp) {
966 struct bio *pbp, *bp;
969 pbp = dbp->bio_parent;
971 if (G_RAID3_HEAD_BIO(pbp) == dbp)
972 G_RAID3_HEAD_BIO(pbp) = sbp;
974 G_RAID3_FOREACH_BIO(pbp, bp) {
987 struct bio *bp, *pbp;
990 pbp = cbp->bio_parent;
991 pbp->bio_children--;
993 size = pbp->bio_length / (sc->sc_ndisks - 1);
995 if (G_RAID3_HEAD_BIO(pbp) == cbp) {
996 G_RAID3_HEAD_BIO(pbp) = G_RAID3_NEXT_BIO(cbp);
1000 G_RAID3_FOREACH_BIO(pbp, bp) {
1015 g_raid3_clone_bio(struct g_raid3_softc *sc, struct bio *pbp)
1021 cbp = g_clone_bio(pbp);
1024 size = pbp->bio_length / (sc->sc_ndisks - 1);
1025 if ((pbp->bio_cflags & G_RAID3_BIO_CFLAG_REGULAR) != 0)
1031 pbp->bio_children--;
1036 if (G_RAID3_HEAD_BIO(pbp) == NULL)
1037 G_RAID3_HEAD_BIO(pbp) = cbp;
1039 G_RAID3_FOREACH_BIO(pbp, bp) {
1050 g_raid3_scatter(struct bio *pbp)
1058 sc = pbp->bio_to->geom->softc;
1060 if ((pbp->bio_pflags & G_RAID3_BIO_PFLAG_NOPARITY) == 0) {
1064 G_RAID3_FOREACH_BIO(pbp, cbp) {
1074 for (left = pbp->bio_length; left > 0; left -= sc->sc_sectorsize) {
1075 G_RAID3_FOREACH_BIO(pbp, cbp) {
1078 bcopy(pbp->bio_data + padd, cbp->bio_data + cadd, atom);
1083 if ((pbp->bio_pflags & G_RAID3_BIO_PFLAG_NOPARITY) == 0) {
1088 G_RAID3_FOREACH_SAFE_BIO(pbp, cbp, tmpbp) {
1103 G_RAID3_FOREACH_SAFE_BIO(pbp, cbp, tmpbp) {
1120 g_raid3_gather(struct bio *pbp)
1127 sc = pbp->bio_to->geom->softc;
1137 G_RAID3_FOREACH_BIO(pbp, cbp) {
1148 if ((pbp->bio_pflags & G_RAID3_BIO_PFLAG_DEGRADED) != 0) {
1153 if (pbp->bio_error == 0)
1154 pbp->bio_error = cbp->bio_error;
1162 if (pbp->bio_error == 0)
1163 pbp->bio_error = fbp->bio_error;
1184 if (pbp->bio_error != 0)
1186 if (fbp != NULL && (pbp->bio_pflags & G_RAID3_BIO_PFLAG_VERIFY) != 0) {
1187 pbp->bio_pflags &= ~G_RAID3_BIO_PFLAG_VERIFY;
1198 disk = pbp->bio_driver2;
1200 pbp->bio_error = fbp->bio_error;
1203 pbp->bio_pflags |= G_RAID3_BIO_PFLAG_DEGRADED;
1204 pbp->bio_inbed--;
1227 G_RAID3_FOREACH_BIO(pbp, cbp) {
1234 if ((pbp->bio_pflags & G_RAID3_BIO_PFLAG_VERIFY) != 0) {
1237 pbp->bio_error = EIO;
1245 for (left = pbp->bio_length; left > 0; left -= sc->sc_sectorsize) {
1246 G_RAID3_FOREACH_BIO(pbp, cbp) {
1247 bcopy(cbp->bio_data + cadd, pbp->bio_data + padd, atom);
1248 pbp->bio_completed += atom;
1254 if (pbp->bio_error == 0)
1255 G_RAID3_LOGREQ(3, pbp, "Request finished.");
1257 if ((pbp->bio_pflags & G_RAID3_BIO_PFLAG_VERIFY) != 0)
1258 G_RAID3_LOGREQ(1, pbp, "Verification error.");
1260 G_RAID3_LOGREQ(0, pbp, "Request failed.");
1262 pbp->bio_pflags &= ~G_RAID3_BIO_PFLAG_MASK;
1263 while ((cbp = G_RAID3_HEAD_BIO(pbp)) != NULL)
1265 g_io_deliver(pbp, pbp->bio_error);
1288 struct bio *pbp;
1292 pbp = cbp->bio_parent;
1293 sc = pbp->bio_to->geom->softc;
1305 pbp->bio_inbed++;
1306 KASSERT(pbp->bio_inbed <= pbp->bio_children,
1307 ("bio_inbed (%u) is bigger than bio_children (%u).", pbp->bio_inbed,
1308 pbp->bio_children));
1309 if (pbp->bio_inbed != pbp->bio_children)
1311 switch (pbp->bio_cmd) {
1313 g_raid3_gather(pbp);
1320 pbp->bio_completed = pbp->bio_length;
1321 while ((cbp = G_RAID3_HEAD_BIO(pbp)) != NULL) {
1329 else if (pbp->bio_error == 0) {
1333 pbp->bio_error = error;
1361 if (pbp->bio_error == 0)
1362 G_RAID3_LOGREQ(3, pbp, "Request finished.");
1364 G_RAID3_LOGREQ(0, pbp, "Request failed.");
1365 pbp->bio_pflags &= ~G_RAID3_BIO_PFLAG_DEGRADED;
1366 pbp->bio_pflags &= ~G_RAID3_BIO_PFLAG_NOPARITY;
1367 bioq_remove(&sc->sc_inflight, pbp);
1370 g_io_deliver(pbp, pbp->bio_error);
1777 g_raid3_register_request(struct bio *pbp)
1788 sc = pbp->bio_to->geom->softc;
1789 if ((pbp->bio_cflags & G_RAID3_BIO_CFLAG_REGSYNC) != 0 &&
1791 g_io_deliver(pbp, EIO);
1794 g_raid3_init_bio(pbp);
1795 length = pbp->bio_length / (sc->sc_ndisks - 1);
1796 offset = pbp->bio_offset / (sc->sc_ndisks - 1);
1798 switch (pbp->bio_cmd) {
1802 pbp->bio_pflags |= G_RAID3_BIO_PFLAG_VERIFY;
1817 pbp->bio_driver2 = &sc->sc_disks[sc->sc_ndisks - 1];
1825 if (g_raid3_sync_collision(sc, pbp)) {
1826 g_raid3_regular_delay(sc, pbp);
1840 cbp = g_raid3_clone_bio(sc, pbp);
1842 while ((cbp = G_RAID3_HEAD_BIO(pbp)) != NULL)
1850 if ((pbp->bio_cflags &
1852 g_io_deliver(pbp, ENOMEM);
1860 switch (pbp->bio_cmd) {
1869 pbp->bio_pflags |= G_RAID3_BIO_PFLAG_DEGRADED;
1876 pbp->bio_driver2 = disk;
1897 pbp->bio_pflags |= G_RAID3_BIO_PFLAG_DEGRADED;
1903 pbp->bio_pflags |=
1918 switch (pbp->bio_cmd) {
1928 G_RAID3_FOREACH_SAFE_BIO(pbp, cbp, tmpbp) {
1946 bioq_insert_tail(&sc->sc_inflight, pbp);
1955 g_raid3_scatter(pbp);