Deleted Added
full compact
g_raid3.c (163836) g_raid3.c (163886)
1/*-
2 * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/geom/raid3/g_raid3.c 163836 2006-10-31 21:23:51Z pjd $");
28__FBSDID("$FreeBSD: head/sys/geom/raid3/g_raid3.c 163886 2006-11-01 22:16:53Z pjd $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/limits.h>
35#include <sys/lock.h>
36#include <sys/mutex.h>

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

1508
1509/*
1510 * Puts request onto delayed queue.
1511 */
1512static void
1513g_raid3_regular_delay(struct g_raid3_softc *sc, struct bio *bp)
1514{
1515
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/limits.h>
35#include <sys/lock.h>
36#include <sys/mutex.h>

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

1508
1509/*
1510 * Puts request onto delayed queue.
1511 */
1512static void
1513g_raid3_regular_delay(struct g_raid3_softc *sc, struct bio *bp)
1514{
1515
1516 G_RAID3_LOGREQ(2, bp, "Delaying request.");
1517 bioq_insert_head(&sc->sc_regular_delayed, bp);
1516 G_RAID3_LOGREQ(2, bp, "Delaying request.");
1517 bioq_insert_head(&sc->sc_regular_delayed, bp);
1518}
1519
1520/*
1521 * Puts synchronization request onto delayed queue.
1522 */
1523static void
1524g_raid3_sync_delay(struct g_raid3_softc *sc, struct bio *bp)
1525{
1526
1518}
1519
1520/*
1521 * Puts synchronization request onto delayed queue.
1522 */
1523static void
1524g_raid3_sync_delay(struct g_raid3_softc *sc, struct bio *bp)
1525{
1526
1527 G_RAID3_LOGREQ(2, bp, "Delaying synchronization request.");
1528 bioq_insert_tail(&sc->sc_sync_delayed, bp);
1527 G_RAID3_LOGREQ(2, bp, "Delaying synchronization request.");
1528 bioq_insert_tail(&sc->sc_sync_delayed, bp);
1529}
1530
1531/*
1532 * Releases delayed regular requests which don't collide anymore with sync
1533 * requests.
1534 */
1535static void
1536g_raid3_regular_release(struct g_raid3_softc *sc)
1537{
1529}
1530
1531/*
1532 * Releases delayed regular requests which don't collide anymore with sync
1533 * requests.
1534 */
1535static void
1536g_raid3_regular_release(struct g_raid3_softc *sc)
1537{
1538 struct bio *bp, *bp2;
1538 struct bio *bp, *bp2;
1539
1539
1540 TAILQ_FOREACH_SAFE(bp, &sc->sc_regular_delayed.queue, bio_queue, bp2) {
1541 if (g_raid3_sync_collision(sc, bp))
1542 continue;
1543 bioq_remove(&sc->sc_regular_delayed, bp);
1544 G_RAID3_LOGREQ(2, bp, "Releasing delayed request (%p).", bp);
1540 TAILQ_FOREACH_SAFE(bp, &sc->sc_regular_delayed.queue, bio_queue, bp2) {
1541 if (g_raid3_sync_collision(sc, bp))
1542 continue;
1543 bioq_remove(&sc->sc_regular_delayed, bp);
1544 G_RAID3_LOGREQ(2, bp, "Releasing delayed request (%p).", bp);
1545 mtx_lock(&sc->sc_queue_mtx);
1546 bioq_insert_head(&sc->sc_queue, bp);
1547#if 0
1548 /*
1549 * wakeup() is not needed, because this function is called from
1550 * the worker thread.
1551 */
1552 wakeup(&sc->sc_queue);
1553#endif
1554 mtx_unlock(&sc->sc_queue_mtx);
1545 mtx_lock(&sc->sc_queue_mtx);
1546 bioq_insert_head(&sc->sc_queue, bp);
1547#if 0
1548 /*
1549 * wakeup() is not needed, because this function is called from
1550 * the worker thread.
1551 */
1552 wakeup(&sc->sc_queue);
1553#endif
1554 mtx_unlock(&sc->sc_queue_mtx);
1555 }
1555 }
1556}
1557
1558/*
1559 * Releases delayed sync requests which don't collide anymore with regular
1560 * requests.
1561 */
1562static void
1563g_raid3_sync_release(struct g_raid3_softc *sc)
1564{
1556}
1557
1558/*
1559 * Releases delayed sync requests which don't collide anymore with regular
1560 * requests.
1561 */
1562static void
1563g_raid3_sync_release(struct g_raid3_softc *sc)
1564{
1565 struct bio *bp, *bp2;
1565 struct bio *bp, *bp2;
1566
1566
1567 TAILQ_FOREACH_SAFE(bp, &sc->sc_sync_delayed.queue, bio_queue, bp2) {
1568 if (g_raid3_regular_collision(sc, bp))
1569 continue;
1570 bioq_remove(&sc->sc_sync_delayed, bp);
1571 G_RAID3_LOGREQ(2, bp,
1572 "Releasing delayed synchronization request.");
1573 g_io_request(bp, bp->bio_from);
1574 }
1567 TAILQ_FOREACH_SAFE(bp, &sc->sc_sync_delayed.queue, bio_queue, bp2) {
1568 if (g_raid3_regular_collision(sc, bp))
1569 continue;
1570 bioq_remove(&sc->sc_sync_delayed, bp);
1571 G_RAID3_LOGREQ(2, bp,
1572 "Releasing delayed synchronization request.");
1573 g_io_request(bp, bp->bio_from);
1574 }
1575}
1576
1577/*
1578 * Handle synchronization requests.
1579 * Every synchronization request is two-steps process: first, READ request is
1580 * send to active provider and then WRITE request (with read data) to the provider
1581 * beeing synchronized. When WRITE is finished, new synchronization request is
1582 * send.

--- 1965 unchanged lines hidden ---
1575}
1576
1577/*
1578 * Handle synchronization requests.
1579 * Every synchronization request is two-steps process: first, READ request is
1580 * send to active provider and then WRITE request (with read data) to the provider
1581 * beeing synchronized. When WRITE is finished, new synchronization request is
1582 * send.

--- 1965 unchanged lines hidden ---