Lines Matching refs:bio
2940 static void end_bio_bh_io_sync(struct bio *bio) in end_bio_bh_io_sync() argument
2942 struct buffer_head *bh = bio->bi_private; in end_bio_bh_io_sync()
2944 if (unlikely(bio_flagged(bio, BIO_QUIET))) in end_bio_bh_io_sync()
2947 bh->b_end_io(bh, !bio->bi_error); in end_bio_bh_io_sync()
2948 bio_put(bio); in end_bio_bh_io_sync()
2963 void guard_bio_eod(int rw, struct bio *bio) in guard_bio_eod() argument
2966 struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1]; in guard_bio_eod()
2969 maxsector = i_size_read(bio->bi_bdev->bd_inode) >> 9; in guard_bio_eod()
2978 if (unlikely(bio->bi_iter.bi_sector >= maxsector)) in guard_bio_eod()
2981 maxsector -= bio->bi_iter.bi_sector; in guard_bio_eod()
2982 if (likely((bio->bi_iter.bi_size >> 9) <= maxsector)) in guard_bio_eod()
2986 truncated_bytes = bio->bi_iter.bi_size - (maxsector << 9); in guard_bio_eod()
2989 bio->bi_iter.bi_size -= truncated_bytes; in guard_bio_eod()
3002 struct bio *bio; in submit_bh_wbc() local
3020 bio = bio_alloc(GFP_NOIO, 1); in submit_bh_wbc()
3023 wbc_init_bio(wbc, bio); in submit_bh_wbc()
3027 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); in submit_bh_wbc()
3028 bio->bi_bdev = bh->b_bdev; in submit_bh_wbc()
3030 bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); in submit_bh_wbc()
3031 BUG_ON(bio->bi_iter.bi_size != bh->b_size); in submit_bh_wbc()
3033 bio->bi_end_io = end_bio_bh_io_sync; in submit_bh_wbc()
3034 bio->bi_private = bh; in submit_bh_wbc()
3035 bio->bi_flags |= bio_flags; in submit_bh_wbc()
3038 guard_bio_eod(rw, bio); in submit_bh_wbc()
3045 submit_bio(rw, bio); in submit_bh_wbc()