Skip to content

Commit

Permalink
split the SIMD-specific functions into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
rdolbeau committed Jun 25, 2015
1 parent d6f5b0e commit 30e763e
Show file tree
Hide file tree
Showing 8 changed files with 1,187 additions and 1,042 deletions.
1 change: 1 addition & 0 deletions include/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/vdev_file.h \
$(top_srcdir)/include/sys/vdev.h \
$(top_srcdir)/include/sys/vdev_impl.h \
$(top_srcdir)/include/sys/vdev_raidz.h \
$(top_srcdir)/include/sys/xvattr.h \
$(top_srcdir)/include/sys/zap.h \
$(top_srcdir)/include/sys/zap_impl.h \
Expand Down
80 changes: 80 additions & 0 deletions include/sys/vdev_raidz.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

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

typedef struct raidz_col {
uint64_t rc_devidx; /* child device index for I/O */
uint64_t rc_offset; /* device offset */
uint64_t rc_size; /* I/O size */
void *rc_data; /* I/O data */
void *rc_gdata; /* used to store the "good" version */
int rc_error; /* I/O error for this device */
uint8_t rc_tried; /* Did we attempt this I/O column? */
uint8_t rc_skipped; /* Did we skip this I/O column? */
} raidz_col_t;

typedef struct raidz_map {
uint64_t rm_cols; /* Regular column count */
uint64_t rm_scols; /* Count including skipped columns */
uint64_t rm_bigcols; /* Number of oversized columns */
uint64_t rm_asize; /* Actual total I/O size */
uint64_t rm_missingdata; /* Count of missing data devices */
uint64_t rm_missingparity; /* Count of missing parity devices */
uint64_t rm_firstdatacol; /* First data column/parity count */
uint64_t rm_nskip; /* Skipped sectors for padding */
uint64_t rm_skipstart; /* Column index of padding start */
void *rm_datacopy; /* rm_asize-buffer of copied data */
uintptr_t rm_reports; /* # of referencing checksum reports */
uint8_t rm_freed; /* map no longer has referencing ZIO */
uint8_t rm_ecksuminjected; /* checksum error was injected */
raidz_col_t rm_col[1]; /* Flexible array of I/O columns */
} raidz_map_t;

#define VDEV_RAIDZ_P 0
#define VDEV_RAIDZ_Q 1
#define VDEV_RAIDZ_R 2

#define VDEV_RAIDZ_MUL_2(x) (((x) << 1) ^ (((x) & 0x80) ? 0x1d : 0))
#define VDEV_RAIDZ_MUL_4(x) (VDEV_RAIDZ_MUL_2(VDEV_RAIDZ_MUL_2(x)))

/*
* We provide a mechanism to perform the field multiplication operation on a
* 64-bit value all at once rather than a byte at a time. This works by
* creating a mask from the top bit in each byte and using that to
* conditionally apply the XOR of 0x1d.
*/
#define VDEV_RAIDZ_64MUL_2(x, mask) \
{ \
(mask) = (x) & 0x8080808080808080ULL; \
(mask) = ((mask) << 1) - ((mask) >> 7); \
(x) = (((x) << 1) & 0xfefefefefefefefeULL) ^ \
((mask) & 0x1d1d1d1d1d1d1d1dULL); \
}

#define VDEV_RAIDZ_64MUL_4(x, mask) \
{ \
VDEV_RAIDZ_64MUL_2((x), mask); \
VDEV_RAIDZ_64MUL_2((x), mask); \
}
3 changes: 3 additions & 0 deletions lib/libzpool/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ libzpool_la_SOURCES = \
$(top_srcdir)/module/zfs/vdev_missing.c \
$(top_srcdir)/module/zfs/vdev_queue.c \
$(top_srcdir)/module/zfs/vdev_raidz.c \
$(top_srcdir)/module/zfs/vdev_raidz_sse.c \
$(top_srcdir)/module/zfs/vdev_raidz_avx128.c \
$(top_srcdir)/module/zfs/vdev_raidz_avx2.c \
$(top_srcdir)/module/zfs/vdev_root.c \
$(top_srcdir)/module/zfs/zap.c \
$(top_srcdir)/module/zfs/zap_leaf.c \
Expand Down
3 changes: 3 additions & 0 deletions module/zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ $(MODULE)-objs += @top_srcdir@/module/zfs/vdev_mirror.o
$(MODULE)-objs += @top_srcdir@/module/zfs/vdev_missing.o
$(MODULE)-objs += @top_srcdir@/module/zfs/vdev_queue.o
$(MODULE)-objs += @top_srcdir@/module/zfs/vdev_raidz.o
$(MODULE)-objs += @top_srcdir@/module/zfs/vdev_raidz_sse.o
$(MODULE)-objs += @top_srcdir@/module/zfs/vdev_raidz_avx128.o
$(MODULE)-objs += @top_srcdir@/module/zfs/vdev_raidz_avx2.o
$(MODULE)-objs += @top_srcdir@/module/zfs/vdev_root.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zap.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zap_leaf.o
Expand Down
Loading

0 comments on commit 30e763e

Please sign in to comment.