blob: c563972510754782fc1806412b2e856690cceb1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2016 Fujitsu. All Rights Reserved.
#
# FS QA Test 353
#
# Check if fiemap ioctl returns correct SHARED flag on reflinked file
# before and after sync the fs
#
# Btrfs has a bug in checking shared extent, which can only handle metadata
# already committed to disk, but not delayed extent tree modification.
# This caused SHARED flag only occurs after sync.
#
. ./common/preamble
_begin_fstest auto quick clone fiemap
# Import common functions.
. ./common/filter
. ./common/reflink
. ./common/punch
# real QA test starts here
# Modify as appropriate.
_supported_fs generic
_require_scratch_reflink
_require_xfs_io_command "fiemap"
_scratch_mkfs > /dev/null 2>&1
_scratch_mount
blocksize=$(_get_file_block_size $SCRATCH_MNT)
file1="$SCRATCH_MNT/file1"
file2="$SCRATCH_MNT/file2"
extmap1="$SCRATCH_MNT/extmap1"
extmap2="$SCRATCH_MNT/extmap2"
# write the initial file
_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
# reflink initial file
_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
# check their fiemap to make sure it's correct
$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
# sync and recheck, to make sure the fiemap doesn't change just
# due to sync
sync
$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
echo "Silence is golden"
# success, all done
status=0
exit
|