MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vdev_cache_fill

Function vdev_cache_fill

freebsd/contrib/openzfs/module/zfs/vdev_cache.c:211–245  ·  view source on GitHub ↗

* Fill a previously allocated cache entry with data. */

Source from the content-addressed store, hash-verified

209 * Fill a previously allocated cache entry with data.
210 */
211static void
212vdev_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.

Callers

nothing calls this directly

Calls 5

mutex_enterFunction · 0.85
zio_walk_parentsFunction · 0.85
vdev_cache_hitFunction · 0.85
vdev_cache_evictFunction · 0.85
mutex_exitFunction · 0.85

Tested by

no test coverage detected