summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorGvozden Neskovic <[email protected]>2017-01-05 14:10:07 -0500
committerBrian Behlendorf <[email protected]>2017-03-29 12:24:51 -0700
commit84c07adadb2486e4049032e43e1f38650ca75289 (patch)
treee3215504111edc9dea3970e643833f6963f3f9d0 /cmd
parent2035575fd67fd7dd14f072e1cb6f4bae8ca62c7d (diff)
Remove dependency on linear ABD
Wherever possible it's best to avoid depending on a linear ABD. Update the code accordingly in the following areas. - vdev_raidz - zio, zio_checksum - zfs_fm - change abd_alloc_for_io() to use abd_alloc() Reviewed-by: David Quigley <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Gvozden Neskovic <[email protected]> Closes #5668
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zdb/zdb.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 82c2b5733..d5b8a7745 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -3736,6 +3736,7 @@ zdb_read_block(char *thing, spa_t *spa)
void *lbuf, *buf;
char *s, *p, *dup, *vdev, *flagstr;
int i, error;
+ boolean_t borrowed = B_FALSE;
dup = strdup(thing);
s = strtok(dup, ":");
@@ -3806,7 +3807,7 @@ zdb_read_block(char *thing, spa_t *spa)
psize = size;
lsize = size;
- pabd = abd_alloc_linear(SPA_MAXBLOCKSIZE, B_FALSE);
+ pabd = abd_alloc_for_io(SPA_MAXBLOCKSIZE, B_FALSE);
lbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
BP_ZERO(bp);
@@ -3907,8 +3908,9 @@ zdb_read_block(char *thing, spa_t *spa)
buf = lbuf;
size = lsize;
} else {
- buf = abd_to_buf(pabd);
size = psize;
+ buf = abd_borrow_buf_copy(pabd, size);
+ borrowed = B_TRUE;
}
if (flags & ZDB_FLAG_PRINT_BLKPTR)
@@ -3924,6 +3926,9 @@ zdb_read_block(char *thing, spa_t *spa)
else
zdb_dump_block(thing, buf, size, flags);
+ if (borrowed)
+ abd_return_buf_copy(pabd, buf, size);
+
out:
abd_free(pabd);
umem_free(lbuf, SPA_MAXBLOCKSIZE);