Print this page
5255 uts shouldn't open-code ISP2


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  24  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  25  */
  26 

  27 #include <sys/zfs_context.h>
  28 #include <sys/fm/fs/zfs.h>
  29 #include <sys/spa.h>
  30 #include <sys/txg.h>
  31 #include <sys/spa_impl.h>
  32 #include <sys/vdev_impl.h>
  33 #include <sys/zio_impl.h>
  34 #include <sys/zio_compress.h>
  35 #include <sys/zio_checksum.h>
  36 #include <sys/dmu_objset.h>
  37 #include <sys/arc.h>
  38 #include <sys/ddt.h>
  39 #include <sys/blkptr.h>
  40 #include <sys/zfeature.h>
  41 
  42 /*
  43  * ==========================================================================
  44  * I/O type descriptions
  45  * ==========================================================================
  46  */


 102 #ifdef _KERNEL
 103         data_alloc_arena = zio_alloc_arena;
 104 #endif
 105         zio_cache = kmem_cache_create("zio_cache",
 106             sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
 107         zio_link_cache = kmem_cache_create("zio_link_cache",
 108             sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
 109 
 110         /*
 111          * For small buffers, we want a cache for each multiple of
 112          * SPA_MINBLOCKSIZE.  For medium-size buffers, we want a cache
 113          * for each quarter-power of 2.  For large buffers, we want
 114          * a cache for each multiple of PAGESIZE.
 115          */
 116         for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) {
 117                 size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
 118                 size_t p2 = size;
 119                 size_t align = 0;
 120                 size_t cflags = (size > zio_buf_debug_limit) ? KMC_NODEBUG : 0;
 121 
 122                 while (p2 & (p2 - 1))
 123                         p2 &= p2 - 1;
 124 
 125 #ifndef _KERNEL
 126                 /*
 127                  * If we are using watchpoints, put each buffer on its own page,
 128                  * to eliminate the performance overhead of trapping to the
 129                  * kernel when modifying a non-watched buffer that shares the
 130                  * page with a watched buffer.
 131                  */
 132                 if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE))
 133                         continue;
 134 #endif
 135                 if (size <= 4 * SPA_MINBLOCKSIZE) {
 136                         align = SPA_MINBLOCKSIZE;
 137                 } else if (IS_P2ALIGNED(size, PAGESIZE)) {
 138                         align = PAGESIZE;
 139                 } else if (IS_P2ALIGNED(size, p2 >> 2)) {
 140                         align = p2 >> 2;
 141                 }
 142 




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  24  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  25  */
  26 
  27 #include <sys/sysmacros.h>
  28 #include <sys/zfs_context.h>
  29 #include <sys/fm/fs/zfs.h>
  30 #include <sys/spa.h>
  31 #include <sys/txg.h>
  32 #include <sys/spa_impl.h>
  33 #include <sys/vdev_impl.h>
  34 #include <sys/zio_impl.h>
  35 #include <sys/zio_compress.h>
  36 #include <sys/zio_checksum.h>
  37 #include <sys/dmu_objset.h>
  38 #include <sys/arc.h>
  39 #include <sys/ddt.h>
  40 #include <sys/blkptr.h>
  41 #include <sys/zfeature.h>
  42 
  43 /*
  44  * ==========================================================================
  45  * I/O type descriptions
  46  * ==========================================================================
  47  */


 103 #ifdef _KERNEL
 104         data_alloc_arena = zio_alloc_arena;
 105 #endif
 106         zio_cache = kmem_cache_create("zio_cache",
 107             sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
 108         zio_link_cache = kmem_cache_create("zio_link_cache",
 109             sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
 110 
 111         /*
 112          * For small buffers, we want a cache for each multiple of
 113          * SPA_MINBLOCKSIZE.  For medium-size buffers, we want a cache
 114          * for each quarter-power of 2.  For large buffers, we want
 115          * a cache for each multiple of PAGESIZE.
 116          */
 117         for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) {
 118                 size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
 119                 size_t p2 = size;
 120                 size_t align = 0;
 121                 size_t cflags = (size > zio_buf_debug_limit) ? KMC_NODEBUG : 0;
 122 
 123                 while (!ISP2(p2))
 124                         p2 &= p2 - 1;
 125 
 126 #ifndef _KERNEL
 127                 /*
 128                  * If we are using watchpoints, put each buffer on its own page,
 129                  * to eliminate the performance overhead of trapping to the
 130                  * kernel when modifying a non-watched buffer that shares the
 131                  * page with a watched buffer.
 132                  */
 133                 if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE))
 134                         continue;
 135 #endif
 136                 if (size <= 4 * SPA_MINBLOCKSIZE) {
 137                         align = SPA_MINBLOCKSIZE;
 138                 } else if (IS_P2ALIGNED(size, PAGESIZE)) {
 139                         align = PAGESIZE;
 140                 } else if (IS_P2ALIGNED(size, p2 >> 2)) {
 141                         align = p2 >> 2;
 142                 }
 143