bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ddrescue] Mapfile update mechanism


From: Antonio Diaz Diaz
Subject: Re: [Bug-ddrescue] Mapfile update mechanism
Date: Tue, 24 Jul 2018 19:55:17 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

Hello Eliyahu,

Eliyahu Saks wrote:
Hi, thanks for your great work.

You are welcome.


I've writing a FUSE driver that presents a damaged drive as a file that's
copy-on-read: any reads to the file are checked against a mapfile; if they
have already been read the data is returned immediately from the ddrescue
image file, if not, ddrescue is invoked on the requested sectors, and then
the data is returned from the image file.

Understandably, invoking ddrescue on every read is very inefficient
(parsing arguments, loading the mapfile, logging, etc.).

I've looked through the source code to see where I can 'hook' in to an
existing rescuebook and rescue parts of the file on demand.

I guess the function you are looking for is 'Rescuebook::copy_and_update' in line 202 of rescuebook.cc.


I see that the constructor for Mapbook calls:

     split_by_domain_borders( domain_ );

which seems to limit the mapfile sblock_vector to blocks in the domain.
When updating the original mapfile, how/where are these blocks merged into
the entire (pre-domain) mapfile? The code in update_mapfile seems the write
just the existing (domain-limited) sblock_vector?

'update_mapfile' always writes the whole block vector (maybe with domain-limited annotations). 'split_by_domain_borders' just splits the blocks to assure that no block is partially in domain. Before the final update, 'Mapfile::compact_sblock_vector' is called to merge the blocks again.


Hope this helps,
Antonio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]