dm-queue-length

dm-queue-length 是一個用於裝置對映器目標(device-mapper targets)的路徑選擇器模組,它選擇飛行中 I/O 數量最少的路徑。此路徑選擇器的名稱是“queue-length”。

每個路徑的表引數:[<repeat_count>]

<repeat_count>: The number of I/Os to dispatch using the selected
                path before switching to the next path.
                If not given, internal default is used. To check
                the default value, see the activated table.

每個路徑的狀態:<status> <fail-count> <in-flight>

<status>: 'A' if the path is active, 'F' if the path is failed.
<fail-count>: The number of path failures.
<in-flight>: The number of in-flight I/Os on the path.

演算法

dm-queue-length 在 I/O 分派/完成時分別增加/減少“in-flight”計數。dm-queue-length 選擇“in-flight”計數最小的路徑。

示例

當使用兩條路徑(sda 和 sdb)且 repeat_count == 128 時。

# echo "0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128" \
  dmsetup create test
#
# dmsetup table
test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128
#
# dmsetup status
test: 0 10 multipath 2 0 0 0 1 1 E 0 2 1 8:0 A 0 0 8:16 A 0 0