Linux block layer
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: linux-block@vger.kernel.org, linux-raid@vger.kernel.org
Cc: axboe@kernel.dk, kent.overstreet@linux.dev,
	janpieter.sollie@edpnet.be, colyli@suse.de, bagasdotme@gmail.com,
	Song Liu <song@kernel.org>
Subject: [PATCH 1/2] block: Check REQ_OP_FLUSH in op_is_flush()
Date: Wed, 20 Dec 2023 17:27:14 -0800	[thread overview]
Message-ID: <20231221012715.3048221-2-song@kernel.org> (raw)
In-Reply-To: <20231221012715.3048221-1-song@kernel.org>

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


  reply	other threads:[~2023-12-21  1:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21  1:27 [PATCH 0/2] block, md: Better handle REQ_OP_FLUSH Song Liu
2023-12-21  1:27 ` Song Liu [this message]
2023-12-21  6:12   ` [PATCH 1/2] block: Check REQ_OP_FLUSH in op_is_flush() Christoph Hellwig
2023-12-21  7:53     ` Song Liu
2023-12-21  1:27 ` [PATCH 2/2] md: Use op_is_flush() to check flush bio Song Liu
2023-12-21  3:36 ` [PATCH 0/2] block, md: Better handle REQ_OP_FLUSH Ed Tsai (蔡宗軒)
2023-12-21  5:30   ` Kent Overstreet
2023-12-21  7:56     ` Ed Tsai (蔡宗軒)
2023-12-21 19:19       ` Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231221012715.3048221-2-song@kernel.org \
    --to=song@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bagasdotme@gmail.com \
    --cc=colyli@suse.de \
    --cc=janpieter.sollie@edpnet.be \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox