Skip to content

Commit 0ef2b9e

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: lift bio_is_zone_append to bio.h
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 <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 7ecd2cd commit 0ef2b9e

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

block/blk.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,6 @@ static inline bool bio_zone_write_plugging(struct bio *bio)
457457
{
458458
return bio_flagged(bio, BIO_ZONE_WRITE_PLUGGING);
459459
}
460-
static inline bool bio_is_zone_append(struct bio *bio)
461-
{
462-
return bio_op(bio) == REQ_OP_ZONE_APPEND ||
463-
bio_flagged(bio, BIO_EMULATES_ZONE_APPEND);
464-
}
465460
void blk_zone_write_plug_bio_merged(struct bio *bio);
466461
void blk_zone_write_plug_init_request(struct request *rq);
467462
static inline void blk_zone_update_request_bio(struct request *rq,
@@ -510,10 +505,6 @@ static inline bool bio_zone_write_plugging(struct bio *bio)
510505
{
511506
return false;
512507
}
513-
static inline bool bio_is_zone_append(struct bio *bio)
514-
{
515-
return false;
516-
}
517508
static inline void blk_zone_write_plug_bio_merged(struct bio *bio)
518509
{
519510
}

include/linux/bio.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,23 @@ static inline void bio_clear_polled(struct bio *bio)
675675
bio->bi_opf &= ~REQ_POLLED;
676676
}
677677

678+
/**
679+
* bio_is_zone_append - is this a zone append bio?
680+
* @bio: bio to check
681+
*
682+
* Check if @bio is a zone append operation. Core block layer code and end_io
683+
* handlers must use this instead of an open coded REQ_OP_ZONE_APPEND check
684+
* because the block layer can rewrite REQ_OP_ZONE_APPEND to REQ_OP_WRITE if
685+
* it is not natively supported.
686+
*/
687+
static inline bool bio_is_zone_append(struct bio *bio)
688+
{
689+
if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED))
690+
return false;
691+
return bio_op(bio) == REQ_OP_ZONE_APPEND ||
692+
bio_flagged(bio, BIO_EMULATES_ZONE_APPEND);
693+
}
694+
678695
struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev,
679696
unsigned int nr_pages, blk_opf_t opf, gfp_t gfp);
680697
struct bio *bio_chain_and_submit(struct bio *prev, struct bio *new);

0 commit comments

Comments
 (0)