Created
March 27, 2018 08:54
-
-
Save lundman/3d7d952b77b31e9bb45afcd69ef42b26 to your computer and use it in GitHub Desktop.
kernel write
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/module/zfs/zfs_vnops_osx.c b/module/zfs/zfs_vnops_osx.c | |
index be23696..410ed8d 100644 | |
--- a/module/zfs/zfs_vnops_osx.c | |
+++ b/module/zfs/zfs_vnops_osx.c | |
@@ -193,6 +193,48 @@ dprintf("%s ENOTSUP\n", __func__); | |
return (ENOTSUP); | |
} | |
+ | |
+ | |
+void write_test(void) | |
+{ | |
+ int err; | |
+ char *buf; | |
+ struct vnode *vp = NULL; | |
+ int oflags = FWRITE | FTRUNC | FCREAT | FOFFMAX; | |
+ | |
+ buf = kmem_alloc(131072, KM_SLEEP); | |
+ for (int i = 0; i < 131072; i++) | |
+ buf[i] = i; | |
+ | |
+ uint64_t start = ddi_get_lbolt64(); | |
+ | |
+ printf("write_test start %llu\n", start); | |
+ | |
+ err = vn_open("/Volumes/BOOM/speedtest", UIO_SYSSPACE, | |
+ oflags, | |
+ 0644, | |
+ &vp, | |
+ CRCREAT, | |
+ 0); | |
+ printf("vn_open(): %d\n", err); | |
+ if (err == 0) { | |
+ uint64_t offset = 0; | |
+ for (int i = 0; i < 4096; i++) { | |
+ err = vn_rdwr(UIO_WRITE, vp, buf, 131072, offset, UIO_SYSSPACE, | |
+ 0, RLIM64_INFINITY, kcred, NULL); | |
+ if (err) printf("vn_rdwr: %d\n", err); | |
+ offset += 131072; | |
+ } | |
+ (void) VOP_CLOSE(vp, oflags, 1, 0, kcred, NULL); | |
+ } | |
+ printf("write_test done %llu\n", ddi_get_lbolt64()); | |
+ printf("write_test delta %llu\n", | |
+ ddi_get_lbolt64() - start); | |
+ kmem_free(buf, 131072); | |
+} | |
+ | |
+ | |
+ | |
static kmutex_t zfs_findernotify_lock; | |
static kcondvar_t zfs_findernotify_thread_cv; | |
static boolean_t zfs_findernotify_thread_exit; | |
@@ -321,6 +363,10 @@ zfs_findernotify_thread(void *notused) | |
if (!zfs_findernotify_thread_exit) | |
vfs_iterate(LK_NOWAIT, zfs_findernotify_callback, NULL); | |
+ if (debug_vnop_osx_printf == 1234) { | |
+ debug_vnop_osx_printf = 0; | |
+ write_test(); | |
+ } | |
} | |
zfs_findernotify_thread_exit = FALSE; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment