* Fill a previously allocated cache entry with data. */
| 209 | * Fill a previously allocated cache entry with data. |
| 210 | */ |
| 211 | static void |
| 212 | vdev_cache_fill(zio_t *fio) |
| 213 | { |
| 214 | vdev_t *vd = fio->io_vd; |
| 215 | vdev_cache_t *vc = &vd->vdev_cache; |
| 216 | vdev_cache_entry_t *ve = fio->io_private; |
| 217 | zio_t *pio; |
| 218 | |
| 219 | ASSERT3U(fio->io_size, ==, VCBS); |
| 220 | |
| 221 | /* |
| 222 | * Add data to the cache. |
| 223 | */ |
| 224 | mutex_enter(&vc->vc_lock); |
| 225 | |
| 226 | ASSERT3P(ve->ve_fill_io, ==, fio); |
| 227 | ASSERT3U(ve->ve_offset, ==, fio->io_offset); |
| 228 | ASSERT3P(ve->ve_abd, ==, fio->io_abd); |
| 229 | |
| 230 | ve->ve_fill_io = NULL; |
| 231 | |
| 232 | /* |
| 233 | * Even if this cache line was invalidated by a missed write update, |
| 234 | * any reads that were queued up before the missed update are still |
| 235 | * valid, so we can satisfy them from this line before we evict it. |
| 236 | */ |
| 237 | zio_link_t *zl = NULL; |
| 238 | while ((pio = zio_walk_parents(fio, &zl)) != NULL) |
| 239 | vdev_cache_hit(vc, ve, pio); |
| 240 | |
| 241 | if (fio->io_error || ve->ve_missed_update) |
| 242 | vdev_cache_evict(vc, ve); |
| 243 | |
| 244 | mutex_exit(&vc->vc_lock); |
| 245 | } |
| 246 | |
| 247 | /* |
| 248 | * Read data from the cache. Returns B_TRUE cache hit, B_FALSE on miss. |
nothing calls this directly
no test coverage detected