Skip to content

Commit

Permalink
Revert "Illumos openzfs#5244 zio pipeline callers should explicitly i…
Browse files Browse the repository at this point in the history
…nvoke next stage openzfs#2828"

This reverts commit 9291279.

conflicts with:

commit 92119cc
Author: Brian Behlendorf <behlendorf1@llnl.gov>
Date:   Sun Jul 13 14:35:19 2014 -0400

    Mark IO pipeline with PF_FSTRANS

    In order to avoid deadlocking in the IO pipeline it is critical that
    pageout be avoided during direct memory reclaim.  This ensures that
    the pipeline threads can always make forward progress and never end
    up blocking on a DMU transaction.  For this very reason Linux now
    provides the PF_FSTRANS flag which may be set in the process context.

    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>

not sure where that commit came from, it's not in master (?!) but commits
where always fetched from master /sadpanda
  • Loading branch information
kernelOfTruth committed Mar 13, 2015
1 parent d6b36ff commit 9221de3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 55 deletions.
2 changes: 1 addition & 1 deletion include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size,
uint64_t *ashift);
typedef void vdev_close_func_t(vdev_t *vd);
typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
typedef void vdev_io_start_func_t(zio_t *zio);
typedef int vdev_io_start_func_t(zio_t *zio);
typedef void vdev_io_done_func_t(zio_t *zio);
typedef void vdev_state_change_func_t(vdev_t *vd, int, int);
typedef void vdev_hold_func_t(vdev_t *vd);
Expand Down
3 changes: 3 additions & 0 deletions include/sys/zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ typedef enum zio_priority {
ZIO_PRIORITY_NOW /* non-queued i/os (e.g. free) */
} zio_priority_t;

#define ZIO_PIPELINE_CONTINUE 0x100
#define ZIO_PIPELINE_STOP 0x101

enum zio_flag {
/*
* Flags inherited by gang, ddt, and vdev children,
Expand Down
4 changes: 0 additions & 4 deletions lib/libzpool/taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
* Copyright (c) 2014 by Delphix. All rights reserved.
*/

#include <sys/zfs_context.h>
Expand All @@ -34,10 +33,8 @@ int taskq_now;
taskq_t *system_taskq;

#define TASKQ_ACTIVE 0x00010000
#define TASKQ_NAMELEN 31

struct taskq {
char tq_name[TASKQ_NAMELEN + 1];
kmutex_t tq_lock;
krwlock_t tq_threadlock;
kcondvar_t tq_dispatch_cv;
Expand Down Expand Up @@ -283,7 +280,6 @@ taskq_create(const char *name, int nthreads, pri_t pri,
cv_init(&tq->tq_dispatch_cv, NULL, CV_DEFAULT, NULL);
cv_init(&tq->tq_wait_cv, NULL, CV_DEFAULT, NULL);
cv_init(&tq->tq_maxalloc_cv, NULL, CV_DEFAULT, NULL);
(void) strncpy(tq->tq_name, name, TASKQ_NAMELEN + 1);
tq->tq_flags = flags | TASKQ_ACTIVE;
tq->tq_active = nthreads;
tq->tq_nthreads = nthreads;
Expand Down
20 changes: 9 additions & 11 deletions module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio)
return (0);
}

static void
static int
vdev_disk_io_start(zio_t *zio)
{
vdev_t *v = zio->io_vd;
Expand All @@ -683,9 +683,7 @@ vdev_disk_io_start(zio_t *zio)

if (!vdev_readable(v)) {
zio->io_error = SET_ERROR(ENXIO);
zio_interrupt(zio);
return;

return (ZIO_PIPELINE_CONTINUE);
}

switch (zio->io_cmd) {
Expand All @@ -701,7 +699,7 @@ vdev_disk_io_start(zio_t *zio)

error = vdev_disk_io_flush(vd->vd_bdev, zio);
if (error == 0)
return;
return (ZIO_PIPELINE_STOP);

zio->io_error = error;
if (error == ENOTSUP)
Expand All @@ -713,8 +711,8 @@ vdev_disk_io_start(zio_t *zio)
zio->io_error = SET_ERROR(ENOTSUP);
}

zio_execute(zio);
return;
return (ZIO_PIPELINE_CONTINUE);

case ZIO_TYPE_WRITE:
flags = WRITE;
break;
Expand All @@ -725,17 +723,17 @@ vdev_disk_io_start(zio_t *zio)

default:
zio->io_error = SET_ERROR(ENOTSUP);
zio_interrupt(zio);
return;
return (ZIO_PIPELINE_CONTINUE);
}

error = __vdev_disk_physio(vd->vd_bdev, zio, NULL,
zio->io_size, zio->io_offset, flags);
if (error) {
zio->io_error = error;
zio_interrupt(zio);
return;
return (ZIO_PIPELINE_CONTINUE);
}

return (ZIO_PIPELINE_STOP);
}

static void
Expand Down
12 changes: 6 additions & 6 deletions module/zfs/vdev_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/

#include <sys/zfs_context.h>
Expand Down Expand Up @@ -183,7 +183,7 @@ vdev_file_io_fsync(void *arg)
zio_interrupt(zio);
}

