Lines 965-971
static void l2arc_hdr_restore(const l2arc_log_ent_phys_t *le,
Link Here
|
965 |
l2arc_dev_t *dev); |
965 |
l2arc_dev_t *dev); |
966 |
|
966 |
|
967 |
/* L2ARC persistence write I/O routines. */ |
967 |
/* L2ARC persistence write I/O routines. */ |
968 |
static void l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, |
968 |
static uint64_t l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, |
969 |
l2arc_write_callback_t *cb); |
969 |
l2arc_write_callback_t *cb); |
970 |
|
970 |
|
971 |
/* L2ARC persistence auxiliary routines. */ |
971 |
/* L2ARC persistence auxiliary routines. */ |
Lines 8175-8181
l2arc_write_eligible(uint64_t spa_guid, arc_buf_hdr_t *hdr)
Link Here
|
8175 |
static uint64_t |
8175 |
static uint64_t |
8176 |
l2arc_write_size(l2arc_dev_t *dev) |
8176 |
l2arc_write_size(l2arc_dev_t *dev) |
8177 |
{ |
8177 |
{ |
8178 |
uint64_t size, dev_size, tsize; |
8178 |
uint64_t size; |
8179 |
|
8179 |
|
8180 |
/* |
8180 |
/* |
8181 |
* Make sure our globals have meaningful values in case the user |
8181 |
* Make sure our globals have meaningful values in case the user |
Lines 8192-8226
l2arc_write_size(l2arc_dev_t *dev)
Link Here
|
8192 |
if (arc_warm == B_FALSE) |
8192 |
if (arc_warm == B_FALSE) |
8193 |
size += l2arc_write_boost; |
8193 |
size += l2arc_write_boost; |
8194 |
|
8194 |
|
8195 |
/* |
|
|
8196 |
* Make sure the write size does not exceed the size of the cache |
8197 |
* device. This is important in l2arc_evict(), otherwise infinite |
8198 |
* iteration can occur. |
8199 |
*/ |
8200 |
dev_size = dev->l2ad_end - dev->l2ad_start; |
8201 |
|
8202 |
/* We need to add in the worst case scenario of log block overhead. */ |
8195 |
/* We need to add in the worst case scenario of log block overhead. */ |
8203 |
tsize = size + l2arc_log_blk_overhead(size, dev); |
8196 |
size += l2arc_log_blk_overhead(size, dev); |
8204 |
if (dev->l2ad_vdev->vdev_has_trim && l2arc_trim_ahead > 0) { |
8197 |
if (dev->l2ad_vdev->vdev_has_trim && l2arc_trim_ahead > 0) { |
8205 |
/* |
8198 |
/* |
8206 |
* Trim ahead of the write size 64MB or (l2arc_trim_ahead/100) |
8199 |
* Trim ahead of the write size 64MB or (l2arc_trim_ahead/100) |
8207 |
* times the writesize, whichever is greater. |
8200 |
* times the writesize, whichever is greater. |
8208 |
*/ |
8201 |
*/ |
8209 |
tsize += MAX(64 * 1024 * 1024, |
8202 |
size += MAX(64 * 1024 * 1024, |
8210 |
(tsize * l2arc_trim_ahead) / 100); |
8203 |
(size * l2arc_trim_ahead) / 100); |
8211 |
} |
8204 |
} |
8212 |
|
8205 |
|
8213 |
if (tsize >= dev_size) { |
8206 |
/* |
|
|
8207 |
* Make sure the write size does not exceed the size of the cache |
8208 |
* device. This is important in l2arc_evict(), otherwise infinite |
8209 |
* iteration can occur. |
8210 |
*/ |
8211 |
if (size >= dev->l2ad_end - dev->l2ad_start) { |
8214 |
cmn_err(CE_NOTE, "l2arc_write_max or l2arc_write_boost " |
8212 |
cmn_err(CE_NOTE, "l2arc_write_max or l2arc_write_boost " |
8215 |
"plus the overhead of log blocks (persistent L2ARC, " |
8213 |
"plus the overhead of log blocks (persistent L2ARC, " |
8216 |
"%llu bytes) exceeds the size of the cache device " |
8214 |
"%llu bytes) exceeds the size of the cache device " |
8217 |
"(guid %llu), resetting them to the default (%d)", |
8215 |
"(guid %llu), resetting them to the default (%d)", |
8218 |
(u_longlong_t)l2arc_log_blk_overhead(size, dev), |
8216 |
(u_longlong_t)l2arc_log_blk_overhead(size, dev), |
8219 |
(u_longlong_t)dev->l2ad_vdev->vdev_guid, L2ARC_WRITE_SIZE); |
8217 |
(u_longlong_t)dev->l2ad_vdev->vdev_guid, L2ARC_WRITE_SIZE); |
|
|
8218 |
|
8220 |
size = l2arc_write_max = l2arc_write_boost = L2ARC_WRITE_SIZE; |
8219 |
size = l2arc_write_max = l2arc_write_boost = L2ARC_WRITE_SIZE; |
8221 |
|
8220 |
|
8222 |
if (arc_warm == B_FALSE) |
8221 |
if (arc_warm == B_FALSE) |
8223 |
size += l2arc_write_boost; |
8222 |
size += l2arc_write_boost; |
|
|
8223 |
|
8224 |
size += l2arc_log_blk_overhead(size, dev); |
8225 |
if (dev->l2ad_vdev->vdev_has_trim && l2arc_trim_ahead > 0) { |
8226 |
size += MAX(64 * 1024 * 1024, |
8227 |
(size * l2arc_trim_ahead) / 100); |
8228 |
} |
8224 |
} |
8229 |
} |
8225 |
|
8230 |
|
8226 |
return (size); |
8231 |
return (size); |
Lines 9413-9420
l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
Link Here
|
9413 |
* arcstat_l2_{size,asize} kstats are updated |
9418 |
* arcstat_l2_{size,asize} kstats are updated |
9414 |
* internally. |
9419 |
* internally. |
9415 |
*/ |
9420 |
*/ |
9416 |
if (l2arc_log_blk_insert(dev, hdr)) |
9421 |
if (l2arc_log_blk_insert(dev, hdr)) { |
9417 |
l2arc_log_blk_commit(dev, pio, cb); |
9422 |
/* |
|
|
9423 |
* l2ad_hand has been accounted for in |
9424 |
* l2arc_log_blk_commit(). |
9425 |
*/ |
9426 |
write_asize += |
9427 |
l2arc_log_blk_commit(dev, pio, cb); |
9428 |
} |
9418 |
|
9429 |
|
9419 |
zio_nowait(wzio); |
9430 |
zio_nowait(wzio); |
9420 |
} |
9431 |
} |
Lines 10564-10570
l2arc_dev_hdr_update(l2arc_dev_t *dev)
Link Here
|
10564 |
* This function allocates some memory to temporarily hold the serialized |
10575 |
* This function allocates some memory to temporarily hold the serialized |
10565 |
* buffer to be written. This is then released in l2arc_write_done. |
10576 |
* buffer to be written. This is then released in l2arc_write_done. |
10566 |
*/ |
10577 |
*/ |
10567 |
static void |
10578 |
static uint64_t |
10568 |
l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb) |
10579 |
l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb) |
10569 |
{ |
10580 |
{ |
10570 |
l2arc_log_blk_phys_t *lb = &dev->l2ad_log_blk; |
10581 |
l2arc_log_blk_phys_t *lb = &dev->l2ad_log_blk; |
Lines 10675-10680
l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb)
Link Here
|
10675 |
dev->l2ad_log_ent_idx = 0; |
10686 |
dev->l2ad_log_ent_idx = 0; |
10676 |
dev->l2ad_log_blk_payload_asize = 0; |
10687 |
dev->l2ad_log_blk_payload_asize = 0; |
10677 |
dev->l2ad_log_blk_payload_start = 0; |
10688 |
dev->l2ad_log_blk_payload_start = 0; |
|
|
10689 |
|
10690 |
return (asize); |
10678 |
} |
10691 |
} |
10679 |
|
10692 |
|
10680 |
/* |
10693 |
/* |