Skip to content

Commit

Permalink
Attempt to run scrub with large stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
lundman committed Jan 27, 2023
1 parent 7dade4a commit 376cbbd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/os/windows/spl/sys/ia32/asm_linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ extern "C" {
*/
#define ENTRY(x) \
.text; \
.align ASM_ENTRY_ALIGN; \
.balign ASM_ENTRY_ALIGN; \
.globl x; \
x: MCOUNT(x)

#define ENTRY_NP(x) \
.text; \
.align ASM_ENTRY_ALIGN; \
.balign ASM_ENTRY_ALIGN; \
.globl x; \
x:

Expand Down
34 changes: 34 additions & 0 deletions module/zfs/dsl_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2720,8 +2720,42 @@ dsl_scan_ds_maxtxg(dsl_dataset_t *ds)
return (smt);
}

#if defined(_WIN32) && defined(_KERNEL)
/*
* Windows lets us callout to a function with a
* larger stack size, which is needed in scrub and resilver.
* but since it takes only one argument, we have to double
* wrap it here.
*/
struct _win32_larger_stack {
dsl_scan_t *scn;
dmu_tx_t *tx;
};

static void
dsl_scan_visit_impl(dsl_scan_t *scn, dmu_tx_t *tx);

void
dsl_scan_visit_wrap(struct _win32_larger_stack *arg)
{
dsl_scan_visit_impl(arg->scn, arg->tx);
}

static void
dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx)
{
struct _win32_larger_stack wls = { scn, tx };
if (KeExpandKernelStackAndCallout(dsl_scan_visit_wrap, &wls,
MAXIMUM_EXPANSION_SIZE) != 0)
dsl_scan_visit_impl(scn, tx);
}

static void
dsl_scan_visit_impl(dsl_scan_t *scn, dmu_tx_t *tx)
#else
static void
dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx)
#endif
{
scan_ds_t *sds;
dsl_pool_t *dp = scn->scn_dp;
Expand Down

0 comments on commit 376cbbd

Please sign in to comment.