From: Ian Pilcher <arequipeno@gmail.com>
To: dm-devel@redhat.com
Subject: dm-cache metadata size questions
Date: Mon, 23 Nov 2015 16:43:37 -0600 [thread overview]
Message-ID: <n304qp$ttu$1@ger.gmane.org> (raw)
I am trying to come up with an algorithm to divide a single fast block
device into cache data and metadata, and I have several questions.
1. Is metadata_size = 4MiB + 16 * nr_blocks still the correct formula
for the metadata size?
2. Am I correct in thinking that the number of blocks is based on the
size of the cache data, rather than the origin device -- i.e.
nr_blocks = cache_size / block_size?
3. Assuming that both of the above are correct, how does this look?
AS: available space on "fast device"
BS: block size
MS: metadata size
CS: cache data size
NB: number of blocks
NB = CS / BS
MS = 4MiB + 16 * NB
= 4MiB + 16 * (CS / BS)
CS = AS - MS
= AS - (4MiB + 16 * (CS / BS))
= AS - 4MiB - 16 * CS / BS
CS * BS = (AS - 4MiB) * BS - 16 * CS
CS * BS + 16 * CS = (AS - 4MiB) * BS
CS * (BS + 16) = (AS - 4MiB) * BS
CS = (AS - 4MiB) * BS / (BS + 16)
I.e. given the available space on my fast device, and the desired
block size, I can calculate the cache data size as:
cache_size = (available_size - 4MiB) * block_size /
(block_size + 16)
and:
metadata_size = available_size - cache_size
Yay algebra!
--
========================================================================
Ian Pilcher arequipeno@gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
reply other threads:[~2015-11-23 22:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='n304qp$ttu$1@ger.gmane.org' \
--to=arequipeno@gmail.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.