Lines Matching refs:lim
103 static unsigned int bio_allowed_max_sectors(const struct queue_limits *lim) in bio_allowed_max_sectors() argument
105 return round_down(UINT_MAX, lim->logical_block_size) >> SECTOR_SHIFT; in bio_allowed_max_sectors()
109 const struct queue_limits *lim, in bio_split_discard() argument
119 granularity = max(lim->discard_granularity >> 9, 1U); in bio_split_discard()
122 min(lim->max_discard_sectors, bio_allowed_max_sectors(lim)); in bio_split_discard()
140 ((lim->discard_alignment >> 9) % granularity); in bio_split_discard()
150 const struct queue_limits *lim, in bio_split_write_zeroes() argument
154 if (!lim->max_write_zeroes_sectors) in bio_split_write_zeroes()
156 if (bio_sectors(bio) <= lim->max_write_zeroes_sectors) in bio_split_write_zeroes()
158 return bio_split(bio, lim->max_write_zeroes_sectors, GFP_NOIO, bs); in bio_split_write_zeroes()
170 const struct queue_limits *lim) in get_max_io_size() argument
172 unsigned pbs = lim->physical_block_size >> SECTOR_SHIFT; in get_max_io_size()
173 unsigned lbs = lim->logical_block_size >> SECTOR_SHIFT; in get_max_io_size()
174 unsigned max_sectors = lim->max_sectors, start, end; in get_max_io_size()
176 if (lim->chunk_sectors) { in get_max_io_size()
179 lim->chunk_sectors)); in get_max_io_size()
197 static inline unsigned get_max_segment_size(const struct queue_limits *lim, in get_max_segment_size() argument
200 unsigned long mask = lim->seg_boundary_mask; in get_max_segment_size()
208 return min(mask - offset, (unsigned long)lim->max_segment_size - 1) + 1; in get_max_segment_size()
231 static bool bvec_split_segs(const struct queue_limits *lim, in bvec_split_segs() argument
241 seg_size = get_max_segment_size(lim, bv->bv_page, in bvec_split_segs()
249 if ((bv->bv_offset + total_len) & lim->virt_boundary_mask) in bvec_split_segs()
279 struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim, in bio_split_rw() argument
291 if (bvprvp && bvec_gap_to_prev(lim, bvprvp, bv.bv_offset)) in bio_split_rw()
294 if (nsegs < lim->max_segments && in bio_split_rw()
300 if (bvec_split_segs(lim, &bv, &nsegs, &bytes, in bio_split_rw()
301 lim->max_segments, max_bytes)) in bio_split_rw()
329 bytes = ALIGN_DOWN(bytes, lim->logical_block_size); in bio_split_rw()
355 const struct queue_limits *lim, in __bio_split_to_limits() argument
364 split = bio_split_discard(bio, lim, nr_segs, bs); in __bio_split_to_limits()
367 split = bio_split_write_zeroes(bio, lim, nr_segs, bs); in __bio_split_to_limits()
370 split = bio_split_rw(bio, lim, nr_segs, bs, in __bio_split_to_limits()
371 get_max_io_size(bio, lim) << SECTOR_SHIFT); in __bio_split_to_limits()
403 const struct queue_limits *lim = &bdev_get_queue(bio->bi_bdev)->limits; in bio_split_to_limits() local
406 if (bio_may_exceed_limits(bio, lim)) in bio_split_to_limits()
407 return __bio_split_to_limits(bio, lim, &nr_segs); in bio_split_to_limits()