@@ -677,15 +677,6 @@ static arc_buf_hdr_t arc_eviction_hdr;
677
677
#define HDR_HAS_L1HDR (hdr ) ((hdr)->b_flags & ARC_FLAG_HAS_L1HDR)
678
678
#define HDR_HAS_L2HDR (hdr ) ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR)
679
679
680
- /* For storing compression mode in b_flags */
681
- #define HDR_COMPRESS_OFFSET 24
682
- #define HDR_COMPRESS_NBITS 7
683
-
684
- #define HDR_GET_COMPRESS (hdr ) ((enum zio_compress)BF32_GET(hdr->b_flags, \
685
- HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS))
686
- #define HDR_SET_COMPRESS (hdr , cmp ) BF32_SET(hdr->b_flags, \
687
- HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS, (cmp))
688
-
689
680
/*
690
681
* Other sizes
691
682
*/
@@ -1483,7 +1474,7 @@ arc_buf_info(arc_buf_t *ab, arc_buf_info_t *abi, int state_index)
1483
1474
if (l2hdr ) {
1484
1475
abi -> abi_l2arc_dattr = l2hdr -> b_daddr ;
1485
1476
abi -> abi_l2arc_asize = l2hdr -> b_asize ;
1486
- abi -> abi_l2arc_compress = HDR_GET_COMPRESS ( hdr ) ;
1477
+ abi -> abi_l2arc_compress = l2hdr -> b_compress ;
1487
1478
abi -> abi_l2arc_hits = l2hdr -> b_hits ;
1488
1479
}
1489
1480
@@ -1954,7 +1945,7 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr)
1954
1945
* separately compressed buffer, so there's nothing to free (it
1955
1946
* points to the same buffer as the arc_buf_t's b_data field).
1956
1947
*/
1957
- if (HDR_GET_COMPRESS ( hdr ) == ZIO_COMPRESS_OFF ) {
1948
+ if (hdr -> b_l2hdr . b_compress == ZIO_COMPRESS_OFF ) {
1958
1949
hdr -> b_l1hdr .b_tmp_cdata = NULL ;
1959
1950
return ;
1960
1951
}
@@ -1963,12 +1954,12 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr)
1963
1954
* There's nothing to free since the buffer was all zero's and
1964
1955
* compressed to a zero length buffer.
1965
1956
*/
1966
- if (HDR_GET_COMPRESS ( hdr ) == ZIO_COMPRESS_EMPTY ) {
1957
+ if (hdr -> b_l2hdr . b_compress == ZIO_COMPRESS_EMPTY ) {
1967
1958
ASSERT3P (hdr -> b_l1hdr .b_tmp_cdata , = = , NULL );
1968
1959
return ;
1969
1960
}
1970
1961
1971
- ASSERT (L2ARC_IS_VALID_COMPRESS (HDR_GET_COMPRESS ( hdr ) ));
1962
+ ASSERT (L2ARC_IS_VALID_COMPRESS (hdr -> b_l2hdr . b_compress ));
1972
1963
1973
1964
arc_buf_free_on_write (hdr -> b_l1hdr .b_tmp_cdata ,
1974
1965
hdr -> b_size , zio_data_buf_free );
@@ -4429,7 +4420,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done,
4429
4420
(vd = hdr -> b_l2hdr .b_dev -> l2ad_vdev ) != NULL ) {
4430
4421
devw = hdr -> b_l2hdr .b_dev -> l2ad_writing ;
4431
4422
addr = hdr -> b_l2hdr .b_daddr ;
4432
- b_compress = HDR_GET_COMPRESS ( hdr ) ;
4423
+ b_compress = hdr -> b_l2hdr . b_compress ;
4433
4424
b_asize = hdr -> b_l2hdr .b_asize ;
4434
4425
/*
4435
4426
* Lock out device removal.
@@ -6037,6 +6028,8 @@ l2arc_read_done(zio_t *zio)
6037
6028
if (cb -> l2rcb_compress != ZIO_COMPRESS_OFF )
6038
6029
l2arc_decompress_zio (zio , hdr , cb -> l2rcb_compress );
6039
6030
ASSERT (zio -> io_data != NULL );
6031
+ ASSERT3U (zio -> io_size , = = , hdr -> b_size );
6032
+ ASSERT3U (BP_GET_LSIZE (& cb -> l2rcb_bp ), = = , hdr -> b_size );
6040
6033
6041
6034
/*
6042
6035
* Check this survived the L2ARC journey.
@@ -6073,7 +6066,7 @@ l2arc_read_done(zio_t *zio)
6073
6066
ASSERT (!pio || pio -> io_child_type == ZIO_CHILD_LOGICAL );
6074
6067
6075
6068
zio_nowait (zio_read (pio , cb -> l2rcb_spa , & cb -> l2rcb_bp ,
6076
- buf -> b_data , zio -> io_size , arc_read_done , buf ,
6069
+ buf -> b_data , hdr -> b_size , arc_read_done , buf ,
6077
6070
zio -> io_priority , cb -> l2rcb_flags , & cb -> l2rcb_zb ));
6078
6071
}
6079
6072
}
@@ -6381,7 +6374,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz,
6381
6374
* can't access without holding the ARC list locks
6382
6375
* (which we want to avoid during compression/writing)
6383
6376
*/
6384
- HDR_SET_COMPRESS ( hdr , ZIO_COMPRESS_OFF ) ;
6377
+ hdr -> b_l2hdr . b_compress = ZIO_COMPRESS_OFF ;
6385
6378
hdr -> b_l2hdr .b_asize = hdr -> b_size ;
6386
6379
hdr -> b_l2hdr .b_hits = 0 ;
6387
6380
hdr -> b_l1hdr .b_tmp_cdata = hdr -> b_l1hdr .b_buf -> b_data ;
@@ -6587,7 +6580,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
6587
6580
l2hdr = & hdr -> b_l2hdr ;
6588
6581
6589
6582
ASSERT (HDR_HAS_L1HDR (hdr ));
6590
- ASSERT ( HDR_GET_COMPRESS ( hdr ) == ZIO_COMPRESS_OFF );
6583
+ ASSERT3U ( l2hdr -> b_compress , = = , ZIO_COMPRESS_OFF );
6591
6584
ASSERT (hdr -> b_l1hdr .b_tmp_cdata != NULL );
6592
6585
6593
6586
len = l2hdr -> b_asize ;
@@ -6605,7 +6598,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
6605
6598
if (csize == 0 ) {
6606
6599
/* zero block, indicate that there's nothing to write */
6607
6600
zio_data_buf_free (cdata , len );
6608
- HDR_SET_COMPRESS ( hdr , ZIO_COMPRESS_EMPTY ) ;
6601
+ l2hdr -> b_compress = ZIO_COMPRESS_EMPTY ;
6609
6602
l2hdr -> b_asize = 0 ;
6610
6603
hdr -> b_l1hdr .b_tmp_cdata = NULL ;
6611
6604
ARCSTAT_BUMP (arcstat_l2_compress_zeros );
@@ -6615,7 +6608,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
6615
6608
* Compression succeeded, we'll keep the cdata around for
6616
6609
* writing and release it afterwards.
6617
6610
*/
6618
- HDR_SET_COMPRESS ( hdr , ZIO_COMPRESS_LZ4 ) ;
6611
+ l2hdr -> b_compress = ZIO_COMPRESS_LZ4 ;
6619
6612
l2hdr -> b_asize = csize ;
6620
6613
hdr -> b_l1hdr .b_tmp_cdata = cdata ;
6621
6614
ARCSTAT_BUMP (arcstat_l2_compress_successes );
@@ -6702,9 +6695,11 @@ l2arc_decompress_zio(zio_t *zio, arc_buf_hdr_t *hdr, enum zio_compress c)
6702
6695
static void
6703
6696
l2arc_release_cdata_buf (arc_buf_hdr_t * hdr )
6704
6697
{
6705
- enum zio_compress comp = HDR_GET_COMPRESS ( hdr ) ;
6698
+ enum zio_compress comp ;
6706
6699
6707
6700
ASSERT (HDR_HAS_L1HDR (hdr ));
6701
+ ASSERT (HDR_HAS_L2HDR (hdr ));
6702
+ comp = hdr -> b_l2hdr .b_compress ;
6708
6703
ASSERT (comp == ZIO_COMPRESS_OFF || L2ARC_IS_VALID_COMPRESS (comp ));
6709
6704
6710
6705
if (comp == ZIO_COMPRESS_OFF ) {
0 commit comments