From 177c79dfbee633b70e7d373ff83c6a2d47625a17 Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Sun, 13 Oct 2019 19:25:19 -0700 Subject: [PATCH] Remove dead code and cleanup scoping in dmu_send.c This addresses a number of problems with dmu_send.c: * bp_span is unused which makes clang complain * dump_write conflicts with FreeBSD's existing core dump code * range_alloc is private to the file and not declared in any headers causing clang to complain Reviewed-by: Matt Ahrens Reviewed-by: Brian Behlendorf Signed-off-by: Matt Macy Closes #9432 --- module/zfs/dmu_send.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index 13e77af6d2d0..ea28dbc28210 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -112,17 +112,6 @@ overflow_multiply(uint64_t a, uint64_t b, uint64_t *c) return (B_TRUE); } -/* - * Return B_TRUE and modifies *out to the span if the span is less than 2^64, - * returns B_FALSE otherwise. - */ -static inline boolean_t -bp_span(uint32_t datablksz, uint8_t indblkshift, uint64_t level, uint64_t *out) -{ - uint64_t spanb = bp_span_in_blocks(indblkshift, level); - return (overflow_multiply(spanb, datablksz, out)); -} - struct send_thread_arg { bqueue_t q; dsl_dataset_t *ds; /* Dataset to traverse */ @@ -468,7 +457,7 @@ dump_redact(dmu_send_cookie_t *dscp, uint64_t object, uint64_t offset, } static int -dump_write(dmu_send_cookie_t *dscp, dmu_object_type_t type, uint64_t object, +dmu_dump_write(dmu_send_cookie_t *dscp, dmu_object_type_t type, uint64_t object, uint64_t offset, int lsize, int psize, const blkptr_t *bp, void *data) { uint64_t payload_size; @@ -1057,7 +1046,7 @@ do_dump(dmu_send_cookie_t *dscp, struct send_range *range) while (srdp->datablksz > 0 && err == 0) { int n = MIN(srdp->datablksz, SPA_OLD_MAXBLOCKSIZE); - err = dump_write(dscp, srdp->obj_type, + err = dmu_dump_write(dscp, srdp->obj_type, range->object, offset, n, n, NULL, buf); offset += n; buf += n; @@ -1076,8 +1065,8 @@ do_dump(dmu_send_cookie_t *dscp, struct send_range *range) } else { psize = BP_GET_PSIZE(bp); } - err = dump_write(dscp, srdp->obj_type, range->object, - offset, srdp->datablksz, psize, bp, + err = dmu_dump_write(dscp, srdp->obj_type, + range->object, offset, srdp->datablksz, psize, bp, (abuf == NULL ? NULL : abuf->b_data)); } if (abuf != NULL) @@ -1116,7 +1105,7 @@ do_dump(dmu_send_cookie_t *dscp, struct send_range *range) return (err); } -struct send_range * +static struct send_range * range_alloc(enum type type, uint64_t object, uint64_t start_blkid, uint64_t end_blkid, boolean_t eos) {