diff options
author | Christoph Hellwig <hch@lst.de> | 2024-11-04 09:26:31 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-09 15:33:32 +0300 |
commit | 2cf5d691f849be1a9474ac43190676f0dd5b151d (patch) | |
tree | dfa44f5ca32dd44a7f800ca20fecb5511bfb73ef /include | |
parent | 92bd18c74624e5eb9f96e70076aa46293f4b626f (diff) | |
download | linux-2cf5d691f849be1a9474ac43190676f0dd5b151d.tar.xz |
block: lift bio_is_zone_append to bio.h
[ Upstream commit 0ef2b9e698dbf9ba78f67952a747f35eb7060470 ]
Make bio_is_zone_append globally available, because file systems need
to use to check for a zone append bio in their end_io handlers to deal
with the block layer emulation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20241104062647.91160-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 6c3864e05548 ("btrfs: use bio_is_zone_append() in the completion handler")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bio.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index faceadb040f9..66b7620a1b53 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -677,6 +677,23 @@ static inline void bio_clear_polled(struct bio *bio) bio->bi_opf &= ~REQ_POLLED; } +/** + * bio_is_zone_append - is this a zone append bio? + * @bio: bio to check + * + * Check if @bio is a zone append operation. Core block layer code and end_io + * handlers must use this instead of an open coded REQ_OP_ZONE_APPEND check + * because the block layer can rewrite REQ_OP_ZONE_APPEND to REQ_OP_WRITE if + * it is not natively supported. + */ +static inline bool bio_is_zone_append(struct bio *bio) +{ + if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED)) + return false; + return bio_op(bio) == REQ_OP_ZONE_APPEND || + bio_flagged(bio, BIO_EMULATES_ZONE_APPEND); +} + struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev, unsigned int nr_pages, blk_opf_t opf, gfp_t gfp); struct bio *bio_chain_and_submit(struct bio *prev, struct bio *new); |