1*f0ba4377SMauro Carvalho Chehab===================== 2f5db4af4SJonthan BrassowDevice-Mapper Logging 3f5db4af4SJonthan Brassow===================== 4f5db4af4SJonthan BrassowThe device-mapper logging code is used by some of the device-mapper 5f5db4af4SJonthan BrassowRAID targets to track regions of the disk that are not consistent. 6f5db4af4SJonthan BrassowA region (or portion of the address space) of the disk may be 7f5db4af4SJonthan Brassowinconsistent because a RAID stripe is currently being operated on or 8f5db4af4SJonthan Brassowa machine died while the region was being altered. In the case of 9f5db4af4SJonthan Brassowmirrors, a region would be considered dirty/inconsistent while you 10f5db4af4SJonthan Brassoware writing to it because the writes need to be replicated for all 11f5db4af4SJonthan Brassowthe legs of the mirror and may not reach the legs at the same time. 12f5db4af4SJonthan BrassowOnce all writes are complete, the region is considered clean again. 13f5db4af4SJonthan Brassow 14f5db4af4SJonthan BrassowThere is a generic logging interface that the device-mapper RAID 15f5db4af4SJonthan Brassowimplementations use to perform logging operations (see 16f5db4af4SJonthan Brassowdm_dirty_log_type in include/linux/dm-dirty-log.h). Various different 17f5db4af4SJonthan Brassowlogging implementations are available and provide different 18f5db4af4SJonthan Brassowcapabilities. The list includes: 19f5db4af4SJonthan Brassow 20*f0ba4377SMauro Carvalho Chehab============== ============================================================== 21f5db4af4SJonthan BrassowType Files 22*f0ba4377SMauro Carvalho Chehab============== ============================================================== 23f5db4af4SJonthan Brassowdisk drivers/md/dm-log.c 24f5db4af4SJonthan Brassowcore drivers/md/dm-log.c 25f5db4af4SJonthan Brassowuserspace drivers/md/dm-log-userspace* include/linux/dm-log-userspace.h 26*f0ba4377SMauro Carvalho Chehab============== ============================================================== 27f5db4af4SJonthan Brassow 28f5db4af4SJonthan BrassowThe "disk" log type 29f5db4af4SJonthan Brassow------------------- 30f5db4af4SJonthan BrassowThis log implementation commits the log state to disk. This way, the 31f5db4af4SJonthan Brassowlogging state survives reboots/crashes. 32f5db4af4SJonthan Brassow 33f5db4af4SJonthan BrassowThe "core" log type 34f5db4af4SJonthan Brassow------------------- 35f5db4af4SJonthan BrassowThis log implementation keeps the log state in memory. The log state 36f5db4af4SJonthan Brassowwill not survive a reboot or crash, but there may be a small boost in 37f5db4af4SJonthan Brassowperformance. This method can also be used if no storage device is 38f5db4af4SJonthan Brassowavailable for storing log state. 39f5db4af4SJonthan Brassow 40f5db4af4SJonthan BrassowThe "userspace" log type 41f5db4af4SJonthan Brassow------------------------ 42f5db4af4SJonthan BrassowThis log type simply provides a way to export the log API to userspace, 43f5db4af4SJonthan Brassowso log implementations can be done there. This is done by forwarding most 44f5db4af4SJonthan Brassowlogging requests to userspace, where a daemon receives and processes the 45f5db4af4SJonthan Brassowrequest. 46f5db4af4SJonthan Brassow 47f5db4af4SJonthan BrassowThe structure used for communication between kernel and userspace are 48f5db4af4SJonthan Brassowlocated in include/linux/dm-log-userspace.h. Due to the frequency, 49f5db4af4SJonthan Brassowdiversity, and 2-way communication nature of the exchanges between 50f5db4af4SJonthan Brassowkernel and userspace, 'connector' is used as the interface for 51f5db4af4SJonthan Brassowcommunication. 52f5db4af4SJonthan Brassow 53f5db4af4SJonthan BrassowThere are currently two userspace log implementations that leverage this 54b8954457SJonathan Brassowframework - "clustered-disk" and "clustered-core". These implementations 55f5db4af4SJonthan Brassowprovide a cluster-coherent log for shared-storage. Device-mapper mirroring 56f5db4af4SJonthan Brassowcan be used in a shared-storage environment when the cluster log implementations 57f5db4af4SJonthan Brassoware employed. 58