Commit fd8f8ede authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

block: export bio_split_rw

bio_split_rw can be used by file systems to split and incoming write
bio into multiple bios fitting the hardware limit for use as ZONE_APPEND
bios.  Export it for initial use in btrfs.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c9a43aaf
...@@ -276,7 +276,7 @@ static bool bvec_split_segs(const struct queue_limits *lim, ...@@ -276,7 +276,7 @@ static bool bvec_split_segs(const struct queue_limits *lim,
* responsible for ensuring that @bs is only destroyed after processing of the * responsible for ensuring that @bs is only destroyed after processing of the
* split bio has finished. * split bio has finished.
*/ */
static struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim, struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
unsigned *segs, struct bio_set *bs, unsigned max_bytes) unsigned *segs, struct bio_set *bs, unsigned max_bytes)
{ {
struct bio_vec bv, bvprv, *bvprvp = NULL; struct bio_vec bv, bvprv, *bvprvp = NULL;
...@@ -336,6 +336,7 @@ static struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim, ...@@ -336,6 +336,7 @@ static struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
bio_clear_polled(bio); bio_clear_polled(bio);
return bio_split(bio, bytes >> SECTOR_SHIFT, GFP_NOIO, bs); return bio_split(bio, bytes >> SECTOR_SHIFT, GFP_NOIO, bs);
} }
EXPORT_SYMBOL_GPL(bio_split_rw);
/** /**
* __bio_split_to_limits - split a bio to fit the queue limits * __bio_split_to_limits - split a bio to fit the queue limits
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#define BIO_MAX_VECS 256U #define BIO_MAX_VECS 256U
struct queue_limits;
static inline unsigned int bio_max_segs(unsigned int nr_segs) static inline unsigned int bio_max_segs(unsigned int nr_segs)
{ {
return min(nr_segs, BIO_MAX_VECS); return min(nr_segs, BIO_MAX_VECS);
...@@ -375,6 +377,8 @@ static inline void bip_set_seed(struct bio_integrity_payload *bip, ...@@ -375,6 +377,8 @@ static inline void bip_set_seed(struct bio_integrity_payload *bip,
void bio_trim(struct bio *bio, sector_t offset, sector_t size); void bio_trim(struct bio *bio, sector_t offset, sector_t size);
extern struct bio *bio_split(struct bio *bio, int sectors, extern struct bio *bio_split(struct bio *bio, int sectors,
gfp_t gfp, struct bio_set *bs); gfp_t gfp, struct bio_set *bs);
struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
unsigned *segs, struct bio_set *bs, unsigned max_bytes);
/** /**
* bio_next_split - get next @sectors from a bio, splitting if necessary * bio_next_split - get next @sectors from a bio, splitting if necessary
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment