1 Let's say we have an LV, made up of three segments of different PV's,
2 I've also added in the device major:minor as this will be useful
5 +-----------------------------+
6 | PV1 | PV2 | PV3 | 254:3
7 +----------+---------+--------+
10 Now our hero decides to PV move PV2 to PV4:
12 1. Suspend our LV (254:3), this starts queueing all io, and flushes
13 all pending io. Once the suspend has completed we are free to change
16 2. Set up *another* (254:4) device with the mapping table of our LV.
18 3. Load a new mapping table into (254:3) that has identity targets for
19 parts that aren't moving, and a mirror target for parts that are.
25 +--------------------->--------------+
27 +-----------------------------+ + -----------+
28 | Identity | mirror | Ident. | 254:3 | PV4 |
29 +----------+---------+--------+ +------------+
32 +-----------------------------+
33 | PV1 | PV2 | PV3 | 254:4
34 +----------+---------+--------+
36 Any writes to segment2 of the LV get intercepted by the mirror target
37 who checks that that chunk has been copied to the new destination, if
38 it hasn't it queues the initial copy and defers the current io until
39 it has finished. Then the current io is written to *both* PV2 and the
42 5. When the copying has completed 254:3 is suspended/pending flushed.
44 6. 254:4 is taken down
46 7. metadata is updated on disk
48 8. 254:3 has new mapping table loaded:
50 +-----------------------------+
51 | PV1 | PV4 | PV3 | 254:3
52 +----------+---------+--------+