arc.c (246666) | arc.c (247187) |
---|---|
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 --- 3031 unchanged lines hidden (view full) --- 3040 * for readers of this block. 3041 */ 3042int 3043arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, 3044 void *private, int priority, int zio_flags, uint32_t *arc_flags, 3045 const zbookmark_t *zb) 3046{ 3047 arc_buf_hdr_t *hdr; | 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 --- 3031 unchanged lines hidden (view full) --- 3040 * for readers of this block. 3041 */ 3042int 3043arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, 3044 void *private, int priority, int zio_flags, uint32_t *arc_flags, 3045 const zbookmark_t *zb) 3046{ 3047 arc_buf_hdr_t *hdr; |
3048 arc_buf_t *buf; | 3048 arc_buf_t *buf = NULL; |
3049 kmutex_t *hash_lock; 3050 zio_t *rzio; 3051 uint64_t guid = spa_load_guid(spa); 3052 3053top: 3054 hdr = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp), 3055 &hash_lock); 3056 if (hdr && hdr->b_datacnt > 0) { --- 65 unchanged lines hidden (view full) --- 3122 data, metadata, hits); 3123 3124 if (done) 3125 done(NULL, buf, private); 3126 } else { 3127 uint64_t size = BP_GET_LSIZE(bp); 3128 arc_callback_t *acb; 3129 vdev_t *vd = NULL; | 3049 kmutex_t *hash_lock; 3050 zio_t *rzio; 3051 uint64_t guid = spa_load_guid(spa); 3052 3053top: 3054 hdr = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp), 3055 &hash_lock); 3056 if (hdr && hdr->b_datacnt > 0) { --- 65 unchanged lines hidden (view full) --- 3122 data, metadata, hits); 3123 3124 if (done) 3125 done(NULL, buf, private); 3126 } else { 3127 uint64_t size = BP_GET_LSIZE(bp); 3128 arc_callback_t *acb; 3129 vdev_t *vd = NULL; |
3130 uint64_t addr; | 3130 uint64_t addr = 0; |
3131 boolean_t devw = B_FALSE; 3132 3133 if (hdr == NULL) { 3134 /* this block is not in the cache */ 3135 arc_buf_hdr_t *exists; 3136 arc_buf_contents_t type = BP_GET_BUFC_TYPE(bp); 3137 buf = arc_buf_alloc(spa, size, private, type); 3138 hdr = buf->b_hdr; --- 101 unchanged lines hidden (view full) --- 3240 cb = kmem_zalloc(sizeof (l2arc_read_callback_t), 3241 KM_SLEEP); 3242 cb->l2rcb_buf = buf; 3243 cb->l2rcb_spa = spa; 3244 cb->l2rcb_bp = *bp; 3245 cb->l2rcb_zb = *zb; 3246 cb->l2rcb_flags = zio_flags; 3247 | 3131 boolean_t devw = B_FALSE; 3132 3133 if (hdr == NULL) { 3134 /* this block is not in the cache */ 3135 arc_buf_hdr_t *exists; 3136 arc_buf_contents_t type = BP_GET_BUFC_TYPE(bp); 3137 buf = arc_buf_alloc(spa, size, private, type); 3138 hdr = buf->b_hdr; --- 101 unchanged lines hidden (view full) --- 3240 cb = kmem_zalloc(sizeof (l2arc_read_callback_t), 3241 KM_SLEEP); 3242 cb->l2rcb_buf = buf; 3243 cb->l2rcb_spa = spa; 3244 cb->l2rcb_bp = *bp; 3245 cb->l2rcb_zb = *zb; 3246 cb->l2rcb_flags = zio_flags; 3247 |
3248 ASSERT(addr >= VDEV_LABEL_START_SIZE && 3249 addr + size < vd->vdev_psize - 3250 VDEV_LABEL_END_SIZE); 3251 |
|
3248 /* 3249 * l2arc read. The SCL_L2ARC lock will be 3250 * released by l2arc_read_done(). 3251 */ 3252 rzio = zio_read_phys(pio, vd, addr, size, 3253 buf->b_data, ZIO_CHECKSUM_OFF, 3254 l2arc_read_done, cb, priority, zio_flags | 3255 ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL | --- 179 unchanged lines hidden (view full) --- 3435 hdr = buf->b_hdr; 3436 ASSERT3P(hash_lock, ==, HDR_LOCK(hdr)); 3437 } 3438 3439 l2hdr = hdr->b_l2hdr; 3440 if (l2hdr) { 3441 mutex_enter(&l2arc_buflist_mtx); 3442 hdr->b_l2hdr = NULL; | 3252 /* 3253 * l2arc read. The SCL_L2ARC lock will be 3254 * released by l2arc_read_done(). 3255 */ 3256 rzio = zio_read_phys(pio, vd, addr, size, 3257 buf->b_data, ZIO_CHECKSUM_OFF, 3258 l2arc_read_done, cb, priority, zio_flags | 3259 ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL | --- 179 unchanged lines hidden (view full) --- 3439 hdr = buf->b_hdr; 3440 ASSERT3P(hash_lock, ==, HDR_LOCK(hdr)); 3441 } 3442 3443 l2hdr = hdr->b_l2hdr; 3444 if (l2hdr) { 3445 mutex_enter(&l2arc_buflist_mtx); 3446 hdr->b_l2hdr = NULL; |
3443 buf_size = hdr->b_size; | |
3444 } | 3447 } |
3448 buf_size = hdr->b_size; |
|
3445 3446 /* 3447 * Do we have more than one buf? 3448 */ 3449 if (hdr->b_datacnt > 1) { 3450 arc_buf_hdr_t *nhdr; 3451 arc_buf_t **bufp; 3452 uint64_t blksz = hdr->b_size; --- 1086 unchanged lines hidden (view full) --- 4539 * 4540 * Currently the metadata lists are hit first, MFU then MRU, followed by 4541 * the data lists. This function returns a locked list, and also returns 4542 * the lock pointer. 4543 */ 4544static list_t * 4545l2arc_list_locked(int list_num, kmutex_t **lock) 4546{ | 3449 3450 /* 3451 * Do we have more than one buf? 3452 */ 3453 if (hdr->b_datacnt > 1) { 3454 arc_buf_hdr_t *nhdr; 3455 arc_buf_t **bufp; 3456 uint64_t blksz = hdr->b_size; --- 1086 unchanged lines hidden (view full) --- 4543 * 4544 * Currently the metadata lists are hit first, MFU then MRU, followed by 4545 * the data lists. This function returns a locked list, and also returns 4546 * the lock pointer. 4547 */ 4548static list_t * 4549l2arc_list_locked(int list_num, kmutex_t **lock) 4550{ |
4547 list_t *list; | 4551 list_t *list = NULL; |
4548 int idx; 4549 4550 ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS); 4551 4552 if (list_num < ARC_BUFC_NUMMETADATALISTS) { 4553 idx = list_num; 4554 list = &arc_mfu->arcs_lists[idx]; 4555 *lock = ARCS_LOCK(arc_mfu, idx); --- 601 unchanged lines hidden --- | 4552 int idx; 4553 4554 ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS); 4555 4556 if (list_num < ARC_BUFC_NUMMETADATALISTS) { 4557 idx = list_num; 4558 list = &arc_mfu->arcs_lists[idx]; 4559 *lock = ARCS_LOCK(arc_mfu, idx); --- 601 unchanged lines hidden --- |