@@ -648,13 +648,6 @@ arc_sums_t arc_sums;
648
648
} while (0)
649
649
650
650
kstat_t * arc_ksp ;
651
- static arc_state_t * arc_anon ;
652
- static arc_state_t * arc_mru_ghost ;
653
- static arc_state_t * arc_mfu_ghost ;
654
- static arc_state_t * arc_l2c_only ;
655
-
656
- arc_state_t * arc_mru ;
657
- arc_state_t * arc_mfu ;
658
651
659
652
/*
660
653
* There are several ARC variables that are critical to export as kstats --
@@ -2203,7 +2196,6 @@ arc_evictable_space_increment(arc_buf_hdr_t *hdr, arc_state_t *state)
2203
2196
return ;
2204
2197
}
2205
2198
2206
- ASSERT (!GHOST_STATE (state ));
2207
2199
if (hdr -> b_l1hdr .b_pabd != NULL ) {
2208
2200
(void ) zfs_refcount_add_many (& state -> arcs_esize [type ],
2209
2201
arc_hdr_size (hdr ), hdr );
@@ -2244,7 +2236,6 @@ arc_evictable_space_decrement(arc_buf_hdr_t *hdr, arc_state_t *state)
2244
2236
return ;
2245
2237
}
2246
2238
2247
- ASSERT (!GHOST_STATE (state ));
2248
2239
if (hdr -> b_l1hdr .b_pabd != NULL ) {
2249
2240
(void ) zfs_refcount_remove_many (& state -> arcs_esize [type ],
2250
2241
arc_hdr_size (hdr ), hdr );
@@ -4036,23 +4027,21 @@ arc_set_need_free(void)
4036
4027
4037
4028
static uint64_t
4038
4029
arc_evict_state_impl (multilist_t * ml , int idx , arc_buf_hdr_t * marker ,
4039
- uint64_t spa , int64_t bytes )
4030
+ uint64_t spa , uint64_t bytes )
4040
4031
{
4041
4032
multilist_sublist_t * mls ;
4042
4033
uint64_t bytes_evicted = 0 , real_evicted = 0 ;
4043
4034
arc_buf_hdr_t * hdr ;
4044
4035
kmutex_t * hash_lock ;
4045
- int evict_count = 0 ;
4036
+ int evict_count = zfs_arc_evict_batch_limit ;
4046
4037
4047
4038
ASSERT3P (marker , != , NULL );
4048
- IMPLY (bytes < 0 , bytes == ARC_EVICT_ALL );
4049
4039
4050
4040
mls = multilist_sublist_lock (ml , idx );
4051
4041
4052
- for (hdr = multilist_sublist_prev (mls , marker ); hdr != NULL ;
4042
+ for (hdr = multilist_sublist_prev (mls , marker ); likely ( hdr != NULL ) ;
4053
4043
hdr = multilist_sublist_prev (mls , marker )) {
4054
- if ((bytes != ARC_EVICT_ALL && bytes_evicted >= bytes ) ||
4055
- (evict_count >= zfs_arc_evict_batch_limit ))
4044
+ if ((evict_count <= 0 ) || (bytes_evicted >= bytes ))
4056
4045
break ;
4057
4046
4058
4047
/*
@@ -4114,7 +4103,7 @@ arc_evict_state_impl(multilist_t *ml, int idx, arc_buf_hdr_t *marker,
4114
4103
* evict_count in this case.
4115
4104
*/
4116
4105
if (evicted != 0 )
4117
- evict_count ++ ;
4106
+ evict_count -- ;
4118
4107
4119
4108
} else {
4120
4109
ARCSTAT_BUMP (arcstat_mutex_miss );
@@ -4175,16 +4164,14 @@ arc_evict_state_impl(multilist_t *ml, int idx, arc_buf_hdr_t *marker,
4175
4164
* the given arc state; which is used by arc_flush().
4176
4165
*/
4177
4166
static uint64_t
4178
- arc_evict_state (arc_state_t * state , uint64_t spa , int64_t bytes ,
4167
+ arc_evict_state (arc_state_t * state , uint64_t spa , uint64_t bytes ,
4179
4168
arc_buf_contents_t type )
4180
4169
{
4181
4170
uint64_t total_evicted = 0 ;
4182
4171
multilist_t * ml = & state -> arcs_list [type ];
4183
4172
int num_sublists ;
4184
4173
arc_buf_hdr_t * * markers ;
4185
4174
4186
- IMPLY (bytes < 0 , bytes == ARC_EVICT_ALL );
4187
-
4188
4175
num_sublists = multilist_get_num_sublists (ml );
4189
4176
4190
4177
/*
@@ -4216,7 +4203,7 @@ arc_evict_state(arc_state_t *state, uint64_t spa, int64_t bytes,
4216
4203
* While we haven't hit our target number of bytes to evict, or
4217
4204
* we're evicting all available buffers.
4218
4205
*/
4219
- while (total_evicted < bytes || bytes == ARC_EVICT_ALL ) {
4206
+ while (total_evicted < bytes ) {
4220
4207
int sublist_idx = multilist_get_random_index (ml );
4221
4208
uint64_t scan_evicted = 0 ;
4222
4209
@@ -4244,9 +4231,7 @@ arc_evict_state(arc_state_t *state, uint64_t spa, int64_t bytes,
4244
4231
uint64_t bytes_remaining ;
4245
4232
uint64_t bytes_evicted ;
4246
4233
4247
- if (bytes == ARC_EVICT_ALL )
4248
- bytes_remaining = ARC_EVICT_ALL ;
4249
- else if (total_evicted < bytes )
4234
+ if (total_evicted < bytes )
4250
4235
bytes_remaining = bytes - total_evicted ;
4251
4236
else
4252
4237
break ;
@@ -4341,7 +4326,7 @@ static uint64_t
4341
4326
arc_evict_impl (arc_state_t * state , uint64_t spa , int64_t bytes ,
4342
4327
arc_buf_contents_t type )
4343
4328
{
4344
- int64_t delta ;
4329
+ uint64_t delta ;
4345
4330
4346
4331
if (bytes > 0 && zfs_refcount_count (& state -> arcs_esize [type ]) > 0 ) {
4347
4332
delta = MIN (zfs_refcount_count (& state -> arcs_esize [type ]),
@@ -7601,13 +7586,6 @@ arc_tuning_update(boolean_t verbose)
7601
7586
static void
7602
7587
arc_state_init (void )
7603
7588
{
7604
- arc_anon = & ARC_anon ;
7605
- arc_mru = & ARC_mru ;
7606
- arc_mru_ghost = & ARC_mru_ghost ;
7607
- arc_mfu = & ARC_mfu ;
7608
- arc_mfu_ghost = & ARC_mfu_ghost ;
7609
- arc_l2c_only = & ARC_l2c_only ;
7610
-
7611
7589
multilist_create (& arc_mru -> arcs_list [ARC_BUFC_METADATA ],
7612
7590
sizeof (arc_buf_hdr_t ),
7613
7591
offsetof(arc_buf_hdr_t , b_l1hdr .b_arc_node ),
0 commit comments