Guest User

Untitled

a guest
Mar 6th, 2020
76
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. # SPDX-License-Identifier: GPL-2.0
  3. # Copyright (C) 2020 SUSE Linux Products GmbH. All Rights Reserved.
  4. #
  5. # FSQA Test No. XXX
  6. #
  7. # TODO description
  8. #
  9. seq=`basename $0`
  10. seqres=$RESULT_DIR/$seq
  11. echo "QA output created by $seq"
  12. tmp=/tmp/$$
  13. status=1    # failure is the default!
  14. trap "_cleanup; exit \$status" 0 1 2 3 15
  15.  
  16. _cleanup()
  17. {
  18.     _cleanup_flakey
  19.     cd /
  20.     rm -f $tmp.*
  21. }
  22.  
  23. # get standard environment, filters and checks
  24. . ./common/rc
  25. . ./common/attr
  26. . ./common/filter
  27. . ./common/dmflakey
  28.  
  29. # real QA test starts here
  30. _supported_fs btrfs
  31. _supported_os Linux
  32. _require_scratch
  33. _require_dm_target flakey
  34. _require_btrfs_fs_feature "no_holes"
  35. _require_btrfs_mkfs_feature "no-holes"
  36. _require_xfs_io_command "sync_range"
  37.  
  38. rm -f $seqres.full
  39.  
  40. _scratch_mkfs -O ^no-holes >>$seqres.full 2>&1
  41. _require_metadata_journaling $SCRATCH_DEV
  42. _init_flakey
  43. _mount_flakey
  44.  
  45. touch $SCRATCH_MNT/foo
  46. # Clear the full sync bit, so that the msync below triggers the fast fsync path.
  47. $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo
  48.  
  49. # get rid of the log tree
  50. sync
  51.  
  52. # Dirty some pages and flush only some of them at the beginning without updating
  53. # the log tree.
  54. $XFS_IO_PROG -c "pwrite -S 0xab 0 1M" \
  55.          -c "sync_range -abw 0 256K" \
  56.          $SCRATCH_MNT/foo >>$seqres.full
  57.  
  58. $XFS_IO_PROG \
  59.         -c "mmap -w 512K 512K"        \
  60.         -c "mwrite -S 0xcd 512K 512K" \
  61.         -c "msync -s 512K 512K"       \
  62.         -c "munmap"                   \
  63.         $SCRATCH_MNT/foo >>$seqres.full
  64.  
  65. _flakey_drop_and_remount
  66. _unmount_flakey
  67.  
  68. # On exit fsck is run and reports missing file extent for range from 0 to 512Kb.
  69.  
  70. status=0
  71. exit
RAW Paste Data