block: Allow using bio_attempt_back_merge() internally
authorDamien Le Moal <dlemoal@kernel.org>
Mon, 8 Apr 2024 01:41:05 +0000 (10:41 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 17 Apr 2024 14:44:02 +0000 (08:44 -0600)
Remove "static" from the definition of bio_attempt_back_merge() and
declare this function in block/blk.h to allow using it internally from
other block layer files. The definition of enum bio_merge_status is
also moved to block/blk.h.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Hans Holmberg <hans.holmberg@wdc.com>
Tested-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240408014128.205141-6-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-merge.c
block/blk.h

index 4e3483a16b7575ec1d6f1cf9b92ebc7dfca1e9e5..3363b13219082274c17681d528af9ef55e4a219a 100644 (file)
@@ -972,13 +972,7 @@ static void blk_account_io_merge_bio(struct request *req)
        part_stat_unlock();
 }
 
-enum bio_merge_status {
-       BIO_MERGE_OK,
-       BIO_MERGE_NONE,
-       BIO_MERGE_FAILED,
-};
-
-static enum bio_merge_status bio_attempt_back_merge(struct request *req,
+enum bio_merge_status bio_attempt_back_merge(struct request *req,
                struct bio *bio, unsigned int nr_segs)
 {
        const blk_opf_t ff = bio_failfast(bio);
index 17786052f32dedafda858658fa8cc1d28b360ddf..bca50a9510c80cf1f138e19648cb49499787f22c 100644 (file)
@@ -269,6 +269,14 @@ static inline void bio_integrity_free(struct bio *bio)
 unsigned long blk_rq_timeout(unsigned long timeout);
 void blk_add_timer(struct request *req);
 
+enum bio_merge_status {
+       BIO_MERGE_OK,
+       BIO_MERGE_NONE,
+       BIO_MERGE_FAILED,
+};
+
+enum bio_merge_status bio_attempt_back_merge(struct request *req,
+               struct bio *bio, unsigned int nr_segs);
 bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
                unsigned int nr_segs);
 bool blk_bio_list_merge(struct request_queue *q, struct list_head *list,