[dm-devel] dm-log.c

Heinz Mauelshagen mauelshagen at redhat.com
Tue Oct 26 09:53:13 UTC 2004


On Mon, Oct 25, 2004 at 12:32:05PM -0500, pagcal at runbox.com wrote:
> Is there an architecture spec or overview document for dm-log.c ?
> 
> If not, what is it's function? What arguments are used in its setup?

It contains the logging functionality to keep track of clean/dirty regions
within a mirror set. Regions with writes in flight are dirty and those
with no writes pending are defined clean.

> 
> If I'm setting up a raid1 I would do something like
> 
> raid1.mirror > 0 `blockdev --getsize`
> mirror core 1 1024
> 2 /dev/hde 0 /dev/hdg 0
> 
> ---
> The last line is parsed by dm-raid1.c.
> 
> The 1024 is sent to dm-log, but why? What function does it do?

It defines the region size, which is typically much larger than
a block for optimization resaons, to keep dirty/clean state for.

IOW: we only know if a regions of the defined size is dirty or clean.

> 
> What are the first two arguments; 0 max-block-count used for?

The general syntax of a mapping table in device-mapper is:

start length target target-specific-parameters.

max-block-count = length of the segment you define.

You can have as many segments as you want to define the address
space of your mapped device.

> 
> core is the type of dm-log, but what is a 'core' dm-log?

A transient dirty-log implementation.
IOW: the state doesn't survive reboots etc.

If you want persistent state, have a look at the persistent dirty-log
(see disk_ctr() in dm-log.c).

> 
> ---
> 
> Do you have examples of setting up a raid1?

0 160086522 mirror core 2 64 nosync 2 /dev/sdc 0 /dev/sdd 0

sets up a 2 way mirror starting at the beginnings of sdc and sdd
using a transient dirty-log setting all regions to clean (nosync argument).

0 160086522 mirror disk /dev/sdb 1 64 2 /dev/sdc 0 /dev/sdd 0

sets up that 2 way mirror using a persistent dirty-log on /dev/mapper/disk_log.
Of course it's better to create another mapping for the dirty-log rather than
using a whole disk device. the size is defined by the amount of
"(2 * regions / 8 + 1024) / 512" in sectors.
regions = mirror_set_size[sectors] / region_size[sectors].

So in the example above:
(2 * 160086522 sectors / 64 / 8 + 1024) / 512 = 1123 sectors

> 
> ---
> 
> Thanks,
> Cal Page
> 
> --
> dm-devel mailing list
> dm-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

-- 

Regards,
Heinz    -- The LVM Guy --

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat GmbH
Consulting Development Engineer                   Am Sonnenhang 11
                                                  56242 Marienrachdorf
                                                  Germany
Mauelshagen at RedHat.com                            +49 2626 141200
                                                       FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




More information about the dm-devel mailing list