Print this page
6536 zfs send: want a way to disable sending of free records
Reviewed by: Alexander Stetsenko <astetsenko@racktopsystems.com>
Reviewed by: Kim Shrier <kshrier@racktopsystems.com>

@@ -26,10 +26,11 @@
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
+ * Copyright 2015 RackTop Systems.
  */
 
 /*
  * ZFS ioctls.
  *

@@ -4403,10 +4404,11 @@
         int error;
         offset_t off;
         boolean_t estimate = (zc->zc_guid != 0);
         boolean_t embedok = (zc->zc_flags & 0x1);
         boolean_t large_block_ok = (zc->zc_flags & 0x2);
+        boolean_t skip_free = (zc->zc_flags & 0x4);
 
         if (zc->zc_obj != 0) {
                 dsl_pool_t *dp;
                 dsl_dataset_t *tosnap;
 

@@ -4465,11 +4467,11 @@
                         return (SET_ERROR(EBADF));
 
                 off = fp->f_offset;
                 error = dmu_send_obj(zc->zc_name, zc->zc_sendobj,
                     zc->zc_fromobj, embedok, large_block_ok,
-                    zc->zc_cookie, fp->f_vnode, &off);
+                    skip_free, zc->zc_cookie, fp->f_vnode, &off);
 
                 if (VOP_SEEK(fp->f_vnode, fp->f_offset, &off, NULL) == 0)
                         fp->f_offset = off;
                 releasef(zc->zc_cookie);
         }

@@ -5394,10 +5396,12 @@
  *     (optional) "fromsnap" -> full snap name to send an incremental from
  *     (optional) "largeblockok" -> (value ignored)
  *         indicates that blocks > 128KB are permitted
  *     (optional) "embedok" -> (value ignored)
  *         presence indicates DRR_WRITE_EMBEDDED records are permitted
+ *     (optional) "skipfree" -> (value ignored)
+ *         presence indicates free records should be omitted
  *     (optional) "resume_object" and "resume_offset" -> (uint64)
  *         if present, resume send stream from specified object and offset.
  * }
  *
  * outnvl is unused

@@ -5410,10 +5414,11 @@
         offset_t off;
         char *fromname = NULL;
         int fd;
         boolean_t largeblockok;
         boolean_t embedok;
+        boolean_t skipfree;
         uint64_t resumeobj = 0;
         uint64_t resumeoff = 0;
 
         error = nvlist_lookup_int32(innvl, "fd", &fd);
         if (error != 0)

@@ -5421,21 +5426,22 @@
 
         (void) nvlist_lookup_string(innvl, "fromsnap", &fromname);
 
         largeblockok = nvlist_exists(innvl, "largeblockok");
         embedok = nvlist_exists(innvl, "embedok");
+        skipfree = nvlist_exists(innvl, "skipfree");
 
         (void) nvlist_lookup_uint64(innvl, "resume_object", &resumeobj);
         (void) nvlist_lookup_uint64(innvl, "resume_offset", &resumeoff);
 
         file_t *fp = getf(fd);
         if (fp == NULL)
                 return (SET_ERROR(EBADF));
 
         off = fp->f_offset;
-        error = dmu_send(snapname, fromname, embedok, largeblockok, fd,
-            resumeobj, resumeoff, fp->f_vnode, &off);
+        error = dmu_send(snapname, fromname, embedok, largeblockok, skipfree,
+            fd, resumeobj, resumeoff, fp->f_vnode, &off);
 
         if (VOP_SEEK(fp->f_vnode, fp->f_offset, &off, NULL) == 0)
                 fp->f_offset = off;
         releasef(fd);
         return (error);