Re: saving fr1 bitmap ?

"Peter T. Breuer" <[email protected]>
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
"Also sprach denis bonnenfant:"
> A simpler way to do that may be to allow bitmap created in step 1 on B to be saved to a temporary 
> file when stopping array on B. This way, A will just have to download the bitmap file (scp, for 
> example) and then start its array with this bitmap, allowing fast sync in any cases.


OK - I am willing to try that. Doing this CORRECTLY is probably very
complicated (you can help by telling me how to write to a file from
within the kernel - I'm lazy) since the bitmap is changing as the file
is written. One probably needs a snapsht mechanism. Or maybe one can do
some miraculous work with mmap and map the bitmap directly onto a file
.. but then what keeps it up to date? Nothing, except syncing.

However doing this as a bodge is quite easy. The easiest thing is
probably to implement an ioctl to get the bitmap value for a particular
block. There is in bitmap.c a commented out function called

   static int
   bitmap_test_bit (struct bitmap *bitmap, unsigned long block);

which would do the trick (it just calls a more generic function which
tests a sequence of blocks all at once).

That would be fine to use.

As to restoring the bitmap. Well, again, the easiest thing would be an
ioctl to set bits one by one, or read them from the save file.

In sum .. tell me how to do the read/write file trick. 


Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.