Skip to contentSkip to conversation

bcachefs: Remove duplicate condition in return statement

PATCH In review Thorsten Blum 2 participants 3 messages Feb 22, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: Remove duplicate condition in return statement

The last two conditions in the return statement are identical. Remove one of them.

---
 fs/bcachefs/extents.h | 1 -
 1 file changed, 1 deletion(-)
fs/bcachefs/extents.h +0 -1
index 620b284aa34f..8afcf2c75015 100644
@@ -703,7 +703,6 @@ static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1,
 	return (ptr1.cached	== ptr2.cached &&
 		ptr1.unwritten	== ptr2.unwritten &&
 		ptr1.offset	== ptr2.offset &&
-		ptr1.dev	== ptr2.dev &&
 		ptr1.dev	== ptr2.dev);
 }
 
Signature · 1 line
2.48.1
#1 lore raw
Quoted 13 lines · Thorsten Blum

The last two conditions in the return statement are identical. Remove one of them.

---
 fs/bcachefs/extents.h | 1 -
 1 file changed, 1 deletion(-)
fs/bcachefs/extents.h +0 -0
index 620b284aa34f..8afcf2c75015 100644

fs/bcachefs/extents.h static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1, · line 706

Quoted 5 lines
fs/bcachefs/extents.h +0 -1
@@ -703,7 +703,6 @@ static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1,
 	return (ptr1.cached	== ptr2.cached &&
 		ptr1.unwritten	== ptr2.unwritten &&
 		ptr1.offset	== ptr2.offset &&
-		ptr1.dev	== ptr2.dev &&
 		ptr1.dev	== ptr2.dev);

Actually should have been checking gen:

From b0e5e78f7e890c48b69e24d19e82597daa2d9cf0 Mon Sep 17 00:00:00 2001
From: Kent Overstreet <[email protected]>
Date: Sat, 22 Feb 2025 09:05:36 -0500
Subject: [PATCH] bcachefs: fix bch2_extent_ptr_eq()

fs/bcachefs/extents.h +1 -1
index 8fae6b23a341..ed160aaa9546 100644
@@ -704,7 +704,7 @@ static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1,
 		ptr1.unwritten	== ptr2.unwritten &&
 		ptr1.offset	== ptr2.offset &&
 		ptr1.dev	== ptr2.dev &&
-		ptr1.dev	== ptr2.dev);
+		ptr1.gen	== ptr2.gen);
 }
 
 void bch2_ptr_swab(struct bkey_s);
author Reviewed-by
#2 lore raw
Quoted 34 lines · Kent Overstreet
Quoted 13 lines · Thorsten Blum

The last two conditions in the return statement are identical. Remove one of them.

---
fs/bcachefs/extents.h | 1 -

1 file changed, 1 deletion(-)
fs/bcachefs/extents.h +0 -0
index 620b284aa34f..8afcf2c75015 100644

fs/bcachefs/extents.h static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1, · line 707

Quoted 6 lines
fs/bcachefs/extents.h +0 -1
@@ -703,7 +703,6 @@ static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1,
 	return (ptr1.cached	== ptr2.cached &&
 		ptr1.unwritten	== ptr2.unwritten &&
 		ptr1.offset	== ptr2.offset &&
-		ptr1.dev	== ptr2.dev &&
 		ptr1.dev	== ptr2.dev);
 

Actually should have been checking gen:

From b0e5e78f7e890c48b69e24d19e82597daa2d9cf0 Mon Sep 17 00:00:00 2001
From: Kent Overstreet <[email protected]>
Date: Sat, 22 Feb 2025 09:05:36 -0500
Subject: [PATCH] bcachefs: fix bch2_extent_ptr_eq()

fs/bcachefs/extents.h +0 -0
index 8fae6b23a341..ed160aaa9546 100644

fs/bcachefs/extents.h static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1, · line 710

Quoted 8 lines
fs/bcachefs/extents.h +1 -1
@@ -704,7 +704,7 @@ static inline bool bch2_extent_ptr_eq(struct bch_extent_ptr ptr1,
 		ptr1.unwritten	== ptr2.unwritten &&
 		ptr1.offset	== ptr2.offset &&
 		ptr1.dev	== ptr2.dev &&
-		ptr1.dev	== ptr2.dev);
+		ptr1.gen	== ptr2.gen);
 }
 
 void bch2_ptr_swab(struct bkey_s);

Thanks, I was about to ask if it should have been gen instead.

Feel free to add: