Skip to content

Commit

Permalink
Merge pull request #188 from truenas/truenas-zfs-2.1.14-test
Browse files Browse the repository at this point in the history
Merge zfs-2.1.14
  • Loading branch information
amotin authored Dec 1, 2023
2 parents dd2649a + 914aa47 commit f487109
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 38 deletions.
2 changes: 1 addition & 1 deletion META
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Meta: 1
Name: zfs
Branch: 1.0
Version: 2.1.13
Version: 2.1.14
Release: 1
Release-Tags: relext
License: CDDL
Expand Down
6 changes: 6 additions & 0 deletions contrib/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
openzfs-linux (2.1.14-0) unstable; urgency=medium

* Merge tag zfs-2.1.14

-- Ameer Hamza <[email protected]> Mon, 01 Dec 2023 09:00:00 -0500

openzfs-linux (2.1.13-0) unstable; urgency=medium

* Merge tag zfs-2.1.13
Expand Down
6 changes: 6 additions & 0 deletions contrib/truenas/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
openzfs (2.1.14-0) unstable; urgency=medium

* Merge tag zfs-2.1.14

-- Ameer Hamza <[email protected]> Mon, 01 Dec 2023 09:00:00 -0500

openzfs (2.1.13-0) unstable; urgency=medium

* Merge tag zfs-2.1.13
Expand Down
28 changes: 2 additions & 26 deletions copy-builtin
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,8 @@ config ZFS
If unsure, say N.
EOF

add_after()
{
FILE="$1"
MARKER="$2"
NEW="$3"

while IFS='' read -r LINE
do
printf "%s\n" "$LINE"

if [ -n "$MARKER" ] && [ "$LINE" = "$MARKER" ]
then
printf "%s\n" "$NEW"
MARKER=''
if IFS='' read -r LINE
then
[ "$LINE" != "$NEW" ] && printf "%s\n" "$LINE"
fi
fi
done < "$FILE" > "$FILE.new"

mv "$FILE.new" "$FILE"
}

add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
sed -i '/source "fs\/ext2\/Kconfig\"/i\source "fs/zfs/Kconfig"' "$KERNEL_DIR/fs/Kconfig"
echo 'obj-$(CONFIG_ZFS) += zfs/' >> "$KERNEL_DIR/fs/Makefile"

echo "$0: done. now you can build the kernel with ZFS support." >&2
echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2
12 changes: 10 additions & 2 deletions module/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1773,15 +1773,23 @@ dnode_try_claim(objset_t *os, uint64_t object, int slots)
}

/*
* Checks if the dnode contains any uncommitted dirty records.
* Checks if the dnode itself is dirty, or is carrying any uncommitted records.
* It is important to check both conditions, as some operations (eg appending
* to a file) can dirty both as a single logical unit, but they are not synced
* out atomically, so checking one and not the other can result in an object
* appearing to be clean mid-way through a commit.
*
* Do not change this lightly! If you get it wrong, dmu_offset_next() can
* detect a hole where there is really data, leading to silent corruption.
*/
boolean_t
dnode_is_dirty(dnode_t *dn)
{
mutex_enter(&dn->dn_mtx);

for (int i = 0; i < TXG_SIZE; i++) {
if (multilist_link_active(&dn->dn_dirty_link[i])) {
if (multilist_link_active(&dn->dn_dirty_link[i]) ||
!list_is_empty(&dn->dn_dirty_records[i])) {
mutex_exit(&dn->dn_mtx);
return (B_TRUE);
}
Expand Down
28 changes: 19 additions & 9 deletions module/zfs/vdev_trim.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Copyright (c) 2016 by Delphix. All rights reserved.
* Copyright (c) 2019 by Lawrence Livermore National Security, LLC.
* Copyright (c) 2021 Hewlett Packard Enterprise Development LP
* Copyright 2023 RackTop Systems, Inc.
*/

#include <sys/spa.h>
Expand Down Expand Up @@ -572,6 +573,7 @@ vdev_trim_ranges(trim_args_t *ta)
uint64_t extent_bytes_max = ta->trim_extent_bytes_max;
uint64_t extent_bytes_min = ta->trim_extent_bytes_min;
spa_t *spa = vd->vdev_spa;
int error = 0;

ta->trim_start_time = gethrtime();
ta->trim_bytes_done = 0;
Expand All @@ -591,19 +593,32 @@ vdev_trim_ranges(trim_args_t *ta)
uint64_t writes_required = ((size - 1) / extent_bytes_max) + 1;

for (uint64_t w = 0; w < writes_required; w++) {
int error;

error = vdev_trim_range(ta, VDEV_LABEL_START_SIZE +
rs_get_start(rs, ta->trim_tree) +
(w *extent_bytes_max), MIN(size -
(w * extent_bytes_max), extent_bytes_max));
if (error != 0) {
return (error);
goto done;
}
}
}

return (0);
done:
/*
* Make sure all TRIMs for this metaslab have completed before
* returning. TRIM zios have lower priority over regular or syncing
* zios, so all TRIM zios for this metaslab must complete before the
* metaslab is re-enabled. Otherwise it's possible write zios to
* this metaslab could cut ahead of still queued TRIM zios for this
* metaslab causing corruption if the ranges overlap.
*/
mutex_enter(&vd->vdev_trim_io_lock);
while (vd->vdev_trim_inflight[0] > 0) {
cv_wait(&vd->vdev_trim_io_cv, &vd->vdev_trim_io_lock);
}
mutex_exit(&vd->vdev_trim_io_lock);

return (error);
}

static void
Expand Down Expand Up @@ -922,11 +937,6 @@ vdev_trim_thread(void *arg)
}

spa_config_exit(spa, SCL_CONFIG, FTAG);
mutex_enter(&vd->vdev_trim_io_lock);
while (vd->vdev_trim_inflight[0] > 0) {
cv_wait(&vd->vdev_trim_io_cv, &vd->vdev_trim_io_lock);
}
mutex_exit(&vd->vdev_trim_io_lock);

range_tree_destroy(ta.trim_tree);

Expand Down

0 comments on commit f487109

Please sign in to comment.