Re: Snapshot in ext4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 4, 2012 at 4:55 AM, Swapnil Gaikwad <swapnilgaik72@xxxxxxxxx> 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux