From: Brian Behlendorf Date: Fri, 5 Dec 2008 17:13:58 +0000 (-0800) Subject: Refresh gcc-uninit branch X-Git-Tag: zfs-0.4.1~447^2^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f7a975c8ecb765f606325ace42fd7a8980664cd;p=zfs Refresh gcc-uninit branch --- 3f7a975c8ecb765f606325ace42fd7a8980664cd diff --cc zfs/lib/libzpool/arc.c index 2adfc2c8d,73aecb285..bd567c1c5 --- a/zfs/lib/libzpool/arc.c +++ b/zfs/lib/libzpool/arc.c @@@ -2386,14 -2422,38 +2422,38 @@@ arc_read_done(zio_t *zio * * arc_read_done() will invoke all the requested "done" functions * for readers of this block. + * + * Normal callers should use arc_read and pass the arc buffer and offset + * for the bp. But if you know you don't need locking, you can use + * arc_read_bp. */ int - arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_byteswap_func_t *swap, - arc_done_func_t *done, void *private, int priority, int flags, - uint32_t *arc_flags, zbookmark_t *zb) + arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *pbuf, + arc_done_func_t *done, void *private, int priority, int zio_flags, + uint32_t *arc_flags, const zbookmark_t *zb) + { + int err; + arc_buf_hdr_t *hdr = pbuf->b_hdr; + + ASSERT(!refcount_is_zero(&pbuf->b_hdr->b_refcnt)); + ASSERT3U((char *)bp - (char *)pbuf->b_data, <, pbuf->b_hdr->b_size); + rw_enter(&pbuf->b_lock, RW_READER); + + err = arc_read_nolock(pio, spa, bp, done, private, priority, + zio_flags, arc_flags, zb); + + ASSERT3P(hdr, ==, pbuf->b_hdr); + rw_exit(&pbuf->b_lock); + return (err); + } + + int + arc_read_nolock(zio_t *pio, spa_t *spa, blkptr_t *bp, + arc_done_func_t *done, void *private, int priority, int zio_flags, + uint32_t *arc_flags, const zbookmark_t *zb) { arc_buf_hdr_t *hdr; - arc_buf_t *buf; + arc_buf_t *buf = NULL; kmutex_t *hash_lock; zio_t *rzio; @@@ -2764,13 -2833,17 +2833,17 @@@ arc_buf_evict(arc_buf_t *buf void arc_release(arc_buf_t *buf, void *tag) { - arc_buf_hdr_t *hdr = buf->b_hdr; - kmutex_t *hash_lock = HDR_LOCK(hdr); - l2arc_buf_hdr_t *l2hdr = NULL; + arc_buf_hdr_t *hdr; + kmutex_t *hash_lock; + l2arc_buf_hdr_t *l2hdr; - uint64_t buf_size; + uint64_t buf_size = 0; + rw_enter(&buf->b_lock, RW_WRITER); + hdr = buf->b_hdr; + /* this buffer is not on any list */ ASSERT(refcount_count(&hdr->b_refcnt) > 0); + ASSERT(!(hdr->b_flags & ARC_STORED)); if (hdr->b_state == arc_anon) { /* this buffer is already released */ @@@ -3856,17 -4050,13 +4050,14 @@@ l2arc_write_buffers(spa_t *spa, l2arc_d arc_buf_hdr_t *ab, *ab_prev, *head; l2arc_buf_hdr_t *hdrl2; list_t *list; - uint64_t passed_sz, write_sz, buf_sz; - uint64_t target_sz = dev->l2ad_write; - uint64_t headroom = dev->l2ad_write * l2arc_headroom; + uint64_t passed_sz, write_sz, buf_sz, headroom; void *buf_data; - kmutex_t *hash_lock, *list_lock; + kmutex_t *hash_lock, *list_lock = NULL; boolean_t have_lock, full; l2arc_write_callback_t *cb; zio_t *pio, *wzio; + int try; - ASSERT(MUTEX_HELD(&l2arc_dev_mtx)); ASSERT(dev->l2ad_vdev != NULL); pio = NULL; diff --cc zfs/lib/libzpool/spa.c index 136d0874e,fb1b96f8b..a24c281e2 --- a/zfs/lib/libzpool/spa.c +++ b/zfs/lib/libzpool/spa.c @@@ -799,10 -816,12 +816,12 @@@ spa_load_l2cache(spa_t *spa nvlist_t **l2cache; uint_t nl2cache; int i, j, oldnvdevs; - uint64_t guid; + uint64_t guid, size; - vdev_t *vd, **oldvdevs, **newvdevs; + vdev_t *vd, **oldvdevs, **newvdevs = NULL; spa_aux_vdev_t *sav = &spa->spa_l2cache; + ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); + if (sav->sav_config != NULL) { VERIFY(nvlist_lookup_nvlist_array(sav->sav_config, ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0); @@@ -2827,7 -3006,8 +3006,8 @@@ spa_vdev_detach(spa_t *spa, uint64_t gu vdev_t *rvd = spa->spa_root_vdev; vdev_t *vd, *pvd, *cvd, *tvd; boolean_t unspare = B_FALSE; - uint64_t unspare_guid; + uint64_t unspare_guid = 0; + size_t len; txg = spa_vdev_enter(spa);