* Write intent bitmap algorithm
@ 2016-05-20 7:03 Ankur Bose
2016-05-22 23:19 ` NeilBrown
0 siblings, 1 reply; 2+ messages in thread
From: Ankur Bose @ 2016-05-20 7:03 UTC (permalink / raw)
To: linux-raid
Hi All,
We are doing performance analysis of MD raid1 and wanted to know the flow/algorithm of the writes with write intent bitmap.
As per "man md" below lines gives the algo
"Before any write request is honored, md will make sure that the corresponding bit in the log is set. After a period of time with no writes to an area of the array, the corresponding bit will be cleared."
Here we wanted to know after what period of time and what is the logic to calculate this period of time which MD does ?
I see a function "void bitmap_daemon_work(struct mddev *mddev)" in bitmap.c file but trying to figure out the logic how it is used.
Thanks,
ankur.
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Write intent bitmap algorithm
2016-05-20 7:03 Write intent bitmap algorithm Ankur Bose
@ 2016-05-22 23:19 ` NeilBrown
0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2016-05-22 23:19 UTC (permalink / raw)
To: Ankur Bose, linux-raid
[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]
On Fri, May 20 2016, Ankur Bose wrote:
> Hi All,
>
> We are doing performance analysis of MD raid1 and wanted to know the flow/algorithm of the writes with write intent bitmap.
> As per "man md" below lines gives the algo
>
> "Before any write request is honored, md will make sure that the corresponding bit in the log is set. After a period of time with no writes to an area of the array, the corresponding bit will be cleared."
>
> Here we wanted to know after what period of time and what is the logic
> to calculate this period of time which MD does ?
When you create an array with a bitmap, or use --grow to add a bitmap,
you can provide the --delay option to give a delay in seconds (which
seems to not be documented in mdadm.8 :-( Patches welcomem.
Alternately when the array is running you can inspected and change
/sys/block/mdXXX/md/bitmap_time_base
Every this-many seconds a task runs in the kernel which marks any bits
with a count that recently reach zero as "should be written", updates
the on-disk bitmap to clear any bits that were marked "should be
written".
So a bit with an active-write count of zero will be cleared in the
non-disk bitmap between 1 and 2 delays after the count reaches zero.
>
> I see a function "void bitmap_daemon_work(struct mddev *mddev)" in bitmap.c file but trying to figure out the logic how it is used.
Yes, this is the task that is run every 'delay' or 'time_base' seconds.
The counter is offset bit 2 normally so when there are no active writes
bitmap_daemon_work will find a counter which is '2' and will change it
to '1'. If it finds a counter that is '1' it will change it to '0' and
immediately clear the bit in the in-memory image of the bitmap. Then it
will write out any pages of the bitmap which have changed.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-22 23:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-20 7:03 Write intent bitmap algorithm Ankur Bose
2016-05-22 23:19 ` NeilBrown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).