Deleted Added
full compact
arc.c (268085) arc.c (268123)
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

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

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.
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

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

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) 2013 by Delphix. All rights reserved.
23 * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
24 * Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
25 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
26 */
27
28/*
29 * DVA-based Adjustable Replacement Cache
30 *
31 * While much of the theory of operation used here is

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

775static list_t *l2arc_free_on_write; /* free after write list ptr */
776static kmutex_t l2arc_free_on_write_mtx; /* mutex for list */
777static uint64_t l2arc_ndev; /* number of devices */
778
779typedef struct l2arc_read_callback {
780 arc_buf_t *l2rcb_buf; /* read buffer */
781 spa_t *l2rcb_spa; /* spa */
782 blkptr_t l2rcb_bp; /* original blkptr */
24 * Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
25 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
26 */
27
28/*
29 * DVA-based Adjustable Replacement Cache
30 *
31 * While much of the theory of operation used here is

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

775static list_t *l2arc_free_on_write; /* free after write list ptr */
776static kmutex_t l2arc_free_on_write_mtx; /* mutex for list */
777static uint64_t l2arc_ndev; /* number of devices */
778
779typedef struct l2arc_read_callback {
780 arc_buf_t *l2rcb_buf; /* read buffer */
781 spa_t *l2rcb_spa; /* spa */
782 blkptr_t l2rcb_bp; /* original blkptr */
783 zbookmark_t l2rcb_zb; /* original bookmark */
783 zbookmark_phys_t l2rcb_zb; /* original bookmark */
784 int l2rcb_flags; /* original flags */
785 enum zio_compress l2rcb_compress; /* applied compress */
786} l2arc_read_callback_t;
787
788typedef struct l2arc_write_callback {
789 l2arc_dev_t *l2wcb_dev; /* device info */
790 arc_buf_hdr_t *l2wcb_head; /* head of write buflist */
791} l2arc_write_callback_t;

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

3139 * and return; or just return.
3140 *
3141 * arc_read_done() will invoke all the requested "done" functions
3142 * for readers of this block.
3143 */
3144int
3145arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done,
3146 void *private, zio_priority_t priority, int zio_flags, uint32_t *arc_flags,
784 int l2rcb_flags; /* original flags */
785 enum zio_compress l2rcb_compress; /* applied compress */
786} l2arc_read_callback_t;
787
788typedef struct l2arc_write_callback {
789 l2arc_dev_t *l2wcb_dev; /* device info */
790 arc_buf_hdr_t *l2wcb_head; /* head of write buflist */
791} l2arc_write_callback_t;

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

3139 * and return; or just return.
3140 *
3141 * arc_read_done() will invoke all the requested "done" functions
3142 * for readers of this block.
3143 */
3144int
3145arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done,
3146 void *private, zio_priority_t priority, int zio_flags, uint32_t *arc_flags,
3147 const zbookmark_t *zb)
3147 const zbookmark_phys_t *zb)
3148{
3149 arc_buf_hdr_t *hdr = NULL;
3150 arc_buf_t *buf = NULL;
3151 kmutex_t *hash_lock = NULL;
3152 zio_t *rzio;
3153 uint64_t guid = spa_load_guid(spa);
3154
3155 ASSERT(!BP_IS_EMBEDDED(bp) ||

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

3333 mutex_exit(hash_lock);
3334
3335 /*
3336 * At this point, we have a level 1 cache miss. Try again in
3337 * L2ARC if possible.
3338 */
3339 ASSERT3U(hdr->b_size, ==, size);
3340 DTRACE_PROBE4(arc__miss, arc_buf_hdr_t *, hdr, blkptr_t *, bp,
3148{
3149 arc_buf_hdr_t *hdr = NULL;
3150 arc_buf_t *buf = NULL;
3151 kmutex_t *hash_lock = NULL;
3152 zio_t *rzio;
3153 uint64_t guid = spa_load_guid(spa);
3154
3155 ASSERT(!BP_IS_EMBEDDED(bp) ||

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

3333 mutex_exit(hash_lock);
3334
3335 /*
3336 * At this point, we have a level 1 cache miss. Try again in
3337 * L2ARC if possible.
3338 */
3339 ASSERT3U(hdr->b_size, ==, size);
3340 DTRACE_PROBE4(arc__miss, arc_buf_hdr_t *, hdr, blkptr_t *, bp,
3341 uint64_t, size, zbookmark_t *, zb);
3341 uint64_t, size, zbookmark_phys_t *, zb);
3342 ARCSTAT_BUMP(arcstat_misses);
3343 ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH),
3344 demand, prefetch, hdr->b_type != ARC_BUFC_METADATA,
3345 data, metadata, misses);
3346#ifdef _KERNEL
3347 curthread->td_ru.ru_inblock++;
3348#endif
3349

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

3867 kmem_free(callback, sizeof (arc_write_callback_t));
3868}
3869
3870zio_t *
3871arc_write(zio_t *pio, spa_t *spa, uint64_t txg,
3872 blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress,
3873 const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone,
3874 arc_done_func_t *done, void *private, zio_priority_t priority,
3342 ARCSTAT_BUMP(arcstat_misses);
3343 ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH),
3344 demand, prefetch, hdr->b_type != ARC_BUFC_METADATA,
3345 data, metadata, misses);
3346#ifdef _KERNEL
3347 curthread->td_ru.ru_inblock++;
3348#endif
3349

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

3867 kmem_free(callback, sizeof (arc_write_callback_t));
3868}
3869
3870zio_t *
3871arc_write(zio_t *pio, spa_t *spa, uint64_t txg,
3872 blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress,
3873 const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone,
3874 arc_done_func_t *done, void *private, zio_priority_t priority,
3875 int zio_flags, const zbookmark_t *zb)
3875 int zio_flags, const zbookmark_phys_t *zb)
3876{
3877 arc_buf_hdr_t *hdr = buf->b_hdr;
3878 arc_write_callback_t *callback;
3879 zio_t *zio;
3880
3881 ASSERT(ready != NULL);
3882 ASSERT(done != NULL);
3883 ASSERT(!HDR_IO_ERROR(hdr));

--- 1736 unchanged lines hidden ---
3876{
3877 arc_buf_hdr_t *hdr = buf->b_hdr;
3878 arc_write_callback_t *callback;
3879 zio_t *zio;
3880
3881 ASSERT(ready != NULL);
3882 ASSERT(done != NULL);
3883 ASSERT(!HDR_IO_ERROR(hdr));

--- 1736 unchanged lines hidden ---