linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@gmail.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, linux-raid@vger.kernel.org,
	linux-block@vger.kernel.org, axboe@kernel.dk
Cc: Kent Overstreet <kent.overstreet@gmail.com>,
	alexander.h.duyck@linux.intel.com
Subject: [PATCH 5/5] brd: Kill usage of page->index
Date: Wed, 13 Oct 2021 12:00:34 -0400	[thread overview]
Message-ID: <20211013160034.3472923-6-kent.overstreet@gmail.com> (raw)
In-Reply-To: <20211013160034.3472923-1-kent.overstreet@gmail.com>

As part of the struct page cleanups underway, we want to remove as much
usage of page->mapping and page->index as possible, as frequently they
are known from context.

In the brd code, we're never actually reading from page->index except in
assertions, so references to it can be safely deleted.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 drivers/block/brd.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 58ec167aa0..0a55aed832 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -72,8 +72,6 @@ static struct page *brd_lookup_page(struct brd_device *brd, sector_t sector)
 	page = radix_tree_lookup(&brd->brd_pages, idx);
 	rcu_read_unlock();
 
-	BUG_ON(page && page->index != idx);
-
 	return page;
 }
 
@@ -108,12 +106,10 @@ static struct page *brd_insert_page(struct brd_device *brd, sector_t sector)
 
 	spin_lock(&brd->brd_lock);
 	idx = sector >> PAGE_SECTORS_SHIFT;
-	page->index = idx;
 	if (radix_tree_insert(&brd->brd_pages, idx, page)) {
 		__free_page(page);
 		page = radix_tree_lookup(&brd->brd_pages, idx);
 		BUG_ON(!page);
-		BUG_ON(page->index != idx);
 	} else {
 		brd->brd_nr_pages++;
 	}
-- 
2.33.0


  parent reply	other threads:[~2021-10-13 16:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 16:00 [PATCH 0/5] Minor mm/struct page work Kent Overstreet
2021-10-13 16:00 ` [PATCH 1/5] mm: Make free_area->nr_free per migratetype Kent Overstreet
2021-10-13 16:33   ` David Hildenbrand
2021-10-14 14:45     ` Kent Overstreet
2021-10-18  7:44       ` Vlastimil Babka
2021-10-15  8:24   ` [mm] 1609369623: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2021-10-13 16:00 ` [PATCH 2/5] mm: Introduce struct page_free_list Kent Overstreet
2021-10-13 16:00 ` [PATCH 3/5] mm/page_reporting: Improve control flow Kent Overstreet
2021-10-13 16:00 ` [PATCH 4/5] md: Kill usage of page->index Kent Overstreet
2021-10-14  8:02   ` Guoqing Jiang
2021-10-14  8:58     ` heming.zhao
2021-10-14 14:30       ` [PATCH v2] " Kent Overstreet
2021-10-15  3:01         ` Guoqing Jiang
2021-10-15  8:59           ` heming.zhao
2021-10-13 16:00 ` Kent Overstreet [this message]
2021-10-14 14:27   ` [PATCH 5/5] brd: " Matthew Wilcox
2021-10-14 15:09   ` David Hildenbrand

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=20211013160034.3472923-6-kent.overstreet@gmail.com \
    --to=kent.overstreet@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-raid@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).