Skip to contentSkip to conversation

ceph/001: skip metrics check if no copyfrom mount option is used

PATCH Superseded Luís Henriques 2 participants 4 messages May 20, 2022 – May 24, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph/001: skip metrics check if no copyfrom mount option is used

Checking the metrics is only valid if 'copyfrom' mount option is explicitly set, otherwise the kernel won't be doing any remote object copies. Fix the logic to skip this metrics checking if 'copyfrom' isn't used.

---
 tests/ceph/001 | 4 ++++
 1 file changed, 4 insertions(+)
tests/ceph/001 +4 -0
index 7970ce352bab..2e6a5e6be2d6 100755
@@ -86,11 +86,15 @@ check_copyfrom_metrics()
 	local copies=$4
 	local c1=$(get_copyfrom_total_copies)
 	local s1=$(get_copyfrom_total_size)
+	local hascopyfrom=$(_fs_options $TEST_DEV | grep "copyfrom")
 	local sum
 
 	if [ ! -d $metrics_dir ]; then
 		return # skip metrics check if debugfs isn't mounted
 	fi
+	if [ -z $hascopyfrom ]; then
+		return # ... or if we don't have copyfrom mount option
+	fi
 
 	sum=$(($c0+$copies))
 	if [ $sum -ne $c1 ]; then
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Luís Henriques

Checking the metrics is only valid if 'copyfrom' mount option is explicitly set, otherwise the kernel won't be doing any remote object copies. Fix the logic to skip this metrics checking if 'copyfrom' isn't used.

---

The code logic looks good to me, but I'm not familiar with cephfs, so if there's not review points or objection from ceph-fs, I'll merge this patch this week.

Thanks,
Zorro

Quoted 24 lines
 tests/ceph/001 | 4 ++++
 1 file changed, 4 insertions(+)
tests/ceph/001 +4 -0
index 7970ce352bab..2e6a5e6be2d6 100755
@@ -86,11 +86,15 @@ check_copyfrom_metrics()
 	local copies=$4
 	local c1=$(get_copyfrom_total_copies)
 	local s1=$(get_copyfrom_total_size)
+	local hascopyfrom=$(_fs_options $TEST_DEV | grep "copyfrom")
 	local sum
 
 	if [ ! -d $metrics_dir ]; then
 		return # skip metrics check if debugfs isn't mounted
 	fi
+	if [ -z $hascopyfrom ]; then
+		return # ... or if we don't have copyfrom mount option
+	fi
 
 	sum=$(($c0+$copies))
 	if [ $sum -ne $c1 ]; then
#2 lore raw
Quoted 20 lines · Zorro Lang
Quoted 7 lines · Luís Henriques

Checking the metrics is only valid if 'copyfrom' mount option is explicitly set, otherwise the kernel won't be doing any remote object copies. Fix the logic to skip this metrics checking if 'copyfrom' isn't used.

---

The code logic looks good to me, but I'm not familiar with cephfs, so if there's not review points or objection from ceph-fs, I'll merge this patch this week.

Thanks,
Zorro

Quoted 3 lines
 tests/ceph/001 | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 9 lines

tests/ceph/001 check_copyfrom_metrics() · line 89

Quoted 9 lines
tests/ceph/001 +1 -0
index 7970ce352bab..2e6a5e6be2d6 100755
@@ -86,11 +86,15 @@ check_copyfrom_metrics()
 	local copies=$4
 	local c1=$(get_copyfrom_total_copies)
 	local s1=$(get_copyfrom_total_size)
+	local hascopyfrom=$(_fs_options $TEST_DEV | grep "copyfrom")

Oh, I forgot to metion that:

I don't know what's the mount option output format at here, can't sure if "grep -w" is needed, or need special pattern.

Quoted 6 lines

tests/ceph/001 check_copyfrom_metrics() · line 95

Quoted 6 lines
tests/ceph/001 +1 -0
 	local sum
 
 	if [ ! -d $metrics_dir ]; then
 		return # skip metrics check if debugfs isn't mounted
 	fi
+	if [ -z $hascopyfrom ]; then

I think better to use quotes ("$hascopyfrom") at here.

Quoted 6 lines
Quoted 6 lines
tests/ceph/001 +2 -0
+		return # ... or if we don't have copyfrom mount option
+	fi
 
 	sum=$(($c0+$copies))
 	if [ $sum -ne $c1 ]; then
#3 lore raw
Quoted 33 lines · Zorro Lang
Quoted 20 lines · Zorro Lang
Quoted 7 lines · Luís Henriques

Checking the metrics is only valid if 'copyfrom' mount option is explicitly set, otherwise the kernel won't be doing any remote object copies. Fix the logic to skip this metrics checking if 'copyfrom' isn't used.

---

The code logic looks good to me, but I'm not familiar with cephfs, so if there's not review points or objection from ceph-fs, I'll merge this patch this week.

Thanks,
Zorro

Quoted 3 lines
 tests/ceph/001 | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 9 lines

tests/ceph/001 check_copyfrom_metrics() · line 89

Quoted 9 lines
tests/ceph/001 +1 -0
index 7970ce352bab..2e6a5e6be2d6 100755
@@ -86,11 +86,15 @@ check_copyfrom_metrics()
 	local copies=$4
 	local c1=$(get_copyfrom_total_copies)
 	local s1=$(get_copyfrom_total_size)
+	local hascopyfrom=$(_fs_options $TEST_DEV | grep "copyfrom")

Oh, I forgot to metion that:

Quoted 2 lines

I don't know what's the mount option output format at here, can't sure if "grep -w" is needed, or need special pattern.

I don't think there's a need for the '-w' here; the mount option is exactly that string:

192.168.155.1:40768:/ on /mnt type ceph (rw,relatime,name=user,secret=<hidden>,acl,copyfrom)

Quoted 8 lines
Quoted 6 lines

tests/ceph/001 check_copyfrom_metrics() · line 95

Quoted 6 lines
tests/ceph/001 +1 -0
 	local sum
 
 	if [ ! -d $metrics_dir ]; then
 		return # skip metrics check if debugfs isn't mounted
 	fi
+	if [ -z $hascopyfrom ]; then

I think better to use quotes ("$hascopyfrom") at here.

I'll send v2 with that changed. Thank you for your feedback.

Cheers,

Signature · 1 line
Luís
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
tests/ceph/001 +2 -0
+		return # ... or if we don't have copyfrom mount option
+	fi
 
 	sum=$(($c0+$copies))
 	if [ $sum -ne $c1 ]; then