Compare commits

..

No commits in common. "zfs-0.8-release" and "zfs-0.8.1" have entirely different histories.

753 changed files with 6325 additions and 16581 deletions

2
.gitignore vendored
View File

@ -36,7 +36,6 @@ Makefile.in
# Top level generated files specific to this top level dir
#
/bin
/build
/configure
/config.log
/config.status
@ -63,3 +62,4 @@ cscope.*
*.orig
*.log
venv

View File

@ -83,7 +83,6 @@ CONTRIBUTORS:
Christopher Voltz <cjunk@voltz.ws>
Chunwei Chen <david.chen@nutanix.com>
Clemens Fruhwirth <clemens@endorphin.org>
Coleman Kane <ckane@colemankane.org>
Colin Ian King <colin.king@canonical.com>
Craig Loomis <cloomis@astro.princeton.edu>
Craig Sanders <github@taz.net.au>

View File

@ -20,10 +20,6 @@ notable exceptions and their respective licenses include:
* AES Implementation: module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
* PBKDF2 Implementation: lib/libzfs/THIRDPARTYLICENSE.openssl
* SPL Implementation: module/spl/THIRDPARTYLICENSE.gplv2
* GCM Implementaion: module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams
* GCM Implementaion: module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl
* GHASH Implementaion: module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams
* GHASH Implementaion: module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl
This product includes software developed by the OpenSSL Project for use
in the OpenSSL Toolkit (http://www.openssl.org/)

4
META
View File

@ -1,10 +1,10 @@
Meta: 1
Name: zfs
Branch: 1.0
Version: 0.8.6
Version: 0.8.1
Release: 1
Release-Tags: relext
License: CDDL
Author: OpenZFS on Linux
Linux-Maximum: 5.9
Linux-Maximum: 5.1
Linux-Minimum: 2.6.32

View File

@ -25,16 +25,11 @@ EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
EXTRA_DIST += CODE_OF_CONDUCT.md
# Include all the extra licensing information for modules
EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE
EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
EXTRA_DIST += module/spl/THIRDPARTYLICENSE.gplv2
EXTRA_DIST += module/spl/THIRDPARTYLICENSE.gplv2.descrip
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE module/icp/algs/skein/THIRDPARTYLICENSE.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
EXTRA_DIST += module/spl/THIRDPARTYLICENSE.gplv2 module/spl/THIRDPARTYLICENSE.gplv2.descrip
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash module/zfs/THIRDPARTYLICENSE.cityhash.descrip
@CODE_COVERAGE_RULES@
@ -44,9 +39,8 @@ gitrev:
BUILT_SOURCES = gitrev
# Double-colon rules are allowed; there are multiple independent definitions.
distclean-local::
-$(RM) -R autom4te*.cache build
-$(RM) -R autom4te*.cache
-find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
-o -name .pc -o -name .hg -o -name .git \) -prune -o \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
@ -58,8 +52,7 @@ distclean-local::
-type f -print | xargs $(RM)
all-local:
-[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \
${top_builddir}/scripts/zfs-tests.sh -c
-${top_srcdir}/scripts/zfs-tests.sh -c
dist-hook: gitrev
cp ${top_srcdir}/include/zfs_gitrev.h $(distdir)/include; \
@ -93,8 +86,8 @@ commitcheck:
fi
cstyle:
@find ${top_srcdir} -name build -prune -o -name '*.[hc]' \
! -name 'zfs_config.*' ! -name '*.mod.c' -type f \
@find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
! -name '*.mod.c' -type f \
-exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
shellcheck:

View File

@ -5,4 +5,4 @@ if USING_PYTHON
SUBDIRS += arcstat arc_summary dbufstat
endif
SUBDIRS += mount_zfs zed zvol_id zvol_wait
SUBDIRS += mount_zfs zed zvol_id

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/python2
#
# $Id: arc_summary.pl,v 388:e27800740aa2 2011-07-08 02:53:29Z jhell $
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3
#
# Copyright (c) 2008 Ben Rockwood <benr@cuddletech.com>,
# Copyright (c) 2010 Martin Matuska <mm@FreeBSD.org>,
@ -43,7 +43,7 @@ import subprocess
import sys
import time
DESCRIPTION = 'Print ARC and other statistics for ZFS on Linux'
DECRIPTION = 'Print ARC and other statistics for ZFS on Linux'
INDENT = ' '*8
LINE_LENGTH = 72
PROC_PATH = '/proc/spl/kstat/zfs/'
@ -65,7 +65,7 @@ SECTION_PATHS = {'arc': 'arcstats',
'zfetch': 'zfetchstats',
'zil': 'zil'}
parser = argparse.ArgumentParser(description=DESCRIPTION)
parser = argparse.ArgumentParser(description=DECRIPTION)
parser.add_argument('-a', '--alternate', action='store_true', default=False,
help='use alternate formatting for tunables and SPL',
dest='alt')
@ -284,7 +284,7 @@ def get_spl_tunables(PATH):
def get_descriptions(request):
"""Get the descriptions of the Solaris Porting Layer (SPL) or the
"""Get the decriptions of the Solaris Porting Layer (SPL) or the
tunables, return with minimal formatting.
"""
@ -677,10 +677,10 @@ def section_l2arc(kstats_dict):
prt_1('L2ARC breakdown:', f_hits(l2_access_total))
prt_i2('Hit ratio:',
f_perc(arc_stats['l2_hits'], l2_access_total),
f_hits(arc_stats['l2_hits']))
f_bytes(arc_stats['l2_hits']))
prt_i2('Miss ratio:',
f_perc(arc_stats['l2_misses'], l2_access_total),
f_hits(arc_stats['l2_misses']))
f_bytes(arc_stats['l2_misses']))
prt_i1('Feeds:', f_hits(arc_stats['l2_feeds']))
print()
@ -708,7 +708,7 @@ def section_l2arc(kstats_dict):
def section_spl(*_):
"""Print the SPL parameters, if requested with alternative format
and/or descriptions. This does not use kstats.
and/or decriptions. This does not use kstats.
"""
spls = get_spl_tunables(SPL_PATH)
@ -725,7 +725,7 @@ def section_spl(*_):
try:
print(INDENT+'#', descriptions[key])
except KeyError:
print(INDENT+'# (No description found)') # paranoid
print(INDENT+'# (No decription found)') # paranoid
print(format_raw_line(key, value))
@ -734,7 +734,7 @@ def section_spl(*_):
def section_tunables(*_):
"""Print the tunables, if requested with alternative format and/or
descriptions. This does not use kstasts.
decriptions. This does not use kstasts.
"""
tunables = get_spl_tunables(TUNABLES_PATH)
@ -751,7 +751,7 @@ def section_tunables(*_):
try:
print(INDENT+'#', descriptions[key])
except KeyError:
print(INDENT+'# (No description found)') # paranoid
print(INDENT+'# (No decription found)') # paranoid
print(format_raw_line(key, value))

View File

@ -1,13 +1,13 @@
dist_bin_SCRIPTS = arcstat
#
# The arcstat script is compatible with both Python 2.6 and 3.4.
# The arcstat script is compatibile with both Python 2.6 and 3.4.
# As such the python 3 shebang can be replaced at install time when
# targeting a python 2 system. This allows us to maintain a single
# version of the source.
#
if USING_PYTHON_2
install-exec-hook:
sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
$(DESTDIR)$(bindir)/arcstat
endif

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3
#
# Print out ZFS ARC Statistics exported via kstat(1)
# For a definition of fields, or usage, use arctstat.pl -v

View File

@ -1,13 +1,13 @@
dist_bin_SCRIPTS = dbufstat
#
# The dbufstat script is compatible with both Python 2.6 and 3.4.
# The dbufstat script is compatibile with both Python 2.6 and 3.4.
# As such the python 3 shebang can be replaced at install time when
# targeting a python 2 system. This allows us to maintain a single
# version of the source.
#
if USING_PYTHON_2
install-exec-hook:
sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
$(DESTDIR)$(bindir)/dbufstat
endif

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3
#
# Print out statistics for all cached dmu buffers. This information
# is available through the dbufs kstat and may be post-processed as

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# fsck.zfs: A fsck helper to accommodate distributions that expect
# fsck.zfs: A fsck helper to accomidate distributions that expect
# to be able to execute a fsck on all filesystem types. Currently
# this script does nothing but it could be extended to act as a
# compatibility wrapper for 'zpool scrub'.

View File

@ -489,7 +489,7 @@ main(int argc, char **argv)
zfsutil = 1;
if ((g_zfs = libzfs_init()) == NULL) {
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
(void) fprintf(stderr, "%s", libzfs_error_init(errno));
return (MOUNT_SYSERR);
}

View File

@ -102,7 +102,7 @@ Usage: vdev_id [-h]
vdev_id <-d device> [-c config_file] [-p phys_per_port]
[-g sas_direct|sas_switch|scsi] [-m]
-c specify name of an alternative config file [default=$CONFIG]
-c specify name of alernate config file [default=$CONFIG]
-d specify basename of device (i.e. sda)
-e Create enclose device symlinks only (/dev/by-enclosure)
-g Storage network topology [default="$TOPOLOGY"]

View File

@ -26,7 +26,6 @@
* Copyright 2016 Nexenta Systems, Inc.
* Copyright (c) 2017, 2018 Lawrence Livermore National Security, LLC.
* Copyright (c) 2015, 2017, Intel Corporation.
* Copyright (c) 2019 Datto Inc.
*/
#include <stdio.h>
@ -110,7 +109,7 @@ typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
uint64_t *zopt_object = NULL;
static unsigned zopt_objects = 0;
uint64_t max_inflight_bytes = 256 * 1024 * 1024; /* 256MB */
uint64_t max_inflight = 1000;
static int leaked_objects = 0;
static range_tree_t *mos_refd_objs;
@ -1450,12 +1449,6 @@ snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp)
(u_longlong_t)BP_GET_FILL(bp),
(u_longlong_t)bp->blk_birth,
(u_longlong_t)BP_PHYSICAL_BIRTH(bp));
(void) snprintf(blkbuf + strlen(blkbuf),
buflen - strlen(blkbuf), " cksum=%llx:%llx:%llx:%llx",
(u_longlong_t)bp->blk_cksum.zc_word[0],
(u_longlong_t)bp->blk_cksum.zc_word[1],
(u_longlong_t)bp->blk_cksum.zc_word[2],
(u_longlong_t)bp->blk_cksum.zc_word[3]);
}
}
@ -2415,7 +2408,7 @@ static const char *objset_types[DMU_OST_NUMTYPES] = {
static void
dump_dir(objset_t *os)
{
dmu_objset_stats_t dds = { 0 };
dmu_objset_stats_t dds;
uint64_t object, object_count;
uint64_t refdbytes, usedobjs, scratch;
char numbuf[32];
@ -3456,7 +3449,7 @@ zdb_blkptr_done(zio_t *zio)
abd_free(zio->io_abd);
mutex_enter(&spa->spa_scrub_lock);
spa->spa_load_verify_bytes -= BP_GET_PSIZE(bp);
spa->spa_load_verify_ios--;
cv_broadcast(&spa->spa_scrub_io_cv);
if (ioerr && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) {
@ -3527,9 +3520,9 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
flags |= ZIO_FLAG_SPECULATIVE;
mutex_enter(&spa->spa_scrub_lock);
while (spa->spa_load_verify_bytes > max_inflight_bytes)
while (spa->spa_load_verify_ios > max_inflight)
cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock);
spa->spa_load_verify_bytes += size;
spa->spa_load_verify_ios++;
mutex_exit(&spa->spa_scrub_lock);
zio_nowait(zio_read(NULL, spa, bp, abd, size,
@ -4292,7 +4285,6 @@ dump_block_stats(spa_t *spa)
ZIO_FLAG_GODFATHER);
}
}
ASSERT0(spa->spa_load_verify_bytes);
/*
* Done after zio_wait() since zcb_haderrors is modified in
@ -4786,7 +4778,7 @@ zdb_set_skip_mmp(char *target)
* the name of the target pool.
*
* Note that the checkpointed state's pool name will be the name of
* the original pool with the above suffix appended to it. In addition,
* the original pool with the above suffix appened to it. In addition,
* if the target is not a pool name (e.g. a path to a dataset) then
* the new_path parameter is populated with the updated path to
* reflect the fact that we are looking into the checkpointed state.
@ -5453,9 +5445,9 @@ dump_zpool(spa_t *spa)
#define ZDB_FLAG_BSWAP 0x0004
#define ZDB_FLAG_GBH 0x0008
#define ZDB_FLAG_INDIRECT 0x0010
#define ZDB_FLAG_RAW 0x0020
#define ZDB_FLAG_PRINT_BLKPTR 0x0040
#define ZDB_FLAG_VERBOSE 0x0080
#define ZDB_FLAG_PHYS 0x0020
#define ZDB_FLAG_RAW 0x0040
#define ZDB_FLAG_PRINT_BLKPTR 0x0080
static int flagbits[256];
@ -5586,30 +5578,11 @@ name:
return (NULL);
}
static boolean_t
zdb_parse_block_sizes(char *sizes, uint64_t *lsize, uint64_t *psize)
{
char *s0, *s1;
if (sizes == NULL)
return (B_FALSE);
s0 = strtok(sizes, "/");
if (s0 == NULL)
return (B_FALSE);
s1 = strtok(NULL, "/");
*lsize = strtoull(s0, NULL, 16);
*psize = s1 ? strtoull(s1, NULL, 16) : *lsize;
return (*lsize >= *psize && *psize > 0);
}
#define ZIO_COMPRESS_MASK(alg) (1ULL << (ZIO_COMPRESS_##alg))
/*
* Read a block from a pool and print it out. The syntax of the
* block descriptor is:
*
* pool:vdev_specifier:offset:[lsize/]psize[:flags]
* pool:vdev_specifier:offset:size[:flags]
*
* pool - The name of the pool you wish to read from
* vdev_specifier - Which vdev (see comment for zdb_vdev_lookup)
@ -5617,14 +5590,15 @@ zdb_parse_block_sizes(char *sizes, uint64_t *lsize, uint64_t *psize)
* size - Amount of data to read, in hex, in bytes
* flags - A string of characters specifying options
* b: Decode a blkptr at given offset within block
* c: Calculate and display checksums
* *c: Calculate and display checksums
* d: Decompress data before dumping
* e: Byteswap data before dumping
* g: Display data as a gang block header
* i: Display as an indirect block
* p: Do I/O to physical offset
* r: Dump raw data to stdout
* v: Verbose
*
* * = not yet implemented
*/
static void
zdb_read_block(char *thing, spa_t *spa)
@ -5632,12 +5606,13 @@ zdb_read_block(char *thing, spa_t *spa)
blkptr_t blk, *bp = &blk;
dva_t *dva = bp->blk_dva;
int flags = 0;
uint64_t offset = 0, psize = 0, lsize = 0, blkptr_offset = 0;
uint64_t offset = 0, size = 0, psize = 0, lsize = 0, blkptr_offset = 0;
zio_t *zio;
vdev_t *vd;
abd_t *pabd;
void *lbuf, *buf;
char *s, *p, *dup, *vdev, *flagstr, *sizes;
const char *s, *vdev;
char *p, *dup, *flagstr;
int i, error;
boolean_t borrowed = B_FALSE;
@ -5646,14 +5621,18 @@ zdb_read_block(char *thing, spa_t *spa)
vdev = s ? s : "";
s = strtok(NULL, ":");
offset = strtoull(s ? s : "", NULL, 16);
sizes = strtok(NULL, ":");
s = strtok(NULL, ":");
flagstr = strdup(s ? s : "");
size = strtoull(s ? s : "", NULL, 16);
s = strtok(NULL, ":");
if (s)
flagstr = strdup(s);
else
flagstr = strdup("");
s = NULL;
if (!zdb_parse_block_sizes(sizes, &lsize, &psize))
s = "invalid size(s)";
if (!IS_P2ALIGNED(psize, DEV_BSIZE) || !IS_P2ALIGNED(lsize, DEV_BSIZE))
if (size == 0)
s = "size must not be zero";
if (!IS_P2ALIGNED(size, DEV_BSIZE))
s = "size must be a multiple of sector size";
if (!IS_P2ALIGNED(offset, DEV_BSIZE))
s = "offset must be a multiple of sector size";
@ -5709,6 +5688,9 @@ zdb_read_block(char *thing, spa_t *spa)
vd->vdev_ops->vdev_op_type);
}
psize = size;
lsize = size;
pabd = abd_alloc_for_io(SPA_MAXBLOCKSIZE, B_FALSE);
lbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
@ -5765,41 +5747,30 @@ zdb_read_block(char *thing, spa_t *spa)
* We don't know how the data was compressed, so just try
* every decompress function at every inflated blocksize.
*/
enum zio_compress c;
void *lbuf2 = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
int cfuncs[ZIO_COMPRESS_FUNCTIONS] = { 0 };
int *cfuncp = cfuncs;
uint64_t maxlsize = SPA_MAXBLOCKSIZE;
uint64_t mask = ZIO_COMPRESS_MASK(ON) | ZIO_COMPRESS_MASK(OFF) |
ZIO_COMPRESS_MASK(INHERIT) | ZIO_COMPRESS_MASK(EMPTY) |
(getenv("ZDB_NO_ZLE") ? ZIO_COMPRESS_MASK(ZLE) : 0);
*cfuncp++ = ZIO_COMPRESS_LZ4;
*cfuncp++ = ZIO_COMPRESS_LZJB;
mask |= ZIO_COMPRESS_MASK(LZ4) | ZIO_COMPRESS_MASK(LZJB);
for (int c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++)
if (((1ULL << c) & mask) == 0)
*cfuncp++ = c;
/*
* On the one hand, with SPA_MAXBLOCKSIZE at 16MB, this
* could take a while and we should let the user know
* XXX - On the one hand, with SPA_MAXBLOCKSIZE at 16MB,
* this could take a while and we should let the user know
* we are not stuck. On the other hand, printing progress
* info gets old after a while. User can specify 'v' flag
* to see the progression.
* info gets old after a while. What to do?
*/
if (lsize == psize)
lsize += SPA_MINBLOCKSIZE;
else
maxlsize = lsize;
for (; lsize <= maxlsize; lsize += SPA_MINBLOCKSIZE) {
for (cfuncp = cfuncs; *cfuncp; cfuncp++) {
if (flags & ZDB_FLAG_VERBOSE) {
for (lsize = psize + SPA_MINBLOCKSIZE;
lsize <= SPA_MAXBLOCKSIZE; lsize += SPA_MINBLOCKSIZE) {
for (c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++) {
/*
* ZLE can easily decompress non zle stream.
* So have an option to disable it.
*/
if (c == ZIO_COMPRESS_ZLE &&
getenv("ZDB_NO_ZLE"))
continue;
(void) fprintf(stderr,
"Trying %05llx -> %05llx (%s)\n",
(u_longlong_t)psize,
(u_longlong_t)lsize,
zio_compress_table[*cfuncp].\
ci_name);
}
(u_longlong_t)psize, (u_longlong_t)lsize,
zio_compress_table[c].ci_name);
/*
* We randomize lbuf2, and decompress to both
@ -5808,30 +5779,27 @@ zdb_read_block(char *thing, spa_t *spa)
*/
VERIFY0(random_get_pseudo_bytes(lbuf2, lsize));
if (zio_decompress_data(*cfuncp, pabd,
if (zio_decompress_data(c, pabd,
lbuf, psize, lsize) == 0 &&
zio_decompress_data(*cfuncp, pabd,
zio_decompress_data(c, pabd,
lbuf2, psize, lsize) == 0 &&
bcmp(lbuf, lbuf2, lsize) == 0)
break;
}
if (*cfuncp != 0)
if (c != ZIO_COMPRESS_FUNCTIONS)
break;
}
umem_free(lbuf2, SPA_MAXBLOCKSIZE);
if (lsize > maxlsize) {
if (lsize > SPA_MAXBLOCKSIZE) {
(void) printf("Decompress of %s failed\n", thing);
goto out;
}
buf = lbuf;
if (*cfuncp == ZIO_COMPRESS_ZLE) {
printf("\nZLE decompression was selected. If you "
"suspect the results are wrong,\ntry avoiding ZLE "
"by setting and exporting ZDB_NO_ZLE=\"true\"\n");
}
size = lsize;
} else {
buf = abd_borrow_buf_copy(pabd, lsize);
size = psize;
buf = abd_borrow_buf_copy(pabd, size);
borrowed = B_TRUE;
}
@ -5839,78 +5807,17 @@ zdb_read_block(char *thing, spa_t *spa)
zdb_print_blkptr((blkptr_t *)(void *)
((uintptr_t)buf + (uintptr_t)blkptr_offset), flags);
else if (flags & ZDB_FLAG_RAW)
zdb_dump_block_raw(buf, lsize, flags);
zdb_dump_block_raw(buf, size, flags);
else if (flags & ZDB_FLAG_INDIRECT)
zdb_dump_indirect((blkptr_t *)buf, lsize / sizeof (blkptr_t),
zdb_dump_indirect((blkptr_t *)buf, size / sizeof (blkptr_t),
flags);
else if (flags & ZDB_FLAG_GBH)
zdb_dump_gbh(buf, flags);
else
zdb_dump_block(thing, buf, lsize, flags);
/*
* If :c was specified, iterate through the checksum table to
* calculate and display each checksum for our specified
* DVA and length.
*/
if ((flags & ZDB_FLAG_CHECKSUM) && !(flags & ZDB_FLAG_RAW) &&
!(flags & ZDB_FLAG_GBH)) {
zio_t *czio, *cio;
(void) printf("\n");
for (enum zio_checksum ck = ZIO_CHECKSUM_LABEL;
ck < ZIO_CHECKSUM_FUNCTIONS; ck++) {
if ((zio_checksum_table[ck].ci_flags &
ZCHECKSUM_FLAG_EMBEDDED) ||
ck == ZIO_CHECKSUM_NOPARITY) {
continue;
}
BP_SET_CHECKSUM(bp, ck);
spa_config_enter(spa, SCL_STATE, FTAG, RW_READER);
czio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL);
czio->io_bp = bp;
if (vd == vd->vdev_top) {
cio = zio_read(czio, spa, bp, pabd, psize,
NULL, NULL,
ZIO_PRIORITY_SYNC_READ,
ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW |
ZIO_FLAG_DONT_RETRY, NULL);
zio_nowait(cio);
} else {
zio_nowait(zio_vdev_child_io(czio, bp, vd,
offset, pabd, psize, ZIO_TYPE_READ,
ZIO_PRIORITY_SYNC_READ,
ZIO_FLAG_DONT_CACHE |
ZIO_FLAG_DONT_PROPAGATE |
ZIO_FLAG_DONT_RETRY |
ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW |
ZIO_FLAG_SPECULATIVE |
ZIO_FLAG_OPTIONAL, NULL, NULL));
}
error = zio_wait(czio);
if (error == 0 || error == ECKSUM) {
zio_t *ck_zio = zio_root(spa, NULL, NULL, 0);
ck_zio->io_offset =
DVA_GET_OFFSET(&bp->blk_dva[0]);
ck_zio->io_bp = bp;
zio_checksum_compute(ck_zio, ck, pabd, lsize);
printf("%12s\tcksum=%llx:%llx:%llx:%llx\n",
zio_checksum_table[ck].ci_name,
(u_longlong_t)bp->blk_cksum.zc_word[0],
(u_longlong_t)bp->blk_cksum.zc_word[1],
(u_longlong_t)bp->blk_cksum.zc_word[2],
(u_longlong_t)bp->blk_cksum.zc_word[3]);
zio_wait(ck_zio);
} else {
printf("error %d reading block\n", error);
}
spa_config_exit(spa, SCL_STATE, FTAG);
}
}
zdb_dump_block(thing, buf, size, flags);
if (borrowed)
abd_return_buf_copy(pabd, buf, lsize);
abd_return_buf_copy(pabd, buf, size);
out:
abd_free(pabd);
@ -6026,10 +5933,10 @@ main(int argc, char **argv)
break;
/* NB: Sort single match options below. */
case 'I':
max_inflight_bytes = strtoull(optarg, NULL, 0);
if (max_inflight_bytes == 0) {
max_inflight = strtoull(optarg, NULL, 0);
if (max_inflight == 0) {
(void) fprintf(stderr, "maximum number "
"of inflight bytes must be greater "
"of inflight I/Os must be greater "
"than 0\n");
usage();
}
@ -6325,8 +6232,8 @@ main(int argc, char **argv)
flagbits['e'] = ZDB_FLAG_BSWAP;
flagbits['g'] = ZDB_FLAG_GBH;
flagbits['i'] = ZDB_FLAG_INDIRECT;
flagbits['p'] = ZDB_FLAG_PHYS;
flagbits['r'] = ZDB_FLAG_RAW;
flagbits['v'] = ZDB_FLAG_VERBOSE;
for (int i = 0; i < argc; i++)
zdb_read_block(argv[i], spa);

View File

@ -1,11 +1,12 @@
SUBDIRS = zed.d
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
EXTRA_DIST = zed.d/README \
zed.d/history_event-zfs-list-cacher.sh.in
sbin_PROGRAMS = zed
ZED_SRC = \
@ -46,3 +47,55 @@ zed_LDADD = \
zed_LDADD += -lrt
zed_LDFLAGS = -pthread
zedconfdir = $(sysconfdir)/zfs/zed.d
dist_zedconf_DATA = \
zed.d/zed-functions.sh \
zed.d/zed.rc
zedexecdir = $(zfsexecdir)/zed.d
dist_zedexec_SCRIPTS = \
zed.d/all-debug.sh \
zed.d/all-syslog.sh \
zed.d/data-notify.sh \
zed.d/generic-notify.sh \
zed.d/resilver_finish-notify.sh \
zed.d/scrub_finish-notify.sh \
zed.d/statechange-led.sh \
zed.d/statechange-notify.sh \
zed.d/vdev_clear-led.sh \
zed.d/vdev_attach-led.sh \
zed.d/pool_import-led.sh \
zed.d/resilver_finish-start-scrub.sh
nodist_zedexec_SCRIPTS = zed.d/history_event-zfs-list-cacher.sh
$(nodist_zedexec_SCRIPTS): %: %.in
-$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
$< >'$@'
zedconfdefaults = \
all-syslog.sh \
data-notify.sh \
resilver_finish-notify.sh \
scrub_finish-notify.sh \
statechange-led.sh \
statechange-notify.sh \
vdev_clear-led.sh \
vdev_attach-led.sh \
pool_import-led.sh \
resilver_finish-start-scrub.sh
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(zedconfdir)"
for f in $(zedconfdefaults); do \
test -f "$(DESTDIR)$(zedconfdir)/$${f}" -o \
-L "$(DESTDIR)$(zedconfdir)/$${f}" || \
ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \
done
chmod 0600 "$(DESTDIR)$(zedconfdir)/zed.rc"

View File

@ -25,7 +25,7 @@
*/
/*
* This file implements the minimal FMD module API required to support the
* This file imlements the minimal FMD module API required to support the
* fault logic modules in ZED. This support includes module registration,
* memory allocation, module property accessors, basic case management,
* one-shot timers and SERD engines.

View File

@ -281,7 +281,7 @@ fmd_serd_eng_empty(fmd_serd_eng_t *sgp)
void
fmd_serd_eng_reset(fmd_serd_eng_t *sgp)
{
serd_log_msg(" SERD Engine: resetting %s", sgp->sg_name);
serd_log_msg(" SERD Engine: reseting %s", sgp->sg_name);
while (sgp->sg_count != 0)
fmd_serd_eng_discard(sgp, list_head(&sgp->sg_list));

View File

@ -116,8 +116,7 @@ zfs_agent_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *arg)
/*
* On a devid match, grab the vdev guid and expansion time, if any.
*/
if (gsp->gs_devid != NULL &&
(nvlist_lookup_string(nvl, ZPOOL_CONFIG_DEVID, &path) == 0) &&
if ((nvlist_lookup_string(nvl, ZPOOL_CONFIG_DEVID, &path) == 0) &&
(strcmp(gsp->gs_devid, path) == 0)) {
(void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_GUID,
&gsp->gs_vdev_guid);

View File

@ -157,7 +157,7 @@ zfs_unavail_pool(zpool_handle_t *zhp, void *data)
* 1. physical match with no fs, no partition
* tag it top, partition disk
*
* 2. physical match again, see partition and tag
* 2. physical match again, see partion and tag
*
*/
@ -674,7 +674,7 @@ zfs_deliver_add(nvlist_t *nvl, boolean_t is_lofi)
devid, devpath ? devpath : "NULL", is_slice);
/*
* Iterate over all vdevs looking for a match in the following order:
* Iterate over all vdevs looking for a match in the folllowing order:
* 1. ZPOOL_CONFIG_DEVID (identifies the unique disk)
* 2. ZPOOL_CONFIG_PHYS_PATH (identifies disk physical location).
*
@ -892,7 +892,7 @@ zfs_enum_pools(void *arg)
*
* sent messages from zevents or udev monitor
*
* For now, each agent has its own libzfs instance
* For now, each agent has it's own libzfs instance
*/
int
zfs_slm_init()

View File

@ -347,8 +347,9 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
zpool_vdev_offline(zhp, devname, B_TRUE);
} else if (!fmd_prop_get_int32(hdl, "spare_on_remove") ||
replace_with_spare(hdl, zhp, vdev) == B_FALSE) {
/* Could not handle with spare */
fmd_hdl_debug(hdl, "no spare for '%s'", devname);
/* Could not handle with spare: offline the device */
fmd_hdl_debug(hdl, "zpool_vdev_offline '%s'", devname);
zpool_vdev_offline(zhp, devname, B_TRUE);
}
free(devname);

View File

@ -1,57 +0,0 @@
include $(top_srcdir)/config/Rules.am
EXTRA_DIST = \
README \
history_event-zfs-list-cacher.sh.in
zedconfdir = $(sysconfdir)/zfs/zed.d
dist_zedconf_DATA = \
zed-functions.sh \
zed.rc
zedexecdir = $(zfsexecdir)/zed.d
dist_zedexec_SCRIPTS = \
all-debug.sh \
all-syslog.sh \
data-notify.sh \
generic-notify.sh \
resilver_finish-notify.sh \
scrub_finish-notify.sh \
statechange-led.sh \
statechange-notify.sh \
vdev_clear-led.sh \
vdev_attach-led.sh \
pool_import-led.sh \
resilver_finish-start-scrub.sh
nodist_zedexec_SCRIPTS = history_event-zfs-list-cacher.sh
$(nodist_zedexec_SCRIPTS): %: %.in
-$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
$< >'$@'
zedconfdefaults = \
all-syslog.sh \
data-notify.sh \
resilver_finish-notify.sh \
scrub_finish-notify.sh \
statechange-led.sh \
statechange-notify.sh \
vdev_clear-led.sh \
vdev_attach-led.sh \
pool_import-led.sh \
resilver_finish-start-scrub.sh
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(zedconfdir)"
for f in $(zedconfdefaults); do \
test -f "$(DESTDIR)$(zedconfdir)/$${f}" -o \
-L "$(DESTDIR)$(zedconfdir)/$${f}" || \
ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \
done
chmod 0600 "$(DESTDIR)$(zedconfdir)/zed.rc"

View File

@ -46,13 +46,8 @@ case "${ZEVENT_HISTORY_INTERNAL_NAME}" in
set|inherit)
# Only act if one of the tracked properties is altered.
case "${ZEVENT_HISTORY_INTERNAL_STR%%=*}" in
canmount|mountpoint|atime|relatime|devices|exec|readonly| \
setuid|nbmand|encroot|keylocation|org.openzfs.systemd:requires| \
org.openzfs.systemd:requires-mounts-for| \
org.openzfs.systemd:before|org.openzfs.systemd:after| \
org.openzfs.systemd:wanted-by|org.openzfs.systemd:required-by| \
org.openzfs.systemd:nofail|org.openzfs.systemd:ignore \
) ;;
canmount|mountpoint|atime|relatime|devices|exec| \
readonly|setuid|nbmand) ;;
*) exit 0 ;;
esac
;;
@ -66,12 +61,8 @@ esac
zed_lock zfs-list
trap abort_alter EXIT
PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\
,readonly,setuid,nbmand,encroot,keylocation\
,org.openzfs.systemd:requires,org.openzfs.systemd:requires-mounts-for\
,org.openzfs.systemd:before,org.openzfs.systemd:after\
,org.openzfs.systemd:wanted-by,org.openzfs.systemd:required-by\
,org.openzfs.systemd:nofail,org.openzfs.systemd:ignore"
PROPS="name,mountpoint,canmount,atime,relatime,devices,exec,readonly"
PROPS="${PROPS},setuid,nbmand"
"${ZFS}" list -H -t filesystem -o $PROPS -r "${ZEVENT_POOL}" > "${FSLIST_TMP}"

View File

@ -20,7 +20,7 @@
#
# Exit codes:
# 0: enclosure led successfully set
# 1: enclosure leds not available
# 1: enclosure leds not not available
# 2: enclosure leds administratively disabled
# 3: The led sysfs path passed from ZFS does not exist
# 4: $ZPOOL not set
@ -68,7 +68,7 @@ check_and_set_led()
# timeout.
for _ in $(seq 1 5); do
# We want to check the current state first, since writing to the
# 'fault' entry always causes a SES command, even if the
# 'fault' entry always always causes a SES command, even if the
# current state is already what you want.
current=$(cat "${file}")

View File

@ -29,7 +29,6 @@
* Copyright 2016 Nexenta Systems, Inc.
* Copyright (c) 2019 Datto Inc.
* Copyright (c) 2019, loli10K <ezomori.nozomu@gmail.com>
* Copyright 2019 Joyent, Inc.
*/
#include <assert.h>
@ -993,12 +992,11 @@ zfs_do_create(int argc, char **argv)
zpool_close(zpool_handle);
goto error;
}
volsize = zvol_volsize_to_reservation(zpool_handle, volsize,
real_props);
nvlist_free(real_props);
zpool_close(zpool_handle);
volsize = zvol_volsize_to_reservation(volsize, real_props);
nvlist_free(real_props);
if (nvlist_lookup_string(props, zfs_prop_to_name(resv_prop),
&strval) != 0) {
if (nvlist_add_uint64(props,
@ -1882,7 +1880,7 @@ zfs_do_get(int argc, char **argv)
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
while (*optarg != '\0') {
static char *type_subopts[] = { "filesystem",
"volume", "snapshot", "snap", "bookmark",
"volume", "snapshot", "bookmark",
"all", NULL };
switch (getsubopt(&optarg, type_subopts,
@ -1894,13 +1892,12 @@ zfs_do_get(int argc, char **argv)
types |= ZFS_TYPE_VOLUME;
break;
case 2:
case 3:
types |= ZFS_TYPE_SNAPSHOT;
break;
case 4:
case 3:
types |= ZFS_TYPE_BOOKMARK;
break;
case 5:
case 4:
types = ZFS_TYPE_DATASET |
ZFS_TYPE_BOOKMARK;
break;
@ -1933,11 +1930,11 @@ zfs_do_get(int argc, char **argv)
fields = argv[0];
/*
* Handle users who want to get all snapshots or bookmarks
* of a dataset (ex. 'zfs get -t snapshot refer <dataset>').
* Handle users who want to get all snapshots of the current
* dataset (ex. 'zfs get -t snapshot refer <dataset>').
*/
if ((types == ZFS_TYPE_SNAPSHOT || types == ZFS_TYPE_BOOKMARK) &&
argc > 1 && (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
if (types == ZFS_TYPE_SNAPSHOT && argc > 1 &&
(flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE);
limit = 1;
}
@ -3437,11 +3434,11 @@ zfs_do_list(int argc, char **argv)
types &= ~ZFS_TYPE_SNAPSHOT;
/*
* Handle users who want to list all snapshots or bookmarks
* of the current dataset (ex. 'zfs list -t snapshot <dataset>').
* Handle users who want to list all snapshots of the current
* dataset (ex. 'zfs list -t snapshot <dataset>').
*/
if ((types == ZFS_TYPE_SNAPSHOT || types == ZFS_TYPE_BOOKMARK) &&
argc > 0 && (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
if (types == ZFS_TYPE_SNAPSHOT && argc > 0 &&
(flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE);
limit = 1;
}
@ -4144,16 +4141,6 @@ zfs_do_send(int argc, char **argv)
}
}
if (flags.dedup) {
(void) fprintf(stderr,
gettext("WARNING: deduplicated send is "
"deprecated, and will be removed in a\n"
"future release. (In the future, the flag will be "
"accepted, but a\n"
"regular, non-deduplicated stream will be "
"generated.)\n\n"));
}
argc -= optind;
argv += optind;
@ -4906,6 +4893,7 @@ parse_fs_perm(fs_perm_t *fsperm, nvlist_t *nvl)
zfs_deleg_who_type_t perm_type = name[0];
char perm_locality = name[1];
const char *perm_name = name + 3;
boolean_t is_set = B_TRUE;
who_perm_t *who_perm = NULL;
assert('$' == name[2]);
@ -4935,6 +4923,7 @@ parse_fs_perm(fs_perm_t *fsperm, nvlist_t *nvl)
assert(!"unhandled zfs_deleg_who_type_t");
}
if (is_set) {
who_perm_node_t *found_node = NULL;
who_perm_node_t *node = safe_malloc(
sizeof (who_perm_node_t));
@ -4983,8 +4972,8 @@ parse_fs_perm(fs_perm_t *fsperm, nvlist_t *nvl)
node = found_node;
who_perm = &node->who_perm;
}
assert(who_perm != NULL);
}
VERIFY3P(who_perm, !=, NULL);
(void) parse_who_perm(who_perm, nvl2, perm_locality);
}
@ -5964,7 +5953,7 @@ typedef struct holds_cbdata {
size_t cb_max_taglen;
} holds_cbdata_t;
#define STRFTIME_FMT_STR "%a %b %e %H:%M %Y"
#define STRFTIME_FMT_STR "%a %b %e %k:%M %Y"
#define DATETIME_BUF_LEN (32)
/*
*
@ -6457,25 +6446,8 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
return (1);
}
if (zfs_mount(zhp, options, flags) != 0) {
/*
* Check if a mount sneaked in after we checked
*/
if (!explicit &&
libzfs_errno(g_zfs) == EZFS_MOUNTFAILED) {
usleep(10 * MILLISEC);
libzfs_mnttab_cache(g_zfs, B_FALSE);
if (zfs_is_mounted(zhp, NULL)) {
(void) fprintf(stderr, gettext(
"Ignoring previous 'already "
"mounted' error for '%s'\n"),
zfs_get_name(zhp));
return (0);
}
}
if (zfs_mount(zhp, options, flags) != 0)
return (1);
}
break;
}
@ -6761,8 +6733,8 @@ unshare_unmount_compare(const void *larg, const void *rarg, void *unused)
/*
* Convenience routine used by zfs_do_umount() and manual_unmount(). Given an
* absolute path, find the entry /proc/self/mounts, verify that it's a
* ZFS filesystem, and unmount it appropriately.
* absolute path, find the entry /proc/self/mounts, verify that its a
* ZFS filesystems, and unmount it appropriately.
*/
static int
unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
@ -7927,7 +7899,7 @@ zfs_do_change_key(int argc, char **argv)
* 4) zfs project [-p id] [-r] [-s] <file|directory ...>
* Set project ID and/or inherit flag on the file(s) or directories.
* -p: Set the project ID as the given id.
* -r: Set on subdirectories recursively. If not specify "-p" option,
* -r: Set on subdirectorie recursively. If not specify "-p" option,
* it will use top-level directory's project ID as the given id,
* then set both project ID and inherit flag on all descendants
* of the top-level directory.
@ -8181,7 +8153,7 @@ main(int argc, char **argv)
return (zfs_do_version(argc, argv));
if ((g_zfs = libzfs_init()) == NULL) {
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
(void) fprintf(stderr, "%s", libzfs_error_init(errno));
return (1);
}

View File

@ -33,7 +33,7 @@ extern "C" {
void * safe_malloc(size_t size);
void nomem(void);
extern libzfs_handle_t *g_zfs;
libzfs_handle_t *g_zfs;
#ifdef __cplusplus
}

View File

@ -176,7 +176,7 @@ object_from_path(const char *dataset, uint64_t object, zinject_record_t *record)
}
/*
* Initialize the range based on the type, level, and range given.
* Intialize the range based on the type, level, and range given.
*/
static int
initialize_range(err_type_t type, int level, char *range,
@ -310,7 +310,7 @@ translate_record(err_type_t type, const char *object, const char *range,
ziprintf("raw object: %llu\n", record->zi_object);
/*
* For the given object, initialize the range in bytes
* For the given object, intialize the range in bytes
*/
if (initialize_range(type, level, (char *)range, record) != 0)
goto err;

View File

@ -763,7 +763,7 @@ main(int argc, char **argv)
uint32_t dvas = 0;
if ((g_zfs = libzfs_init()) == NULL) {
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
(void) fprintf(stderr, "%s", libzfs_error_init(errno));
return (1);
}

View File

@ -73,8 +73,6 @@
#include "statcommon.h"
libzfs_handle_t *g_zfs;
static int zpool_do_create(int, char **);
static int zpool_do_destroy(int, char **);
@ -787,7 +785,7 @@ add_prop_list_default(const char *propname, char *propval, nvlist_t **props,
* -P Display full path for vdev name.
*
* Adds the given vdevs to 'pool'. As with create, the bulk of this work is
* handled by make_root_vdev(), which constructs the nvlist needed to pass to
* handled by get_vdev_spec(), which constructs the nvlist needed to pass to
* libzfs.
*/
int
@ -885,7 +883,7 @@ zpool_do_add(int argc, char **argv)
}
}
/* pass off to make_root_vdev for processing */
/* pass off to get_vdev_spec for processing */
nvroot = make_root_vdev(zhp, props, force, !force, B_FALSE, dryrun,
argc, argv);
if (nvroot == NULL) {
@ -1234,9 +1232,9 @@ errout:
* -O Set fsproperty=value in the pool's root file system
*
* Creates the named pool according to the given vdev specification. The
* bulk of the vdev processing is done in make_root_vdev() in zpool_vdev.c.
* Once we get the nvlist back from make_root_vdev(), we either print out the
* contents (if '-n' was specified), or pass it to libzfs to do the creation.
* bulk of the vdev processing is done in get_vdev_spec() in zpool_vdev.c. Once
* we get the nvlist back from get_vdev_spec(), we either print out the contents
* (if '-n' was specified), or pass it to libzfs to do the creation.
*/
int
zpool_do_create(int argc, char **argv)
@ -1390,7 +1388,7 @@ zpool_do_create(int argc, char **argv)
goto errout;
}
/* pass off to make_root_vdev for bulk processing */
/* pass off to get_vdev_spec for bulk processing */
nvroot = make_root_vdev(NULL, props, force, !force, B_FALSE, dryrun,
argc - 1, argv + 1);
if (nvroot == NULL)
@ -6113,8 +6111,9 @@ zpool_do_detach(int argc, char **argv)
int ret;
/* check options */
while ((c = getopt(argc, argv, "")) != -1) {
while ((c = getopt(argc, argv, "f")) != -1) {
switch (c) {
case 'f':
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@ -6343,11 +6342,12 @@ zpool_do_online(int argc, char **argv)
int flags = 0;
/* check options */
while ((c = getopt(argc, argv, "e")) != -1) {
while ((c = getopt(argc, argv, "et")) != -1) {
switch (c) {
case 'e':
flags |= ZFS_ONLINE_EXPAND;
break;
case 't':
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@ -8421,12 +8421,24 @@ typedef struct hist_cbdata {
boolean_t internal;
} hist_cbdata_t;
static void
print_history_records(nvlist_t *nvhis, hist_cbdata_t *cb)
/*
* Print out the command history for a specific pool.
*/
static int
get_history_one(zpool_handle_t *zhp, void *data)
{
nvlist_t *nvhis;
nvlist_t **records;
uint_t numrecords;
int i;
int ret, i;
hist_cbdata_t *cb = (hist_cbdata_t *)data;
cb->first = B_FALSE;
(void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp));
if ((ret = zpool_get_history(zhp, &nvhis)) != 0)
return (ret);
verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD,
&records, &numrecords) == 0);
@ -8530,32 +8542,8 @@ print_history_records(nvlist_t *nvhis, hist_cbdata_t *cb)
(void) printf("]");
(void) printf("\n");
}
}
/*
* Print out the command history for a specific pool.
*/
static int
get_history_one(zpool_handle_t *zhp, void *data)
{
nvlist_t *nvhis;
int ret;
hist_cbdata_t *cb = (hist_cbdata_t *)data;
uint64_t off = 0;
boolean_t eof = B_FALSE;
cb->first = B_FALSE;
(void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp));
while (!eof) {
if ((ret = zpool_get_history(zhp, &nvhis, &off, &eof)) != 0)
return (ret);
print_history_records(nvhis, cb);
nvlist_free(nvhis);
}
(void) printf("\n");
nvlist_free(nvhis);
return (ret);
}
@ -8620,9 +8608,9 @@ zpool_do_events_short(nvlist_t *nvl, ev_opts_t *opts)
verify(nvlist_lookup_int64_array(nvl, FM_EREPORT_TIME, &tv, &n) == 0);
memset(str, ' ', 32);
(void) ctime_r((const time_t *)&tv[0], ctime_str);
(void) memcpy(str, ctime_str+4, 6); /* 'Jun 30' */
(void) memcpy(str+7, ctime_str+20, 4); /* '1993' */
(void) memcpy(str+12, ctime_str+11, 8); /* '21:49:08' */
(void) strncpy(str, ctime_str+4, 6); /* 'Jun 30' */
(void) strncpy(str+7, ctime_str+20, 4); /* '1993' */
(void) strncpy(str+12, ctime_str+11, 8); /* '21:49:08' */
(void) sprintf(str+20, ".%09lld", (longlong_t)tv[1]); /* '.123456789' */
if (opts->scripted)
(void) printf(gettext("%s\t"), str);
@ -9296,7 +9284,7 @@ main(int argc, char **argv)
return (zpool_do_version(argc, argv));
if ((g_zfs = libzfs_init()) == NULL) {
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
(void) fprintf(stderr, "%s", libzfs_error_init(errno));
return (1);
}

View File

@ -80,7 +80,7 @@ void pool_list_free(zpool_list_t *);
int pool_list_count(zpool_list_t *);
void pool_list_remove(zpool_list_t *, zpool_handle_t *);
extern libzfs_handle_t *g_zfs;
libzfs_handle_t *g_zfs;
typedef struct vdev_cmd_data

View File

@ -433,12 +433,11 @@ check_disk(const char *path, blkid_cache cache, int force,
char *value = blkid_get_tag_value(cache, "TYPE", path);
(void) fprintf(stderr, gettext("%s is in use and contains "
"a %s filesystem.\n"), path, value ? value : "unknown");
free(value);
return (-1);
}
/*
* Expected to fail for non-EFI labeled disks. Just check the device
* Expected to fail for non-EFI labled disks. Just check the device
* as given and do not attempt to detect and scan partitions.
*/
err = efi_alloc_and_read(fd, &vtoc);
@ -829,7 +828,7 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
rep.zprl_children = 1;
rep.zprl_parity = 0;
} else {
int64_t vdev_size;
uint64_t vdev_size;
/*
* This is a mirror or RAID-Z vdev. Go through and make
@ -859,12 +858,12 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
*/
type = NULL;
dontreport = 0;
vdev_size = -1LL;
vdev_size = -1ULL;
for (c = 0; c < children; c++) {
nvlist_t *cnv = child[c];
char *path;
struct stat64 statbuf;
int64_t size = -1LL;
uint64_t size = -1ULL;
char *childtype;
int fd, err;
@ -955,7 +954,7 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
* (~16MB) then report an error.
*/
if (!dontreport &&
(vdev_size != -1LL &&
(vdev_size != -1ULL &&
(labs(size - vdev_size) >
ZPOOL_FUZZ))) {
if (ret != NULL)
@ -1867,7 +1866,7 @@ make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep,
}
/*
* Validate each device to make sure that it's not shared with another
* Validate each device to make sure that its not shared with another
* subsystem. We do this even if 'force' is set, because there are some
* uses (such as a dedicated dump device) that even '-f' cannot
* override.

View File

@ -53,6 +53,7 @@
*/
#define DUMP_GROUPING 4
uint64_t total_write_size = 0;
uint64_t total_stream_len = 0;
FILE *send_stream = 0;
boolean_t do_byteswap = B_FALSE;
@ -197,7 +198,7 @@ print_block(char *buf, int length)
}
/*
* Print an array of bytes to stdout as hexadecimal characters. str must
* Print an array of bytes to stdout as hexidecimal characters. str must
* have buf_len * 2 + 1 bytes of space.
*/
static void
@ -218,9 +219,6 @@ main(int argc, char *argv[])
{
char *buf = safe_malloc(SPA_MAXBLOCKSIZE);
uint64_t drr_record_count[DRR_NUMTYPES] = { 0 };
uint64_t total_payload_size = 0;
uint64_t total_overhead_size = 0;
uint64_t drr_byte_count[DRR_NUMTYPES] = { 0 };
char salt[ZIO_DATA_SALT_LEN * 2 + 1];
char iv[ZIO_DATA_IV_LEN * 2 + 1];
char mac[ZIO_DATA_MAC_LEN * 2 + 1];
@ -338,9 +336,7 @@ main(int argc, char *argv[])
}
drr_record_count[drr->drr_type]++;
total_overhead_size += sizeof (*drr);
total_records++;
payload_size = 0;
switch (drr->drr_type) {
case DRR_BEGIN:
@ -394,7 +390,6 @@ main(int argc, char *argv[])
nvlist_print(stdout, nv);
nvlist_free(nv);
}
payload_size = sz;
}
break;
@ -559,6 +554,7 @@ main(int argc, char *argv[])
if (dump) {
print_block(buf, payload_size);
}
total_write_size += payload_size;
break;
case DRR_WRITE_BYREF:
@ -687,7 +683,6 @@ main(int argc, char *argv[])
print_block(buf,
P2ROUNDUP(drrwe->drr_psize, 8));
}
payload_size = P2ROUNDUP(drrwe->drr_psize, 8);
break;
case DRR_OBJECT_RANGE:
if (do_byteswap) {
@ -728,8 +723,6 @@ main(int argc, char *argv[])
(longlong_t)drrc->drr_checksum.zc_word[3]);
}
pcksum = zc;
drr_byte_count[drr->drr_type] += payload_size;
total_payload_size += payload_size;
}
free(buf);
fletcher_4_fini();
@ -737,40 +730,28 @@ main(int argc, char *argv[])
/* Print final summary */
(void) printf("SUMMARY:\n");
(void) printf("\tTotal DRR_BEGIN records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_BEGIN],
(u_longlong_t)drr_byte_count[DRR_BEGIN]);
(void) printf("\tTotal DRR_END records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_END],
(u_longlong_t)drr_byte_count[DRR_END]);
(void) printf("\tTotal DRR_OBJECT records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_OBJECT],
(u_longlong_t)drr_byte_count[DRR_OBJECT]);
(void) printf("\tTotal DRR_FREEOBJECTS records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_FREEOBJECTS],
(u_longlong_t)drr_byte_count[DRR_FREEOBJECTS]);
(void) printf("\tTotal DRR_WRITE records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_WRITE],
(u_longlong_t)drr_byte_count[DRR_WRITE]);
(void) printf("\tTotal DRR_WRITE_BYREF records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_WRITE_BYREF],
(u_longlong_t)drr_byte_count[DRR_WRITE_BYREF]);
(void) printf("\tTotal DRR_WRITE_EMBEDDED records = %lld (%llu "
"bytes)\n", (u_longlong_t)drr_record_count[DRR_WRITE_EMBEDDED],
(u_longlong_t)drr_byte_count[DRR_WRITE_EMBEDDED]);
(void) printf("\tTotal DRR_FREE records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_FREE],
(u_longlong_t)drr_byte_count[DRR_FREE]);
(void) printf("\tTotal DRR_SPILL records = %lld (%llu bytes)\n",
(u_longlong_t)drr_record_count[DRR_SPILL],
(u_longlong_t)drr_byte_count[DRR_SPILL]);
(void) printf("\tTotal DRR_BEGIN records = %lld\n",
(u_longlong_t)drr_record_count[DRR_BEGIN]);
(void) printf("\tTotal DRR_END records = %lld\n",
(u_longlong_t)drr_record_count[DRR_END]);
(void) printf("\tTotal DRR_OBJECT records = %lld\n",
(u_longlong_t)drr_record_count[DRR_OBJECT]);
(void) printf("\tTotal DRR_FREEOBJECTS records = %lld\n",
(u_longlong_t)drr_record_count[DRR_FREEOBJECTS]);
(void) printf("\tTotal DRR_WRITE records = %lld\n",
(u_longlong_t)drr_record_count[DRR_WRITE]);
(void) printf("\tTotal DRR_WRITE_BYREF records = %lld\n",
(u_longlong_t)drr_record_count[DRR_WRITE_BYREF]);
(void) printf("\tTotal DRR_WRITE_EMBEDDED records = %lld\n",
(u_longlong_t)drr_record_count[DRR_WRITE_EMBEDDED]);
(void) printf("\tTotal DRR_FREE records = %lld\n",
(u_longlong_t)drr_record_count[DRR_FREE]);
(void) printf("\tTotal DRR_SPILL records = %lld\n",
(u_longlong_t)drr_record_count[DRR_SPILL]);
(void) printf("\tTotal records = %lld\n",
(u_longlong_t)total_records);
(void) printf("\tTotal payload size = %lld (0x%llx)\n",
(u_longlong_t)total_payload_size, (u_longlong_t)total_payload_size);
(void) printf("\tTotal header overhead = %lld (0x%llx)\n",
(u_longlong_t)total_overhead_size,
(u_longlong_t)total_overhead_size);
(void) printf("\tTotal write size = %lld (0x%llx)\n",
(u_longlong_t)total_write_size, (u_longlong_t)total_write_size);
(void) printf("\tTotal stream length = %lld (0x%llx)\n",
(u_longlong_t)total_stream_len, (u_longlong_t)total_stream_len);
return (0);

View File

@ -74,7 +74,7 @@
*
* To turn this into an overnight stress test, use -T to specify run time.
*
* You can ask more vdevs [-v], datasets [-d], or threads [-t]
* You can ask more more vdevs [-v], datasets [-d], or threads [-t]
* to increase the pool capacity, fanout, and overall stress level.
*
* Use the -k option to set the desired frequency of kills.
@ -107,7 +107,6 @@
#include <sys/vdev_impl.h>
#include <sys/vdev_file.h>
#include <sys/vdev_initialize.h>
#include <sys/vdev_raidz.h>
#include <sys/vdev_trim.h>
#include <sys/spa_impl.h>
#include <sys/metaslab_impl.h>
@ -1693,7 +1692,7 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t *tx, lr_write_t *lr)
if (zil_replaying(zd->zd_zilog, tx))
return;
if (lr->lr_length > zil_max_log_data(zd->zd_zilog))
if (lr->lr_length > ZIL_MAX_LOG_DATA)
write_state = WR_INDIRECT;
itx = zil_itx_create(TX_WRITE,
@ -2225,7 +2224,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
zgd->zgd_private = zd;
if (buf != NULL) { /* immediate write */
zgd->zgd_lr = (struct zfs_locked_range *)ztest_range_lock(zd,
zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd,
object, offset, size, RL_READER);
error = dmu_read(os, object, offset, size, buf,
@ -2240,7 +2239,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
offset = 0;
}
zgd->zgd_lr = (struct zfs_locked_range *)ztest_range_lock(zd,
zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd,
object, offset, size, RL_READER);
error = dmu_buf_hold(os, object, offset, zgd, &db,
@ -2746,24 +2745,8 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
VERIFY3U(EEXIST, ==,
spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL));
nvlist_free(nvroot);
/*
* We open a reference to the spa and then we try to export it
* expecting one of the following errors:
*
* EBUSY
* Because of the reference we just opened.
*
* ZFS_ERR_EXPORT_IN_PROGRESS
* For the case that there is another ztest thread doing
* an export concurrently.
*/
VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG));
int error = spa_destroy(zo->zo_pool);
if (error != EBUSY && error != ZFS_ERR_EXPORT_IN_PROGRESS) {
fatal(0, "spa_destroy(%s) returned unexpected value %d",
spa->spa_name, error);
}
VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool));
spa_close(spa, FTAG);
(void) pthread_rwlock_unlock(&ztest_name_lock);
@ -7111,8 +7094,6 @@ ztest_run(ztest_shared_t *zs)
metaslab_preload_limit = ztest_random(20) + 1;
ztest_spa = spa;
VERIFY0(vdev_raidz_impl_set("cycle"));
dmu_objset_stats_t dds;
VERIFY0(ztest_dmu_objset_own(ztest_opts.zo_pool,
DMU_OST_ANY, B_TRUE, B_TRUE, FTAG, &os));

View File

@ -1 +0,0 @@
dist_bin_SCRIPTS = zvol_wait

View File

@ -1,112 +0,0 @@
#!/bin/sh
count_zvols() {
if [ -z "$zvols" ]; then
echo 0
else
echo "$zvols" | wc -l
fi
}
filter_out_zvols_with_links() {
while read -r zvol; do
if [ ! -L "/dev/zvol/$zvol" ]; then
echo "$zvol"
fi
done
}
filter_out_deleted_zvols() {
while read -r zvol; do
if zfs list "$zvol" >/dev/null 2>&1; then
echo "$zvol"
fi
done
}
list_zvols() {
zfs list -t volume -H -o name,volmode,receive_resume_token |
while read -r zvol_line; do
name=$(echo "$zvol_line" | awk '{print $1}')
volmode=$(echo "$zvol_line" | awk '{print $2}')
token=$(echo "$zvol_line" | awk '{print $3}')
#
# /dev links are not created for zvols with volmode = "none".
#
[ "$volmode" = "none" ] && continue
#
# We also also ignore partially received zvols if it is
# not an incremental receive, as those won't even have a block
# device minor node created yet.
#
if [ "$token" != "-" ]; then
#
# Incremental receives create an invisible clone that
# is not automatically displayed by zfs list.
#
if ! zfs list "$name/%recv" >/dev/null 2>&1; then
continue
fi
fi
echo "$name"
done
}
zvols=$(list_zvols)
zvols_count=$(count_zvols)
if [ "$zvols_count" -eq 0 ]; then
echo "No zvols found, nothing to do."
exit 0
fi
echo "Testing $zvols_count zvol links"
outer_loop=0
while [ "$outer_loop" -lt 20 ]; do
outer_loop=$((outer_loop + 1))
old_zvols_count=$(count_zvols)
inner_loop=0
while [ "$inner_loop" -lt 30 ]; do
inner_loop=$((inner_loop + 1))
zvols="$(echo "$zvols" | filter_out_zvols_with_links)"
zvols_count=$(count_zvols)
if [ "$zvols_count" -eq 0 ]; then
echo "All zvol links are now present."
exit 0
fi
sleep 1
done
echo "Still waiting on $zvols_count zvol links ..."
#
# Although zvols should normally not be deleted at boot time,
# if that is the case then their links will be missing and
# we would stall.
#
if [ "$old_zvols_count" -eq "$zvols_count" ]; then
echo "No progress since last loop."
echo "Checking if any zvols were deleted."
zvols=$(echo "$zvols" | filter_out_deleted_zvols)
zvols_count=$(count_zvols)
if [ "$old_zvols_count" -ne "$zvols_count" ]; then
echo "$((old_zvols_count - zvols_count)) zvol(s) deleted."
fi
if [ "$zvols_count" -ne 0 ]; then
echo "Remaining zvols:"
echo "$zvols"
else
echo "All zvol links are now present."
exit 0
fi
fi
done
echo "Timed out waiting on zvol links"
exit 1

View File

@ -1,3 +1,47 @@
dnl #
dnl # ZFS_AC_PYTHON_VERSION(version, [action-if-true], [action-if-false])
dnl #
dnl # Verify Python version
dnl #
AC_DEFUN([ZFS_AC_PYTHON_VERSION], [
ver_check=`$PYTHON -c "import sys; print (sys.version.split()[[0]] $1)"`
AS_IF([test "$ver_check" = "True"], [
m4_ifvaln([$2], [$2])
], [
m4_ifvaln([$3], [$3])
])
])
dnl #
dnl # ZFS_AC_PYTHON_VERSION_IS_2
dnl # ZFS_AC_PYTHON_VERSION_IS_3
dnl #
dnl # Tests if the $PYTHON_VERSION matches 2.x or 3.x.
dnl #
AC_DEFUN([ZFS_AC_PYTHON_VERSION_IS_2],
[test "${PYTHON_VERSION%%\.*}" = "2"])
AC_DEFUN([ZFS_AC_PYTHON_VERSION_IS_3],
[test "${PYTHON_VERSION%%\.*}" = "3"])
dnl #
dnl # ZFS_AC_PYTHON_MODULE(module_name, [action-if-true], [action-if-false])
dnl #
dnl # Checks for Python module. Freely inspired by AX_PYTHON_MODULE
dnl # https://www.gnu.org/software/autoconf-archive/ax_python_module.html
dnl # Required by ZFS_AC_CONFIG_ALWAYS_PYZFS.
dnl #
AC_DEFUN([ZFS_AC_PYTHON_MODULE], [
PYTHON_NAME=`basename $PYTHON`
AC_MSG_CHECKING([for $PYTHON_NAME module: $1])
AS_IF([$PYTHON -c "import $1" 2>/dev/null], [
AC_MSG_RESULT(yes)
m4_ifvaln([$2], [$2])
], [
AC_MSG_RESULT(no)
m4_ifvaln([$3], [$3])
])
])
dnl #
dnl # The majority of the python scripts are written to be compatible
dnl # with Python 2.6 and Python 3.4. Therefore, they may be installed
@ -22,38 +66,35 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
[AC_MSG_ERROR([Unknown --with-python value '$with_python'])]
)
AS_IF([test $PYTHON != :], [
AS_IF([$PYTHON --version >/dev/null 2>&1],
[AM_PATH_PYTHON([2.6], [], [:])],
[AC_MSG_ERROR([Cannot find $PYTHON in your system path])]
)
])
AM_CONDITIONAL([USING_PYTHON], [test "$PYTHON" != :])
AM_CONDITIONAL([USING_PYTHON_2], [ZFS_AC_PYTHON_VERSION_IS_2])
AM_CONDITIONAL([USING_PYTHON_3], [ZFS_AC_PYTHON_VERSION_IS_3])
dnl #
dnl # Minimum supported Python versions for utilities:
dnl # Python 2.6 or Python 3.4
dnl # Python 2.6.x, or Python 3.4.x
dnl #
AM_PATH_PYTHON([], [], [:])
AS_IF([test -z "$PYTHON_VERSION"], [
PYTHON_VERSION=$(basename $PYTHON | tr -cd 0-9.)
AS_IF([ZFS_AC_PYTHON_VERSION_IS_2], [
ZFS_AC_PYTHON_VERSION([>= '2.6'], [ true ],
[AC_MSG_ERROR("Python >= 2.6.x is not available")])
])
PYTHON_MINOR=${PYTHON_VERSION#*\.}
AS_CASE([$PYTHON_VERSION],
[2.*], [
AS_IF([test $PYTHON_MINOR -lt 6],
[AC_MSG_ERROR("Python >= 2.6 is required")])
],
[3.*], [
AS_IF([test $PYTHON_MINOR -lt 4],
[AC_MSG_ERROR("Python >= 3.4 is required")])
],
[:|2|3], [],
[PYTHON_VERSION=3]
)
AM_CONDITIONAL([USING_PYTHON], [test "$PYTHON" != :])
AM_CONDITIONAL([USING_PYTHON_2], [test "x${PYTHON_VERSION%%\.*}" = x2])
AM_CONDITIONAL([USING_PYTHON_3], [test "x${PYTHON_VERSION%%\.*}" = x3])
AS_IF([ZFS_AC_PYTHON_VERSION_IS_3], [
ZFS_AC_PYTHON_VERSION([>= '3.4'], [ true ],
[AC_MSG_ERROR("Python >= 3.4.x is not available")])
])
dnl #
dnl # Request that packages be built for a specific Python version.
dnl #
AS_IF([test "x$with_python" != xcheck], [
PYTHON_PKG_VERSION=$(echo $PYTHON_VERSION | tr -d .)
AS_IF([test $with_python != check], [
PYTHON_PKG_VERSION=`echo ${PYTHON} | tr -d 'a-zA-Z.'`
DEFINE_PYTHON_PKG_VERSION='--define "__use_python_pkg_version '${PYTHON_PKG_VERSION}'"'
DEFINE_PYTHON_VERSION='--define "__use_python '${PYTHON}'"'
], [

View File

@ -1,24 +1,5 @@
dnl #
dnl # ZFS_AC_PYTHON_MODULE(module_name, [action-if-true], [action-if-false])
dnl #
dnl # Checks for Python module. Freely inspired by AX_PYTHON_MODULE
dnl # https://www.gnu.org/software/autoconf-archive/ax_python_module.html
dnl # Required by ZFS_AC_CONFIG_ALWAYS_PYZFS.
dnl #
AC_DEFUN([ZFS_AC_PYTHON_MODULE], [
PYTHON_NAME=$(basename $PYTHON)
AC_MSG_CHECKING([for $PYTHON_NAME module: $1])
AS_IF([$PYTHON -c "import $1" 2>/dev/null], [
AC_MSG_RESULT(yes)
m4_ifvaln([$2], [$2])
], [
AC_MSG_RESULT(no)
m4_ifvaln([$3], [$3])
])
])
dnl #
dnl # Determines if pyzfs can be built, requires Python 2.7 or later.
dnl # Determines if pyzfs can be built, requires Python 2.7 or latter.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
AC_ARG_ENABLE([pyzfs],
@ -37,7 +18,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
DEFINE_PYZFS='--without pyzfs'
])
], [
AS_IF([test "$PYTHON" != :], [
AS_IF([test $PYTHON != :], [
DEFINE_PYZFS=''
], [
enable_pyzfs=no
@ -50,16 +31,20 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
dnl # Require python-devel libraries
dnl #
AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
AS_CASE([$PYTHON_VERSION],
[3.*], [PYTHON_REQUIRED_VERSION=">= '3.4.0'"],
[2.*], [PYTHON_REQUIRED_VERSION=">= '2.7.0'"],
[AC_MSG_ERROR("Python $PYTHON_VERSION unknown")]
)
AS_IF([ZFS_AC_PYTHON_VERSION_IS_2], [
PYTHON_REQUIRED_VERSION=">= '2.7.0'"
], [
AS_IF([ZFS_AC_PYTHON_VERSION_IS_3], [
PYTHON_REQUIRED_VERSION=">= '3.4.0'"
], [
AC_MSG_ERROR("Python $PYTHON_VERSION unknown")
])
])
AX_PYTHON_DEVEL([$PYTHON_REQUIRED_VERSION], [
AS_IF([test "x$enable_pyzfs" = xyes], [
AC_MSG_ERROR("Python $PYTHON_REQUIRED_VERSION development library is not installed")
], [test "x$enable_pyzfs" != xno], [
], [test ! "x$enable_pyzfs" = xno], [
enable_pyzfs=no
])
])
@ -72,7 +57,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
ZFS_AC_PYTHON_MODULE([setuptools], [], [
AS_IF([test "x$enable_pyzfs" = xyes], [
AC_MSG_ERROR("Python $PYTHON_VERSION setuptools is not installed")
], [test "x$enable_pyzfs" != xno], [
], [test ! "x$enable_pyzfs" = xno], [
enable_pyzfs=no
])
])
@ -85,7 +70,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
ZFS_AC_PYTHON_MODULE([cffi], [], [
AS_IF([test "x$enable_pyzfs" = xyes], [
AC_MSG_ERROR("Python $PYTHON_VERSION cffi is not installed")
], [test "x$enable_pyzfs" != xno], [
], [test ! "x$enable_pyzfs" = xno], [
enable_pyzfs=no
])
])
@ -96,7 +81,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
dnl #
AS_IF([test "x$enable_pyzfs" = xcheck], [enable_pyzfs=yes])
AM_CONDITIONAL([PYZFS_ENABLED], [test "x$enable_pyzfs" = xyes])
AM_CONDITIONAL([PYZFS_ENABLED], [test x$enable_pyzfs = xyes])
AC_SUBST([PYZFS_ENABLED], [$enable_pyzfs])
AC_SUBST(pythonsitedir, [$PYTHON_SITE_PKG])

View File

@ -50,7 +50,7 @@
# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
# deprecated. They have the same value.
#
# This code was derived from Makefile.decl in GLib, originally licensed
# This code was derived from Makefile.decl in GLib, originally licenced
# under LGPLv2.1+.
#
# LICENSE

View File

@ -20,7 +20,7 @@ deb-kmod: deb-local rpm-kmod
arch=`$(RPM) -qp $${name}-kmod-$${version}.src.rpm --qf %{arch} | tail -1`; \
debarch=`$(DPKG) --print-architecture`; \
pkg1=kmod-$${name}*$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1 || exit 1; \
fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1; \
$(RM) $$pkg1
@ -30,7 +30,7 @@ deb-dkms: deb-local rpm-dkms
arch=`$(RPM) -qp $${name}-dkms-$${version}.src.rpm --qf %{arch} | tail -1`; \
debarch=`$(DPKG) --print-architecture`; \
pkg1=$${name}-dkms-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1 || exit 1; \
fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1; \
$(RM) $$pkg1
deb-utils: deb-local rpm-utils
@ -45,7 +45,7 @@ deb-utils: deb-local rpm-utils
pkg5=libzpool2-$${version}.$${arch}.rpm; \
pkg6=libzfs2-devel-$${version}.$${arch}.rpm; \
pkg7=$${name}-test-$${version}.$${arch}.rpm; \
pkg8=$${name}-dracut-$${version}.noarch.rpm; \
pkg8=$${name}-dracut-$${version}.$${arch}.rpm; \
pkg9=$${name}-initramfs-$${version}.$${arch}.rpm; \
pkg10=`ls python*-pyzfs-$${version}* | tail -1`; \
## Arguments need to be passed to dh_shlibdeps. Alien provides no mechanism
@ -63,7 +63,7 @@ deb-utils: deb-local rpm-utils
env PATH=$${path_prepend}:$${PATH} \
fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch \
$$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
$$pkg8 $$pkg9 $$pkg10 || exit 1; \
$$pkg8 $$pkg9 $$pkg10; \
$(RM) $${path_prepend}/dh_shlibdeps; \
rmdir $${path_prepend}; \
$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \

View File

@ -269,7 +269,8 @@ size_t iconv();
[am_cv_proto_iconv_arg1="const"])
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([$am_cv_proto_iconv])
AC_MSG_RESULT([
$am_cv_proto_iconv])
else
dnl When compiling GNU libiconv on a system that does not have iconv yet,
dnl pick the POSIX compliant declaration without 'const'.

View File

@ -4,23 +4,17 @@ dnl #
dnl # - access_ok(type, addr, size)
dnl # + access_ok(addr, size)
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE], [
ZFS_LINUX_TEST_SRC([access_ok_type], [
#include <linux/uaccess.h>
],[
const void __user __attribute__((unused)) *addr =
(void *) 0xdeadbeef;
unsigned long __attribute__((unused)) size = 1;
int error __attribute__((unused)) = access_ok(0, addr, size);
])
])
AC_DEFUN([ZFS_AC_KERNEL_ACCESS_OK_TYPE], [
AC_MSG_CHECKING([whether access_ok() has 'type' parameter])
ZFS_LINUX_TEST_RESULT([access_ok_type], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/uaccess.h>
],[
const void __user __attribute__((unused)) *addr = (void *) 0xdeadbeef;
unsigned long __attribute__((unused)) size = 1;
int error __attribute__((unused)) = access_ok(0, addr, size);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ACCESS_OK_TYPE, 1,
[kernel has access_ok with 'type' parameter])
AC_DEFINE(HAVE_ACCESS_OK_TYPE, 1, [kernel has access_ok with 'type' parameter])
],[
AC_MSG_RESULT(no)
])

View File

@ -3,26 +3,32 @@ dnl # Check if posix_acl_release can be used from a ZFS_META_LICENSED
dnl # module. The is_owner_or_cap macro was replaced by
dnl # inode_owner_or_capable
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [
ZFS_LINUX_TEST_SRC([posix_acl_release], [
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
AC_MSG_CHECKING([whether posix_acl_release() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/cred.h>
#include <linux/fs.h>
#include <linux/posix_acl.h>
],[
struct posix_acl* tmp = posix_acl_alloc(1, 0);
posix_acl_release(tmp);
], [], [$ZFS_META_LICENSE])
])
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
AC_MSG_CHECKING([whether posix_acl_release() is available])
ZFS_LINUX_TEST_RESULT([posix_acl_release], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1,
[posix_acl_release() is available])
AC_MSG_CHECKING([whether posix_acl_release() is GPL-only])
ZFS_LINUX_TEST_RESULT([posix_acl_release_license], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/module.h>
#include <linux/cred.h>
#include <linux/fs.h>
#include <linux/posix_acl.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
],[
struct posix_acl* tmp = posix_acl_alloc(1, 0);
posix_acl_release(tmp);
],[
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(yes)
@ -40,25 +46,24 @@ dnl # set_cached_acl() and forget_cached_acl() changed from inline to
dnl # EXPORT_SYMBOL. In the former case, they may not be usable because of
dnl # posix_acl_release. In the latter case, we can always use them.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [
ZFS_LINUX_TEST_SRC([set_cached_acl], [
AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
AC_MSG_CHECKING([whether set_cached_acl() is usable])
ZFS_LINUX_TRY_COMPILE([
#include <linux/module.h>
#include <linux/cred.h>
#include <linux/fs.h>
#include <linux/posix_acl.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
],[
struct inode *ip = NULL;
struct posix_acl *acl = posix_acl_alloc(1, 0);
set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
forget_cached_acl(ip, ACL_TYPE_ACCESS);
], [], [$ZFS_META_LICENSE])
])
AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
AC_MSG_CHECKING([whether set_cached_acl() is usable])
ZFS_LINUX_TEST_RESULT([set_cached_acl_license], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1,
[set_cached_acl() is usable])
[posix_acl_release() is usable])
],[
AC_MSG_RESULT(no)
])
@ -72,25 +77,14 @@ dnl #
dnl # 3.14 API change,
dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [
ZFS_LINUX_TEST_SRC([posix_acl_chmod], [
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
AC_MSG_CHECKING([whether posix_acl_chmod exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
#include <linux/posix_acl.h>
],[
posix_acl_chmod(NULL, 0, 0)
])
ZFS_LINUX_TEST_SRC([__posix_acl_chmod], [
#include <linux/fs.h>
#include <linux/posix_acl.h>
],[
__posix_acl_chmod(NULL, 0, 0)
])
])
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
AC_MSG_CHECKING([whether posix_acl_chmod exists])
ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
],[
@ -98,10 +92,14 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
])
AC_MSG_CHECKING([whether __posix_acl_chmod exists])
ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
#include <linux/posix_acl.h>
],[
__posix_acl_chmod(NULL, 0, 0)
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1,
[__posix_acl_chmod() exists])
AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, [__posix_acl_chmod() exists])
],[
AC_MSG_RESULT(no)
])
@ -111,19 +109,15 @@ dnl #
dnl # 3.1 API change,
dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
#include <linux/posix_acl.h>
],[
umode_t tmp;
posix_acl_equiv_mode(NULL,&tmp);
])
])
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
[ posix_acl_equiv_mode wants umode_t*])
@ -136,8 +130,9 @@ dnl #
dnl # 4.8 API change,
dnl # The function posix_acl_valid now must be passed a namespace.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS], [
ZFS_LINUX_TEST_SRC([posix_acl_valid_with_ns], [
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
#include <linux/posix_acl.h>
],[
@ -146,12 +141,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS], [
int error;
error = posix_acl_valid(user_ns, acl);
])
])
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
ZFS_LINUX_TEST_RESULT([posix_acl_valid_with_ns], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
[posix_acl_valid() wants user namespace])
@ -165,8 +155,9 @@ dnl # 2.6.27 API change,
dnl # Check if inode_operations contains the function permission
dnl # and expects the nameidata structure to have been removed.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION], [
ZFS_LINUX_TEST_SRC([inode_operations_permission], [
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
AC_MSG_CHECKING([whether iops->permission() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
int permission_fn(struct inode *inode, int mask) { return 0; }
@ -175,12 +166,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION], [
iops __attribute__ ((unused)) = {
.permission = permission_fn,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
AC_MSG_CHECKING([whether iops->permission() exists])
ZFS_LINUX_TEST_RESULT([inode_operations_permission], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
],[
@ -193,8 +180,9 @@ dnl # 2.6.26 API change,
dnl # Check if inode_operations contains the function permission
dnl # and expects the nameidata structure to be passed.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
ZFS_LINUX_TEST_SRC([inode_operations_permission_with_nameidata], [
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
AC_MSG_CHECKING([whether iops->permission() wants nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
#include <linux/sched.h>
@ -205,12 +193,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
iops __attribute__ ((unused)) = {
.permission = permission_fn,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
AC_MSG_CHECKING([whether iops->permission() wants nameidata])
ZFS_LINUX_TEST_RESULT([inode_operations_permission_with_nameidata], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
@ -224,8 +208,9 @@ dnl #
dnl # 2.6.32 API change,
dnl # Check if inode_operations contains the function check_acl
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL], [
ZFS_LINUX_TEST_SRC([inode_operations_check_acl], [
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
AC_MSG_CHECKING([whether iops->check_acl() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
int check_acl_fn(struct inode *inode, int mask) { return 0; }
@ -234,12 +219,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL], [
iops __attribute__ ((unused)) = {
.check_acl = check_acl_fn,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
AC_MSG_CHECKING([whether iops->check_acl() exists])
ZFS_LINUX_TEST_RESULT([inode_operations_check_acl], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
],[
@ -251,8 +232,9 @@ dnl #
dnl # 2.6.38 API change,
dnl # The function check_acl gained a new parameter: flags
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
ZFS_LINUX_TEST_SRC([inode_operations_check_acl_with_flags], [
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
AC_MSG_CHECKING([whether iops->check_acl() wants flags])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
int check_acl_fn(struct inode *inode, int mask,
@ -262,12 +244,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
iops __attribute__ ((unused)) = {
.check_acl = check_acl_fn,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
AC_MSG_CHECKING([whether iops->check_acl() wants flags])
ZFS_LINUX_TEST_RESULT([inode_operations_check_acl_with_flags], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1,
@ -281,8 +259,9 @@ dnl #
dnl # 3.1 API change,
dnl # Check if inode_operations contains the function get_acl
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
AC_MSG_CHECKING([whether iops->get_acl() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
struct posix_acl *get_acl_fn(struct inode *inode, int type)
@ -292,12 +271,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
iops __attribute__ ((unused)) = {
.get_acl = get_acl_fn,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
AC_MSG_CHECKING([whether iops->get_acl() exists])
ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
],[
@ -309,23 +284,20 @@ dnl #
dnl # 3.14 API change,
dnl # Check if inode_operations contains the function set_acl
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
AC_MSG_CHECKING([whether iops->set_acl() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
int set_acl_fn(struct inode *inode, struct posix_acl *acl,
int type) { return 0; }
int set_acl_fn(struct inode *inode, struct posix_acl *acl, int type)
{ return 0; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.set_acl = set_acl_fn,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
AC_MSG_CHECKING([whether iops->set_acl() exists])
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
],[
@ -339,79 +311,16 @@ dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
dnl # anymore.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE], [
ZFS_LINUX_TEST_SRC([get_acl_handle_cache], [
#include <linux/fs.h>
],[
void *sentinel __attribute__ ((unused)) =
uncached_acl_sentinel(NULL);
])
])
AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [
AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
ZFS_LINUX_TEST_RESULT([get_acl_handle_cache], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1,
[uncached_acl_sentinel() exists])
AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, [uncached_acl_sentinel() exists])
],[
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 4.16 kernel: check if struct posix_acl acl.a_refcount is a refcount_t.
dnl # It's an atomic_t on older kernels.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT], [
ZFS_LINUX_TEST_SRC([acl_refcount], [
#include <linux/backing-dev.h>
#include <linux/refcount.h>
#include <linux/posix_acl.h>
],[
struct posix_acl acl;
refcount_t *r __attribute__ ((unused)) = &acl.a_refcount;
])
])
AC_DEFUN([ZFS_AC_KERNEL_ACL_HAS_REFCOUNT], [
AC_MSG_CHECKING([whether posix_acl has refcount_t])
ZFS_LINUX_TEST_RESULT([acl_refcount], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ACL_REFCOUNT, 1, [posix_acl has refcount_t])
],[
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [
ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE
ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE
ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD
ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL
ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE
ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT
])
AC_DEFUN([ZFS_AC_KERNEL_ACL], [
ZFS_AC_KERNEL_POSIX_ACL_RELEASE
ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE
ZFS_AC_KERNEL_POSIX_ACL_CHMOD
ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS
ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION
ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA
ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL
ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
])

View File

@ -1,23 +1,21 @@
dnl #
dnl # Linux 4.9-rc5+ ABI, removal of the .aio_fsync field
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_AIO_FSYNC], [
ZFS_LINUX_TEST_SRC([aio_fsync], [
AC_DEFUN([ZFS_AC_KERNEL_AIO_FSYNC], [
AC_MSG_CHECKING([whether fops->aio_fsync() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
static const struct file_operations
fops __attribute__ ((unused)) = {
.aio_fsync = NULL,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_AIO_FSYNC], [
AC_MSG_CHECKING([whether fops->aio_fsync() exists])
ZFS_LINUX_TEST_RESULT([aio_fsync], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_AIO_FSYNC, 1, [fops->aio_fsync() exists])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -5,19 +5,16 @@ dnl # solution to handling automounts. Prior to this cifs/nfs clients
dnl # which required automount support would abuse the follow_link()
dnl # operation on directories for this purpose.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_AUTOMOUNT], [
ZFS_LINUX_TEST_SRC([dentry_operations_d_automount], [
AC_DEFUN([ZFS_AC_KERNEL_AUTOMOUNT], [
AC_MSG_CHECKING([whether dops->d_automount() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/dcache.h>
struct vfsmount *d_automount(struct path *p) { return NULL; }
struct dentry_operations dops __attribute__ ((unused)) = {
.d_automount = d_automount,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_AUTOMOUNT], [
AC_MSG_CHECKING([whether dops->d_automount() exists])
ZFS_LINUX_TEST_RESULT([dentry_operations_d_automount], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_AUTOMOUNT, 1, [dops->automount() exists])
],[

View File

@ -5,22 +5,21 @@ dnl # it has been true for a while that there was no strict 1:1 mapping
dnl # between physical sector size and logical block size this change makes
dnl # it explicit.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_LOGICAL_BLOCK_SIZE], [
ZFS_LINUX_TEST_SRC([bdev_logical_block_size], [
AC_DEFUN([ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE], [
AC_MSG_CHECKING([whether bdev_logical_block_size() is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct block_device *bdev = NULL;
bdev_logical_block_size(bdev);
], [$NO_UNUSED_BUT_SET_VARIABLE])
])
AC_DEFUN([ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE], [
AC_MSG_CHECKING([whether bdev_logical_block_size() is available])
ZFS_LINUX_TEST_RESULT([bdev_logical_block_size], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BDEV_LOGICAL_BLOCK_SIZE, 1,
[bdev_logical_block_size() is available])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -19,22 +19,21 @@ dnl #
dnl # Unfortunately, this interface isn't entirely reliable because
dnl # drives are sometimes known to misreport this value.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_PHYSICAL_BLOCK_SIZE], [
ZFS_LINUX_TEST_SRC([bdev_physical_block_size], [
AC_DEFUN([ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE], [
AC_MSG_CHECKING([whether bdev_physical_block_size() is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct block_device *bdev = NULL;
bdev_physical_block_size(bdev);
], [$NO_UNUSED_BUT_SET_VARIABLE])
])
AC_DEFUN([ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE], [
AC_MSG_CHECKING([whether bdev_physical_block_size() is available])
ZFS_LINUX_TEST_RESULT([bdev_physical_block_size], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BDEV_PHYSICAL_BLOCK_SIZE, 1,
[bdev_physical_block_size() is available])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -1,28 +1,43 @@
dnl #
dnl # Check available BDI interfaces.
dnl # 2.6.32 - 2.6.33, bdi_setup_and_register() is not exported.
dnl # 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
dnl # 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments.
dnl # 4.12 - x.y, super_setup_bdi_name() new interface.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BDI], [
ZFS_LINUX_TEST_SRC([super_setup_bdi_name], [
AC_DEFUN([ZFS_AC_KERNEL_BDI], [
AC_MSG_CHECKING([whether super_setup_bdi_name() exists])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fs.h>
struct super_block sb;
], [
char *name = "bdi";
atomic_long_t zfs_bdi_seq;
int error __attribute__((unused)) =
super_setup_bdi_name(&sb, "%.28s-%ld", name,
atomic_long_inc_return(&zfs_bdi_seq));
])
ZFS_LINUX_TEST_SRC([bdi_setup_and_register], [
super_setup_bdi_name(&sb, "%.28s-%ld", name, atomic_long_inc_return(&zfs_bdi_seq));
], [super_setup_bdi_name], [fs/super.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
[super_setup_bdi_name() exits])
], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING(
[whether bdi_setup_and_register() wants 2 args])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/backing-dev.h>
struct backing_dev_info bdi;
], [
char *name = "bdi";
int error __attribute__((unused)) =
bdi_setup_and_register(&bdi, name);
])
ZFS_LINUX_TEST_SRC([bdi_setup_and_register_3args], [
], [bdi_setup_and_register], [mm/backing-dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1,
[bdi_setup_and_register() wants 2 args])
], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING(
[whether bdi_setup_and_register() wants 3 args])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/backing-dev.h>
struct backing_dev_info bdi;
], [
@ -30,52 +45,11 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BDI], [
unsigned int cap = BDI_CAP_MAP_COPY;
int error __attribute__((unused)) =
bdi_setup_and_register(&bdi, name, cap);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BDI], [
dnl #
dnl # 4.12, super_setup_bdi_name() introduced.
dnl #
AC_MSG_CHECKING([whether super_setup_bdi_name() exists])
ZFS_LINUX_TEST_RESULT_SYMBOL([super_setup_bdi_name],
[super_setup_bdi_name], [fs/super.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
[super_setup_bdi_name() exits])
], [
AC_MSG_RESULT(no)
dnl #
dnl # 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments.
dnl #
AC_MSG_CHECKING(
[whether bdi_setup_and_register() wants 2 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([bdi_setup_and_register],
[bdi_setup_and_register], [mm/backing-dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1,
[bdi_setup_and_register() wants 2 args])
], [
AC_MSG_RESULT(no)
dnl #
dnl # 2.6.34 - 3.19, bdi_setup_and_register()
dnl # takes 3 arguments.
dnl #
AC_MSG_CHECKING(
[whether bdi_setup_and_register() wants 3 args])
ZFS_LINUX_TEST_RESULT_SYMBOL(
[bdi_setup_and_register_3args],
[bdi_setup_and_register], [mm/backing-dev.c], [
], [bdi_setup_and_register], [mm/backing-dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1,
[bdi_setup_and_register() wants 3 args])
], [
dnl #
dnl # 2.6.32 - 2.6.33, bdi_setup_and_register()
dnl # is not exported.
dnl #
AC_MSG_RESULT(no)
])
])

View File

@ -3,21 +3,18 @@ dnl # 3.14 API change,
dnl # Immutable biovecs. A number of fields of struct bio are moved to
dnl # struct bvec_iter.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER], [
ZFS_LINUX_TEST_SRC([bio_bvec_iter], [
AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [
AC_MSG_CHECKING([whether bio has bi_iter])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
struct bio bio;
bio.bi_iter.bi_sector = 0;
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_BVEC_ITER], [
AC_MSG_CHECKING([whether bio has bi_iter])
ZFS_LINUX_TEST_RESULT([bio_bvec_iter], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_BVEC_ITER, 1, [bio has bi_iter])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -5,17 +5,16 @@ dnl # bio->bi_error. This also replaces bio->bi_flags value BIO_UPTODATE.
dnl # Introduced by torvalds/linux@4246a0b63bd8f56a1469b12eafeb875b1041a451
dnl # ("block: add a bi_error field to struct bio").
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS], [
ZFS_LINUX_TEST_SRC([bio_end_io_t_args], [
#include <linux/bio.h>
void wanted_end_io(struct bio *bio) { return; }
bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io;
], [])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [
AC_MSG_CHECKING([whether bio_end_io_t wants 1 arg])
ZFS_LINUX_TEST_RESULT([bio_end_io_t_args], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
void wanted_end_io(struct bio *bio) { return; }
bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io;
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_1ARG_BIO_END_IO_T, 1,
[bio_end_io_t wants 1 arg])
@ -29,19 +28,16 @@ dnl # 4.13 API change
dnl # The bio->bi_error field was replaced with bio->bi_status which is an
dnl # enum which describes all possible error types.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BI_STATUS], [
ZFS_LINUX_TEST_SRC([bio_bi_status], [
AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [
AC_MSG_CHECKING([whether bio->bi_status exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
struct bio bio __attribute__ ((unused));
blk_status_t status __attribute__ ((unused)) = BLK_STS_OK;
bio.bi_status = status;
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_STATUS], [
AC_MSG_CHECKING([whether bio->bi_status exists])
ZFS_LINUX_TEST_RESULT([bio_bi_status], [
bio.bi_status = status;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_BI_STATUS, 1, [bio->bi_status exists])
],[

View File

@ -3,20 +3,17 @@ dnl # Preferred interface for setting FAILFAST on a bio:
dnl # 2.6.28-2.6.35: BIO_RW_FAILFAST_{DEV|TRANSPORT|DRIVER}
dnl # >= 2.6.36: REQ_FAILFAST_{DEV|TRANSPORT|DRIVER}
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_FAILFAST_DTD], [
ZFS_LINUX_TEST_SRC([bio_failfast_dtd], [
AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST_DTD], [
AC_MSG_CHECKING([whether BIO_RW_FAILFAST_* are defined])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
int flags __attribute__ ((unused));
flags = ((1 << BIO_RW_FAILFAST_DEV) |
(1 << BIO_RW_FAILFAST_TRANSPORT) |
(1 << BIO_RW_FAILFAST_DRIVER));
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST_DTD], [
AC_MSG_CHECKING([whether BIO_RW_FAILFAST_* are defined])
ZFS_LINUX_TEST_RESULT([bio_failfast_dtd], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_RW_FAILFAST_DTD, 1,
[BIO_RW_FAILFAST_* are defined])
@ -25,18 +22,14 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST_DTD], [
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_REQ_FAILFAST_MASK], [
ZFS_LINUX_TEST_SRC([bio_failfast_mask], [
AC_DEFUN([ZFS_AC_KERNEL_REQ_FAILFAST_MASK], [
AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
int flags __attribute__ ((unused));
flags = REQ_FAILFAST_MASK;
])
])
AC_DEFUN([ZFS_AC_KERNEL_REQ_FAILFAST_MASK], [
AC_MSG_CHECKING([whether REQ_FAILFAST_MASK is defined])
ZFS_LINUX_TEST_RESULT([bio_failfast_mask], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REQ_FAILFAST_MASK, 1,
[REQ_FAILFAST_MASK is defined])
@ -44,13 +37,3 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_FAILFAST_MASK], [
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_FAILFAST], [
ZFS_AC_KERNEL_SRC_BIO_FAILFAST_DTD
ZFS_AC_KERNEL_SRC_REQ_FAILFAST_MASK
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_FAILFAST], [
ZFS_AC_KERNEL_BIO_FAILFAST_DTD
ZFS_AC_KERNEL_REQ_FAILFAST_MASK
])

View File

@ -5,43 +5,13 @@ dnl # The bio_op() helper was introduced as a replacement for explicitly
dnl # checking the bio->bi_rw flags. The following checks are used to
dnl # detect if a specific operation is supported.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_OPS], [
ZFS_LINUX_TEST_SRC([req_op_discard], [
AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_DISCARD], [
AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined])
ZFS_LINUX_TRY_COMPILE([
#include <linux/blk_types.h>
],[
int op __attribute__ ((unused)) = REQ_OP_DISCARD;
])
ZFS_LINUX_TEST_SRC([req_op_secure_erase], [
#include <linux/blk_types.h>
],[
int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE;
])
ZFS_LINUX_TEST_SRC([req_op_flush], [
#include <linux/blk_types.h>
],[
int op __attribute__ ((unused)) = REQ_OP_FLUSH;
])
ZFS_LINUX_TEST_SRC([bio_bi_opf], [
#include <linux/bio.h>
],[
struct bio bio __attribute__ ((unused));
bio.bi_opf = 0;
])
ZFS_LINUX_TEST_SRC([bio_set_op_attrs], [
#include <linux/bio.h>
],[
struct bio *bio __attribute__ ((unused)) = NULL;
bio_set_op_attrs(bio, 0, 0);
])
])
AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_DISCARD], [
AC_MSG_CHECKING([whether REQ_OP_DISCARD is defined])
ZFS_LINUX_TEST_RESULT([req_op_discard], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REQ_OP_DISCARD, 1,
[REQ_OP_DISCARD is defined])
@ -52,7 +22,11 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_DISCARD], [
AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE], [
AC_MSG_CHECKING([whether REQ_OP_SECURE_ERASE is defined])
ZFS_LINUX_TEST_RESULT([req_op_secure_erase], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/blk_types.h>
],[
int op __attribute__ ((unused)) = REQ_OP_SECURE_ERASE;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REQ_OP_SECURE_ERASE, 1,
[REQ_OP_SECURE_ERASE is defined])
@ -64,9 +38,14 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE], [
AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_FLUSH], [
AC_MSG_CHECKING([whether REQ_OP_FLUSH is defined])
ZFS_LINUX_TEST_RESULT([req_op_flush], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/blk_types.h>
],[
int op __attribute__ ((unused)) = REQ_OP_FLUSH;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REQ_OP_FLUSH, 1, [REQ_OP_FLUSH is defined])
AC_DEFINE(HAVE_REQ_OP_FLUSH, 1,
[REQ_OP_FLUSH is defined])
],[
AC_MSG_RESULT(no)
])
@ -74,7 +53,12 @@ AC_DEFUN([ZFS_AC_KERNEL_REQ_OP_FLUSH], [
AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [
AC_MSG_CHECKING([whether bio->bi_opf is defined])
ZFS_LINUX_TEST_RESULT([bio_bi_opf], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
struct bio bio __attribute__ ((unused));
bio.bi_opf = 0;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_BI_OPF, 1, [bio->bi_opf is defined])
],[
@ -84,7 +68,13 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_BI_OPF], [
AC_DEFUN([ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS], [
AC_MSG_CHECKING([whether bio_set_op_attrs is available])
ZFS_LINUX_TEST_RESULT([bio_set_op_attrs], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
struct bio *bio __attribute__ ((unused)) = NULL;
bio_set_op_attrs(bio, 0, 0);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_SET_OP_ATTRS, 1,
[bio_set_op_attrs is available])
@ -92,11 +82,3 @@ AC_DEFUN([ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS], [
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_OPS], [
ZFS_AC_KERNEL_REQ_OP_DISCARD
ZFS_AC_KERNEL_REQ_OP_SECURE_ERASE
ZFS_AC_KERNEL_REQ_OP_FLUSH
ZFS_AC_KERNEL_BIO_BI_OPF
ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS
])

View File

@ -3,25 +3,20 @@ dnl # Interface for issuing a discard bio:
dnl # 2.6.28-2.6.35: BIO_RW_BARRIER
dnl # 2.6.36-3.x: REQ_BARRIER
dnl #
dnl #
dnl # Since REQ_BARRIER is a preprocessor definition, there is no need for an
dnl # autotools check for it. Also, REQ_BARRIER existed in the request layer
dnl # until torvalds/linux@7b6d91daee5cac6402186ff224c3af39d79f4a0e unified the
dnl # request layer and bio layer flags, so it would be wrong to assume that
dnl # the APIs are mutually exclusive contrary to the typical case.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER], [
ZFS_LINUX_TEST_SRC([bio_rw_barrier], [
AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_BARRIER], [
AC_MSG_CHECKING([whether BIO_RW_BARRIER is defined])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
int flags __attribute__ ((unused));
flags = BIO_RW_BARRIER;
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_BARRIER], [
AC_MSG_CHECKING([whether BIO_RW_BARRIER is defined])
ZFS_LINUX_TEST_RESULT([bio_rw_barrier], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_RW_BARRIER, 1, [BIO_RW_BARRIER is defined])
],[

View File

@ -3,25 +3,20 @@ dnl # Interface for issuing a discard bio:
dnl # 2.6.28-2.6.35: BIO_RW_DISCARD
dnl # 2.6.36-3.x: REQ_DISCARD
dnl #
dnl #
dnl # Since REQ_DISCARD is a preprocessor definition, there is no need for an
dnl # autotools check for it. Also, REQ_DISCARD existed in the request layer
dnl # until torvalds/linux@7b6d91daee5cac6402186ff224c3af39d79f4a0e unified the
dnl # request layer and bio layer flags, so it would be wrong to assume that
dnl # the APIs are mutually exclusive contrary to the typical case.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD], [
ZFS_LINUX_TEST_SRC([bio_rw_discard], [
AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_DISCARD], [
AC_MSG_CHECKING([whether BIO_RW_DISCARD is defined])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
int flags __attribute__ ((unused));
flags = BIO_RW_DISCARD;
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_DISCARD], [
AC_MSG_CHECKING([whether BIO_RW_DISCARD is defined])
ZFS_LINUX_TEST_RESULT([bio_rw_discard], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_RW_DISCARD, 1, [BIO_RW_DISCARD is defined])
],[

View File

@ -1,37 +0,0 @@
dnl #
dnl # Linux 5.5 API,
dnl #
dnl # The Linux 5.5 kernel updated percpu_ref_tryget() which is inlined by
dnl # blkg_tryget() to use rcu_read_lock() instead of rcu_read_lock_sched().
dnl # As a side effect the function was converted to GPL-only.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [
ZFS_LINUX_TEST_SRC([blkg_tryget], [
#include <linux/blk-cgroup.h>
#include <linux/bio.h>
#include <linux/fs.h>
],[
struct blkcg_gq blkg __attribute__ ((unused)) = {};
bool rc __attribute__ ((unused));
rc = blkg_tryget(&blkg);
], [], [$ZFS_META_LICENSE])
])
AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [
AC_MSG_CHECKING([whether blkg_tryget() is available])
ZFS_LINUX_TEST_RESULT([blkg_tryget], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLKG_TRYGET, 1, [blkg_tryget() is available])
AC_MSG_CHECKING([whether blkg_tryget() is GPL-only])
ZFS_LINUX_TEST_RESULT([blkg_tryget_license], [
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLKG_TRYGET_GPL_ONLY, 1,
[blkg_tryget() GPL-only])
])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -4,37 +4,50 @@ dnl #
dnl # The bio_set_dev() helper macro was introduced as part of the transition
dnl # to have struct gendisk in struct bio.
dnl #
dnl # Linux 5.0 API,
dnl #
dnl # The bio_set_dev() helper macro was updated to internally depend on
dnl # bio_associate_blkg() symbol which is exported GPL-only.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [
ZFS_LINUX_TEST_SRC([bio_set_dev], [
AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_MACRO], [
AC_MSG_CHECKING([whether bio_set_dev() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
#include <linux/fs.h>
],[
struct block_device *bdev = NULL;
struct bio *bio = NULL;
bio_set_dev(bio, bdev);
], [], [$ZFS_META_LICENSE])
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() exists])
],[
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
AC_MSG_CHECKING([whether bio_set_dev() is available])
ZFS_LINUX_TEST_RESULT([bio_set_dev], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() is available])
dnl #
dnl # Linux 5.0 API,
dnl #
dnl # The bio_set_dev() helper macro was updated to internally depend on
dnl # bio_associate_blkg() symbol which is exported GPL-only.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY], [
AC_MSG_CHECKING([whether bio_set_dev() is GPL-only])
ZFS_LINUX_TEST_RESULT([bio_set_dev_license], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/module.h>
#include <linux/bio.h>
#include <linux/fs.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
],[
struct block_device *bdev = NULL;
struct bio *bio = NULL;
bio_set_dev(bio, bdev);
],[
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1,
[bio_set_dev() GPL-only])
])
],[
AC_MSG_RESULT(no)
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
ZFS_AC_KERNEL_BIO_SET_DEV_MACRO
ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY
])

View File

@ -2,19 +2,15 @@ dnl #
dnl # 2.6.32 - 4.11, statically allocated bdi in request_queue
dnl # 4.12 - x.y, dynamically allocated bdi in request_queue
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [
ZFS_LINUX_TEST_SRC([blk_queue_bdi], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
AC_MSG_CHECKING([whether blk_queue bdi is dynamic])
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct request_queue q;
struct backing_dev_info bdi;
q.backing_dev_info = &bdi;
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
AC_MSG_CHECKING([whether blk_queue bdi is dynamic])
ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1,
[blk queue backing_dev_info is dynamic])

View File

@ -2,19 +2,16 @@ dnl #
dnl # 2.6.32 - 4.x API,
dnl # blk_queue_discard()
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [
ZFS_LINUX_TEST_SRC([blk_queue_discard], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [
AC_MSG_CHECKING([whether blk_queue_discard() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct request_queue *q __attribute__ ((unused)) = NULL;
int value __attribute__ ((unused));
value = blk_queue_discard(q);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [
AC_MSG_CHECKING([whether blk_queue_discard() is available])
ZFS_LINUX_TEST_RESULT([blk_queue_discard], [
value = blk_queue_discard(q);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1,
[blk_queue_discard() is available])
@ -33,27 +30,16 @@ dnl #
dnl # 2.6.x - 2.6.35 API,
dnl # Unsupported by kernel
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [
ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [
#include <linux/blkdev.h>
],[
struct request_queue *q __attribute__ ((unused)) = NULL;
int value __attribute__ ((unused));
value = blk_queue_secure_erase(q);
])
ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [
#include <linux/blkdev.h>
],[
struct request_queue *q __attribute__ ((unused)) = NULL;
int value __attribute__ ((unused));
value = blk_queue_secdiscard(q);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
AC_MSG_CHECKING([whether blk_queue_secure_erase() is available])
ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct request_queue *q __attribute__ ((unused)) = NULL;
int value __attribute__ ((unused));
value = blk_queue_secure_erase(q);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1,
[blk_queue_secure_erase() is available])
@ -61,7 +47,14 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether blk_queue_secdiscard() is available])
ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct request_queue *q __attribute__ ((unused)) = NULL;
int value __attribute__ ((unused));
value = blk_queue_secdiscard(q);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1,
[blk_queue_secdiscard() is available])

View File

@ -3,54 +3,36 @@ dnl # API change
dnl # https://github.com/torvalds/linux/commit/8814ce8
dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET], [
ZFS_LINUX_TEST_SRC([blk_queue_flag_set], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [
AC_MSG_CHECKING([whether blk_queue_flag_set() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/kernel.h>
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
blk_queue_flag_set(0, q);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [
AC_MSG_CHECKING([whether blk_queue_flag_set() exists])
ZFS_LINUX_TEST_RESULT([blk_queue_flag_set], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1,
[blk_queue_flag_set() exists])
AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1, [blk_queue_flag_set() exists])
],[
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR], [
ZFS_LINUX_TEST_SRC([blk_queue_flag_clear], [
#include <linux/kernel.h>
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
blk_queue_flag_clear(0, q);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [
AC_MSG_CHECKING([whether blk_queue_flag_clear() exists])
ZFS_LINUX_TEST_RESULT([blk_queue_flag_clear], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/kernel.h>
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
blk_queue_flag_clear(0, q);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1,
[blk_queue_flag_clear() exists])
AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1, [blk_queue_flag_clear() exists])
],[
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAGS], [
ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET
ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAGS], [
ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET
ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR
])

View File

@ -9,32 +9,30 @@ dnl # there we implement our own compatibility function, otherwise
dnl # we use the function. The hope is that long term this function
dnl # will be opened up.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [
ZFS_LINUX_TEST_SRC([blk_queue_flush], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
AC_MSG_CHECKING([whether blk_queue_flush() is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
(void) blk_queue_flush(q, REQ_FLUSH);
], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [
#include <linux/kernel.h>
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
blk_queue_write_cache(q, true, true);
], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
AC_MSG_CHECKING([whether blk_queue_flush() is available])
ZFS_LINUX_TEST_RESULT([blk_queue_flush], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1,
[blk_queue_flush() is available])
AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only])
ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/module.h>
#include <linux/blkdev.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
],[
struct request_queue *q = NULL;
(void) blk_queue_flush(q, REQ_FLUSH);
],[
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(yes)
@ -50,13 +48,29 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
dnl # Replace blk_queue_flush with blk_queue_write_cache
dnl #
AC_MSG_CHECKING([whether blk_queue_write_cache() exists])
ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/kernel.h>
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
blk_queue_write_cache(q, true, true);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
[blk_queue_write_cache() exists])
AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only])
ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/blkdev.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
],[
struct request_queue *q = NULL;
blk_queue_write_cache(q, true, true);
],[
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(yes)
@ -66,4 +80,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -2,22 +2,21 @@ dnl #
dnl # 2.6.34 API change
dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors().
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [
ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
(void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS);
], [$NO_UNUSED_BUT_SET_VARIABLE])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available])
ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_MAX_HW_SECTORS, 1,
[blk_queue_max_hw_sectors() is available])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -3,22 +3,21 @@ dnl # 2.6.34 API change
dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments()
dnl # and blk_queue_max_phys_segments().
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [
ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
AC_MSG_CHECKING([whether blk_queue_max_segments() is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct request_queue *q = NULL;
(void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS);
], [$NO_UNUSED_BUT_SET_VARIABLE])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
AC_MSG_CHECKING([whether blk_queue_max_segments() is available])
ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
[blk_queue_max_segments() is available])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -2,53 +2,43 @@ dnl #
dnl # 2.6.32-2.6.35 API - The BIO_RW_UNPLUG enum can be used as a hint
dnl # to unplug the queue.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_RW_UNPLUG], [
ZFS_LINUX_TEST_SRC([blk_queue_bio_rw_unplug], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BIO_RW_UNPLUG], [
AC_MSG_CHECKING([whether the BIO_RW_UNPLUG enum is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
enum bio_rw_flags rw __attribute__ ((unused)) = BIO_RW_UNPLUG;
])
])
extern enum bio_rw_flags rw;
AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_UNPLUG], [
AC_MSG_CHECKING([whether the BIO_RW_UNPLUG enum is available])
ZFS_LINUX_TEST_RESULT([blk_queue_bio_rw_unplug], [
rw = BIO_RW_UNPLUG;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BIO_RW_UNPLUG, 1,
[BIO_RW_UNPLUG is available])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_PLUG], [
ZFS_LINUX_TEST_SRC([blk_plug], [
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BLK_PLUG], [
AC_MSG_CHECKING([whether struct blk_plug is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct blk_plug plug __attribute__ ((unused));
struct blk_plug plug;
blk_start_plug(&plug);
blk_finish_plug(&plug);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_PLUG], [
AC_MSG_CHECKING([whether struct blk_plug is available])
ZFS_LINUX_TEST_RESULT([blk_plug], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLK_QUEUE_HAVE_BLK_PLUG, 1,
[struct blk_plug is available])
],[
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG], [
ZFS_AC_KERNEL_SRC_BIO_RW_UNPLUG
ZFS_AC_KERNEL_SRC_BLK_PLUG
])
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [
ZFS_AC_KERNEL_BIO_RW_UNPLUG
ZFS_AC_KERNEL_BLK_PLUG
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -1,62 +0,0 @@
dnl #
dnl # check_disk_change() was removed in 5.10
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE], [
ZFS_LINUX_TEST_SRC([check_disk_change], [
#include <linux/fs.h>
#include <linux/blkdev.h>
], [
struct block_device *bdev = NULL;
bool error;
error = check_disk_change(bdev);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE], [
AC_MSG_CHECKING([whether check_disk_change() exists])
ZFS_LINUX_TEST_RESULT([check_disk_change], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CHECK_DISK_CHANGE, 1,
[check_disk_change() exists])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 5.10 API, check_disk_change() is removed, in favor of
dnl # bdev_check_media_change(), which doesn't force revalidation
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [
ZFS_LINUX_TEST_SRC([bdev_check_media_change], [
#include <linux/fs.h>
#include <linux/blkdev.h>
], [
struct block_device *bdev = NULL;
int error;
error = bdev_check_media_change(bdev);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [
AC_MSG_CHECKING([whether bdev_disk_changed() exists])
ZFS_LINUX_TEST_RESULT([bdev_check_media_change], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BDEV_CHECK_MEDIA_CHANGE, 1,
[bdev_check_media_change() exists])
], [
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_CHANGE], [
ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
])
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_CHANGE], [
ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
])

View File

@ -3,19 +3,13 @@ dnl # 2.6.38 API change
dnl # open_bdev_exclusive() changed to blkdev_get_by_path()
dnl # close_bdev_exclusive() changed to blkdev_put()
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [
ZFS_LINUX_TEST_SRC([blkdev_get_by_path], [
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH],
[AC_MSG_CHECKING([whether blkdev_get_by_path() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fs.h>
#include <linux/blkdev.h>
], [
blkdev_get_by_path(NULL, 0, NULL);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [
AC_MSG_CHECKING([whether blkdev_get_by_path() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([blkdev_get_by_path],
[blkdev_get_by_path], [fs/block_dev.c], [
], [blkdev_get_by_path], [fs/block_dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1,
[blkdev_get_by_path() is available])

View File

@ -2,21 +2,16 @@ dnl #
dnl # 4.1 API, exported blkdev_reread_part() symbol, backported to the
dnl # 3.10.0 CentOS 7.x enterprise kernels.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART], [
ZFS_LINUX_TEST_SRC([blkdev_reread_part], [
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [
AC_MSG_CHECKING([whether blkdev_reread_part() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
#include <linux/blkdev.h>
], [
struct block_device *bdev = NULL;
int error;
error = blkdev_reread_part(bdev);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [
AC_MSG_CHECKING([whether blkdev_reread_part() is available])
ZFS_LINUX_TEST_RESULT([blkdev_reread_part], [
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1,
[blkdev_reread_part() is available])

View File

@ -1,8 +1,11 @@
dnl #
dnl # 2.6.38 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
ZFS_LINUX_TEST_SRC([block_device_operations_check_events], [
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
AC_MSG_CHECKING([whether bops->check_events() exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
unsigned int blk_check_events(struct gendisk *disk,
@ -12,25 +15,25 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
bops __attribute__ ((unused)) = {
.check_events = blk_check_events,
};
], [], [$NO_UNUSED_BUT_SET_VARIABLE])
])
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
AC_MSG_CHECKING([whether bops->check_events() exists])
ZFS_LINUX_TEST_RESULT([block_device_operations_check_events], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS, 1,
[bops->check_events() exists])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])
dnl #
dnl # 3.10.x API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
ZFS_LINUX_TEST_SRC([block_device_operations_release_void], [
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
AC_MSG_CHECKING([whether bops->release() is void])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
void blk_release(struct gendisk *g, fmode_t mode) { return; }
@ -42,26 +45,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
.ioctl = NULL,
.compat_ioctl = NULL,
};
], [], [$NO_UNUSED_BUT_SET_VARIABLE])
])
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
AC_MSG_CHECKING([whether bops->release() is void])
ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [
AC_MSG_RESULT(yes)
],[
],[
AC_MSG_RESULT(void)
AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID, 1,
[bops->release() returns void])
],[
AC_MSG_RESULT(no)
AC_MSG_RESULT(int)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
])
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -19,18 +19,13 @@ dnl # Therefore, to ensure we have the correct API we only allow the
dnl # clear_inode() compatibility code to be defined iff the evict_inode()
dnl # functionality is also detected.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CLEAR_INODE], [
ZFS_LINUX_TEST_SRC([clear_inode], [
AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE],
[AC_MSG_CHECKING([whether clear_inode() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fs.h>
], [
clear_inode(NULL);
])
])
AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE], [
AC_MSG_CHECKING([whether clear_inode() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([clear_inode],
[clear_inode], [fs/inode.c], [
], [clear_inode], [fs/inode.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CLEAR_INODE, 1, [clear_inode() is available])
], [

View File

@ -4,19 +4,16 @@ dnl # Added eops->commit_metadata() callback to allow the underlying
dnl # filesystem to determine the most efficient way to commit the inode.
dnl # Prior to this the nfs server would issue an explicit fsync().
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_COMMIT_METADATA], [
ZFS_LINUX_TEST_SRC([export_operations_commit_metadata], [
AC_DEFUN([ZFS_AC_KERNEL_COMMIT_METADATA], [
AC_MSG_CHECKING([whether eops->commit_metadata() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/exportfs.h>
int commit_metadata(struct inode *inode) { return 0; }
static struct export_operations eops __attribute__ ((unused))={
.commit_metadata = commit_metadata,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_COMMIT_METADATA], [
AC_MSG_CHECKING([whether eops->commit_metadata() exists])
ZFS_LINUX_TEST_RESULT([export_operations_commit_metadata], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_COMMIT_METADATA, 1,
[eops->commit_metadata() exists])

View File

@ -1,183 +0,0 @@
dnl #
dnl # Certain kernel build options are not supported. These must be
dnl # detected at configure time and cause a build failure. Otherwise
dnl # modules may be successfully built that behave incorrectly.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [
AS_IF([test "x$cross_compiling" != xyes], [
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#include "$LINUX/include/linux/license.h"
], [
return !license_is_gpl_compatible(
"$ZFS_META_LICENSE");
])
], [
AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1],
[Define to 1 if GPL-only symbols can be used])
], [
])
])
ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE
ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC
ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS
ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE
ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE
AC_MSG_CHECKING([for kernel config option compatibility])
ZFS_LINUX_TEST_COMPILE_ALL([config])
AC_MSG_RESULT([done])
ZFS_AC_KERNEL_CONFIG_THREAD_SIZE
ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE
ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE
])
dnl #
dnl # Check configured THREAD_SIZE
dnl #
dnl # The stack size will vary by architecture, but as of Linux 3.15 on x86_64
dnl # the default thread stack size was increased to 16K from 8K. Therefore,
dnl # on newer kernels and some architectures stack usage optimizations can be
dnl # conditionally applied to improve performance without negatively impacting
dnl # stability.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE], [
ZFS_LINUX_TEST_SRC([config_thread_size], [
#include <linux/module.h>
],[
#if (THREAD_SIZE < 16384)
#error "THREAD_SIZE is less than 16K"
#endif
])
])
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_THREAD_SIZE], [
AC_MSG_CHECKING([whether kernel was built with 16K or larger stacks])
ZFS_LINUX_TEST_RESULT([config_thread_size], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks])
],[
AC_MSG_RESULT([no])
])
])
dnl #
dnl # Check CONFIG_DEBUG_LOCK_ALLOC
dnl #
dnl # This is typically only set for debug kernels because it comes with
dnl # a performance penalty. However, when it is set it maps the non-GPL
dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol.
dnl # This will cause a failure at link time which we'd rather know about
dnl # at compile time.
dnl #
dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol
dnl # with the upstream community we add a check to detect this case.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [
ZFS_LINUX_TEST_SRC([config_debug_lock_alloc], [
#include <linux/mutex.h>
],[
struct mutex lock;
mutex_init(&lock);
mutex_lock(&lock);
mutex_unlock(&lock);
], [], [$ZFS_META_LICENSE])
])
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
AC_MSG_CHECKING([whether mutex_lock() is GPL-only])
ZFS_LINUX_TEST_RESULT([config_debug_lock_alloc_license], [
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(yes)
AC_MSG_ERROR([
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
*** with the CDDL license and will prevent the module linking stage
*** from succeeding. You must rebuild your kernel without this
*** option enabled.])
])
])
dnl #
dnl # Check CONFIG_TRIM_UNUSED_KSYMS
dnl #
dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS], [
ZFS_LINUX_TEST_SRC([config_trim_unusued_ksyms], [
#if defined(CONFIG_TRIM_UNUSED_KSYMS)
#error CONFIG_TRIM_UNUSED_KSYMS not defined
#endif
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [
AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
ZFS_LINUX_TEST_RESULT([config_trim_unusued_ksyms], [
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AS_IF([test "x$enable_linux_builtin" != xyes], [
AC_MSG_ERROR([
*** This kernel has unused symbols trimming enabled, please disable.
*** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
])
])
])
dnl #
dnl # Check CONFIG_ZLIB_INFLATE
dnl #
dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE], [
ZFS_LINUX_TEST_SRC([config_zlib_inflate], [
#if !defined(CONFIG_ZLIB_INFLATE) && \
!defined(CONFIG_ZLIB_INFLATE_MODULE)
#error CONFIG_ZLIB_INFLATE not defined
#endif
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [
AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
ZFS_LINUX_TEST_RESULT([config_zlib_inflate], [
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([
*** This kernel does not include the required zlib inflate support.
*** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
])
])
dnl #
dnl # Check CONFIG_ZLIB_DEFLATE
dnl #
dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE], [
ZFS_LINUX_TEST_SRC([config_zlib_deflate], [
#if !defined(CONFIG_ZLIB_DEFLATE) && \
!defined(CONFIG_ZLIB_DEFLATE_MODULE)
#error CONFIG_ZLIB_DEFLATE not defined
#endif
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [
AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
ZFS_LINUX_TEST_RESULT([config_zlib_deflate], [
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([
*** This kernel does not include the required zlib deflate support.
*** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
])
])

View File

@ -1,8 +1,9 @@
dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_NAMEIDATA], [
ZFS_LINUX_TEST_SRC([create_nameidata], [
AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
AC_MSG_CHECKING([whether iops->create() passes nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
#include <linux/sched.h>
@ -18,12 +19,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_NAMEIDATA], [
iops __attribute__ ((unused)) = {
.create = inode_create,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
AC_MSG_CHECKING([whether iops->create() passes nameidata])
ZFS_LINUX_TEST_RESULT([create_nameidata], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1,
[iops->create() passes nameidata])

View File

@ -2,18 +2,14 @@ dnl #
dnl # 2.6.33 API change,
dnl # Removed .ctl_name from struct ctl_table.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CTL_NAME], [
ZFS_LINUX_TEST_SRC([ctl_name], [
AC_DEFUN([ZFS_AC_KERNEL_CTL_NAME], [
AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
ZFS_LINUX_TRY_COMPILE([
#include <linux/sysctl.h>
],[
struct ctl_table ctl __attribute__ ((unused));
ctl.ctl_name = 0;
])
])
AC_DEFUN([ZFS_AC_KERNEL_CTL_NAME], [
AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
ZFS_LINUX_TEST_RESULT([ctl_name], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
],[

View File

@ -2,19 +2,14 @@ dnl #
dnl # 4.9, current_time() added
dnl # 4.18, return type changed from timespec to timespec64
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CURRENT_TIME], [
ZFS_LINUX_TEST_SRC([current_time], [
AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME],
[AC_MSG_CHECKING([whether current_time() exists])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fs.h>
], [
struct inode ip __attribute__ ((unused));
ip.i_atime = current_time(&ip);
])
])
AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME], [
AC_MSG_CHECKING([whether current_time() exists])
ZFS_LINUX_TEST_RESULT_SYMBOL([current_time],
[current_time], [fs/inode.c], [
], [current_time], [fs/inode.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CURRENT_TIME, 1, [current_time() exists])
], [

View File

@ -4,36 +4,30 @@ dnl # current->bio_tail and current->bio_list were struct bio pointers prior to
dnl # Linux 2.6.34. They were refactored into a struct bio_list pointer called
dnl # current->bio_list in Linux 2.6.34.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL], [
ZFS_LINUX_TEST_SRC([current_bio_tail], [
AC_DEFUN([ZFS_AC_KERNEL_CURRENT_BIO_TAIL], [
AC_MSG_CHECKING([whether current->bio_tail exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/sched.h>
],[
current->bio_tail = (struct bio **) NULL;
])
ZFS_LINUX_TEST_SRC([current_bio_list], [
#include <linux/sched.h>
],[
current->bio_list = (struct bio_list *) NULL;
])
])
AC_DEFUN([ZFS_AC_KERNEL_CURRENT_BIO_TAIL], [
AC_MSG_CHECKING([whether current->bio_tail exists])
ZFS_LINUX_TEST_RESULT([current_bio_tail], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CURRENT_BIO_TAIL, 1,
[current->bio_tail exists])
],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether current->bio_list exists])
ZFS_LINUX_TEST_RESULT([current_bio_list], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/sched.h>
],[
current->bio_list = (struct bio_list *) NULL;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CURRENT_BIO_LIST, 1,
[current->bio_list exists])
],[
ZFS_LINUX_TEST_ERROR([bio_list])
AC_MSG_ERROR(no - Please file a bug report at
https://github.com/zfsonlinux/zfs/issues/new)
])
])
])

View File

@ -0,0 +1,17 @@
dnl #
dnl # 3.4.0 API change
dnl # Added d_make_root() to replace previous d_alloc_root() function.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT],
[AC_MSG_CHECKING([whether d_make_root() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/dcache.h>
], [
d_make_root(NULL);
], [d_make_root], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_MAKE_ROOT, 1, [d_make_root() is available])
], [
AC_MSG_RESULT(no)
])
])

View File

@ -0,0 +1,18 @@
dnl #
dnl # 2.6.28 API change
dnl # Added d_obtain_alias() helper function.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS],
[AC_MSG_CHECKING([whether d_obtain_alias() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/dcache.h>
], [
d_obtain_alias(NULL);
], [d_obtain_alias], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
[d_obtain_alias() is available])
], [
AC_MSG_RESULT(no)
])
])

View File

@ -0,0 +1,19 @@
dnl #
dnl # 2.6.12 API change
dnl # d_prune_aliases() helper function available.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_D_PRUNE_ALIASES],
[AC_MSG_CHECKING([whether d_prune_aliases() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/dcache.h>
], [
struct inode *ip = NULL;
d_prune_aliases(ip);
], [d_prune_aliases], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_PRUNE_ALIASES, 1,
[d_prune_aliases() is available])
], [
AC_MSG_RESULT(no)
])
])

View File

@ -2,10 +2,13 @@ dnl #
dnl # Ensure the DECLARE_EVENT_CLASS macro is available to non-GPL modules.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-I\$(src)"
AC_MSG_CHECKING([whether DECLARE_EVENT_CLASS() is available])
ZFS_LINUX_TRY_COMPILE_HEADER([
#include <linux/module.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
MODULE_LICENSE(ZFS_META_LICENSE);
#define CREATE_TRACE_POINTS
#include "conftest.h"
@ -52,4 +55,5 @@ AC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
#define TRACE_INCLUDE_FILE conftest
#include <trace/define_trace.h>
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -1,103 +1,9 @@
dnl #
dnl # 3.4.0 API change
dnl # Added d_make_root() to replace previous d_alloc_root() function.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_D_MAKE_ROOT], [
ZFS_LINUX_TEST_SRC([d_make_root], [
#include <linux/dcache.h>
], [
d_make_root(NULL);
])
])
AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT], [
AC_MSG_CHECKING([whether d_make_root() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([d_make_root],
[d_make_root], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_MAKE_ROOT, 1, [d_make_root() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.28 API change
dnl # Added d_obtain_alias() helper function.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS], [
ZFS_LINUX_TEST_SRC([d_obtain_alias], [
#include <linux/dcache.h>
], [
d_obtain_alias(NULL);
])
])
AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [
AC_MSG_CHECKING([whether d_obtain_alias() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([d_obtain_alias],
[d_obtain_alias], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
[d_obtain_alias() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.12 API change
dnl # d_prune_aliases() helper function available.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_D_PRUNE_ALIASES], [
ZFS_LINUX_TEST_SRC([d_prune_aliases], [
#include <linux/dcache.h>
], [
struct inode *ip = NULL;
d_prune_aliases(ip);
])
])
AC_DEFUN([ZFS_AC_KERNEL_D_PRUNE_ALIASES], [
AC_MSG_CHECKING([whether d_prune_aliases() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([d_prune_aliases],
[d_prune_aliases], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_PRUNE_ALIASES, 1,
[d_prune_aliases() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.38 API change
dnl # Added d_set_d_op() helper function.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_D_SET_D_OP], [
ZFS_LINUX_TEST_SRC([d_set_d_op], [
#include <linux/dcache.h>
], [
d_set_d_op(NULL, NULL);
])
])
AC_DEFUN([ZFS_AC_KERNEL_D_SET_D_OP], [
AC_MSG_CHECKING([whether d_set_d_op() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([d_set_d_op],
[d_set_d_op], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_SET_D_OP, 1, [d_set_d_op() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA], [
ZFS_LINUX_TEST_SRC([dentry_operations_revalidate], [
AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/dcache.h>
#include <linux/sched.h>
@ -108,12 +14,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA], [
dops __attribute__ ((unused)) = {
.d_revalidate = revalidate,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [
AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata])
ZFS_LINUX_TEST_RESULT([dentry_operations_revalidate], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_REVALIDATE_NAMEIDATA, 1,
[dops->d_revalidate() operation takes nameidata])
@ -126,8 +28,9 @@ dnl #
dnl # 2.6.30 API change
dnl # The 'struct dentry_operations' was constified in the dentry structure.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS], [
ZFS_LINUX_TEST_SRC([dentry_operations_const], [
AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
AC_MSG_CHECKING([whether dentry uses const struct dentry_operations])
ZFS_LINUX_TRY_COMPILE([
#include <linux/dcache.h>
const struct dentry_operations test_d_op = {
@ -135,13 +38,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS], [
};
],[
struct dentry d __attribute__ ((unused));
d.d_op = &test_d_op;
])
])
AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
AC_MSG_CHECKING([whether dentry uses const struct dentry_operations])
ZFS_LINUX_TEST_RESULT([dentry_operations_const], [
d.d_op = &test_d_op;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CONST_DENTRY_OPERATIONS, 1,
[dentry uses const struct dentry_operations])
@ -152,43 +51,38 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
dnl #
dnl # 2.6.38 API change
dnl # Added d_set_d_op() helper function.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_D_SET_D_OP],
[AC_MSG_CHECKING([whether d_set_d_op() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/dcache.h>
], [
d_set_d_op(NULL, NULL);
], [d_set_d_op], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_D_SET_D_OP, 1,
[d_set_d_op() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.38 API chage
dnl # Added sb->s_d_op default dentry_operations member
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_S_D_OP], [
ZFS_LINUX_TEST_SRC([super_block_s_d_op], [
AC_DEFUN([ZFS_AC_KERNEL_S_D_OP],
[AC_MSG_CHECKING([whether super_block has s_d_op])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct super_block sb __attribute__ ((unused));
sb.s_d_op = NULL;
])
])
AC_DEFUN([ZFS_AC_KERNEL_S_D_OP], [
AC_MSG_CHECKING([whether super_block has s_d_op])
ZFS_LINUX_TEST_RESULT([super_block_s_d_op], [
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_S_D_OP, 1, [struct super_block has s_d_op])
], [
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY], [
ZFS_AC_KERNEL_SRC_D_MAKE_ROOT
ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS
ZFS_AC_KERNEL_SRC_D_PRUNE_ALIASES
ZFS_AC_KERNEL_SRC_D_SET_D_OP
ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA
ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS
ZFS_AC_KERNEL_SRC_S_D_OP
])
AC_DEFUN([ZFS_AC_KERNEL_DENTRY], [
ZFS_AC_KERNEL_D_MAKE_ROOT
ZFS_AC_KERNEL_D_OBTAIN_ALIAS
ZFS_AC_KERNEL_D_PRUNE_ALIASES
ZFS_AC_KERNEL_D_SET_D_OP
ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
ZFS_AC_KERNEL_S_D_OP
])

View File

@ -4,8 +4,9 @@ dnl # The sops->dirty_inode() callbacks were updated to take a flags
dnl # argument. This allows the greater control over whether the
dnl # filesystem needs to push out a transaction or not.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_DIRTY_INODE], [
ZFS_LINUX_TEST_SRC([dirty_inode_with_flags], [
AC_DEFUN([ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS], [
AC_MSG_CHECKING([whether sops->dirty_inode() wants flags])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
void dirty_inode(struct inode *a, int b) { return; }
@ -14,12 +15,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_DIRTY_INODE], [
sops __attribute__ ((unused)) = {
.dirty_inode = dirty_inode,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_DIRTY_INODE], [
AC_MSG_CHECKING([whether sops->dirty_inode() wants flags])
ZFS_LINUX_TEST_RESULT([dirty_inode_with_flags], [
],[
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_DIRTY_INODE_WITH_FLAGS, 1,
[sops->dirty_inode() wants flags])

View File

@ -2,18 +2,15 @@ dnl #
dnl # 2.6.33 API change
dnl # Discard granularity and alignment restrictions may now be set.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_DISCARD_GRANULARITY], [
ZFS_LINUX_TEST_SRC([discard_granularity], [
AC_DEFUN([ZFS_AC_KERNEL_DISCARD_GRANULARITY], [
AC_MSG_CHECKING([whether ql->discard_granularity is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct queue_limits ql __attribute__ ((unused));
ql.discard_granularity = 0;
])
])
AC_DEFUN([ZFS_AC_KERNEL_DISCARD_GRANULARITY], [
AC_MSG_CHECKING([whether ql->discard_granularity is available])
ZFS_LINUX_TEST_RESULT([discard_granularity], [
ql.discard_granularity = 0;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DISCARD_GRANULARITY, 1,
[ql->discard_granularity is available])

View File

@ -0,0 +1,25 @@
dnl #
dnl # 2.6.36 API, exported elevator_change() symbol
dnl # 4.12 API, removed elevator_change() symbol
dnl #
AC_DEFUN([ZFS_AC_KERNEL_ELEVATOR_CHANGE], [
AC_MSG_CHECKING([whether elevator_change() is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
#include <linux/elevator.h>
],[
int ret;
struct request_queue *q = NULL;
char *elevator = NULL;
ret = elevator_change(q, elevator);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ELEVATOR_CHANGE, 1,
[elevator_change() is available])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -4,20 +4,17 @@ dnl # torvalds/linux@b0b0382bb4904965a9e9fca77ad87514dfda0d1c changed the
dnl # ->encode_fh() callback to pass the child inode and its parents inode
dnl # rather than a dentry and a boolean saying whether we want the parent.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE], [
ZFS_LINUX_TEST_SRC([export_operations_encode_fh], [
AC_DEFUN([ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE], [
AC_MSG_CHECKING([whether eops->encode_fh() wants inode])
ZFS_LINUX_TRY_COMPILE([
#include <linux/exportfs.h>
int encode_fh(struct inode *inode, __u32 *fh, int *max_len,
struct inode *parent) { return 0; }
static struct export_operations eops __attribute__ ((unused))={
.encode_fh = encode_fh,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE], [
AC_MSG_CHECKING([whether eops->encode_fh() wants inode])
ZFS_LINUX_TEST_RESULT([export_operations_encode_fh], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ENCODE_FH_WITH_INODE, 1,
[eops->encode_fh() wants child and parent inodes])

View File

@ -3,19 +3,16 @@ dnl # 2.6.36 API change
dnl # The sops->delete_inode() and sops->clear_inode() callbacks have
dnl # replaced by a single sops->evict_inode() callback.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_EVICT_INODE], [
ZFS_LINUX_TEST_SRC([evict_inode], [
AC_DEFUN([ZFS_AC_KERNEL_EVICT_INODE], [
AC_MSG_CHECKING([whether sops->evict_inode() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
void evict_inode (struct inode * t) { return; }
static struct super_operations sops __attribute__ ((unused)) = {
.evict_inode = evict_inode,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_EVICT_INODE], [
AC_MSG_CHECKING([whether sops->evict_inode() exists])
ZFS_LINUX_TEST_RESULT([evict_inode], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EVICT_INODE, 1, [sops->evict_inode() exists])
],[

View File

@ -0,0 +1,19 @@
dnl #
dnl # PaX Linux 2.6.38 - 3.x API
dnl #
AC_DEFUN([ZFS_AC_PAX_KERNEL_FILE_FALLOCATE], [
AC_MSG_CHECKING([whether fops->fallocate() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
struct file_operations_no_const fops __attribute__ ((unused)) = {
.fallocate = fallocate,
};
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
],[
AC_MSG_RESULT(no)
])
])

View File

@ -1,11 +1,9 @@
dnl #
dnl # The fallocate callback was moved from the inode_operations
dnl # structure to the file_operations structure.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
dnl # Linux 2.6.38 - 3.x API
ZFS_LINUX_TEST_SRC([file_fallocate], [
dnl #
AC_DEFUN([ZFS_AC_KERNEL_FILE_FALLOCATE], [
AC_MSG_CHECKING([whether fops->fallocate() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
long test_fallocate(struct file *file, int mode,
@ -15,10 +13,21 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
fops __attribute__ ((unused)) = {
.fallocate = test_fallocate,
};
], [])
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
],[
AC_MSG_RESULT(no)
])
])
dnl #
dnl # Linux 2.6.x - 2.6.37 API
ZFS_LINUX_TEST_SRC([inode_fallocate], [
dnl #
AC_DEFUN([ZFS_AC_KERNEL_INODE_FALLOCATE], [
AC_MSG_CHECKING([whether iops->fallocate() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
long test_fallocate(struct inode *inode, int mode,
@ -28,23 +37,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
fops __attribute__ ((unused)) = {
.fallocate = test_fallocate,
};
], [])
])
AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
AC_MSG_CHECKING([whether fops->fallocate() exists])
ZFS_LINUX_TEST_RESULT([file_fallocate], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([whether iops->fallocate() exists])
ZFS_LINUX_TEST_RESULT([inode_fallocate], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
],[
AC_MSG_RESULT(no)
])
])
dnl #
dnl # The fallocate callback was moved from the inode_operations
dnl # structure to the file_operations structure.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_FALLOCATE], [
ZFS_AC_KERNEL_FILE_FALLOCATE
ZFS_AC_KERNEL_INODE_FALLOCATE
])

View File

@ -4,18 +4,14 @@ dnl # struct access file->f_path.dentry was replaced by accessor function
dnl # since fix torvalds/linux@4bacc9c9234c ("overlayfs: Make f_path always
dnl # point to the overlay and f_inode to the underlay").
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE_DENTRY], [
ZFS_LINUX_TEST_SRC([file_dentry], [
AC_DEFUN([ZFS_AC_KERNEL_FILE_DENTRY], [
AC_MSG_CHECKING([whether file_dentry() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file *f = NULL;
file_dentry(f);
])
])
AC_DEFUN([ZFS_AC_KERNEL_FILE_DENTRY], [
AC_MSG_CHECKING([whether file_dentry() is available])
ZFS_LINUX_TEST_RESULT([file_dentry], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_DENTRY, 1, [file_dentry() is available])
],[

View File

@ -3,18 +3,14 @@ dnl # 3.19 API change
dnl # struct access f->f_dentry->d_inode was replaced by accessor function
dnl # file_inode(f)
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE_INODE], [
ZFS_LINUX_TEST_SRC([file_inode], [
AC_DEFUN([ZFS_AC_KERNEL_FILE_INODE], [
AC_MSG_CHECKING([whether file_inode() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file *f = NULL;
file_inode(f);
])
])
AC_DEFUN([ZFS_AC_KERNEL_FILE_INODE], [
AC_MSG_CHECKING([whether file_inode() is available])
ZFS_LINUX_TEST_RESULT([file_inode], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FILE_INODE, 1, [file_inode() is available])
],[

View File

@ -2,19 +2,16 @@ dnl #
dnl # 2.6.28 API change,
dnl # check if fmode_t typedef is defined
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FMODE_T], [
ZFS_LINUX_TEST_SRC([type_fmode_t], [
AC_DEFUN([ZFS_AC_KERNEL_TYPE_FMODE_T],
[AC_MSG_CHECKING([whether kernel defines fmode_t])
ZFS_LINUX_TRY_COMPILE([
#include <linux/types.h>
],[
fmode_t *ptr __attribute__ ((unused));
])
])
AC_DEFUN([ZFS_AC_KERNEL_FMODE_T], [
AC_MSG_CHECKING([whether kernel defines fmode_t])
ZFS_LINUX_TEST_RESULT([type_fmode_t], [
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FMODE_T, 1, [kernel defines fmode_t])
AC_DEFINE(HAVE_FMODE_T, 1,
[kernel defines fmode_t])
],[
AC_MSG_RESULT([no])
])

View File

@ -3,18 +3,14 @@ dnl # 2.6.38 API change
dnl # follow_down() renamed follow_down_one(). The original follow_down()
dnl # symbol still exists but will traverse down all the layers.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FOLLOW_DOWN_ONE], [
ZFS_LINUX_TEST_SRC([follow_down_one], [
AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_DOWN_ONE], [
AC_MSG_CHECKING([whether follow_down_one() is available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/namei.h>
],[
struct path *p = NULL;
follow_down_one(p);
])
])
AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_DOWN_ONE], [
AC_MSG_CHECKING([whether follow_down_one() is available])
ZFS_LINUX_TEST_RESULT([follow_down_one], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FOLLOW_DOWN_ONE, 1,
[follow_down_one() is available])

View File

@ -2,9 +2,8 @@ dnl #
dnl # Handle differences in kernel FPU code.
dnl #
dnl # Kernel
dnl # 5.0: Wrappers have been introduced to save/restore the FPU state.
dnl # This change was made to the 4.19.38 and 4.14.120 LTS kernels.
dnl # HAVE_KERNEL_FPU_INTERNAL
dnl # 5.0: All kernel fpu functions are GPL only, so we can't use them.
dnl # (nothing defined)
dnl #
dnl # 4.2: Use __kernel_fpu_{begin,end}()
dnl # HAVE_UNDERSCORE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
@ -12,120 +11,55 @@ dnl #
dnl # Pre-4.2: Use kernel_fpu_{begin,end}()
dnl # HAVE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
dnl #
dnl # N.B. The header check is performed before all other checks since it
dnl # depends on HAVE_KERNEL_FPU_API_HEADER being set in confdefs.h.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_FPU_HEADER], [
AC_MSG_CHECKING([whether fpu headers are available])
AC_DEFUN([ZFS_AC_KERNEL_FPU], [
AC_MSG_CHECKING([which kernel_fpu header to use])
ZFS_LINUX_TRY_COMPILE([
#include <linux/module.h>
#include <asm/fpu/api.h>
],[
],[
AC_DEFINE(HAVE_KERNEL_FPU_API_HEADER, 1,
[kernel has asm/fpu/api.h])
AC_DEFINE(HAVE_KERNEL_FPU_API_HEADER, 1, [kernel has asm/fpu/api.h])
AC_MSG_RESULT(asm/fpu/api.h)
],[
AC_MSG_RESULT(i387.h & xcr.h)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
ZFS_LINUX_TEST_SRC([kernel_fpu], [
#include <linux/types.h>
AC_MSG_CHECKING([which kernel_fpu function to use])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/module.h>
#ifdef HAVE_KERNEL_FPU_API_HEADER
#include <asm/fpu/api.h>
#else
#include <asm/i387.h>
#include <asm/xcr.h>
#endif
MODULE_LICENSE("$ZFS_META_LICENSE");
],[
kernel_fpu_begin();
kernel_fpu_end();
], [], [$ZFS_META_LICENSE])
ZFS_LINUX_TEST_SRC([__kernel_fpu], [
#include <linux/types.h>
], [kernel_fpu_begin], [arch/x86/kernel/fpu/core.c], [
AC_MSG_RESULT(kernel_fpu_*)
AC_DEFINE(HAVE_KERNEL_FPU, 1, [kernel has kernel_fpu_* functions])
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1, [kernel exports FPU functions])
],[
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/module.h>
#ifdef HAVE_KERNEL_FPU_API_HEADER
#include <asm/fpu/api.h>
#else
#include <asm/i387.h>
#include <asm/xcr.h>
#endif
MODULE_LICENSE("$ZFS_META_LICENSE");
],[
__kernel_fpu_begin();
__kernel_fpu_end();
], [], [$ZFS_META_LICENSE])
ZFS_LINUX_TEST_SRC([fpu_internal], [
#if defined(__x86_64) || defined(__x86_64__) || \
defined(__i386) || defined(__i386__)
#if !defined(__x86)
#define __x86
#endif
#endif
#if !defined(__x86)
#error Unsupported architecture
#endif
#include <linux/types.h>
#ifdef HAVE_KERNEL_FPU_API_HEADER
#include <asm/fpu/api.h>
#include <asm/fpu/internal.h>
#else
#include <asm/i387.h>
#include <asm/xcr.h>
#endif
#if !defined(XSTATE_XSAVE)
#error XSTATE_XSAVE not defined
#endif
#if !defined(XSTATE_XRESTORE)
#error XSTATE_XRESTORE not defined
#endif
],[
struct fpu *fpu = &current->thread.fpu;
union fpregs_state *st = &fpu->state;
struct fregs_state *fr __attribute__ ((unused)) = &st->fsave;
struct fxregs_state *fxr __attribute__ ((unused)) = &st->fxsave;
struct xregs_state *xr __attribute__ ((unused)) = &st->xsave;
])
])
AC_DEFUN([ZFS_AC_KERNEL_FPU], [
dnl #
dnl # Legacy kernel
dnl #
AC_MSG_CHECKING([whether kernel fpu is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([kernel_fpu_license],
[kernel_fpu_begin], [arch/x86/kernel/fpu/core.c], [
AC_MSG_RESULT(kernel_fpu_*)
AC_DEFINE(HAVE_KERNEL_FPU, 1,
[kernel has kernel_fpu_* functions])
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
[kernel exports FPU functions])
],[
dnl #
dnl # Linux 4.2 kernel
dnl #
ZFS_LINUX_TEST_RESULT_SYMBOL([__kernel_fpu_license],
[__kernel_fpu_begin],
[arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
], [__kernel_fpu_begin], [arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
AC_MSG_RESULT(__kernel_fpu_*)
AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1,
[kernel has __kernel_fpu_* functions])
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
[kernel exports FPU functions])
AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1, [kernel has __kernel_fpu_* functions])
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1, [kernel exports FPU functions])
],[
ZFS_LINUX_TEST_RESULT([fpu_internal], [
AC_MSG_RESULT(internal)
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
[kernel fpu internal])
],[
AC_MSG_RESULT(unavailable)
])
AC_MSG_RESULT(not exported)
])
])
])

View File

@ -3,8 +3,9 @@ dnl # 2.6.38 API change
dnl # The .get_sb callback has been replaced by a .mount callback
dnl # in the file_system_type structure.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FST_MOUNT], [
ZFS_LINUX_TEST_SRC([file_system_type_mount], [
AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [
AC_MSG_CHECKING([whether fst->mount() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
static struct dentry *
@ -17,12 +18,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FST_MOUNT], [
static struct file_system_type fst __attribute__ ((unused)) = {
.mount = mount,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [
AC_MSG_CHECKING([whether fst->mount() exists])
ZFS_LINUX_TEST_RESULT([file_system_type_mount], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists])
],[

View File

@ -1,8 +1,8 @@
dnl #
dnl # Check file_operations->fsync interface.
dnl # Linux 2.6.x - 2.6.34 API
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
ZFS_LINUX_TEST_SRC([fsync_with_dentry], [
AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITH_DENTRY], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
int test_fsync(struct file *f, struct dentry *dentry, int x)
@ -12,9 +12,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
fops __attribute__ ((unused)) = {
.fsync = test_fsync,
};
],[])
],[
],[
AC_MSG_RESULT([dentry])
AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1,
[fops->fsync() with dentry])
],[
])
])
ZFS_LINUX_TEST_SRC([fsync_without_dentry], [
dnl #
dnl # Linux 2.6.35 - Linux 3.0 API
dnl #
AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
int test_fsync(struct file *f, int x) { return 0; }
@ -23,9 +34,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
fops __attribute__ ((unused)) = {
.fsync = test_fsync,
};
],[])
],[
],[
AC_MSG_RESULT([no dentry])
AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1,
[fops->fsync() without dentry])
],[
])
])
ZFS_LINUX_TEST_SRC([fsync_range], [
dnl #
dnl # Linux 3.1 - 3.x API
dnl #
AC_DEFUN([ZFS_AC_KERNEL_FSYNC_RANGE], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
int test_fsync(struct file *f, loff_t a, loff_t b, int c)
@ -35,43 +57,18 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
fops __attribute__ ((unused)) = {
.fsync = test_fsync,
};
],[])
])
AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [
dnl #
dnl # Linux 2.6.x - 2.6.34 API
dnl #
AC_MSG_CHECKING([whether fops->fsync() wants dentry])
ZFS_LINUX_TEST_RESULT([fsync_with_dentry], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1,
[fops->fsync() with dentry])
],[
AC_MSG_RESULT([no])
dnl #
dnl # Linux 2.6.35 - Linux 3.0 API
dnl #
AC_MSG_CHECKING([whether fops->fsync() wants no dentry])
ZFS_LINUX_TEST_RESULT([fsync_without_dentry], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1,
[fops->fsync() without dentry])
],[
AC_MSG_RESULT([no])
dnl #
dnl # Linux 3.1 - 3.x API
dnl #
AC_MSG_CHECKING([whether fops->fsync() wants range])
ZFS_LINUX_TEST_RESULT([fsync_range], [
AC_MSG_RESULT([range])
AC_DEFINE(HAVE_FSYNC_RANGE, 1,
[fops->fsync() with range])
],[
ZFS_LINUX_TEST_ERROR([fops->fsync])
])
])
])
AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [
AC_MSG_CHECKING([whether fops->fsync() wants])
ZFS_AC_KERNEL_FSYNC_WITH_DENTRY
ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY
ZFS_AC_KERNEL_FSYNC_RANGE
])

View File

@ -1,8 +1,12 @@
dnl #
dnl # Check for generic io accounting interface.
dnl # 3.19 API addition
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
ZFS_LINUX_TEST_SRC([generic_acct_3args], [
dnl # torvalds/linux@394ffa503bc40e32d7f54a9b817264e81ce131b4 allows us to
dnl # increment iostat counters without generic_make_request().
dnl #
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT_3ARG], [
AC_MSG_CHECKING([whether 3 arg generic IO accounting symbols are available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/bio.h>
void (*generic_start_io_acct_f)(int, unsigned long,
@ -12,9 +16,24 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
], [
generic_start_io_acct(0, 0, NULL);
generic_end_io_acct(0, NULL, 0);
], [generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
[generic_start_io_acct()/generic_end_io_acct() available])
], [
AC_MSG_RESULT(no)
])
])
ZFS_LINUX_TEST_SRC([generic_acct_4args], [
dnl #
dnl # Linux 4.14 API,
dnl #
dnl # generic_start_io_acct/generic_end_io_acct now require request_queue to be
dnl # provided. No functional changes, but preparation for inflight accounting
dnl #
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT_4ARG], [
AC_MSG_CHECKING([whether 4 arg generic IO accounting symbols are available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/bio.h>
void (*generic_start_io_acct_f)(struct request_queue *, int,
@ -24,41 +43,11 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
], [
generic_start_io_acct(NULL, 0, 0, NULL);
generic_end_io_acct(NULL, 0, NULL, 0);
])
])
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [
dnl #
dnl # 3.19 API addition
dnl #
dnl # torvalds/linux@394ffa50 allows us to increment iostat
dnl # counters without generic_make_request().
dnl #
AC_MSG_CHECKING([whether generic IO accounting wants 3 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
[generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
[generic_start_io_acct()/generic_end_io_acct() available])
], [
AC_MSG_RESULT(no)
dnl #
dnl # Linux 4.14 API,
dnl #
dnl # generic_start_io_acct/generic_end_io_acct now require
dnl # request_queue to be provided. No functional changes,
dnl # but preparation for inflight accounting.
dnl #
AC_MSG_CHECKING([whether generic IO accounting wants 4 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args],
[generic_start_io_acct], [block/bio.c], [
], [generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
[generic_start_io_acct()/generic_end_io_acct() ]
[4 arg available])
[generic_start_io_acct()/generic_end_io_acct() 4 arg available])
], [
AC_MSG_RESULT(no)
])
])
])

View File

@ -4,18 +4,15 @@ dnl #
dnl # NULL inode_operations.readlink implies generic_readlink(), which
dnl # has been made static.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL], [
ZFS_LINUX_TEST_SRC([generic_readlink_global], [
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL], [
AC_MSG_CHECKING([whether generic_readlink is global])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
int i __attribute__ ((unused));
i = generic_readlink(NULL, NULL, 0);
])
])
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL], [
AC_MSG_CHECKING([whether generic_readlink is global])
ZFS_LINUX_TEST_RESULT([generic_readlink_global], [
i = generic_readlink(NULL, NULL, 0);
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GENERIC_READLINK, 1,
[generic_readlink is global])

View File

@ -2,19 +2,14 @@ dnl #
dnl # 4.16 API change
dnl # Verify if get_disk_and_module() symbol is available.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE], [
ZFS_LINUX_TEST_SRC([get_disk_and_module], [
AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE],
[AC_MSG_CHECKING([whether get_disk_and_module() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/genhd.h>
], [
struct gendisk *disk = NULL;
(void) get_disk_and_module(disk);
])
])
AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE], [
AC_MSG_CHECKING([whether get_disk_and_module() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([get_disk_and_module],
[get_disk_and_module], [block/genhd.c], [
], [get_disk_and_module], [block/genhd.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_DISK_AND_MODULE,
1, [get_disk_and_module() is available])

View File

@ -1,21 +1,21 @@
dnl #
dnl # 2.6.x API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_DISK_RO], [
ZFS_LINUX_TEST_SRC([get_disk_ro], [
AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [
AC_MSG_CHECKING([whether get_disk_ro() is available])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
ZFS_LINUX_TRY_COMPILE([
#include <linux/blkdev.h>
],[
struct gendisk *disk = NULL;
(void) get_disk_ro(disk);
], [$NO_UNUSED_BUT_SET_VARIABLE])
])
AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [
AC_MSG_CHECKING([whether get_disk_ro() is available])
ZFS_LINUX_TEST_RESULT([get_disk_ro], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_DISK_RO, 1, [blk_disk_ro() is available])
AC_DEFINE(HAVE_GET_DISK_RO, 1,
[blk_disk_ro() is available])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

View File

@ -1,29 +1,13 @@
dnl #
dnl # Supported get_link() interfaces checked newest to oldest.
dnl # Note this interface used to be named follow_link.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
ZFS_LINUX_TEST_SRC([inode_operations_get_link], [
#include <linux/fs.h>
const char *get_link(struct dentry *de, struct inode *ip,
struct delayed_call *done) { return "symlink"; }
static struct inode_operations
iops __attribute__ ((unused)) = {
.get_link = get_link,
};
],[])
ZFS_LINUX_TEST_SRC([inode_operations_get_link_cookie], [
#include <linux/fs.h>
const char *get_link(struct dentry *de, struct
inode *ip, void **cookie) { return "symlink"; }
static struct inode_operations
iops __attribute__ ((unused)) = {
.get_link = get_link,
};
],[])
ZFS_LINUX_TEST_SRC([inode_operations_follow_link], [
AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [
dnl #
dnl # 4.2 API change
dnl # - This kernel retired the nameidata structure.
dnl #
AC_MSG_CHECKING([whether iops->follow_link() passes cookie])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
const char *follow_link(struct dentry *de,
void **cookie) { return "symlink"; }
@ -31,9 +15,19 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
iops __attribute__ ((unused)) = {
.follow_link = follow_link,
};
],[])
ZFS_LINUX_TEST_SRC([inode_operations_follow_link_nameidata], [
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FOLLOW_LINK_COOKIE, 1,
[iops->follow_link() cookie])
],[
dnl #
dnl # 2.6.32 API
dnl #
AC_MSG_RESULT(no)
AC_MSG_CHECKING(
[whether iops->follow_link() passes nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
void *follow_link(struct dentry *de, struct
nameidata *nd) { return (void *)NULL; }
@ -41,7 +35,15 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
iops __attribute__ ((unused)) = {
.follow_link = follow_link,
};
],[])
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
[iops->follow_link() nameidata])
],[
AC_MSG_ERROR(no; please file a bug report)
])
])
])
AC_DEFUN([ZFS_AC_KERNEL_GET_LINK], [
@ -51,12 +53,20 @@ AC_DEFUN([ZFS_AC_KERNEL_GET_LINK], [
dnl # used it to retire the put_link() interface.
dnl #
AC_MSG_CHECKING([whether iops->get_link() passes delayed])
ZFS_LINUX_TEST_RESULT([inode_operations_get_link], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_LINK_DELAYED, 1, [iops->get_link() delayed])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
const char *get_link(struct dentry *de, struct inode *ip,
struct delayed_call *done) { return "symlink"; }
static struct inode_operations
iops __attribute__ ((unused)) = {
.get_link = get_link,
};
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_LINK_DELAYED, 1,
[iops->get_link() delayed])
],[
AC_MSG_RESULT(no)
dnl #
dnl # 4.5 API change
dnl # The follow_link() interface has been replaced by
@ -64,41 +74,27 @@ AC_DEFUN([ZFS_AC_KERNEL_GET_LINK], [
dnl # - An inode is passed as a separate argument
dnl # - When called in RCU mode a NULL dentry is passed.
dnl #
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether iops->get_link() passes cookie])
ZFS_LINUX_TEST_RESULT([inode_operations_get_link_cookie], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
const char *get_link(struct dentry *de, struct
inode *ip, void **cookie) { return "symlink"; }
static struct inode_operations
iops __attribute__ ((unused)) = {
.get_link = get_link,
};
],[
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_LINK_COOKIE, 1,
[iops->get_link() cookie])
],[
dnl #
dnl # Check for the follow_link APIs.
dnl #
AC_MSG_RESULT(no)
dnl #
dnl # 4.2 API change
dnl # This kernel retired the nameidata structure.
dnl #
AC_MSG_CHECKING(
[whether iops->follow_link() passes cookie])
ZFS_LINUX_TEST_RESULT([inode_operations_follow_link], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FOLLOW_LINK_COOKIE, 1,
[iops->follow_link() cookie])
],[
AC_MSG_RESULT(no)
dnl #
dnl # 2.6.32 API
dnl #
AC_MSG_CHECKING(
[whether iops->follow_link() passes nameidata])
ZFS_LINUX_TEST_RESULT(
[inode_operations_follow_link_nameidata],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
[iops->follow_link() nameidata])
],[
ZFS_LINUX_TEST_ERROR([get_link])
])
])
ZFS_AC_KERNEL_FOLLOW_LINK
])
])
])

View File

@ -4,21 +4,16 @@ dnl #
dnl # 75ef71840539 mm, vmstat: add infrastructure for per-node vmstats
dnl # 599d0c954f91 mm, vmscan: move LRU lists to node
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_NODE_PAGE_STATE], [
ZFS_LINUX_TEST_SRC([global_node_page_state], [
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE], [
AC_MSG_CHECKING([whether global_node_page_state() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/mm.h>
#include <linux/vmstat.h>
],[
(void) global_node_page_state(0);
])
])
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE], [
AC_MSG_CHECKING([whether global_node_page_state() exists])
ZFS_LINUX_TEST_RESULT([global_node_page_state], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(ZFS_GLOBAL_NODE_PAGE_STATE, 1,
[global_node_page_state() exists])
AC_DEFINE(ZFS_GLOBAL_NODE_PAGE_STATE, 1, [global_node_page_state() exists])
],[
AC_MSG_RESULT(no)
])
@ -29,21 +24,16 @@ dnl # 4.14 API change
dnl #
dnl # c41f012ade0b mm: rename global_page_state to global_zone_page_state
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_ZONE_PAGE_STATE], [
ZFS_LINUX_TEST_SRC([global_zone_page_state], [
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE], [
AC_MSG_CHECKING([whether global_zone_page_state() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/mm.h>
#include <linux/vmstat.h>
],[
(void) global_zone_page_state(0);
])
])
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE], [
AC_MSG_CHECKING([whether global_zone_page_state() exists])
ZFS_LINUX_TEST_RESULT([global_zone_page_state], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(ZFS_GLOBAL_ZONE_PAGE_STATE, 1,
[global_zone_page_state() exists])
AC_DEFINE(ZFS_GLOBAL_ZONE_PAGE_STATE, 1, [global_zone_page_state() exists])
],[
AC_MSG_RESULT(no)
])
@ -54,11 +44,9 @@ dnl # Create a define and autoconf variable for an enum member
dnl #
AC_DEFUN([ZFS_AC_KERNEL_ENUM_MEMBER], [
AC_MSG_CHECKING([whether enum $2 contains $1])
AS_IF([AC_TRY_COMMAND(
"${srcdir}/scripts/enum-extract.pl" "$2" "$3" | egrep -qx $1)],[
AS_IF([AC_TRY_COMMAND("${srcdir}/scripts/enum-extract.pl" "$2" "$3" | egrep -qx $1)],[
AC_MSG_RESULT([yes])
AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1,
[enum $2 contains $1])
AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1, [enum $2 contains $1])
m4_join([_], [ZFS_ENUM], m4_toupper($2), $1)=1
],[
AC_MSG_RESULT([no])
@ -71,7 +59,8 @@ dnl #
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR],[
AC_MSG_RESULT(no)
AC_MSG_RESULT([$1 in either node_stat_item or zone_stat_item: $2])
ZFS_LINUX_TEST_ERROR([global page state])
AC_MSG_RESULT([configure needs updating, see: config/kernel-global_page_state.m4])
AC_MSG_FAILURE([SHUT 'ER DOWN CLANCY, SHE'S PUMPIN' MUD!])
])
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK], [
@ -86,23 +75,19 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK], [
])
dnl #
dnl # Ensure the config tests are finding one and only one of each enum.
dnl # Ensure the config tests are finding one and only one of each enum of interest
dnl #
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [
AC_MSG_CHECKING([whether global_page_state enums are sane])
AC_MSG_CHECKING([global_page_state enums are sane])
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_FILE_PAGES])
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_ANON])
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_FILE])
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_SLAB_RECLAIMABLE])
AC_MSG_RESULT(yes)
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE], [
ZFS_AC_KERNEL_SRC_GLOBAL_NODE_PAGE_STATE
ZFS_AC_KERNEL_SRC_GLOBAL_ZONE_PAGE_STATE
])
dnl #
dnl # enum members in which we're interested
dnl #
@ -110,19 +95,15 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE], [
ZFS_AC_KERNEL_GLOBAL_NODE_PAGE_STATE
ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE
ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
[node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
[node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
[node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES], [node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON], [node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE], [node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE], [node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
[zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
[zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
[zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE], [zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY
])

View File

@ -2,21 +2,20 @@ dnl #
dnl # 4.9 API change
dnl # group_info changed from 2d array via >blocks to 1d array via ->gid
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GROUP_INFO_GID], [
ZFS_LINUX_TEST_SRC([group_info_gid], [
AC_DEFUN([ZFS_AC_KERNEL_GROUP_INFO_GID], [
AC_MSG_CHECKING([whether group_info->gid exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
ZFS_LINUX_TRY_COMPILE([
#include <linux/cred.h>
],[
struct group_info *gi = groups_alloc(1);
gi->gid[0] = KGIDT_INIT(0);
])
])
AC_DEFUN([ZFS_AC_KERNEL_GROUP_INFO_GID], [
AC_MSG_CHECKING([whether group_info->gid exists])
ZFS_LINUX_TEST_RESULT([group_info_gid], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GROUP_INFO_GID, 1, [group_info->gid exists])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])

Some files were not shown because too many files have changed in this diff Show More