Print this page
NEX-13937 Improve kstat performance
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
6328 Fix cstyle errors in zfs codebase (fix studio)
6328 Fix cstyle errors in zfs codebase
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Jorgen Lundman <lundman@lundman.net>
Approved by: Robert Mustacchi <rm@joyent.com>
6209 libc mutexes break kernel writers hearts
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Dan McDonald <danmcd@omniti.com>
5815 libzpool's panic function doesn't set global panicstr, ::status not as useful
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>
re #12393 rb3935 Kerberos and smbd disagree about who is our AD server (fix elf runtime attributes check)
re #11612 rb3907 Failing vdev of a mirrored pool should not take zfs operations out of action for extended periods of time.


  32 #include <stdlib.h>
  33 #include <string.h>
  34 #include <zlib.h>
  35 #include <libgen.h>
  36 #include <sys/spa.h>
  37 #include <sys/stat.h>
  38 #include <sys/processor.h>
  39 #include <sys/zfs_context.h>
  40 #include <sys/rrwlock.h>
  41 #include <sys/zmod.h>
  42 #include <sys/utsname.h>
  43 #include <sys/systeminfo.h>
  44 
  45 extern void system_taskq_init(void);
  46 extern void system_taskq_fini(void);
  47 
  48 /*
  49  * Emulation of kernel services in userland.
  50  */
  51 
  52 pgcnt_t physmem;
  53 vnode_t *rootdir = (vnode_t *)0xabcd1234;
  54 char hw_serial[HW_HOSTID_LEN];
  55 kmutex_t cpu_lock;
  56 vmem_t *zio_arena = NULL;
  57 
  58 /* If set, all blocks read will be copied to the specified directory. */
  59 char *vn_dumpdir = NULL;
  60 
  61 struct utsname utsname = {
  62         "userland", "libzpool", "1", "1", "na"
  63 };
  64 
  65 /*
  66  * =========================================================================
  67  * vnode operations
  68  * =========================================================================
  69  */
  70 /*
  71  * Note: for the xxxat() versions of these functions, we assume that the
  72  * starting vp is always rootdir (which is true for spa_directory.c, the only


 444         (void) snprintf(hw_serial, sizeof (hw_serial), "%ld",
 445             (mode & FWRITE) ? gethostid() : 0);
 446 
 447         system_taskq_init();
 448 
 449         mutex_init(&cpu_lock, NULL, MUTEX_DEFAULT, NULL);
 450 
 451         spa_init(mode);
 452 
 453         tsd_create(&rrw_tsd_key, rrw_tsd_destroy);
 454 }
 455 
 456 void
 457 kernel_fini(void)
 458 {
 459         spa_fini();
 460 
 461         system_taskq_fini();
 462 }
 463 
 464 /* ARGSUSED */
 465 uint32_t
 466 zone_get_hostid(void *zonep)
 467 {
 468         /*
 469          * We're emulating the system's hostid in userland.
 470          */
 471         return (strtoul(hw_serial, NULL, 10));
 472 }
 473 
 474 int
 475 z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen)
 476 {
 477         int ret;
 478         uLongf len = *dstlen;
 479 
 480         if ((ret = uncompress(dst, &len, src, srclen)) == Z_OK)
 481                 *dstlen = (size_t)len;
 482 
 483         return (ret);
 484 }
 485 
 486 int
 487 z_compress_level(void *dst, size_t *dstlen, const void *src, size_t srclen,
 488     int level)
 489 {
 490         int ret;
 491         uLongf len = *dstlen;
 492 
 493         if ((ret = compress2(dst, &len, src, srclen, level)) == Z_OK)




  32 #include <stdlib.h>
  33 #include <string.h>
  34 #include <zlib.h>
  35 #include <libgen.h>
  36 #include <sys/spa.h>
  37 #include <sys/stat.h>
  38 #include <sys/processor.h>
  39 #include <sys/zfs_context.h>
  40 #include <sys/rrwlock.h>
  41 #include <sys/zmod.h>
  42 #include <sys/utsname.h>
  43 #include <sys/systeminfo.h>
  44 
  45 extern void system_taskq_init(void);
  46 extern void system_taskq_fini(void);
  47 
  48 /*
  49  * Emulation of kernel services in userland.
  50  */
  51 
  52 volatile pgcnt_t physmem;
  53 vnode_t *rootdir = (vnode_t *)0xabcd1234;
  54 char hw_serial[HW_HOSTID_LEN];
  55 kmutex_t cpu_lock;
  56 vmem_t *zio_arena = NULL;
  57 
  58 /* If set, all blocks read will be copied to the specified directory. */
  59 char *vn_dumpdir = NULL;
  60 
  61 struct utsname utsname = {
  62         "userland", "libzpool", "1", "1", "na"
  63 };
  64 
  65 /*
  66  * =========================================================================
  67  * vnode operations
  68  * =========================================================================
  69  */
  70 /*
  71  * Note: for the xxxat() versions of these functions, we assume that the
  72  * starting vp is always rootdir (which is true for spa_directory.c, the only


 444         (void) snprintf(hw_serial, sizeof (hw_serial), "%ld",
 445             (mode & FWRITE) ? gethostid() : 0);
 446 
 447         system_taskq_init();
 448 
 449         mutex_init(&cpu_lock, NULL, MUTEX_DEFAULT, NULL);
 450 
 451         spa_init(mode);
 452 
 453         tsd_create(&rrw_tsd_key, rrw_tsd_destroy);
 454 }
 455 
 456 void
 457 kernel_fini(void)
 458 {
 459         spa_fini();
 460 
 461         system_taskq_fini();
 462 }
 463 










 464 int
 465 z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen)
 466 {
 467         int ret;
 468         uLongf len = *dstlen;
 469 
 470         if ((ret = uncompress(dst, &len, src, srclen)) == Z_OK)
 471                 *dstlen = (size_t)len;
 472 
 473         return (ret);
 474 }
 475 
 476 int
 477 z_compress_level(void *dst, size_t *dstlen, const void *src, size_t srclen,
 478     int level)
 479 {
 480         int ret;
 481         uLongf len = *dstlen;
 482 
 483         if ((ret = compress2(dst, &len, src, srclen, level)) == Z_OK)