(no commit message)
[ikiwiki.git] / docs / developer / dmmirror / index.mdwn
CommitLineData
3ffcc72d 1#Device Mapper Mirror Target
2
3GSoC 2011
4Adam Hoka
5
6##Specification
7
50990a62 8Version 2
3ffcc72d 9
10###Definitions
11- DM: Device Mapper (see: http://sources.redhat.com/dm/)
12- Volume: a DM's idea of the whole or the a part of a disk's storage area
13
14###Requirements
15
161. The Mirror target should implement RAID 1.
172. Two or more volumes should be able to used within the mirror.
183. Removal of all but one volume should still produce a working volume.
194. Online removal of any volumes should keep the mirror working, given that there is still a working volume present.
205. Failure to any of the disks holding any of the volumes should not lead to data loss or corruption, given that one or more disks holding at least one of the mirrored volumes are still present and healthy.
50990a62 216. The Mirror target's interface should be integrated with LVM Tools.
3ffcc72d 227. Any meta data stored on disk should be kept consistent across any possible unclean shutdown.
cbd5a573 23
24##The Write Intent Bitmap
25
26###Description
27
28Chunk status is stored in a bitmap data structure. Every chunk has 1 byte of information
29in the bitmap, a typical chunk size would be 1MB. This way the bitmap is easily addressable.
30the 2 lower bit of the byte will be used initially for the status. The status could be CLEAN, DIRTY.
31We can also store a MODIFIED flag, which means that there was a write to that chunk when the
32volume was out of sync (for faster recovery).
33
34##Layout
35
36[[header: WIBM][size][primary/secondary][serial][crc32]]
37
38##Reading the bitmap
39read two pages
40check crc
41 if any crc is invalid -> use the other (TODO, what if serial is different?)
42 if both crc is invalid -> trouble! full resync
43 both valid -> continue
44
45check serial
46 if one of the copies is outdated, use the other
47 if match we have a valid bitmap
48
49##Writing the bitmap
50- modify bitmap in memory (bump serial, 1 if overflow)
51- write first copy, mark as primary
52- flushing would be a good idea here! [1]
53- write second copy, mark as secondary
54- flushing would be a good idea here! [1]
55
56
57
58[1] does it kill performance?