On Thu, Feb 23, 2023 at 12:34:46PM -0700, Uday Shankar wrote:
> I chose to add blk_queue_get_max_segments as a public function because
> it parallels blk_queue_get_max_sectors. If you don't want two functions,
> I could manually inline the (2) uses of blk_rq_get_max_segments(rq),
> converting them
On Wed, Feb 22, 2023 at 12:16:02PM -0700, Keith Busch wrote:
> On Wed, Feb 22, 2023 at 11:52:25AM -0700, Uday Shankar wrote:
> > static inline unsigned int blk_rq_get_max_segments(struct request *rq)
> > {
> > - if (req_op(rq) == REQ_OP_DISCARD)
> > - return
On Wed, Feb 22, 2023 at 11:52:25AM -0700, Uday Shankar wrote:
> static inline unsigned int blk_rq_get_max_segments(struct request *rq)
> {
> - if (req_op(rq) == REQ_OP_DISCARD)
> - return queue_max_discard_segments(rq->q);
> - return queue_max_segments(rq->q);
> + return
The block layer might merge together discard requests up until the
max_discard_segments limit is hit, but blk_insert_cloned_request checks
the segment count against max_segments regardless of the req op. This
can result in errors like the following when discards are issued through
a DM device and