public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Pankaj Raghav <p.raghav@samsung.com>,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH] brd: Remove use of page->index
Date: Fri, 15 Mar 2024 12:23:23 -0600	[thread overview]
Message-ID: <ZfSSG3z0rQffkwGy@kbusch-mbp> (raw)
In-Reply-To: <20240315181212.2573753-1-willy@infradead.org>

On Fri, Mar 15, 2024 at 06:12:09PM +0000, Matthew Wilcox (Oracle) wrote:
>  static struct page *brd_lookup_page(struct brd_device *brd, sector_t sector)
>  {
> -	pgoff_t idx;
> -	struct page *page;
> -
> -	idx = sector >> PAGE_SECTORS_SHIFT; /* sector to page index */
> -	page = xa_load(&brd->brd_pages, idx);
> -
> -	BUG_ON(page && page->index != idx);
> -
> -	return page;
> +	return xa_load(&brd->brd_pages, sector >> PAGE_SECTORS_SHIFT);
>  }
>  
>  /*
> @@ -67,8 +56,8 @@ static struct page *brd_lookup_page(struct brd_device *brd, sector_t sector)
>   */
>  static int brd_insert_page(struct brd_device *brd, sector_t sector, gfp_t gfp)
>  {
> -	pgoff_t idx;
> -	struct page *page, *cur;
> +	pgoff_t idx = sector >> PAGE_SECTORS_SHIFT;
> +	struct page *page;
>  	int ret = 0;
>  
>  	page = brd_lookup_page(brd, sector);

This looks good. Unnecessary suggestion, but since you're already
changing these, might as well replace "sector" with "idx" here and skip
the duplicated shift in brd_lookup_page().

Reviewed-by: Keith Busch <kbusch@kernel.org>

  reply	other threads:[~2024-03-15 18:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 18:12 [PATCH] brd: Remove use of page->index Matthew Wilcox (Oracle)
2024-03-15 18:23 ` Keith Busch [this message]
2024-03-15 18:27   ` Keith Busch
2024-03-15 18:29     ` Matthew Wilcox
2024-03-15 18:27 ` Hannes Reinecke
2024-03-15 23:09 ` Jens Axboe

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=ZfSSG3z0rQffkwGy@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=willy@infradead.org \
    /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