Add -p switch to "zpool get"
[zfs.git] / module / zfs / dmu_zfetch.c
index 37037c3..1763bae 100644 (file)
 int zfs_prefetch_disable = 0;
 
 /* max # of streams per zfetch */
-uint32_t       zfetch_max_streams = 8;
+unsigned int   zfetch_max_streams = 8;
 /* min time before stream reclaim */
-uint32_t       zfetch_min_sec_reap = 2;
+unsigned int   zfetch_min_sec_reap = 2;
 /* max number of blocks to fetch at a time */
-uint32_t       zfetch_block_cap = 256;
+unsigned int   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;
+unsigned long  zfetch_array_rd_sz = 1024 * 1024;
 
 /* forward decls for static routines */
 static int             dmu_zfetch_colinear(zfetch_t *, zstream_t *);
@@ -665,7 +665,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched)
                ZFETCHSTAT_BUMP(zfetchstat_hits);
        } else {
                ZFETCHSTAT_BUMP(zfetchstat_misses);
-               if (fetched = dmu_zfetch_colinear(zf, &zst)) {
+               if ((fetched = dmu_zfetch_colinear(zf, &zst))) {
                        ZFETCHSTAT_BUMP(zfetchstat_colinear_hits);
                } else {
                        ZFETCHSTAT_BUMP(zfetchstat_colinear_misses);
@@ -699,7 +699,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched)
                        if (cur_streams >= max_streams) {
                                return;
                        }
-                       newstream = kmem_zalloc(sizeof (zstream_t), KM_SLEEP);
+                       newstream = kmem_zalloc(sizeof (zstream_t), KM_PUSHPAGE);
                }
 
                newstream->zst_offset = zst.zst_offset;
@@ -722,3 +722,21 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched)
                }
        }
 }
+
+#if defined(_KERNEL) && defined(HAVE_SPL)
+module_param(zfs_prefetch_disable, int, 0644);
+MODULE_PARM_DESC(zfs_prefetch_disable, "Disable all ZFS prefetching");
+
+module_param(zfetch_max_streams, uint, 0644);
+MODULE_PARM_DESC(zfetch_max_streams, "Max number of streams per zfetch");
+
+module_param(zfetch_min_sec_reap, uint, 0644);
+MODULE_PARM_DESC(zfetch_min_sec_reap, "Min time before stream reclaim");
+
+module_param(zfetch_block_cap, uint, 0644);
+MODULE_PARM_DESC(zfetch_block_cap, "Max number of blocks to fetch at a time");
+
+module_param(zfetch_array_rd_sz, ulong, 0644);
+MODULE_PARM_DESC(zfetch_array_rd_sz, "Number of bytes in a array_read");
+#endif
+