Print this page
OS-1566 filesystem limits for ZFS datasets


1780                 if (received)
1781                         break;
1782 
1783                 if (hasmntopt(&mnt, mntopt_on) && !*val) {
1784                         *val = B_TRUE;
1785                         if (src)
1786                                 *src = ZPROP_SRC_TEMPORARY;
1787                 } else if (hasmntopt(&mnt, mntopt_off) && *val) {
1788                         *val = B_FALSE;
1789                         if (src)
1790                                 *src = ZPROP_SRC_TEMPORARY;
1791                 }
1792                 break;
1793 
1794         case ZFS_PROP_CANMOUNT:
1795         case ZFS_PROP_VOLSIZE:
1796         case ZFS_PROP_QUOTA:
1797         case ZFS_PROP_REFQUOTA:
1798         case ZFS_PROP_RESERVATION:
1799         case ZFS_PROP_REFRESERVATION:


1800                 *val = getprop_uint64(zhp, prop, source);
1801 
1802                 if (*source == NULL) {
1803                         /* not default, must be local */
1804                         *source = zhp->zfs_name;
1805                 }
1806                 break;
1807 
1808         case ZFS_PROP_MOUNTED:
1809                 *val = (zhp->zfs_mntopts != NULL);
1810                 break;
1811 
1812         case ZFS_PROP_NUMCLONES:
1813                 *val = zhp->zfs_dmustats.dds_num_clones;
1814                 break;
1815 
1816         case ZFS_PROP_VERSION:
1817         case ZFS_PROP_NORMALIZE:
1818         case ZFS_PROP_UTF8ONLY:
1819         case ZFS_PROP_CASE:


2198                         return (-1);
2199 
2200                 /*
2201                  * If quota or reservation is 0, we translate this into 'none'
2202                  * (unless literal is set), and indicate that it's the default
2203                  * value.  Otherwise, we print the number nicely and indicate
2204                  * that its set locally.
2205                  */
2206                 if (val == 0) {
2207                         if (literal)
2208                                 (void) strlcpy(propbuf, "0", proplen);
2209                         else
2210                                 (void) strlcpy(propbuf, "none", proplen);
2211                 } else {
2212                         if (literal)
2213                                 (void) snprintf(propbuf, proplen, "%llu",
2214                                     (u_longlong_t)val);
2215                         else
2216                                 zfs_nicenum(val, propbuf, proplen);
2217                 }






















2218                 break;
2219 
2220         case ZFS_PROP_REFRATIO:
2221         case ZFS_PROP_COMPRESSRATIO:
2222                 if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2223                         return (-1);
2224                 (void) snprintf(propbuf, proplen, "%llu.%02llux",
2225                     (u_longlong_t)(val / 100),
2226                     (u_longlong_t)(val % 100));
2227                 break;
2228 
2229         case ZFS_PROP_TYPE:
2230                 switch (zhp->zfs_type) {
2231                 case ZFS_TYPE_FILESYSTEM:
2232                         str = "filesystem";
2233                         break;
2234                 case ZFS_TYPE_VOLUME:
2235                         str = "volume";
2236                         break;
2237                 case ZFS_TYPE_SNAPSHOT:




1780                 if (received)
1781                         break;
1782 
1783                 if (hasmntopt(&mnt, mntopt_on) && !*val) {
1784                         *val = B_TRUE;
1785                         if (src)
1786                                 *src = ZPROP_SRC_TEMPORARY;
1787                 } else if (hasmntopt(&mnt, mntopt_off) && *val) {
1788                         *val = B_FALSE;
1789                         if (src)
1790                                 *src = ZPROP_SRC_TEMPORARY;
1791                 }
1792                 break;
1793 
1794         case ZFS_PROP_CANMOUNT:
1795         case ZFS_PROP_VOLSIZE:
1796         case ZFS_PROP_QUOTA:
1797         case ZFS_PROP_REFQUOTA:
1798         case ZFS_PROP_RESERVATION:
1799         case ZFS_PROP_REFRESERVATION:
1800         case ZFS_PROP_FILESYSTEM_LIMIT:
1801         case ZFS_PROP_SNAPSHOT_LIMIT:
1802                 *val = getprop_uint64(zhp, prop, source);
1803 
1804                 if (*source == NULL) {
1805                         /* not default, must be local */
1806                         *source = zhp->zfs_name;
1807                 }
1808                 break;
1809 
1810         case ZFS_PROP_MOUNTED:
1811                 *val = (zhp->zfs_mntopts != NULL);
1812                 break;
1813 
1814         case ZFS_PROP_NUMCLONES:
1815                 *val = zhp->zfs_dmustats.dds_num_clones;
1816                 break;
1817 
1818         case ZFS_PROP_VERSION:
1819         case ZFS_PROP_NORMALIZE:
1820         case ZFS_PROP_UTF8ONLY:
1821         case ZFS_PROP_CASE:


2200                         return (-1);
2201 
2202                 /*
2203                  * If quota or reservation is 0, we translate this into 'none'
2204                  * (unless literal is set), and indicate that it's the default
2205                  * value.  Otherwise, we print the number nicely and indicate
2206                  * that its set locally.
2207                  */
2208                 if (val == 0) {
2209                         if (literal)
2210                                 (void) strlcpy(propbuf, "0", proplen);
2211                         else
2212                                 (void) strlcpy(propbuf, "none", proplen);
2213                 } else {
2214                         if (literal)
2215                                 (void) snprintf(propbuf, proplen, "%llu",
2216                                     (u_longlong_t)val);
2217                         else
2218                                 zfs_nicenum(val, propbuf, proplen);
2219                 }
2220                 break;
2221 
2222         case ZFS_PROP_FILESYSTEM_LIMIT:
2223         case ZFS_PROP_SNAPSHOT_LIMIT:
2224 
2225                 if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2226                         return (-1);
2227 
2228                 /*
2229                  * If limit is UINT64_MAX, we translate this into 'none' (unless
2230                  * literal is set), and indicate that it's the default value.
2231                  * Otherwise, we print the number nicely and indicate that it's
2232                  * set locally.
2233                  */
2234                 if (literal) {
2235                         (void) snprintf(propbuf, proplen, "%llu",
2236                             (u_longlong_t)val);
2237                 } else if (val == UINT64_MAX) {
2238                         (void) strlcpy(propbuf, "none", proplen);
2239                 } else {
2240                         zfs_nicenum(val, propbuf, proplen);
2241                 }
2242                 break;
2243 
2244         case ZFS_PROP_REFRATIO:
2245         case ZFS_PROP_COMPRESSRATIO:
2246                 if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2247                         return (-1);
2248                 (void) snprintf(propbuf, proplen, "%llu.%02llux",
2249                     (u_longlong_t)(val / 100),
2250                     (u_longlong_t)(val % 100));
2251                 break;
2252 
2253         case ZFS_PROP_TYPE:
2254                 switch (zhp->zfs_type) {
2255                 case ZFS_TYPE_FILESYSTEM:
2256                         str = "filesystem";
2257                         break;
2258                 case ZFS_TYPE_VOLUME:
2259                         str = "volume";
2260                         break;
2261                 case ZFS_TYPE_SNAPSHOT: