Skip to contentSkip to conversation

blk_types.h: Use REQ_OP_WRITE in op_is_write

PATCH In review Marcos Paulo de Souza 2 participants 3 messages Dec 22, 2018 – Jan 11, 2019 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk_types.h: Use REQ_OP_WRITE in op_is_write

Instead of just using plain '1', as it improves readability.

---
 include/linux/blk_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blk_types.h +1 -1
index 1dcf652ba0aa..905c666a0101 100644
@@ -377,7 +377,7 @@ static inline void bio_set_op_attrs(struct bio *bio, unsigned op,
 
 static inline bool op_is_write(unsigned int op)
 {
-	return (op & 1);
+	return (op & REQ_OP_WRITE);
 }
 
 /*
Signature · 1 line
2.16.4
#1 lore raw

ping?

Quoted 23 lines · Marcos Paulo de Souza

Instead of just using plain '1', as it improves readability.

---
 include/linux/blk_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blk_types.h +1 -1
index 1dcf652ba0aa..905c666a0101 100644
@@ -377,7 +377,7 @@ static inline void bio_set_op_attrs(struct bio *bio, unsigned op,
 
 static inline bool op_is_write(unsigned int op)
 {
-	return (op & 1);
+	return (op & REQ_OP_WRITE);
 }
 
 /*
Signature · 1 line
2.16.4
Signature · 2 lines
Thanks,
Marcos
#2 lore raw
In reply to Marcos Paulo de Souza
Quoted 12 lines · Marcos Paulo de Souza

Instead of just using plain '1', as it improves readability.

---
 include/linux/blk_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blk_types.h +0 -0
index 1dcf652ba0aa..905c666a0101 100644

include/linux/blk_types.h static inline void bio_set_op_attrs(struct bio *bio, unsigned op, · line 383

Quoted 8 lines
include/linux/blk_types.h +1 -1
@@ -377,7 +377,7 @@ static inline void bio_set_op_attrs(struct bio *bio, unsigned op,
 
 static inline bool op_is_write(unsigned int op)
 {
-	return (op & 1);
+	return (op & REQ_OP_WRITE);
 }
 
 /*

Nak. Conceptually, an operation is a write if the least significant bit is set. The 1 here doesn't mean REQ_OP_WRITE, it means the least significant bit.