Print this page
3741 zfs needs better comments
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>

*** 46,60 **** uint32_t zfetch_block_cap = 256; /* number of bytes in a array_read at which we stop prefetching (1Mb) */ uint64_t zfetch_array_rd_sz = 1024 * 1024; /* forward decls for static routines */ ! static int dmu_zfetch_colinear(zfetch_t *, zstream_t *); static void dmu_zfetch_dofetch(zfetch_t *, zstream_t *); static uint64_t dmu_zfetch_fetch(dnode_t *, uint64_t, uint64_t); static uint64_t dmu_zfetch_fetchsz(dnode_t *, uint64_t, uint64_t); ! static int dmu_zfetch_find(zfetch_t *, zstream_t *, int); static int dmu_zfetch_stream_insert(zfetch_t *, zstream_t *); static zstream_t *dmu_zfetch_stream_reclaim(zfetch_t *); static void dmu_zfetch_stream_remove(zfetch_t *, zstream_t *); static int dmu_zfetch_streams_equal(zstream_t *, zstream_t *); --- 46,60 ---- uint32_t zfetch_block_cap = 256; /* number of bytes in a array_read at which we stop prefetching (1Mb) */ uint64_t zfetch_array_rd_sz = 1024 * 1024; /* forward decls for static routines */ ! static boolean_t dmu_zfetch_colinear(zfetch_t *, zstream_t *); static void dmu_zfetch_dofetch(zfetch_t *, zstream_t *); static uint64_t dmu_zfetch_fetch(dnode_t *, uint64_t, uint64_t); static uint64_t dmu_zfetch_fetchsz(dnode_t *, uint64_t, uint64_t); ! static boolean_t dmu_zfetch_find(zfetch_t *, zstream_t *, int); static int dmu_zfetch_stream_insert(zfetch_t *, zstream_t *); static zstream_t *dmu_zfetch_stream_reclaim(zfetch_t *); static void dmu_zfetch_stream_remove(zfetch_t *, zstream_t *); static int dmu_zfetch_streams_equal(zstream_t *, zstream_t *);
*** 102,114 **** * In other words: if we find two sequential access streams that are * the same length and distance N appart, and this read is N from the * last stream, then we are probably in a strided access pattern. So * combine the two sequential streams into a single strided stream. * ! * If no co-linear streams are found, return NULL. */ ! static int dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh) { zstream_t *z_walk; zstream_t *z_comp; --- 102,114 ---- * In other words: if we find two sequential access streams that are * the same length and distance N appart, and this read is N from the * last stream, then we are probably in a strided access pattern. So * combine the two sequential streams into a single strided stream. * ! * Returns whether co-linear streams were found. */ ! static boolean_t dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh) { zstream_t *z_walk; zstream_t *z_comp;
*** 324,334 **** /* * given a zfetch and a zstream structure, see if there is an associated zstream * for this block read. If so, it starts a prefetch for the stream it * located and returns true, otherwise it returns false */ ! static int dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched) { zstream_t *zs; int64_t diff; int reset = !prefetched; --- 324,334 ---- /* * given a zfetch and a zstream structure, see if there is an associated zstream * for this block read. If so, it starts a prefetch for the stream it * located and returns true, otherwise it returns false */ ! static boolean_t dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched) { zstream_t *zs; int64_t diff; int reset = !prefetched;
*** 637,647 **** void dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched) { zstream_t zst; zstream_t *newstream; ! int fetched; int inserted; unsigned int blkshft; uint64_t blksz; if (zfs_prefetch_disable) --- 637,647 ---- void dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched) { zstream_t zst; zstream_t *newstream; ! boolean_t fetched; int inserted; unsigned int blkshft; uint64_t blksz; if (zfs_prefetch_disable)
*** 663,673 **** fetched = dmu_zfetch_find(zf, &zst, prefetched); if (fetched) { ZFETCHSTAT_BUMP(zfetchstat_hits); } else { ZFETCHSTAT_BUMP(zfetchstat_misses); ! if (fetched = dmu_zfetch_colinear(zf, &zst)) { ZFETCHSTAT_BUMP(zfetchstat_colinear_hits); } else { ZFETCHSTAT_BUMP(zfetchstat_colinear_misses); } } --- 663,674 ---- fetched = dmu_zfetch_find(zf, &zst, prefetched); if (fetched) { ZFETCHSTAT_BUMP(zfetchstat_hits); } else { ZFETCHSTAT_BUMP(zfetchstat_misses); ! fetched = dmu_zfetch_colinear(zf, &zst); ! if (fetched) { ZFETCHSTAT_BUMP(zfetchstat_colinear_hits); } else { ZFETCHSTAT_BUMP(zfetchstat_colinear_misses); } }