Skip to content

Commit

Permalink
block: move bio_full out of bio.h
Browse files Browse the repository at this point in the history
bio_full is only used in bio.c, so move it there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211012161804.991559-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Oct 18, 2021
1 parent b6559d8 commit 9a6083b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
17 changes: 17 additions & 0 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,23 @@ const char *bio_devname(struct bio *bio, char *buf)
}
EXPORT_SYMBOL(bio_devname);

/**
* bio_full - check if the bio is full
* @bio: bio to check
* @len: length of one segment to be added
*
* Return true if @bio is full and one segment with @len bytes can't be
* added to the bio, otherwise return false
*/
static inline bool bio_full(struct bio *bio, unsigned len)
{
if (bio->bi_vcnt >= bio->bi_max_vecs)
return true;
if (bio->bi_iter.bi_size > UINT_MAX - len)
return true;
return false;
}

static inline bool page_is_mergeable(const struct bio_vec *bv,
struct page *page, unsigned int len, unsigned int off,
bool *same_page)
Expand Down
19 changes: 0 additions & 19 deletions include/linux/bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,6 @@ static inline void *bio_data(struct bio *bio)
return NULL;
}

/**
* bio_full - check if the bio is full
* @bio: bio to check
* @len: length of one segment to be added
*
* Return true if @bio is full and one segment with @len bytes can't be
* added to the bio, otherwise return false
*/
static inline bool bio_full(struct bio *bio, unsigned len)
{
if (bio->bi_vcnt >= bio->bi_max_vecs)
return true;

if (bio->bi_iter.bi_size > UINT_MAX - len)
return true;

return false;
}

static inline bool bio_next_segment(const struct bio *bio,
struct bvec_iter_all *iter)
{
Expand Down

0 comments on commit 9a6083b

Please sign in to comment.