Print this page
OS-1566 filesystem limits for ZFS datasets

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libzfs/common/libzfs_dataset.c
          +++ new/usr/src/lib/libzfs/common/libzfs_dataset.c
↓ open down ↓ 1789 lines elided ↑ open up ↑
1790 1790                                  *src = ZPROP_SRC_TEMPORARY;
1791 1791                  }
1792 1792                  break;
1793 1793  
1794 1794          case ZFS_PROP_CANMOUNT:
1795 1795          case ZFS_PROP_VOLSIZE:
1796 1796          case ZFS_PROP_QUOTA:
1797 1797          case ZFS_PROP_REFQUOTA:
1798 1798          case ZFS_PROP_RESERVATION:
1799 1799          case ZFS_PROP_REFRESERVATION:
     1800 +        case ZFS_PROP_FILESYSTEM_LIMIT:
     1801 +        case ZFS_PROP_SNAPSHOT_LIMIT:
1800 1802                  *val = getprop_uint64(zhp, prop, source);
1801 1803  
1802 1804                  if (*source == NULL) {
1803 1805                          /* not default, must be local */
1804 1806                          *source = zhp->zfs_name;
1805 1807                  }
1806 1808                  break;
1807 1809  
1808 1810          case ZFS_PROP_MOUNTED:
1809 1811                  *val = (zhp->zfs_mntopts != NULL);
↓ open down ↓ 399 lines elided ↑ open up ↑
2209 2211                          else
2210 2212                                  (void) strlcpy(propbuf, "none", proplen);
2211 2213                  } else {
2212 2214                          if (literal)
2213 2215                                  (void) snprintf(propbuf, proplen, "%llu",
2214 2216                                      (u_longlong_t)val);
2215 2217                          else
2216 2218                                  zfs_nicenum(val, propbuf, proplen);
2217 2219                  }
2218 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;
2219 2243  
2220 2244          case ZFS_PROP_REFRATIO:
2221 2245          case ZFS_PROP_COMPRESSRATIO:
2222 2246                  if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2223 2247                          return (-1);
2224 2248                  (void) snprintf(propbuf, proplen, "%llu.%02llux",
2225 2249                      (u_longlong_t)(val / 100),
2226 2250                      (u_longlong_t)(val % 100));
2227 2251                  break;
2228 2252  
↓ open down ↓ 2178 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX