From: greg.freemyer@gmail.com (Greg Freemyer)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Snapshot in ext4
Date: Thu, 5 Jan 2012 14:35:15 -0500 [thread overview]
Message-ID: <CAGpXXZLYLe=tJ2iL1_DscQDo3tNQkfgw==EUWrECyio-C5EKkg@mail.gmail.com> (raw)
In-Reply-To: <CAJokiOcvVdLMH-7GVG-F5TLmSOn02tipT=hGyvE+GTf5e2VCAg@mail.gmail.com>
On Wed, Jan 4, 2012 at 4:55 AM, Swapnil Gaikwad <swapnilgaik72@gmail.com> wrote:
> If we store snapshot on other partition and assign new inode to each file's
> snapshot. Then datablocks of that partition where we store snapshot is
> wasted ? If not how?
That's effectively what a device mapper snapshot does.
Since only _changed_ blocks (inodes, pointer blocks, and data blocks)
are maintained in the snapshot volume, the snapshot volume can be much
smaller than the original volume.
I haven't studied the code, but obviously they have something like:
struct {
boolean virgin;
int alt_location;
} map[max_blocks];
So a read from the snapshot is just:
if (map[block].virgin)
read(primary_volume, block)
else
read(snapshot_volume,map[block].alt_location)
And write to the primary volume becomes
if (map[block].virgin) {
alt_loc=alloc_block_in_snapshot()
map[block].alt_location = alt_loc
map[block].virgin = false
copy(block,alt_loc)
}
write(primary_volume, block)
Then when your snapshot volume fills up, you have to discard it
because it can't hold anymore changes. So if your snapshot volume is
only 10% of the size of the primary volume, you can only support
having 10% of the original volume written to.
Greg
next prev parent reply other threads:[~2012-01-05 19:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-04 9:55 Snapshot in ext4 Swapnil Gaikwad
2012-01-05 19:35 ` Greg Freemyer [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-01-04 9:56 Swapnil Gaikwad
2012-01-05 19:40 ` Greg Freemyer
2012-01-04 9:53 Swapnil Gaikwad
2012-01-05 19:21 ` Greg Freemyer
2012-01-04 9:43 Swapnil Gaikwad
2012-01-05 19:17 ` Greg Freemyer
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='CAGpXXZLYLe=tJ2iL1_DscQDo3tNQkfgw==EUWrECyio-C5EKkg@mail.gmail.com' \
--to=greg.freemyer@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/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 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).