block: use enumerate instead of integer in op_is_write()
PATCH 1/1 block: use enumerate instead of integer in op_is_write()
From: Chunguang Xu <[email protected]>
For mask operation, using enumerate may be safer than integer.
Signed-off-by Chunguang Xu <[email protected]>
--- include/linux/blk_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blk_types.h +1 -1
@@ -447,7 +447,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
1.8.3.1
Quoted 3 lines · brookxu
From: Chunguang Xu <[email protected]>
For mask operation, using enumerate may be safer than integer.
Except that we are explicitly checking for least significant bit as that is part of the encoding, not a specific enum value.