static void
static int
vdev_file_io_start(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
Expand All @@ -193,8 +193,7 @@ vdev_file_io_start(zio_t *zio)
/* XXPOLICY */
if (!vdev_readable(vd)) {
zio->io_error = SET_ERROR(ENXIO);
zio_interrupt(zio);
return;
return (ZIO_PIPELINE_CONTINUE);
}

switch (zio->io_cmd) {
Expand Down Expand Up @@ -223,12 +222,13 @@ vdev_file_io_start(zio_t *zio)
zio->io_error = SET_ERROR(ENOTSUP);
}

zio_execute(zio);
return;
return (ZIO_PIPELINE_CONTINUE);
}

VERIFY3U(taskq_dispatch(vdev_file_taskq, vdev_file_io_strategy, zio,
TQ_SLEEP), !=, 0);

return (ZIO_PIPELINE_STOP);
}

/* ARGSUSED */
Expand Down
9 changes: 4 additions & 5 deletions module/zfs/vdev_mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

/*
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/

#include <sys/zfs_context.h>
Expand Down Expand Up @@ -326,7 +326,7 @@ vdev_mirror_child_select(zio_t *zio)
return (-1);
}

static void
static int
vdev_mirror_io_start(zio_t *zio)
{
mirror_map_t *mm;
Expand Down Expand Up @@ -357,8 +357,7 @@ vdev_mirror_io_start(zio_t *zio)
zio->io_type, zio->io_priority, 0,
vdev_mirror_scrub_done, mc));
}
zio_execute(zio);
return;
return (ZIO_PIPELINE_CONTINUE);
}
/*
* For normal reads just pick one child.
Expand All @@ -384,7 +383,7 @@ vdev_mirror_io_start(zio_t *zio)
c++;
}

zio_execute(zio);
return (ZIO_PIPELINE_CONTINUE);
}

static int
Expand Down
6 changes: 3 additions & 3 deletions module/zfs/vdev_missing.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

/*
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/

/*
Expand Down Expand Up @@ -66,11 +66,11 @@ vdev_missing_close(vdev_t *vd)
}

/* ARGSUSED */
static void
static int
vdev_missing_io_start(zio_t *zio)
{
zio->io_error = SET_ERROR(ENOTSUP);
zio_execute(zio);
return (ZIO_PIPELINE_CONTINUE);
}

/* ARGSUSED */
Expand Down
9 changes: 4 additions & 5 deletions module/zfs/vdev_raidz.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/

#include <sys/zfs_context.h>
Expand Down Expand Up @@ -1722,7 +1722,7 @@ vdev_raidz_child_done(zio_t *zio)
* vdevs have had errors, then create zio read operations to the parity
* columns' VDevs as well.
*/
static void
static int
vdev_raidz_io_start(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
Expand Down Expand Up @@ -1766,8 +1766,7 @@ vdev_raidz_io_start(zio_t *zio)
ZIO_FLAG_NODATA | ZIO_FLAG_OPTIONAL, NULL, NULL));
}

zio_execute(zio);
return;
return (ZIO_PIPELINE_CONTINUE);
}

ASSERT(zio->io_type == ZIO_TYPE_READ);
Expand Down Expand Up @@ -1807,7 +1806,7 @@ vdev_raidz_io_start(zio_t *zio)
}
}

zio_execute(zio);
return (ZIO_PIPELINE_CONTINUE);
}


Expand Down
23 changes: 3 additions & 20 deletions module/zfs/zio.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ kmem_cache_t *zio_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT];
kmem_cache_t *zio_data_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT];
int zio_delay_max = ZIO_DELAY_MAX;

#define ZIO_PIPELINE_CONTINUE 0x100
#define ZIO_PIPELINE_STOP 0x101

/*
* The following actions directly effect the spa's sync-to-convergence logic.
* The values below define the sync pass when we start performing the action.
Expand Down Expand Up @@ -2611,18 +2608,6 @@ zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp)
* Read and write to physical devices
* ==========================================================================
*/


/*
* Issue an I/O to the underlying vdev. Typically the issue pipeline
* stops after this stage and will resume upon I/O completion.
* However, there are instances where the vdev layer may need to
* continue the pipeline when an I/O was not issued. Since the I/O
* that was sent to the vdev layer might be different than the one
* currently active in the pipeline (see vdev_queue_io()), we explicitly
* force the underlying vdev layers to call either zio_execute() or
* zio_interrupt() to ensure that the pipeline continues with the correct I/O.
*/
static int
zio_vdev_io_start(zio_t *zio)
{
Expand All @@ -2640,16 +2625,15 @@ zio_vdev_io_start(zio_t *zio)
/*
* The mirror_ops handle multiple DVAs in a single BP.
*/
vdev_mirror_ops.vdev_op_io_start(zio);
return (ZIO_PIPELINE_STOP);
return (vdev_mirror_ops.vdev_op_io_start(zio));
}

/*
* We keep track of time-sensitive I/Os so that the scan thread
* can quickly react to certain workloads. In particular, we care
* about non-scrubbing, top-level reads and writes with the following
* characteristics:
* - synchronous writes of user data to non-slog devices
* - synchronous writes of user data to non-slog devices
* - any reads of user data
* When these conditions are met, adjust the timestamp of spa_last_io
* which allows the scan thread to adjust its workload accordingly.
Expand Down Expand Up @@ -2739,8 +2723,7 @@ zio_vdev_io_start(zio_t *zio)
}
}

vd->vdev_ops->vdev_op_io_start(zio);
return (ZIO_PIPELINE_STOP);
return (vd->vdev_ops->vdev_op_io_start(zio));
}

static int
Expand Down

0 comments on commit 9221de3

Please sign in to comment.