| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# |
| 4 |
# This file is part of util-linux. |
| 5 |
# |
| 6 |
# This file is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 2 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# This file is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU General Public License for more details. |
| 15 |
# |
| 16 |
|
| 17 |
|
| 18 |
# |
| 19 |
# Test alignment for 512/512 disk *with* topology -- aligned to optimal |
| 20 |
# I/O size (32KiB) |
| 21 |
# |
| 22 |
|
| 23 |
TS_TOPDIR="${0%/*}/../.." |
| 24 |
TS_DESC="align 512/4K +alignment_offset" |
| 25 |
|
| 26 |
. "$TS_TOPDIR"/functions.sh |
| 27 |
ts_init "$*" |
| 28 |
|
| 29 |
ts_check_test_command "$TS_CMD_FDISK" |
| 30 |
|
| 31 |
ts_skip_nonroot |
| 32 |
|
| 33 |
# set global variable TS_DEVICE |
| 34 |
ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3 lowest_aligned=7 |
| 35 |
DEVNAME=$(basename $TS_DEVICE) |
| 36 |
|
| 37 |
ts_log "Create partitions" |
| 38 |
$TS_CMD_FDISK --noauto-pt ${TS_DEVICE} >> $TS_OUTPUT 2>> $TS_ERRLOG <<EOF |
| 39 |
o |
| 40 |
n |
| 41 |
p |
| 42 |
1 |
| 43 |
|
| 44 |
+10M |
| 45 |
n |
| 46 |
p |
| 47 |
2 |
| 48 |
|
| 49 |
+10M |
| 50 |
n |
| 51 |
p |
| 52 |
3 |
| 53 |
|
| 54 |
+10M |
| 55 |
n |
| 56 |
e |
| 57 |
|
| 58 |
|
| 59 |
n |
| 60 |
|
| 61 |
+5M |
| 62 |
n |
| 63 |
|
| 64 |
+5M |
| 65 |
n |
| 66 |
|
| 67 |
|
| 68 |
p |
| 69 |
w |
| 70 |
q |
| 71 |
EOF |
| 72 |
|
| 73 |
udevadm settle |
| 74 |
ts_log "Alignment offsets:" |
| 75 |
cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTPUT 2>> $TS_ERRLOG |
| 76 |
|
| 77 |
|
| 78 |
ts_fdisk_clean $TS_DEVICE |
| 79 |
|
| 80 |
ts_finalize |