Skip to content

Commit

Permalink
move all Z.I.A. include guards into Z.I.A. files
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lee <[email protected]>
  • Loading branch information
calccrypto committed Mar 18, 2024
1 parent fd78799 commit b025b3e
Show file tree
Hide file tree
Showing 27 changed files with 229 additions and 336 deletions.
2 changes: 0 additions & 2 deletions include/sys/abd.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ typedef struct abd {
list_t abd_gang_chain;
} abd_gang;
} abd_u;
#ifdef ZIA
void *abd_zia_handle;
#endif
} abd_t;

typedef int abd_iter_func_t(void *buf, size_t len, void *priv);
Expand Down
2 changes: 0 additions & 2 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ typedef enum {
ZPOOL_PROP_BCLONEUSED,
ZPOOL_PROP_BCLONESAVED,
ZPOOL_PROP_BCLONERATIO,
#ifdef ZIA
ZPOOL_PROP_ZIA_PROVIDER,
ZPOOL_PROP_ZIA_COMPRESS,
ZPOOL_PROP_ZIA_DECOMPRESS,
Expand All @@ -271,7 +270,6 @@ typedef enum {
ZPOOL_PROP_ZIA_RAIDZ3_REC,
ZPOOL_PROP_ZIA_FILE_WRITE,
ZPOOL_PROP_ZIA_DISK_WRITE,
#endif
ZPOOL_NUM_PROPS
} zpool_prop_t;

Expand Down
7 changes: 1 addition & 6 deletions include/sys/spa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@
#include <sys/zfeature.h>
#include <sys/zthr.h>
#include <sys/dsl_deadlist.h>
#include <zfeature_common.h>

#ifdef ZIA
#include <sys/zia.h>
#endif
#include <zfeature_common.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -470,9 +467,7 @@ struct spa {
spa_config_lock_t spa_config_lock[SCL_LOCKS]; /* config changes */
zfs_refcount_t spa_refcount; /* number of opens */

#ifdef ZIA
zia_props_t spa_zia_props;
#endif
};

extern char *spa_config_path;
Expand Down
3 changes: 1 addition & 2 deletions include/sys/vdev_disk.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@
#ifdef _KERNEL
#include <sys/vdev.h>

#ifdef ZIA
int __vdev_disk_physio(struct block_device *bdev, zio_t *zio,
size_t io_size, uint64_t io_offset, int rw, int flags);
int vdev_disk_io_flush(struct block_device *bdev, zio_t *zio);
void vdev_disk_error(zio_t *zio);
#endif /* ZIA */

#endif /* _KERNEL */
#endif /* _SYS_VDEV_DISK_H */
3 changes: 1 addition & 2 deletions include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ struct vdev {
uint64_t vdev_io_t;
uint64_t vdev_slow_io_n;
uint64_t vdev_slow_io_t;
#ifdef ZIA

void *vdev_zia_handle;
#endif
};

#define VDEV_PAD_SIZE (8 << 10)
Expand Down
2 changes: 0 additions & 2 deletions include/sys/vdev_raidz.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,10 @@ extern void spa_start_raidz_expansion_thread(spa_t *);
extern int spa_raidz_expand_get_stats(spa_t *, pool_raidz_expand_stat_t *);
extern int vdev_raidz_load(vdev_t *);

#ifdef ZIA
void vdev_raidz_generate_parity_p(struct raidz_row *);
void vdev_raidz_generate_parity_pq(struct raidz_row *);
void vdev_raidz_generate_parity_pqr(struct raidz_row *);
void vdev_raidz_reconstruct_general(struct raidz_row *, int *, int);
#endif

/* RAIDZ scratch area pause points (for testing) */
#define RAIDZ_EXPAND_PAUSE_NONE 0
Expand Down
2 changes: 0 additions & 2 deletions include/sys/vdev_raidz_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ typedef struct raidz_row {
uint64_t rr_offset; /* Logical offset for *_io_verify() */
uint64_t rr_size; /* Physical size for *_io_verify() */
#endif
#ifdef ZIA
void *rr_zia_handle;
#endif
raidz_col_t rr_col[]; /* Flexible array of I/O columns */
} raidz_row_t;

Expand Down
7 changes: 3 additions & 4 deletions include/sys/zia.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
*
*/

#ifdef ZIA

#ifndef _ZIA_H
#define _ZIA_H

Expand Down Expand Up @@ -84,6 +82,9 @@ typedef struct raidz_map raidz_map_t;
#define ZIA_ACCELERATOR_DOWN 1005
/* ******************************************************** */

/* DPUSM was not found by configure */
#define ZIA_DISABLED 1006

/*
* This struct is normally set with
* zpool set zia_<property>=on/off/<value>
Expand Down Expand Up @@ -221,5 +222,3 @@ int zia_disk_close(vdev_t *vdev);
#endif

#endif

#endif
12 changes: 4 additions & 8 deletions include/sys/zia_cddl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,15 @@
* CDDL HEADER END
*/

#ifdef ZIA

#ifndef _ZIA_CDDL_H
#define _ZIA_CDDL_H

#include <sys/abd.h>
#include <sys/spa.h>
#include <sys/zio.h>
#include <sys/zio_compress.h>
#include <sys/zio_checksum.h>

#ifdef ZIA
#include <dpusm/user_api.h>

int
zia_compress_impl(const dpusm_uf_t *dpusm, zia_props_t *props,
enum zio_compress c, abd_t *src, size_t s_len,
Expand All @@ -48,8 +44,8 @@ zia_disk_write_completion(void *zio_ptr, int error);

void
zia_disk_flush_completion(void *zio_ptr, int error);
#endif
#endif /* _KERNEL */

#endif
#endif /* ZIA */

#endif
#endif /* _ZIA_CDDL_H */
19 changes: 9 additions & 10 deletions include/sys/zia_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,32 @@
*
*/

#ifdef ZIA

#ifndef _ZIA_PRIVATE_H
#define _ZIA_PRIVATE_H

#include <sys/zio.h>
#include <sys/zio_compress.h>
#include <sys/zio_checksum.h>

#include <dpusm/user_api.h>

/*
* needed by both zia.h and zia_cddl.h
*/

#include <sys/zio.h>
#include <sys/zio_compress.h>
#include <sys/zio_checksum.h>

#define ABD_HANDLE(abd) (abd)->abd_zia_handle

#define VDEV_HANDLE(vdev) (vdev)->vdev_zia_handle

int
dpusm_to_ret(const int dpusm_ret);

#ifdef ZIA
#include <dpusm/user_api.h>

dpusm_compress_t
compress_to_dpusm(enum zio_compress c);

int zia_get_capabilities(void *provider, dpusm_pc_t **caps);

#endif
#endif /* ZIA */

#endif
#endif /* _ZIA_PRIVATE_H */
4 changes: 0 additions & 4 deletions include/sys/zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ typedef uint64_t zio_flag_t;
#define ZIO_FLAG_REEXECUTED (1ULL << 29)
#define ZIO_FLAG_DELEGATED (1ULL << 30)

#ifdef ZIA
#define ZIO_FLAG_ZIA_REEXECUTE (1ULL << 32)
#endif

#define ZIO_ALLOCATOR_NONE (-1)
#define ZIO_HAS_ALLOCATOR(zio) ((zio)->io_allocator != ZIO_ALLOCATOR_NONE)
Expand Down Expand Up @@ -537,9 +535,7 @@ struct zio {
/* write issue taskq selection, based upon sync thread */
taskq_t *io_wr_iss_tq;

#ifdef ZIA
boolean_t io_can_offload;
#endif
};

enum blk_verify_flag {
Expand Down
2 changes: 0 additions & 2 deletions include/sys/zio_compress.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ typedef const struct zio_compress_info {

extern zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS];

#ifdef ZIA
extern int zio_compress_zeroed_cb(void *data, size_t len, void *private);
#endif

/*
* lz4 compression init & free
Expand Down
32 changes: 2 additions & 30 deletions module/os/linux/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <sys/vdev_trim.h>
#include <sys/abd.h>
#include <sys/fs/zfs.h>
#include <sys/zia.h>
#include <sys/zio.h>
#include <linux/blkpg.h>
#include <linux/msdos_fs.h>
Expand Down Expand Up @@ -61,10 +62,6 @@ typedef void zfs_bdev_handle_t;
#define BDH_ERR_PTR(err) (ERR_PTR(err))
#endif

#ifdef ZIA
#include <sys/zia.h>
#endif

typedef struct vdev_disk {
zfs_bdev_handle_t *vd_bdh;
krwlock_t vd_lock;
Expand Down Expand Up @@ -214,11 +211,7 @@ bdev_max_capacity(struct block_device *bdev, uint64_t wholedisk)
return (psize);
}

#ifndef ZIA
static void
#else
void
#endif
vdev_disk_error(zio_t *zio)
{
/*
Expand Down Expand Up @@ -333,9 +326,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
reread_part = B_TRUE;
}

#ifdef ZIA
zia_disk_close(v);
#endif
vdev_blkdev_put(bdh, mode, zfs_vdev_holder);
}

Expand Down Expand Up @@ -457,12 +448,10 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
*logical_ashift = highbit64(MAX(logical_block_size,
SPA_MINBLOCKSIZE)) - 1;

#ifdef ZIA
zia_get_props(v->vdev_spa)->min_offload_size = 2 << *physical_ashift;

/* open disk; ignore errors - will fall back to ZFS */
zia_disk_open(v, v->vdev_path, vd->vd_bdh);
#endif

return (0);
}
Expand Down Expand Up @@ -731,11 +720,7 @@ vdev_bio_max_segs(zio_t *zio, int bio_size, uint64_t abd_offset)
#endif
}

#ifndef ZIA
static int
#else
int
#endif
__vdev_disk_physio(struct block_device *bdev, zio_t *zio,
size_t io_size, uint64_t io_offset, int rw, int flags)
{
Expand Down Expand Up @@ -845,9 +830,7 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio,
return (error);
}

#ifdef ZIA
EXPORT_SYMBOL(__vdev_disk_physio);
#endif

BIO_END_IO_PROTO(vdev_disk_io_flush_completion, bio, error)
{
Expand All @@ -868,11 +851,7 @@ BIO_END_IO_PROTO(vdev_disk_io_flush_completion, bio, error)
zio_interrupt(zio);
}

#ifndef ZIA
static int
#else
int
#endif
vdev_disk_io_flush(struct block_device *bdev, zio_t *zio)
{
struct request_queue *q;
Expand All @@ -895,9 +874,7 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio)
return (0);
}

#ifdef ZIA
EXPORT_SYMBOL(vdev_disk_io_flush);
#endif

#if defined(HAVE_BLKDEV_ISSUE_SECURE_ERASE) || \
defined(HAVE_BLKDEV_ISSUE_DISCARD_ASYNC)
Expand Down Expand Up @@ -1016,7 +993,6 @@ vdev_disk_io_start(zio_t *zio)
break;
}

#ifdef ZIA
error = zia_disk_flush(v, zio);

/*
Expand All @@ -1027,7 +1003,6 @@ vdev_disk_io_start(zio_t *zio)
rw_exit(&vd->vd_lock);
return;
}
#endif
error = vdev_disk_io_flush(BDH_BDEV(vd->vd_bdh), zio);
if (error == 0) {
rw_exit(&vd->vd_lock);
Expand Down Expand Up @@ -1072,7 +1047,7 @@ vdev_disk_io_start(zio_t *zio)
}

zio->io_target_timestamp = zio_handle_io_delay(zio);
#ifdef ZIA

error = EIO;

if (rw == WRITE) {
Expand Down Expand Up @@ -1103,7 +1078,6 @@ vdev_disk_io_start(zio_t *zio)
return;
}
}
#endif
error = __vdev_disk_physio(BDH_BDEV(vd->vd_bdh), zio,
zio->io_size, zio->io_offset, rw, 0);
rw_exit(&vd->vd_lock);
Expand All @@ -1128,9 +1102,7 @@ vdev_disk_io_done(zio_t *zio)
vdev_disk_t *vd = v->vdev_tsd;

if (!zfs_check_disk_status(BDH_BDEV(vd->vd_bdh))) {
#ifdef ZIA
zia_disk_invalidate(v);
#endif
invalidate_bdev(BDH_BDEV(vd->vd_bdh));
v->vdev_remove_wanted = B_TRUE;
spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE);
Expand Down
Loading

0 comments on commit b025b3e

Please sign in to comment.