OpenZFS restructuring - move platform specific sources

Move platform specific Linux source under module/os/linux/
and update the build system accordingly.  Additional code
restructuring will follow to make the common code fully
portable.
    
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Macy <mmacy@FreeBSD.org>
Closes #9206
This commit is contained in:
Matthew Macy
2019-09-06 11:26:26 -07:00
committed by Brian Behlendorf
parent 870e7a52c1
commit bced7e3aaa
62 changed files with 167 additions and 87 deletions
+53 -14
View File
@@ -3,9 +3,11 @@ obj-m += icp/
obj-m += lua/
obj-m += nvpair/
obj-m += spl/
obj-m += os/linux/spl/
obj-m += unicode/
obj-m += zcommon/
obj-m += zfs/
obj-m += os/linux/zfs/
INSTALL_MOD_DIR ?= extra
@@ -16,7 +18,6 @@ ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include/os/linux/kernel
ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include/os/linux/spl
ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include/os/linux/zfs
ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include
ZFS_MODULE_CPPFLAGS += -D_KERNEL
ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@
@@ -27,25 +28,38 @@ export ZFS_MODULE_CFLAGS ZFS_MODULE_CPPFLAGS
SUBDIR_TARGETS = icp lua
modules:
all: modules
distclean maintainer-clean: clean
install: modules_install
uninstall: modules_uninstall
check:
modules-Linux:
list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
$(MAKE) -C $$targetdir; \
done
$(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m $@
$(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m modules
clean:
modules-unknown:
@true
modules: modules-@ac_system@
clean-Linux:
@# Only cleanup the kernel build directories when CONFIG_KERNEL
@# is defined. This indicates that kernel modules should be built.
@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ $@
@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ clean
if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
if [ -f Module.markers ]; then $(RM) Module.markers; fi
find . -name '*.ur-safe' -type f -print | xargs $(RM)
modules_install:
clean: clean-@ac_system@
modules_install-Linux:
@# Install the kernel modules
$(MAKE) -C @LINUX_OBJ@ M=`pwd` $@ \
$(MAKE) -C @LINUX_OBJ@ M=`pwd` modules_install \
INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
KERNELRELEASE=@LINUX_VERSION@
@@ -59,22 +73,47 @@ modules_install:
depmod -ae -F $$sysmap @LINUX_VERSION@; \
fi
modules_uninstall:
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
modules_install: modules_install-@ac_system@
modules_uninstall-Linux:
@# Uninstall the kernel modules
kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
list='$(obj-m)'; for objdir in $$list; do \
$(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
done
modules_uninstall: modules_uninstall-@ac_system@
distdir:
list='$(obj-m)'; for objdir in $$list; do \
(cd @top_srcdir@/module && find $$objdir \
-name '*.c' -o -name '*.h' -o -name '*.S' | \
xargs cp --parents -t @abs_top_builddir@/module/$$distdir); \
done
distclean maintainer-clean: clean
install: modules_install
uninstall: modules_uninstall
all: modules
check:
+1
View File
@@ -0,0 +1 @@
subdirs-m = linux
+1
View File
@@ -0,0 +1 @@
subdirs-m = spl zfs
+18
View File
@@ -0,0 +1,18 @@
$(MODULE)-objs += ../os/linux/spl/spl-atomic.o
$(MODULE)-objs += ../os/linux/spl/spl-condvar.o
$(MODULE)-objs += ../os/linux/spl/spl-cred.o
$(MODULE)-objs += ../os/linux/spl/spl-err.o
$(MODULE)-objs += ../os/linux/spl/spl-generic.o
$(MODULE)-objs += ../os/linux/spl/spl-kmem.o
$(MODULE)-objs += ../os/linux/spl/spl-kmem-cache.o
$(MODULE)-objs += ../os/linux/spl/spl-kobj.o
$(MODULE)-objs += ../os/linux/spl/spl-kstat.o
$(MODULE)-objs += ../os/linux/spl/spl-proc.o
$(MODULE)-objs += ../os/linux/spl/spl-procfs-list.o
$(MODULE)-objs += ../os/linux/spl/spl-taskq.o
$(MODULE)-objs += ../os/linux/spl/spl-thread.o
$(MODULE)-objs += ../os/linux/spl/spl-tsd.o
$(MODULE)-objs += ../os/linux/spl/spl-vmem.o
$(MODULE)-objs += ../os/linux/spl/spl-vnode.o
$(MODULE)-objs += ../os/linux/spl/spl-xdr.o
$(MODULE)-objs += ../os/linux/spl/spl-zlib.o
+34
View File
@@ -0,0 +1,34 @@
#
# Linux specific sources included from module/zfs/Makefile.in
#
# Suppress unused-value warnings in sparc64 architecture headers
ifeq ($(target_cpu),sparc64)
ccflags-y += -Wno-unused-value
endif
ccflags-y += -I@abs_top_srcdir@/module/os/linux/zfs
$(MODULE)-objs += ../os/linux/zfs/abd.o
$(MODULE)-objs += ../os/linux/zfs/policy.o
$(MODULE)-objs += ../os/linux/zfs/qat.o
$(MODULE)-objs += ../os/linux/zfs/qat_compress.o
$(MODULE)-objs += ../os/linux/zfs/qat_crypt.o
$(MODULE)-objs += ../os/linux/zfs/spa_stats.o
$(MODULE)-objs += ../os/linux/zfs/vdev_disk.o
$(MODULE)-objs += ../os/linux/zfs/vdev_file.o
$(MODULE)-objs += ../os/linux/zfs/zfs_acl.o
$(MODULE)-objs += ../os/linux/zfs/zfs_ctldir.o
$(MODULE)-objs += ../os/linux/zfs/zfs_debug.o
$(MODULE)-objs += ../os/linux/zfs/zfs_dir.o
$(MODULE)-objs += ../os/linux/zfs/zfs_sysfs.o
$(MODULE)-objs += ../os/linux/zfs/zfs_vfsops.o
$(MODULE)-objs += ../os/linux/zfs/zfs_vnops.o
$(MODULE)-objs += ../os/linux/zfs/zfs_znode.o
$(MODULE)-objs += ../os/linux/zfs/zio_crypt.o
$(MODULE)-objs += ../os/linux/zfs/zpl_ctldir.o
$(MODULE)-objs += ../os/linux/zfs/zpl_export.o
$(MODULE)-objs += ../os/linux/zfs/zpl_file.o
$(MODULE)-objs += ../os/linux/zfs/zpl_inode.o
$(MODULE)-objs += ../os/linux/zfs/zpl_super.o
$(MODULE)-objs += ../os/linux/zfs/zpl_xattr.o
@@ -26,7 +26,7 @@
#include <sys/zil.h>
#include <sys/sha2.h>
#include <sys/hkdf.h>
#include "qat.h"
#include <sys/qat.h>
/*
* This file is responsible for handling all of the details of generating
+2 -18
View File
@@ -7,21 +7,5 @@ obj-$(CONFIG_ZFS) := $(MODULE).o
ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
$(MODULE)-objs += spl-atomic.o
$(MODULE)-objs += spl-condvar.o
$(MODULE)-objs += spl-cred.o
$(MODULE)-objs += spl-err.o
$(MODULE)-objs += spl-generic.o
$(MODULE)-objs += spl-kmem.o
$(MODULE)-objs += spl-kmem-cache.o
$(MODULE)-objs += spl-kobj.o
$(MODULE)-objs += spl-kstat.o
$(MODULE)-objs += spl-proc.o
$(MODULE)-objs += spl-procfs-list.o
$(MODULE)-objs += spl-taskq.o
$(MODULE)-objs += spl-thread.o
$(MODULE)-objs += spl-tsd.o
$(MODULE)-objs += spl-vmem.o
$(MODULE)-objs += spl-vnode.o
$(MODULE)-objs += spl-xdr.o
$(MODULE)-objs += spl-zlib.o
-include @abs_top_builddir@/module/os/linux/spl/Makefile
+11 -32
View File
@@ -16,18 +16,17 @@ endif
# Suppress unused but set variable warnings often due to ASSERTs
ccflags-y += $(NO_UNUSED_BUT_SET_VARIABLE)
$(MODULE)-objs += abd.o
$(MODULE)-objs += aggsum.o
$(MODULE)-objs += arc.o
$(MODULE)-objs += blkptr.o
$(MODULE)-objs += bplist.o
$(MODULE)-objs += bpobj.o
$(MODULE)-objs += cityhash.o
$(MODULE)-objs += dbuf.o
$(MODULE)-objs += dbuf_stats.o
$(MODULE)-objs += bptree.o
$(MODULE)-objs += bqueue.o
$(MODULE)-objs += cityhash.o
$(MODULE)-objs += dataset_kstats.o
$(MODULE)-objs += dbuf.o
$(MODULE)-objs += dbuf_stats.o
$(MODULE)-objs += ddt.o
$(MODULE)-objs += ddt_zap.o
$(MODULE)-objs += dmu.o
@@ -42,28 +41,29 @@ $(MODULE)-objs += dmu_tx.o
$(MODULE)-objs += dmu_zfetch.o
$(MODULE)-objs += dnode.o
$(MODULE)-objs += dnode_sync.o
$(MODULE)-objs += dsl_bookmark.o
$(MODULE)-objs += dsl_crypt.o
$(MODULE)-objs += dsl_dataset.o
$(MODULE)-objs += dsl_deadlist.o
$(MODULE)-objs += dsl_deleg.o
$(MODULE)-objs += dsl_bookmark.o
$(MODULE)-objs += dsl_destroy.o
$(MODULE)-objs += dsl_dir.o
$(MODULE)-objs += dsl_crypt.o
$(MODULE)-objs += dsl_pool.o
$(MODULE)-objs += dsl_prop.o
$(MODULE)-objs += dsl_scan.o
$(MODULE)-objs += dsl_synctask.o
$(MODULE)-objs += dsl_userhold.o
$(MODULE)-objs += edonr_zfs.o
$(MODULE)-objs += fm.o
$(MODULE)-objs += gzip.o
$(MODULE)-objs += hkdf.o
$(MODULE)-objs += lzjb.o
$(MODULE)-objs += lz4.o
$(MODULE)-objs += lzjb.o
$(MODULE)-objs += metaslab.o
$(MODULE)-objs += mmp.o
$(MODULE)-objs += multilist.o
$(MODULE)-objs += objlist.o
$(MODULE)-objs += pathname.o
$(MODULE)-objs += policy.o
$(MODULE)-objs += range_tree.o
$(MODULE)-objs += refcount.o
$(MODULE)-objs += rrwlock.o
@@ -78,17 +78,14 @@ $(MODULE)-objs += spa_errlog.o
$(MODULE)-objs += spa_history.o
$(MODULE)-objs += spa_log_spacemap.o
$(MODULE)-objs += spa_misc.o
$(MODULE)-objs += spa_stats.o
$(MODULE)-objs += space_map.o
$(MODULE)-objs += space_reftree.o
$(MODULE)-objs += txg.o
$(MODULE)-objs += trace.o
$(MODULE)-objs += txg.o
$(MODULE)-objs += uberblock.o
$(MODULE)-objs += unique.o
$(MODULE)-objs += vdev.o
$(MODULE)-objs += vdev_cache.o
$(MODULE)-objs += vdev_disk.o
$(MODULE)-objs += vdev_file.o
$(MODULE)-objs += vdev_indirect.o
$(MODULE)-objs += vdev_indirect_births.o
$(MODULE)-objs += vdev_indirect_mapping.o
@@ -112,11 +109,7 @@ $(MODULE)-objs += zcp_global.o
$(MODULE)-objs += zcp_iter.o
$(MODULE)-objs += zcp_synctask.o
$(MODULE)-objs += zfeature.o
$(MODULE)-objs += zfs_acl.o
$(MODULE)-objs += zfs_byteswap.o
$(MODULE)-objs += zfs_ctldir.o
$(MODULE)-objs += zfs_debug.o
$(MODULE)-objs += zfs_dir.o
$(MODULE)-objs += zfs_fm.o
$(MODULE)-objs += zfs_fuid.o
$(MODULE)-objs += zfs_ioctl.o
@@ -126,31 +119,15 @@ $(MODULE)-objs += zfs_ratelimit.o
$(MODULE)-objs += zfs_replay.o
$(MODULE)-objs += zfs_rlock.o
$(MODULE)-objs += zfs_sa.o
$(MODULE)-objs += zfs_sysfs.o
$(MODULE)-objs += zfs_vfsops.o
$(MODULE)-objs += zfs_vnops.o
$(MODULE)-objs += zfs_znode.o
$(MODULE)-objs += zil.o
$(MODULE)-objs += zio.o
$(MODULE)-objs += zio_checksum.o
$(MODULE)-objs += zio_compress.o
$(MODULE)-objs += zio_crypt.o
$(MODULE)-objs += zio_inject.o
$(MODULE)-objs += zle.o
$(MODULE)-objs += zpl_ctldir.o
$(MODULE)-objs += zpl_export.o
$(MODULE)-objs += zpl_file.o
$(MODULE)-objs += zpl_inode.o
$(MODULE)-objs += zpl_super.o
$(MODULE)-objs += zpl_xattr.o
$(MODULE)-objs += zrlock.o
$(MODULE)-objs += zthr.o
$(MODULE)-objs += zvol.o
$(MODULE)-objs += dsl_destroy.o
$(MODULE)-objs += dsl_userhold.o
$(MODULE)-objs += qat.o
$(MODULE)-objs += qat_compress.o
$(MODULE)-objs += qat_crypt.o
# Suppress incorrect warnings from versions of objtool which are not
# aware of x86 EVEX prefix instructions used for AVX512.
@@ -165,3 +142,5 @@ $(MODULE)-$(CONFIG_X86) += vdev_raidz_math_avx512bw.o
$(MODULE)-$(CONFIG_ARM64) += vdev_raidz_math_aarch64_neon.o
$(MODULE)-$(CONFIG_ARM64) += vdev_raidz_math_aarch64_neonx2.o
-include @abs_top_builddir@/module/os/linux/zfs/Makefile
+1 -1
View File
@@ -29,7 +29,7 @@
#include <sys/debug.h>
#include <sys/types.h>
#include <sys/strings.h>
#include "qat.h"
#include <sys/qat.h>
#ifdef _KERNEL
-204
View File
@@ -1,204 +0,0 @@
/*
* 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
*/
#ifndef _SYS_QAT_H
#define _SYS_QAT_H
typedef enum qat_compress_dir {
QAT_DECOMPRESS = 0,
QAT_COMPRESS = 1,
} qat_compress_dir_t;
typedef enum qat_encrypt_dir {
QAT_DECRYPT = 0,
QAT_ENCRYPT = 1,
} qat_encrypt_dir_t;
#if defined(_KERNEL) && defined(HAVE_QAT)
#include <sys/zio.h>
#include <sys/crypto/api.h>
#include "cpa.h"
#include "dc/cpa_dc.h"
#include "lac/cpa_cy_sym.h"
/*
* Timeout - no response from hardware after 0.5 seconds
*/
#define QAT_TIMEOUT_MS 500
/*
* The minimal and maximal buffer size which are not restricted
* in the QAT hardware, but with the input buffer size between 4KB
* and 128KB the hardware can provide the optimal performance.
*/
#define QAT_MIN_BUF_SIZE (4*1024)
#define QAT_MAX_BUF_SIZE (128*1024)
/*
* Used for QAT kstat.
*/
typedef struct qat_stats {
/*
* Number of jobs submitted to QAT compression engine.
*/
kstat_named_t comp_requests;
/*
* Total bytes sent to QAT compression engine.
*/
kstat_named_t comp_total_in_bytes;
/*
* Total bytes output from QAT compression engine.
*/
kstat_named_t comp_total_out_bytes;
/*
* Number of jobs submitted to QAT de-compression engine.
*/
kstat_named_t decomp_requests;
/*
* Total bytes sent to QAT de-compression engine.
*/
kstat_named_t decomp_total_in_bytes;
/*
* Total bytes output from QAT de-compression engine.
*/
kstat_named_t decomp_total_out_bytes;
/*
* Number of fails in the QAT compression / decompression engine.
* Note: when a QAT error happens, it doesn't necessarily indicate a
* critical hardware issue. Sometimes it is because the output buffer
* is not big enough. The compression job will be transferred to the
* gzip software implementation so the functionality of ZFS is not
* impacted.
*/
kstat_named_t dc_fails;
/*
* Number of jobs submitted to QAT encryption engine.
*/
kstat_named_t encrypt_requests;
/*
* Total bytes sent to QAT encryption engine.
*/
kstat_named_t encrypt_total_in_bytes;
/*
* Total bytes output from QAT encryption engine.
*/
kstat_named_t encrypt_total_out_bytes;
/*
* Number of jobs submitted to QAT decryption engine.
*/
kstat_named_t decrypt_requests;
/*
* Total bytes sent to QAT decryption engine.
*/
kstat_named_t decrypt_total_in_bytes;
/*
* Total bytes output from QAT decryption engine.
*/
kstat_named_t decrypt_total_out_bytes;
/*
* Number of fails in the QAT encryption / decryption engine.
* Note: when a QAT error happens, it doesn't necessarily indicate a
* critical hardware issue. The encryption job will be transferred
* to the software implementation so the functionality of ZFS is
* not impacted.
*/
kstat_named_t crypt_fails;
/*
* Number of jobs submitted to QAT checksum engine.
*/
kstat_named_t cksum_requests;
/*
* Total bytes sent to QAT checksum engine.
*/
kstat_named_t cksum_total_in_bytes;
/*
* Number of fails in the QAT checksum engine.
* Note: when a QAT error happens, it doesn't necessarily indicate a
* critical hardware issue. The checksum job will be transferred to the
* software implementation so the functionality of ZFS is not impacted.
*/
kstat_named_t cksum_fails;
} qat_stats_t;
#define QAT_STAT_INCR(stat, val) \
atomic_add_64(&qat_stats.stat.value.ui64, (val))
#define QAT_STAT_BUMP(stat) \
QAT_STAT_INCR(stat, 1)
extern qat_stats_t qat_stats;
extern int zfs_qat_compress_disable;
extern int zfs_qat_checksum_disable;
extern int zfs_qat_encrypt_disable;
/* inlined for performance */
static inline struct page *
qat_mem_to_page(void *addr)
{
if (!is_vmalloc_addr(addr))
return (virt_to_page(addr));
return (vmalloc_to_page(addr));
}
CpaStatus qat_mem_alloc_contig(void **pp_mem_addr, Cpa32U size_bytes);
void qat_mem_free_contig(void **pp_mem_addr);
#define QAT_PHYS_CONTIG_ALLOC(pp_mem_addr, size_bytes) \
qat_mem_alloc_contig((void *)(pp_mem_addr), (size_bytes))
#define QAT_PHYS_CONTIG_FREE(p_mem_addr) \
qat_mem_free_contig((void *)&(p_mem_addr))
extern int qat_dc_init(void);
extern void qat_dc_fini(void);
extern int qat_cy_init(void);
extern void qat_cy_fini(void);
extern int qat_init(void);
extern void qat_fini(void);
/* fake CpaStatus used to indicate data was not compressible */
#define CPA_STATUS_INCOMPRESSIBLE (-127)
extern boolean_t qat_dc_use_accel(size_t s_len);
extern boolean_t qat_crypt_use_accel(size_t s_len);
extern boolean_t qat_checksum_use_accel(size_t s_len);
extern int qat_compress(qat_compress_dir_t dir, char *src, int src_len,
char *dst, int dst_len, size_t *c_len);
extern int qat_crypt(qat_encrypt_dir_t dir, uint8_t *src_buf, uint8_t *dst_buf,
uint8_t *aad_buf, uint32_t aad_len, uint8_t *iv_buf, uint8_t *digest_buf,
crypto_key_t *key, uint64_t crypt, uint32_t enc_len);
extern int qat_checksum(uint64_t cksum, uint8_t *buf, uint64_t size,
zio_cksum_t *zcp);
#else
#define CPA_STATUS_SUCCESS 0
#define CPA_STATUS_INCOMPRESSIBLE (-127)
#define qat_init()
#define qat_fini()
#define qat_dc_use_accel(s_len) 0
#define qat_crypt_use_accel(s_len) 0
#define qat_checksum_use_accel(s_len) 0
#define qat_compress(dir, s, sl, d, dl, cl) 0
#define qat_crypt(dir, s, d, a, al, i, db, k, c, el) 0
#define qat_checksum(c, buf, s, z) 0
#endif
#endif /* _SYS_QAT_H */
+1 -1
View File
@@ -30,7 +30,7 @@
#include <sys/zio.h>
#include <sys/sha2.h>
#include <sys/abd.h>
#include "qat.h"
#include <sys/qat.h>
static int
sha_incremental(void *buf, size_t size, void *arg)
+1 -1
View File
@@ -59,7 +59,7 @@
#include <sys/kstat.h>
#include "zfs_prop.h"
#include <sys/zfeature.h>
#include "qat.h"
#include <sys/qat.h>
/*
* SPA locking