Print this page
Use the LZ4 algorithm to compress metadata when the corresponding feature is enabled

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/spa.c
          +++ new/usr/src/uts/common/fs/zfs/spa.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  25      - * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright (c) 2013, 2014, Nexenta Systems, Inc.  All rights reserved.
  26   26   */
  27   27  
  28   28  /*
  29   29   * SPA: Storage Pool Allocator
  30   30   *
  31   31   * This file contains all the routines used when modifying on-disk SPA state.
  32   32   * This includes opening, importing, destroying, exporting a pool, and syncing a
  33   33   * pool.
  34   34   */
  35   35  
↓ open down ↓ 6063 lines elided ↑ open up ↑
6099 6099                  dsl_pool_upgrade_dir_clones(dp, tx);
6100 6100  
6101 6101                  /* Keeping the freedir open increases spa_minref */
6102 6102                  spa->spa_minref += 3;
6103 6103          }
6104 6104  
6105 6105          if (spa->spa_ubsync.ub_version < SPA_VERSION_FEATURES &&
6106 6106              spa->spa_uberblock.ub_version >= SPA_VERSION_FEATURES) {
6107 6107                  spa_feature_create_zap_objects(spa, tx);
6108 6108          }
     6109 +
     6110 +        if (spa->spa_uberblock.ub_version >= SPA_VERSION_FEATURES) {
     6111 +                boolean_t lz4_en = spa_feature_is_enabled(spa,
     6112 +                    SPA_FEATURE_LZ4_COMPRESS);
     6113 +                boolean_t lz4_ac = spa_feature_is_active(spa,
     6114 +                    SPA_FEATURE_LZ4_COMPRESS);
     6115 +
     6116 +                if (lz4_en && !lz4_ac)
     6117 +                        spa_feature_incr(spa, SPA_FEATURE_LZ4_COMPRESS, tx);
     6118 +        }
6109 6119          rrw_exit(&dp->dp_config_rwlock, FTAG);
6110 6120  }
6111 6121  
6112 6122  /*
6113 6123   * Sync the specified transaction group.  New blocks may be dirtied as
6114 6124   * part of the process, so we iterate until it converges.
6115 6125   */
6116 6126  void
6117 6127  spa_sync(spa_t *spa, uint64_t txg)
6118 6128  {
↓ open down ↓ 430 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX