<div dir="ltr">I have a kernel module that sits on top of a thin device mapper target that receives block I/O requests and re-submits then to the thin target. I would like to implement the following functionality: whenever I receive a write completion from the thin target (assuming that it's the first time a block written to) I would like to extract the newly-established mapping of that virtual block.<div><br></div><div>I know that I can do this using thin_dump, however this involves:</div><div>(1) spawning a process</div><div>(2) reserving/releasing a <span id="gmail-m_8004591443944844714:29k.18">metadata</span> snapshot, and</div><div>(3) dumping _all_ the mappings.</div><div><br></div><div>In other words, it's far to heavyweight for my <span id="gmail-m_8004591443944844714:29k.19">performance</span> requirements.</div><div><br></div><div>Ideally I would like to be able to obtain the mapping in kernel space. I had a look at thin_dump and from what I <span id="gmail-m_8004591443944844714:29k.20">understand</span> it directly reads the B-tree from the disk? Is there some kernel function that already does this? E.g. given a thin <span id="gmail-m_8004591443944844714:29k.21">LBA</span> return the physical block address.</div><div><br></div><div>Also, regarding having to have reserved a <span id="gmail-m_8004591443944844714:29k.22">metadata</span> snapshot, is this necessary for obtaining mappings? Aren't mappings immutable once e<span id="gmail-m_8004591443944844714:29k.23">stablished</span>?<br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_8004591443944844714gmail_signature"><span id="gmail-m_8004591443944844714:29k.24">Thanos</span> <span id="gmail-m_8004591443944844714:29k.25">Makatos</span><br></div></div></div>