Skip to content

Commit 06315b7

Browse files
ahrensChristopher Siden
authored andcommitted
4881 zfs send performance degradation when embedded block pointers are encountered
Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Approved by: Dan McDonald <danmcd@omniti.com>
1 parent 7fd05ac commit 06315b7

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

usr/src/uts/common/fs/zfs/dmu_traverse.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
/*
2222
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23-
* Copyright (c) 2013 by Delphix. All rights reserved.
23+
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
2424
*/
2525

2626
#include <sys/zfs_context.h>
@@ -197,6 +197,16 @@ traverse_prefetch_metadata(traverse_data_t *td,
197197
ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb);
198198
}
199199

200+
static boolean_t
201+
prefetch_needed(prefetch_data_t *pfd, const blkptr_t *bp)
202+
{
203+
ASSERT(pfd->pd_flags & TRAVERSE_PREFETCH_DATA);
204+
if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp) ||
205+
BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG)
206+
return (B_FALSE);
207+
return (B_TRUE);
208+
}
209+
200210
static int
201211
traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
202212
const blkptr_t *bp, const zbookmark_t *zb)
@@ -242,16 +252,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
242252
return (0);
243253
}
244254

245-
if (BP_IS_HOLE(bp)) {
246-
err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg);
247-
if (err != 0)
248-
goto post;
249-
return (0);
250-
}
251-
252-
if (pd && !pd->pd_exited &&
253-
((pd->pd_flags & TRAVERSE_PREFETCH_DATA) ||
254-
BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0)) {
255+
if (pd != NULL && !pd->pd_exited && prefetch_needed(pd, bp)) {
255256
mutex_enter(&pd->pd_mtx);
256257
ASSERT(pd->pd_blks_fetched >= 0);
257258
while (pd->pd_blks_fetched == 0 && !pd->pd_exited)
@@ -261,6 +262,13 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
261262
mutex_exit(&pd->pd_mtx);
262263
}
263264

265+
if (BP_IS_HOLE(bp)) {
266+
err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg);
267+
if (err != 0)
268+
goto post;
269+
return (0);
270+
}
271+
264272
if (td->td_flags & TRAVERSE_PRE) {
265273
err = td->td_func(td->td_spa, NULL, bp, zb, dnp,
266274
td->td_arg);
@@ -444,10 +452,7 @@ traverse_prefetcher(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
444452
if (pfd->pd_cancel)
445453
return (SET_ERROR(EINTR));
446454

447-
if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp) ||
448-
!((pfd->pd_flags & TRAVERSE_PREFETCH_DATA) ||
449-
BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0) ||
450-
BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG)
455+
if (!prefetch_needed(pfd, bp))
451456
return (0);
452457

453458
mutex_enter(&pfd->pd_mtx);

0 commit comments

Comments
 (0)