Skip to content

Instantly share code, notes, and snippets.

View pcd1193182's full-sized avatar

Paul Dagnelie pcd1193182

  • Delphix
View GitHub Profile
commit f660dfd33470d8c66e15417c8f8783898fb4d6bf
Author: Paul Dagnelie <pcd@delphix.com>
AuthorDate: Thu May 2 16:19:24 2024 -0700
Commit: Paul Dagnelie <pcd@delphix.com>
CommitDate: Fri May 3 12:08:30 2024 -0700
site pkg
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
@pcd1193182
pcd1193182 / gist:5c35b1bc8bf084b582703ab7b17c1adf
Last active May 21, 2021 20:01
Object Storage MMP Pseudocode
heartbeat_interval = 1 second
lease_duration = 10 seconds
agent_id_path = /run/zfs_agent_id
heartbeat_thread(s3):
file = open(agent_id_path)
if !file.exists:
file.create()
file.write(random_guid())
else:
@pcd1193182
pcd1193182 / gist:f0f077940be3a08c0f6ae28c092fa4d4
Last active January 5, 2021 18:21
A list of pairs you get from swapping ie with ei, from a variety of dictionaries
Many thanks to the 12dicts project for the better of the wordlists in use here.
2of12inf.txt:
climates clematis
lie lei
lintel lentil
pines penis
prices precis
risen resin
@pcd1193182
pcd1193182 / pre-push
Created August 27, 2020 19:18
Git pre-push hook that prints correct github PR creation url
#!/bin/sh
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
if [[ ! "$url" =~ github ]]; then
echo "doesn't match github"
exit 0
fi
delphix@appliance:~$ cat thing.patch
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c
index 6ce1d0fb6..929f15f19 100644
--- a/module/zfs/dmu_send.c
+++ b/module/zfs/dmu_send.c
@@ -2252,6 +2252,11 @@ dmu_send_impl(struct dmu_send_params *dspp)
dsl_pool_t *dp = dspp->dp;
void *tag = dspp->tag;
+ if (fromtxg != 0) {
@pcd1193182
pcd1193182 / recv.diff
Created September 26, 2018 04:21
Diff between bottom half of dmu_send.c and dmu_recv.c
0a1,108
> /*
> * CDDL HEADER START
> *
> * The contents of this file are subject to the terms of the
> * Common Development and Distribution License (the "License").
> * You may not use this file except in compliance with the License.
> *
> * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
> * or http://www.opensolaris.org/os/licensing.
index b47b669e80..9868aa3020 100644
--- a/usr/src/lib/libzfs/common/libzfs_diff.c
+++ b/usr/src/lib/libzfs/common/libzfs_diff.c
@@ -359,13 +359,13 @@ describe_free(FILE *fp, differ_info_t *di, uint64_t object, char *namebuf,
if (get_stats_for_obj(di, di->fromsnap, object, namebuf,
maxlen, &sb) != 0) {
- /* Let it slide, if in the delete queue on from side */
- if (di->zerr == ENOENT && sb.zs_links == 0) {
- di->zerr = 0;
diff --git a/usr/src/uts/common/fs/zfs/dmu_send.c b/usr/src/uts/common/fs/zfs/dmu_send.c
index 01a4514..db60198 100644
--- a/usr/src/uts/common/fs/zfs/dmu_send.c
+++ b/usr/src/uts/common/fs/zfs/dmu_send.c
@@ -190,6 +190,15 @@ dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset,
(object == dsp->dsa_last_data_object &&
offset > dsp->dsa_last_data_offset));
+ /*
+ * If we are doing a non-incremental send, then there can't
diff --git a/usr/src/uts/common/fs/zfs/dnode.c b/usr/src/uts/common/fs/zfs/dnode.c
index 7fdb64d..540b23e 100644
--- a/usr/src/uts/common/fs/zfs/dnode.c
+++ b/usr/src/uts/common/fs/zfs/dnode.c
@@ -1552,6 +1552,72 @@ dnode_dirty_l1(dnode_t *dn, uint64_t l1blkid, dmu_tx_t *tx)
}
}
+/*
+ * Dirty all the in-core level-1 dbufs in the range specified by start_blkid
@pcd1193182
pcd1193182 / gist:f91e950925d8edc0648ff4a69d00b08e
Last active August 23, 2016 16:38
alternate 4996 patch, now compiles, boots, passes 3.sh
diff --git a/usr/src/uts/common/fs/zfs/dnode_sync.c b/usr/src/uts/common/fs/zfs/dnode_sync.c
index d4e6502..c8c8240 100644
--- a/usr/src/uts/common/fs/zfs/dnode_sync.c
+++ b/usr/src/uts/common/fs/zfs/dnode_sync.c
@@ -111,7 +111,7 @@ dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx)
}
static void
-free_blocks(dnode_t *dn, blkptr_t *bp, int num, dmu_tx_t *tx)
+free_blocks(dnode_t *dn, blkptr_t *bp, int num, uint64_t birth, dmu_tx_t *tx)