forked from kdave/xfstests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btrfs/14{2,3}: use dm-dust instead of fail_make_request
These two tests test direct I/O and buffered read repair, respectively, with fail_make_request. However, by using "fail_make_request/times", they rely on repair having a specific I/O pattern. My pending Btrfs direct I/O refactoring patch series changes this I/O pattern and thus breaks this test. The dm-dust target (added in v5.2) emulates a device with bad blocks that are fixed when written to (like a device that remaps bad blocks). This is exactly what we want for testing repair. Add some common dm-dust helpers and update the tests to use dm-dust. Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
- Loading branch information
Showing
3 changed files
with
73 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Copyright (c) 2020 Facebook. All Rights Reserved. | ||
# | ||
# common functions for setting up and tearing down a dmdust device | ||
|
||
_init_dust() | ||
{ | ||
local DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` | ||
DUST_DEV=/dev/mapper/dust-test | ||
DUST_TABLE="0 $DEV_SIZE dust $SCRATCH_DEV 0 512" | ||
_dmsetup_create dust-test --table "$DUST_TABLE" || \ | ||
_fatal "failed to create dust device" | ||
} | ||
|
||
_mount_dust() | ||
{ | ||
_scratch_options mount | ||
_mount -t $FSTYP `_common_dev_mount_options $*` $SCRATCH_OPTIONS \ | ||
$DUST_DEV $SCRATCH_MNT | ||
} | ||
|
||
_unmount_dust() | ||
{ | ||
$UMOUNT_PROG $SCRATCH_MNT | ||
} | ||
|
||
_cleanup_dust() | ||
{ | ||
# If dmsetup load fails then we need to make sure to do resume here | ||
# otherwise the umount will hang | ||
$DMSETUP_PROG resume dust-test > /dev/null 2>&1 | ||
$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1 | ||
_dmsetup_remove dust-test | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters