1*6cf2a73cSMauro Carvalho Chehab===================== 2*6cf2a73cSMauro Carvalho ChehabDevice-Mapper Logging 3*6cf2a73cSMauro Carvalho Chehab===================== 4*6cf2a73cSMauro Carvalho ChehabThe device-mapper logging code is used by some of the device-mapper 5*6cf2a73cSMauro Carvalho ChehabRAID targets to track regions of the disk that are not consistent. 6*6cf2a73cSMauro Carvalho ChehabA region (or portion of the address space) of the disk may be 7*6cf2a73cSMauro Carvalho Chehabinconsistent because a RAID stripe is currently being operated on or 8*6cf2a73cSMauro Carvalho Chehaba machine died while the region was being altered. In the case of 9*6cf2a73cSMauro Carvalho Chehabmirrors, a region would be considered dirty/inconsistent while you 10*6cf2a73cSMauro Carvalho Chehabare writing to it because the writes need to be replicated for all 11*6cf2a73cSMauro Carvalho Chehabthe legs of the mirror and may not reach the legs at the same time. 12*6cf2a73cSMauro Carvalho ChehabOnce all writes are complete, the region is considered clean again. 13*6cf2a73cSMauro Carvalho Chehab 14*6cf2a73cSMauro Carvalho ChehabThere is a generic logging interface that the device-mapper RAID 15*6cf2a73cSMauro Carvalho Chehabimplementations use to perform logging operations (see 16*6cf2a73cSMauro Carvalho Chehabdm_dirty_log_type in include/linux/dm-dirty-log.h). Various different 17*6cf2a73cSMauro Carvalho Chehablogging implementations are available and provide different 18*6cf2a73cSMauro Carvalho Chehabcapabilities. The list includes: 19*6cf2a73cSMauro Carvalho Chehab 20*6cf2a73cSMauro Carvalho Chehab============== ============================================================== 21*6cf2a73cSMauro Carvalho ChehabType Files 22*6cf2a73cSMauro Carvalho Chehab============== ============================================================== 23*6cf2a73cSMauro Carvalho Chehabdisk drivers/md/dm-log.c 24*6cf2a73cSMauro Carvalho Chehabcore drivers/md/dm-log.c 25*6cf2a73cSMauro Carvalho Chehabuserspace drivers/md/dm-log-userspace* include/linux/dm-log-userspace.h 26*6cf2a73cSMauro Carvalho Chehab============== ============================================================== 27*6cf2a73cSMauro Carvalho Chehab 28*6cf2a73cSMauro Carvalho ChehabThe "disk" log type 29*6cf2a73cSMauro Carvalho Chehab------------------- 30*6cf2a73cSMauro Carvalho ChehabThis log implementation commits the log state to disk. This way, the 31*6cf2a73cSMauro Carvalho Chehablogging state survives reboots/crashes. 32*6cf2a73cSMauro Carvalho Chehab 33*6cf2a73cSMauro Carvalho ChehabThe "core" log type 34*6cf2a73cSMauro Carvalho Chehab------------------- 35*6cf2a73cSMauro Carvalho ChehabThis log implementation keeps the log state in memory. The log state 36*6cf2a73cSMauro Carvalho Chehabwill not survive a reboot or crash, but there may be a small boost in 37*6cf2a73cSMauro Carvalho Chehabperformance. This method can also be used if no storage device is 38*6cf2a73cSMauro Carvalho Chehabavailable for storing log state. 39*6cf2a73cSMauro Carvalho Chehab 40*6cf2a73cSMauro Carvalho ChehabThe "userspace" log type 41*6cf2a73cSMauro Carvalho Chehab------------------------ 42*6cf2a73cSMauro Carvalho ChehabThis log type simply provides a way to export the log API to userspace, 43*6cf2a73cSMauro Carvalho Chehabso log implementations can be done there. This is done by forwarding most 44*6cf2a73cSMauro Carvalho Chehablogging requests to userspace, where a daemon receives and processes the 45*6cf2a73cSMauro Carvalho Chehabrequest. 46*6cf2a73cSMauro Carvalho Chehab 47*6cf2a73cSMauro Carvalho ChehabThe structure used for communication between kernel and userspace are 48*6cf2a73cSMauro Carvalho Chehablocated in include/linux/dm-log-userspace.h. Due to the frequency, 49*6cf2a73cSMauro Carvalho Chehabdiversity, and 2-way communication nature of the exchanges between 50*6cf2a73cSMauro Carvalho Chehabkernel and userspace, 'connector' is used as the interface for 51*6cf2a73cSMauro Carvalho Chehabcommunication. 52*6cf2a73cSMauro Carvalho Chehab 53*6cf2a73cSMauro Carvalho ChehabThere are currently two userspace log implementations that leverage this 54*6cf2a73cSMauro Carvalho Chehabframework - "clustered-disk" and "clustered-core". These implementations 55*6cf2a73cSMauro Carvalho Chehabprovide a cluster-coherent log for shared-storage. Device-mapper mirroring 56*6cf2a73cSMauro Carvalho Chehabcan be used in a shared-storage environment when the cluster log implementations 57*6cf2a73cSMauro Carvalho Chehabare employed. 58