dm-snap.c (ee18026ac69efba804144541171299efd41747d2) dm-snap.c (7de3ee57da4b717050e79c9313a9bf66ccc72519)
1/*
2 * dm-snapshot.c
3 *
4 * Copyright (C) 2001-2002 Sistina Software (UK) Limited.
5 *
6 * This file is released under the GPL.
7 */
8

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

1562 bio->bi_bdev = s->cow->bdev;
1563 bio->bi_sector = chunk_to_sector(s->store,
1564 dm_chunk_number(e->new_chunk) +
1565 (chunk - e->old_chunk)) +
1566 (bio->bi_sector &
1567 s->store->chunk_mask);
1568}
1569
1/*
2 * dm-snapshot.c
3 *
4 * Copyright (C) 2001-2002 Sistina Software (UK) Limited.
5 *
6 * This file is released under the GPL.
7 */
8

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

1562 bio->bi_bdev = s->cow->bdev;
1563 bio->bi_sector = chunk_to_sector(s->store,
1564 dm_chunk_number(e->new_chunk) +
1565 (chunk - e->old_chunk)) +
1566 (bio->bi_sector &
1567 s->store->chunk_mask);
1568}
1569
1570static int snapshot_map(struct dm_target *ti, struct bio *bio,
1571 union map_info *map_context)
1570static int snapshot_map(struct dm_target *ti, struct bio *bio)
1572{
1573 struct dm_exception *e;
1574 struct dm_snapshot *s = ti->private;
1575 int r = DM_MAPIO_REMAPPED;
1576 chunk_t chunk;
1577 struct dm_snap_pending_exception *pe = NULL;
1578
1579 init_tracked_chunk(bio);

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

1678 * merged.
1679 *
1680 * For each chunk, if there is an existing exception, it is used to
1681 * redirect I/O to the cow device. Otherwise I/O is sent to the origin,
1682 * which in turn might generate exceptions in other snapshots.
1683 * If merging is currently taking place on the chunk in question, the
1684 * I/O is deferred by adding it to s->bios_queued_during_merge.
1685 */
1571{
1572 struct dm_exception *e;
1573 struct dm_snapshot *s = ti->private;
1574 int r = DM_MAPIO_REMAPPED;
1575 chunk_t chunk;
1576 struct dm_snap_pending_exception *pe = NULL;
1577
1578 init_tracked_chunk(bio);

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

1677 * merged.
1678 *
1679 * For each chunk, if there is an existing exception, it is used to
1680 * redirect I/O to the cow device. Otherwise I/O is sent to the origin,
1681 * which in turn might generate exceptions in other snapshots.
1682 * If merging is currently taking place on the chunk in question, the
1683 * I/O is deferred by adding it to s->bios_queued_during_merge.
1684 */
1686static int snapshot_merge_map(struct dm_target *ti, struct bio *bio,
1687 union map_info *map_context)
1685static int snapshot_merge_map(struct dm_target *ti, struct bio *bio)
1688{
1689 struct dm_exception *e;
1690 struct dm_snapshot *s = ti->private;
1691 int r = DM_MAPIO_REMAPPED;
1692 chunk_t chunk;
1693
1694 init_tracked_chunk(bio);
1695

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

1739 }
1740
1741out_unlock:
1742 up_write(&s->lock);
1743
1744 return r;
1745}
1746
1686{
1687 struct dm_exception *e;
1688 struct dm_snapshot *s = ti->private;
1689 int r = DM_MAPIO_REMAPPED;
1690 chunk_t chunk;
1691
1692 init_tracked_chunk(bio);
1693

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

1737 }
1738
1739out_unlock:
1740 up_write(&s->lock);
1741
1742 return r;
1743}
1744
1747static int snapshot_end_io(struct dm_target *ti, struct bio *bio,
1748 int error, union map_info *map_context)
1745static int snapshot_end_io(struct dm_target *ti, struct bio *bio, int error)
1749{
1750 struct dm_snapshot *s = ti->private;
1751
1752 if (is_bio_tracked(bio))
1753 stop_tracking_chunk(s, bio);
1754
1755 return 0;
1756}

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

2114}
2115
2116static void origin_dtr(struct dm_target *ti)
2117{
2118 struct dm_dev *dev = ti->private;
2119 dm_put_device(ti, dev);
2120}
2121
1746{
1747 struct dm_snapshot *s = ti->private;
1748
1749 if (is_bio_tracked(bio))
1750 stop_tracking_chunk(s, bio);
1751
1752 return 0;
1753}

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

2111}
2112
2113static void origin_dtr(struct dm_target *ti)
2114{
2115 struct dm_dev *dev = ti->private;
2116 dm_put_device(ti, dev);
2117}
2118
2122static int origin_map(struct dm_target *ti, struct bio *bio,
2123 union map_info *map_context)
2119static int origin_map(struct dm_target *ti, struct bio *bio)
2124{
2125 struct dm_dev *dev = ti->private;
2126 bio->bi_bdev = dev->bdev;
2127
2128 if (bio->bi_rw & REQ_FLUSH)
2129 return DM_MAPIO_REMAPPED;
2130
2131 /* Only tell snapshots if this is a write */

--- 182 unchanged lines hidden ---
2120{
2121 struct dm_dev *dev = ti->private;
2122 bio->bi_bdev = dev->bdev;
2123
2124 if (bio->bi_rw & REQ_FLUSH)
2125 return DM_MAPIO_REMAPPED;
2126
2127 /* Only tell snapshots if this is a write */

--- 182 unchanged lines hidden ---