linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH] block: fix splitting segments
Date: Wed, 8 Jan 2020 06:02:48 -0800	[thread overview]
Message-ID: <20200108140248.GA2896@infradead.org> (raw)
In-Reply-To: <20191229023230.28940-1-ming.lei@redhat.com>

> +static inline unsigned get_max_segment_size(const struct request_queue *q,
> +					    const struct page *start_page,
> +					    unsigned long offset)
>  {
>  	unsigned long mask = queue_segment_boundary(q);
>  
> -	/* default segment boundary mask means no boundary limit */
> -	if (mask == BLK_SEG_BOUNDARY_MASK)
> -		return queue_max_segment_size(q);
> -
> -	return min_t(unsigned long, mask - (mask & offset) + 1,
> +	offset = mask & (page_to_phys(start_page) + offset);

This looks weird and potentionaly incorrect - once you add the offset
to page_phys it really isn't an offset anymore and should be in a
variable named paddr or similar.  And that needs to use a phys_addr_t
as we can have 32-bit architectures that use 64-bit physical addresses.

I'd also pass in the actual phys_addr_t instead of the page and offset.

  parent reply	other threads:[~2020-01-08 14:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-29  2:32 [PATCH] block: fix splitting segments Ming Lei
2019-12-29 16:14 ` Jens Axboe
2019-12-30  1:15   ` Bart Van Assche
2019-12-30  1:25     ` Ming Lei
2020-01-07 12:47 ` Guenter Roeck
2020-01-07 15:23   ` Ming Lei
2020-01-07 18:11     ` Guenter Roeck
2020-01-07 22:30       ` Ming Lei
2020-01-07 22:32         ` Jens Axboe
2020-01-08  1:59           ` Ming Lei
2020-01-08  2:36             ` Jens Axboe
2020-01-07 23:06         ` Guenter Roeck
2020-01-08 14:02 ` Christoph Hellwig [this message]
2020-01-09  2:03   ` Ming Lei
2020-01-09  7:16     ` Christoph Hellwig
2020-01-09 15:18       ` Jens Axboe
2020-01-10  2:58         ` Ming Lei
2020-01-10  3:00           ` Ming Lei
2020-01-10  5:10             ` Guenter Roeck
2020-01-10  6:37               ` Ming Lei
2020-01-10  7:15                 ` Ming Lei
2020-01-10 12:48                   ` Guenter Roeck
2020-01-10 12:36                 ` Guenter Roeck
2020-01-11 12:57                   ` Ming Lei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200108140248.GA2896@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).