summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 11:04:17 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 08:38:50 -0700
commitc776b317e44a64d53217d34c3fa61d36fd5a32d5 (patch)
tree672c470c9bae76b906be4ada12fc080ac3698ab9 /module
parent5ae4e2c2c660269d87dd5bbac6f590f69d0c7d8c (diff)
Fix stack zio_done()
Eliminated local variables pointing to members of the zio struct. Just refer to the struct members directly. This saved about 32 bytes per call, but this function can be called recurisvely up to 19 levels deep, so we potentially save up to 608 bytes. Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r--module/zfs/zio.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index f0f0cff6b..fb60bd8a0 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -2663,11 +2663,6 @@ zio_ready(zio_t *zio)
static int
zio_done(zio_t *zio)
{
- spa_t *spa = zio->io_spa;
- zio_t *lio = zio->io_logical;
- blkptr_t *bp = zio->io_bp;
- vdev_t *vd = zio->io_vd;
- uint64_t psize = zio->io_size;
zio_t *pio, *pio_next;
int c, w;
@@ -2685,18 +2680,18 @@ zio_done(zio_t *zio)
for (w = 0; w < ZIO_WAIT_TYPES; w++)
ASSERT(zio->io_children[c][w] == 0);
- if (bp != NULL) {
- ASSERT(bp->blk_pad[0] == 0);
- ASSERT(bp->blk_pad[1] == 0);
- ASSERT(bcmp(bp, &zio->io_bp_copy, sizeof (blkptr_t)) == 0 ||
- (bp == zio_unique_parent(zio)->io_bp));
- if (zio->io_type == ZIO_TYPE_WRITE && !BP_IS_HOLE(bp) &&
+ if (zio->io_bp != NULL) {
+ ASSERT(zio->io_bp->blk_pad[0] == 0);
+ ASSERT(zio->io_bp->blk_pad[1] == 0);
+ ASSERT(bcmp(zio->io_bp, &zio->io_bp_copy, sizeof (blkptr_t)) == 0 ||
+ (zio->io_bp == zio_unique_parent(zio)->io_bp));
+ if (zio->io_type == ZIO_TYPE_WRITE && !BP_IS_HOLE(zio->io_bp) &&
zio->io_bp_override == NULL &&
!(zio->io_flags & ZIO_FLAG_IO_REPAIR)) {
- ASSERT(!BP_SHOULD_BYTESWAP(bp));
- ASSERT3U(zio->io_prop.zp_copies, <=, BP_GET_NDVAS(bp));
- ASSERT(BP_COUNT_GANG(bp) == 0 ||
- (BP_COUNT_GANG(bp) == BP_GET_NDVAS(bp)));
+ ASSERT(!BP_SHOULD_BYTESWAP(zio->io_bp));
+ ASSERT3U(zio->io_prop.zp_copies, <=, BP_GET_NDVAS(zio->io_bp));
+ ASSERT(BP_COUNT_GANG(zio->io_bp) == 0 ||
+ (BP_COUNT_GANG(zio->io_bp) == BP_GET_NDVAS(zio->io_bp)));
}
}
@@ -2715,13 +2710,13 @@ zio_done(zio_t *zio)
while (zio->io_cksum_report != NULL) {
zio_cksum_report_t *zcr = zio->io_cksum_report;
uint64_t align = zcr->zcr_align;
- uint64_t asize = P2ROUNDUP(psize, align);
+ uint64_t asize = P2ROUNDUP(zio->io_size, align);
char *abuf = zio->io_data;
- if (asize != psize) {
+ if (asize != zio->io_size) {
abuf = zio_buf_alloc(asize);
- bcopy(zio->io_data, abuf, psize);
- bzero(abuf + psize, asize - psize);
+ bcopy(zio->io_data, abuf, zio->io_size);
+ bzero(abuf + zio->io_size, asize - zio->io_size);
}
zio->io_cksum_report = zcr->zcr_next;
@@ -2729,14 +2724,14 @@ zio_done(zio_t *zio)
zcr->zcr_finish(zcr, abuf);
zfs_ereport_free_checksum(zcr);
- if (asize != psize)
+ if (asize != zio->io_size)
zio_buf_free(abuf, asize);
}
}
zio_pop_transforms(zio); /* note: may set zio->io_error */
- vdev_stat_update(zio, psize);
+ vdev_stat_update(zio, zio->io_size);
if (zio->io_error) {
/*
@@ -2745,28 +2740,30 @@ zio_done(zio_t *zio)
* at the block level. We ignore these errors if the
* device is currently unavailable.
*/
- if (zio->io_error != ECKSUM && vd != NULL && !vdev_is_dead(vd))
- zfs_ereport_post(FM_EREPORT_ZFS_IO, spa, vd, zio, 0, 0);
+ if (zio->io_error != ECKSUM && zio->io_vd != NULL &&
+ !vdev_is_dead(zio->io_vd))
+ zfs_ereport_post(FM_EREPORT_ZFS_IO, zio->io_spa,
+ zio->io_vd, zio, 0, 0);
if ((zio->io_error == EIO || !(zio->io_flags &
(ZIO_FLAG_SPECULATIVE | ZIO_FLAG_DONT_PROPAGATE))) &&
- zio == lio) {
+ zio == zio->io_logical) {
/*
* For logical I/O requests, tell the SPA to log the
* error and generate a logical data ereport.
*/
- spa_log_error(spa, zio);
- zfs_ereport_post(FM_EREPORT_ZFS_DATA, spa, NULL, zio,
+ spa_log_error(zio->io_spa, zio);
+ zfs_ereport_post(FM_EREPORT_ZFS_DATA, zio->io_spa, NULL, zio,
0, 0);
}
}
- if (zio->io_error && zio == lio) {
+ if (zio->io_error && zio == zio->io_logical) {
/*
* Determine whether zio should be reexecuted. This will
* propagate all the way to the root via zio_notify_parent().
*/
- ASSERT(vd == NULL && bp != NULL);
+ ASSERT(zio->io_vd == NULL && zio->io_bp != NULL);
ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL);
if (IO_IS_ALLOCATING(zio) &&
@@ -2781,8 +2778,8 @@ zio_done(zio_t *zio)
zio->io_type == ZIO_TYPE_FREE) &&
!(zio->io_flags & ZIO_FLAG_SCAN_THREAD) &&
zio->io_error == ENXIO &&
- spa_load_state(spa) == SPA_LOAD_NONE &&
- spa_get_failmode(spa) != ZIO_FAILURE_MODE_CONTINUE)
+ spa_load_state(zio->io_spa) == SPA_LOAD_NONE &&
+ spa_get_failmode(zio->io_spa) != ZIO_FAILURE_MODE_CONTINUE)
zio->io_reexecute |= ZIO_REEXECUTE_SUSPEND;
if (!(zio->io_flags & ZIO_FLAG_CANFAIL) && !zio->io_reexecute)
@@ -2808,7 +2805,7 @@ zio_done(zio_t *zio)
if ((zio->io_error || zio->io_reexecute) &&
IO_IS_ALLOCATING(zio) && zio->io_gang_leader == zio &&
!(zio->io_flags & ZIO_FLAG_IO_REWRITE))
- zio_dva_unallocate(zio, zio->io_gang_tree, bp);
+ zio_dva_unallocate(zio, zio->io_gang_tree, zio->io_bp);
zio_gang_tree_free(&zio->io_gang_tree);
@@ -2873,14 +2870,14 @@ zio_done(zio_t *zio)
* We'd fail again if we reexecuted now, so suspend
* until conditions improve (e.g. device comes online).
*/
- zio_suspend(spa, zio);
+ zio_suspend(zio->io_spa, zio);
} else {
/*
* Reexecution is potentially a huge amount of work.
* Hand it off to the otherwise-unused claim taskq.
*/
(void) taskq_dispatch(
- spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
+ zio->io_spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
(task_func_t *)zio_reexecute, zio, TQ_SLEEP);
}
return (ZIO_PIPELINE_STOP);