On 01/24/13 00:04, Matthew Ahrens wrote:
On Tue, Jan 22, 2013 at 5:29 AM, Darren J Moffat
<darr...@opensolaris.org <mailto:darr...@opensolaris.org>> wrote:
Preallocated ZVOLs - for swap/dump.
Darren, good to hear about the cool stuff in S11.
Just to clarify, is this preallocated ZVOL different than the
preallocated dump which has been there for quite some time (and is in
Illumos)? Can you use it for other zvols besides swap and dump?
It is the same but we are using it for swap now too. It isn't available
for general use.
Some background: the zfs dump device has always been preallocated
("thick provisioned"), so that we can reliably dump. By definition,
something has gone horribly wrong when we are dumping, so this code path
needs to be as small as possible to have any hope of getting a dump. So
we preallocate the space for dump, and store a simple linked list of
disk segments where it will be stored. The dump device is not COW,
checksummed, deduped, compressed, etc. by ZFS.
For the sake of others, I know you know this Matt, the dump system does
the compression so ZFS didn't need to anyway.
In Illumos (and S10), swap was treated more or less like a regular zvol.
This leads to some tricky code paths because ZFS allocates memory from
many points in the code as it is writing out changes. I could see
advantages to the simplicity of a preallocated swap volume, using the
same code that already existed for preallocated dump. Of course, the
loss of checksumming and encryption is much more of a concern with swap
(which is critical for correct behavior) than with dump (which is nice
to have for debugging).
We have encryption for dump because it is hooked in to the zvol code.
For encrypting swap Illumos could do the same as Solaris 11 does and use
lofi. I changed swapadd so that if "encryption" is specified in the
options field of the vfstab entry it creates a lofi shim over the swap
device using 'lofiadm -e'. This provides you encrypted swap regardless
of what the underlying "disk" is (normal ZVOL, prealloc ZVOL, real disk
slide, SVM mirror etc).
Darren J Moffat
zfs-discuss mailing list