Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Mar 8, 2023

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 051b5785bc47ab216fa3db9dceb6184073dcc88a:

Merge branch 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio (2023-03-03 10:46:26 -0700)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 557cfc51068921766e8cd6b242feb4c929cb45ea:

t/zbd: fix minimum write size to sequential write required zones (2023-03-07 12:45:41 -0500)

----------------------------------------------------------------
Shin'ichiro Kawasaki (2):
t/zbd: rename logical_block_size to min_seq_write_size t/zbd: fix minimum write size to sequential write required zones

 t/zbd/functions        | 28 +++++++++++++++++++++++++---
 t/zbd/test-zbd-support | 42 +++++++++++++++++++++---------------------
 2 files changed, 46 insertions(+), 24 deletions(-)

---

Diff of recent changes:

t/zbd/functions +25 -3
index 812320f5..9a6d6999 100644
@@ -238,18 +238,40 @@ max_open_zones() {
     fi
 }
 
+# Get minimum block size to write to seq zones. Refer the sysfs attribute
+# zone_write_granularity which shows the valid minimum size regardless of zoned
+# block device type. If the sysfs attribute is not available, refer physical
+# block size for rotational SMR drives. For non-rotational devices such as ZNS
+# devices, refer logical block size.
+min_seq_write_size() {
+	local sys_path="/sys/block/$1/queue"
+	local -i size=0
+
+	if [[ -r "$sys_path/zone_write_granularity" ]]; then
+		size=$(<"$sys_path/zone_write_granularity")
+	fi
+
+	if ((size)); then
+		echo "$size"
+	elif (($(<"$sys_path/rotational"))); then
+		cat "$sys_path/physical_block_size"
+	else
+		cat "$sys_path/logical_block_size"
+	fi
+}
+
 is_zbc() {
 	local dev=$1
 
 	[[ -z "$(${zbc_info} "$dev" | grep "is not a zoned block device")" ]]
 }
 
-zbc_logical_block_size() {
+zbc_physical_block_size() {
 	local dev=$1
 
 	${zbc_info} "$dev" |
-		grep "logical blocks" |
-		sed -n 's/^[[:blank:]]*[0-9]* logical blocks of[[:blank:]]*//p' |
+		grep "physical blocks" |
+		sed -n 's/^[[:blank:]]*[0-9]* physical blocks of[[:blank:]]*//p' |
 		sed 's/ B//'
 }
 
t/zbd/test-zbd-support +21 -21

144 lines not on this page · raw message