zfs: merge openzfs/zfs@508fff0e4 (zfs-2.1-release) into stable/13

Notable upstream pull request merges:
  #12253 module/zfs: simplify ddt_stat_add() loop
  #12280 Help compiller optimize out abd_verify()
  #12288 Avoid 64bit division in multilist index functions

Obtained from:	OpenZFS
OpenZFS commit:	508fff0e4b
OpenZFS tag:	zfs-2.1.0-rc8
This commit is contained in:
Martin Matuska 2021-06-30 10:55:27 +02:00
commit 7f101ca7d1
10 changed files with 50 additions and 16 deletions

View file

@ -2,9 +2,9 @@ Meta: 1
Name: zfs
Branch: 1.0
Version: 2.1.0
Release: rc7
Release: rc8
Release-Tags: relext
License: CDDL
Author: OpenZFS
Linux-Maximum: 5.12
Linux-Maximum: 5.13
Linux-Minimum: 3.10

View file

@ -263,7 +263,7 @@ zed_notify_email()
-e "s/@SUBJECT@/${subject}/g")"
# shellcheck disable=SC2086
${ZED_EMAIL_PROG} ${ZED_EMAIL_OPTS} < "${pathname}" >/dev/null 2>&1
eval ${ZED_EMAIL_PROG} ${ZED_EMAIL_OPTS} < "${pathname}" >/dev/null 2>&1
rv=$?
if [ "${rv}" -ne 0 ]; then
zed_log_err "$(basename "${ZED_EMAIL_PROG}") exit=${rv}"

View file

@ -179,8 +179,8 @@ ask_for_password() {
# Prompt for password with plymouth, if installed and running.
if plymouth --ping 2>/dev/null; then
plymouth ask-for-password \
--prompt "$ply_prompt" --number-of-tries="$ply_tries" \
--command="$ply_cmd"
--prompt "$ply_prompt" --number-of-tries="$ply_tries" | \
eval "$ply_cmd"
ret=$?
else
if [ "$tty_echo_off" = yes ]; then

View file

@ -108,15 +108,14 @@ int zfs_abd_scatter_enabled = B_TRUE;
void
abd_verify(abd_t *abd)
{
#ifdef ZFS_DEBUG
ASSERT3U(abd->abd_size, >, 0);
ASSERT3U(abd->abd_size, <=, SPA_MAXBLOCKSIZE);
ASSERT3U(abd->abd_flags, ==, abd->abd_flags & (ABD_FLAG_LINEAR |
ABD_FLAG_OWNER | ABD_FLAG_META | ABD_FLAG_MULTI_ZONE |
ABD_FLAG_MULTI_CHUNK | ABD_FLAG_LINEAR_PAGE | ABD_FLAG_GANG |
ABD_FLAG_GANG_FREE | ABD_FLAG_ZEROS | ABD_FLAG_ALLOCD));
#ifdef ZFS_DEBUG
IMPLY(abd->abd_parent != NULL, !(abd->abd_flags & ABD_FLAG_OWNER));
#endif
IMPLY(abd->abd_flags & ABD_FLAG_META, abd->abd_flags & ABD_FLAG_OWNER);
if (abd_is_linear(abd)) {
ASSERT3P(ABD_LINEAR_BUF(abd), !=, NULL);
@ -133,6 +132,7 @@ abd_verify(abd_t *abd)
} else {
abd_verify_scatter(abd);
}
#endif
}
static void

View file

@ -7459,9 +7459,10 @@ arc_state_multilist_index_func(multilist_t *ml, void *obj)
* Also, the low order bits of the hash value are thought to be
* distributed evenly. Otherwise, in the case that the multilist
* has a power of two number of sublists, each sublists' usage
* would not be evenly distributed.
* would not be evenly distributed. In this context full 64bit
* division would be a waste of time, so limit it to 32 bits.
*/
return (buf_hash(hdr->b_spa, &hdr->b_dva, hdr->b_birth) %
return ((unsigned int)buf_hash(hdr->b_spa, &hdr->b_dva, hdr->b_birth) %
multilist_get_num_sublists(ml));
}

View file

@ -622,9 +622,10 @@ dbuf_cache_multilist_index_func(multilist_t *ml, void *obj)
* Also, the low order bits of the hash value are thought to be
* distributed evenly. Otherwise, in the case that the multilist
* has a power of two number of sublists, each sublists' usage
* would not be evenly distributed.
* would not be evenly distributed. In this context full 64bit
* division would be a waste of time, so limit it to 32 bits.
*/
return (dbuf_hash(db->db_objset, db->db.db_object,
return ((unsigned int)dbuf_hash(db->db_objset, db->db.db_object,
db->db_level, db->db_blkid) %
multilist_get_num_sublists(ml));
}

View file

@ -399,7 +399,15 @@ static unsigned int
dnode_multilist_index_func(multilist_t *ml, void *obj)
{
dnode_t *dn = obj;
return (dnode_hash(dn->dn_objset, dn->dn_object) %
/*
* The low order bits of the hash value are thought to be
* distributed evenly. Otherwise, in the case that the multilist
* has a power of two number of sublists, each sublists' usage
* would not be evenly distributed. In this context full 64bit
* division would be a waste of time, so limit it to 32 bits.
*/
return ((unsigned int)dnode_hash(dn->dn_objset, dn->dn_object) %
multilist_get_num_sublists(ml));
}

View file

@ -1874,7 +1874,12 @@ static unsigned int
metaslab_idx_func(multilist_t *ml, void *arg)
{
metaslab_t *msp = arg;
return (msp->ms_id % multilist_get_num_sublists(ml));
/*
* ms_id values are allocated sequentially, so full 64bit
* division would be a waste of time, so limit it to 32 bits.
*/
return ((unsigned int)msp->ms_id % multilist_get_num_sublists(ml));
}
uint64_t

View file

@ -202,6 +202,25 @@ static struct zstd_fallback_mem zstd_dctx_fallback;
static struct zstd_pool *zstd_mempool_cctx;
static struct zstd_pool *zstd_mempool_dctx;
/*
* The library zstd code expects these if ADDRESS_SANITIZER gets defined,
* and while ASAN does this, KASAN defines that and does not. So to avoid
* changing the external code, we do this.
*/
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define ADDRESS_SANITIZER 1
#endif
#elif defined(__SANITIZE_ADDRESS__)
#define ADDRESS_SANITIZER 1
#endif
#if defined(_KERNEL) && defined(ADDRESS_SANITIZER)
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
void __asan_poison_memory_region(void const volatile *addr, size_t size);
void __asan_unpoison_memory_region(void const volatile *addr, size_t size) {};
void __asan_poison_memory_region(void const volatile *addr, size_t size) {};
#endif
static void
zstd_mempool_reap(struct zstd_pool *zstd_mempool)

View file

@ -734,7 +734,7 @@
/* #undef ZFS_IS_GPL_COMPATIBLE */
/* Define the project alias string. */
#define ZFS_META_ALIAS "zfs-2.1.0-FreeBSD_gaee26af27"
#define ZFS_META_ALIAS "zfs-2.1.0-FreeBSD_g508fff0e4"
/* Define the project author. */
#define ZFS_META_AUTHOR "OpenZFS"
@ -743,7 +743,7 @@
/* #undef ZFS_META_DATA */
/* Define the maximum compatible kernel version. */
#define ZFS_META_KVER_MAX "5.12"
#define ZFS_META_KVER_MAX "5.13"
/* Define the minimum compatible kernel version. */
#define ZFS_META_KVER_MIN "3.10"
@ -764,7 +764,7 @@
#define ZFS_META_NAME "zfs"
/* Define the project release. */
#define ZFS_META_RELEASE "FreeBSD_gaee26af27"
#define ZFS_META_RELEASE "FreeBSD_g508fff0e4"
/* Define the project version. */
#define ZFS_META_VERSION "2.1.0"