Deleted Added
full compact
zio.c (232066) zio.c (243674)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 112 unchanged lines hidden (view full) ---

121 size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
122 size_t p2 = size;
123 size_t align = 0;
124 size_t cflags = (size > zio_buf_debug_limit) ? (KMC_NODEBUG|KMC_NOTOUCH) : 0;
125
126 while (p2 & (p2 - 1))
127 p2 &= p2 - 1;
128
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 112 unchanged lines hidden (view full) ---

121 size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
122 size_t p2 = size;
123 size_t align = 0;
124 size_t cflags = (size > zio_buf_debug_limit) ? (KMC_NODEBUG|KMC_NOTOUCH) : 0;
125
126 while (p2 & (p2 - 1))
127 p2 &= p2 - 1;
128
129#ifdef illumos
130#ifndef _KERNEL
131 /*
132 * If we are using watchpoints, put each buffer on its own page,
133 * to eliminate the performance overhead of trapping to the
134 * kernel when modifying a non-watched buffer that shares the
135 * page with a watched buffer.
136 */
137 if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE))
138 continue;
139#endif
140#endif /* illumos */
129 if (size <= 4 * SPA_MINBLOCKSIZE) {
130 align = SPA_MINBLOCKSIZE;
141 if (size <= 4 * SPA_MINBLOCKSIZE) {
142 align = SPA_MINBLOCKSIZE;
131 } else if (P2PHASE(size, PAGESIZE) == 0) {
143 } else if (IS_P2ALIGNED(size, PAGESIZE)) {
132 align = PAGESIZE;
144 align = PAGESIZE;
133 } else if (P2PHASE(size, p2 >> 2) == 0) {
145 } else if (IS_P2ALIGNED(size, p2 >> 2)) {
134 align = p2 >> 2;
135 }
136
137 if (align != 0) {
138 char name[36];
139 (void) sprintf(name, "zio_buf_%lu", (ulong_t)size);
140 zio_buf_cache[c] = kmem_cache_create(name, size,
141 align, NULL, NULL, NULL, NULL, NULL, cflags);

--- 488 unchanged lines hidden (view full) ---

630 int priority, enum zio_flag flags, const zbookmark_t *zb)
631{
632 zio_t *zio;
633
634 ASSERT(zp->zp_checksum >= ZIO_CHECKSUM_OFF &&
635 zp->zp_checksum < ZIO_CHECKSUM_FUNCTIONS &&
636 zp->zp_compress >= ZIO_COMPRESS_OFF &&
637 zp->zp_compress < ZIO_COMPRESS_FUNCTIONS &&
146 align = p2 >> 2;
147 }
148
149 if (align != 0) {
150 char name[36];
151 (void) sprintf(name, "zio_buf_%lu", (ulong_t)size);
152 zio_buf_cache[c] = kmem_cache_create(name, size,
153 align, NULL, NULL, NULL, NULL, NULL, cflags);

--- 488 unchanged lines hidden (view full) ---

642 int priority, enum zio_flag flags, const zbookmark_t *zb)
643{
644 zio_t *zio;
645
646 ASSERT(zp->zp_checksum >= ZIO_CHECKSUM_OFF &&
647 zp->zp_checksum < ZIO_CHECKSUM_FUNCTIONS &&
648 zp->zp_compress >= ZIO_COMPRESS_OFF &&
649 zp->zp_compress < ZIO_COMPRESS_FUNCTIONS &&
638 zp->zp_type < DMU_OT_NUMTYPES &&
650 DMU_OT_IS_VALID(zp->zp_type) &&
639 zp->zp_level < 32 &&
640 zp->zp_copies > 0 &&
641 zp->zp_copies <= spa_max_replication(spa) &&
642 zp->zp_dedup <= 1 &&
643 zp->zp_dedup_verify <= 1);
644
645 zio = zio_create(pio, spa, txg, bp, data, size, done, private,
646 ZIO_TYPE_WRITE, priority, flags, NULL, 0, zb,

--- 267 unchanged lines hidden (view full) ---

914 zio->io_child_type == ZIO_CHILD_LOGICAL &&
915 !(zio->io_flags & ZIO_FLAG_RAW)) {
916 uint64_t psize = BP_GET_PSIZE(bp);
917 void *cbuf = zio_buf_alloc(psize);
918
919 zio_push_transform(zio, cbuf, psize, psize, zio_decompress);
920 }
921
651 zp->zp_level < 32 &&
652 zp->zp_copies > 0 &&
653 zp->zp_copies <= spa_max_replication(spa) &&
654 zp->zp_dedup <= 1 &&
655 zp->zp_dedup_verify <= 1);
656
657 zio = zio_create(pio, spa, txg, bp, data, size, done, private,
658 ZIO_TYPE_WRITE, priority, flags, NULL, 0, zb,

--- 267 unchanged lines hidden (view full) ---

926 zio->io_child_type == ZIO_CHILD_LOGICAL &&
927 !(zio->io_flags & ZIO_FLAG_RAW)) {
928 uint64_t psize = BP_GET_PSIZE(bp);
929 void *cbuf = zio_buf_alloc(psize);
930
931 zio_push_transform(zio, cbuf, psize, psize, zio_decompress);
932 }
933
922 if (!dmu_ot[BP_GET_TYPE(bp)].ot_metadata && BP_GET_LEVEL(bp) == 0)
934 if (!DMU_OT_IS_METADATA(BP_GET_TYPE(bp)) && BP_GET_LEVEL(bp) == 0)
923 zio->io_flags |= ZIO_FLAG_DONT_CACHE;
924
925 if (BP_GET_TYPE(bp) == DMU_OT_DDT_ZAP)
926 zio->io_flags |= ZIO_FLAG_DONT_CACHE;
927
928 if (BP_GET_DEDUP(bp) && zio->io_child_type == ZIO_CHILD_LOGICAL)
929 zio->io_pipeline = ZIO_DDT_READ_PIPELINE;
930

--- 1218 unchanged lines hidden (view full) ---

2149 int flags = 0;
2150
2151 if (zio->io_gang_leader == NULL) {
2152 ASSERT(zio->io_child_type > ZIO_CHILD_GANG);
2153 zio->io_gang_leader = zio;
2154 }
2155
2156 ASSERT(BP_IS_HOLE(bp));
935 zio->io_flags |= ZIO_FLAG_DONT_CACHE;
936
937 if (BP_GET_TYPE(bp) == DMU_OT_DDT_ZAP)
938 zio->io_flags |= ZIO_FLAG_DONT_CACHE;
939
940 if (BP_GET_DEDUP(bp) && zio->io_child_type == ZIO_CHILD_LOGICAL)
941 zio->io_pipeline = ZIO_DDT_READ_PIPELINE;
942

--- 1218 unchanged lines hidden (view full) ---

2161 int flags = 0;
2162
2163 if (zio->io_gang_leader == NULL) {
2164 ASSERT(zio->io_child_type > ZIO_CHILD_GANG);
2165 zio->io_gang_leader = zio;
2166 }
2167
2168 ASSERT(BP_IS_HOLE(bp));
2157 ASSERT3U(BP_GET_NDVAS(bp), ==, 0);
2169 ASSERT0(BP_GET_NDVAS(bp));
2158 ASSERT3U(zio->io_prop.zp_copies, >, 0);
2159 ASSERT3U(zio->io_prop.zp_copies, <=, spa_max_replication(spa));
2160 ASSERT3U(zio->io_size, ==, BP_GET_PSIZE(bp));
2161
2162 /*
2163 * The dump device does not support gang blocks so allocation on
2164 * behalf of the dump device (i.e. ZIO_FLAG_NODATA) must avoid
2165 * the "fast" gang feature.

--- 839 unchanged lines hidden (view full) ---

3005 zio_dva_claim,
3006 zio_ready,
3007 zio_vdev_io_start,
3008 zio_vdev_io_done,
3009 zio_vdev_io_assess,
3010 zio_checksum_verify,
3011 zio_done
3012};
2170 ASSERT3U(zio->io_prop.zp_copies, >, 0);
2171 ASSERT3U(zio->io_prop.zp_copies, <=, spa_max_replication(spa));
2172 ASSERT3U(zio->io_size, ==, BP_GET_PSIZE(bp));
2173
2174 /*
2175 * The dump device does not support gang blocks so allocation on
2176 * behalf of the dump device (i.e. ZIO_FLAG_NODATA) must avoid
2177 * the "fast" gang feature.

--- 839 unchanged lines hidden (view full) ---

3017 zio_dva_claim,
3018 zio_ready,
3019 zio_vdev_io_start,
3020 zio_vdev_io_done,
3021 zio_vdev_io_assess,
3022 zio_checksum_verify,
3023 zio_done
3024};
3025
3026/* dnp is the dnode for zb1->zb_object */
3027boolean_t
3028zbookmark_is_before(const dnode_phys_t *dnp, const zbookmark_t *zb1,
3029 const zbookmark_t *zb2)
3030{
3031 uint64_t zb1nextL0, zb2thisobj;
3032
3033 ASSERT(zb1->zb_objset == zb2->zb_objset);
3034 ASSERT(zb2->zb_level == 0);
3035
3036 /*
3037 * A bookmark in the deadlist is considered to be after
3038 * everything else.
3039 */
3040 if (zb2->zb_object == DMU_DEADLIST_OBJECT)
3041 return (B_TRUE);
3042
3043 /* The objset_phys_t isn't before anything. */
3044 if (dnp == NULL)
3045 return (B_FALSE);
3046
3047 zb1nextL0 = (zb1->zb_blkid + 1) <<
3048 ((zb1->zb_level) * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT));
3049
3050 zb2thisobj = zb2->zb_object ? zb2->zb_object :
3051 zb2->zb_blkid << (DNODE_BLOCK_SHIFT - DNODE_SHIFT);
3052
3053 if (zb1->zb_object == DMU_META_DNODE_OBJECT) {
3054 uint64_t nextobj = zb1nextL0 *
3055 (dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT) >> DNODE_SHIFT;
3056 return (nextobj <= zb2thisobj);
3057 }
3058
3059 if (zb1->zb_object < zb2thisobj)
3060 return (B_TRUE);
3061 if (zb1->zb_object > zb2thisobj)
3062 return (B_FALSE);
3063 if (zb2->zb_object == DMU_META_DNODE_OBJECT)
3064 return (B_FALSE);
3065 return (zb1nextL0 <= zb2->zb_blkid);
3066}