Thread (9 messages) 9 messages, 4 authors, 2023-12-21
STALE942d

[PATCH 1/2] block: Check REQ_OP_FLUSH in op_is_flush()

From: Song Liu <song@kernel.org>
Date: 2023-12-21 01:27:41
Also in: linux-block
Subsystem: block layer, the rest · Maintainers: Jens Axboe, Linus Torvalds

Upper layer (fs, etc.) may issue flush with something like:

  bio_reset(bio, bdev, REQ_OP_FLUSH);
  bio->bi_end_io = xxx;
  submit_bio(bio);

op_is_flush(bio->bi_opf) should return true for this bio.

Signed-off-by: Song Liu <song@kernel.org>
---
 include/linux/blk_types.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index d5c5e59ddbd2..338423da84ca 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -487,7 +487,8 @@ static inline bool op_is_write(blk_opf_t op)
  */
 static inline bool op_is_flush(blk_opf_t op)
 {
-	return op & (REQ_FUA | REQ_PREFLUSH);
+	return op & (REQ_FUA | REQ_PREFLUSH) ||
+		(op & REQ_OP_MASK) == REQ_OP_FLUSH;
 }
 
 /*
-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help