From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.137.202.133 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796025814; b=S5mcS38KUBc5id8UQ5JvsrIPsXJOnyX9q5155L8vExb0+xeXnNlGup3W/jIcKNvIhmcI CJC+o0ZlFdY84XSPq5q2bo+G0MtMo8MMPpUJUX58w4xWrMahVM9P8kshVx/KWuP7OPZes JPsscHOhjqpffI88ablbtW/jl6jpqa24bppJ8m5OgiL0bp9BtDMnXm5reYeGgjBAkL5Rw Q8uSrhTpfDrFfMBTSz7kyIAd/qPXakSOIbvKRsDcZWK+0qxTSQ9xq2bXktkPAxrmNmEV/ mPGxSD41wRFzDsA8RURPUpARIYI31Gkwz9rI6OiuebHKi/pJj69sQi93FoUG1rUGn0w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796025814; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To:X-SRS-Rewrite; bh=FCrkxB4+lfDKw4HHfac/oo0GZiRkq70Mjqyhi0evzf0=; b=QIz0/Uw6Ab4kIozAQc4IwA/DvowVfvaZbYf+cmfWffkneijavNz5/YTBkIdcSdZhnvQU VALRkFsRQEaef1qlISzDWzw/EAfbd2i6MFuu+Wxb0SQxh4HNMYSkS2VsEg9V3RDd2f2Yf +I7XvZ9xvnZr5h8eFixblq0lcEKkuOztt28hJ9g/ylgTzfiqF3vE26CcFkIQA/k3EIvkp 9RFupVJSA+NMw2TEOlGRaV36VX5/G+sRJwd1MIq9tObcp2jMP/LeyYzFHIqrWasjwQtAU rQ298bEt1eisjXz4nMS9DN5s0GFFoXgcwnDfGCrk0wlbOJhdp1sT/FTjqIVv/S59Tng== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QkdRnuFH; arc=none smtp.remote-ip=198.137.202.133 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 702E4606A33C for ; Mon, 30 Nov 2026 08:03:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 702E4606A33C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QkdRnuFH DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FCrkxB4+lfDKw4HHfac/oo0GZiRkq70Mjqyhi0evzf0=; b=QkdRnuFHV/ppWOlITm+RG6M+Ac T13OaQPpqjqyCbVTZvPvpig2nCulpmzFLCwAd78VwaenWgRaLj1U3Yzhwc0gQWg0m52O5ewPgBH06 FFzwBVPW85DhY7YHjXAVFInaTM3zq0P/hOOPdHKYSTqCfirxVSlSDCBTTWCpj1Kztb0kZ3IklZ0rz YHCDqemUTFchWo1DmnGobB9NYTiBwXurXyGlqVGRr3da2ErOfEYzgGG2f/apkAwJwb+C8+9M2IcRx aE/afIIDWSHdn2eSvIIrSqiMVJS5g2Eaf3B6PxiXC/kH7poC8iHLcc09CrKEH1zY+IcSroJOoHLZ6 1BgQVfPA==; Received: from hch by bombadil.infradead.org with local (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXwMG-00000003gU1-4AE6; Mon, 30 Nov 2026 08:03:32 +0000 Date: Mon, 30 Nov 2026 00:03:32 -0800 From: Christoph Hellwig To: Nilay Vaish Cc: Jens Axboe , Christoph Hellwig , Bart Van Assche , linux-block@vger.kernel.org Subject: Re: [PATCH v2 2/2] null_blk: stop storing the page index in page->private Message-ID: References: <20261126212341.916839-1-nilayvaish@google.com> <20261126212341.916839-3-nilayvaish@google.com> X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261126212341.916839-3-nilayvaish@google.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Thu, Nov 26, 2026 at 01:23:41PM -0800, Nilay Vaish wrote: > Each backing page records its own index in page->private. The index was > only needed because radix_tree_gang_lookup() returns entries without > their indices. The XArray iteration provides the index, and every other > user already has it at hand. > > Take the index from the iteration when flushing the cache, pass it to > null_flush_cache_page(), and drop the copy kept in the page together > with the sanity checks that compared it with the lookup index. > > null_blk no longer uses page->private. > > Suggested-by: Christoph Hellwig > Signed-off-by: Nilay Vaish > --- > > Notes: > These patches were written with the help of an AI coding assistant (Gemini). > > drivers/block/null_blk/main.c | 24 ++++++++++-------------- > 1 file changed, 10 insertions(+), 14 deletions(-) > > diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c > index e073eca48655..299cf57b1c12 100644 > --- a/drivers/block/null_blk/main.c > +++ b/drivers/block/null_blk/main.c > @@ -961,8 +961,6 @@ static struct nullb_page *__null_lookup_page(struct nullb *nullb, > > xa = is_cache ? &nullb->dev->cache : &nullb->dev->data; > t_page = xa_load(xa, idx); > - WARN_ON(t_page && t_page->page->private != idx); > - > if (t_page && (for_write || test_bit(sector_bit, t_page->bitmap))) > return t_page; > > @@ -1000,7 +998,6 @@ static struct nullb_page *null_insert_page(struct nullb *nullb, > t_page = null_alloc_page(); > if (!t_page) > goto out_lock; > - t_page->page->private = idx; > > /* > * The store has to happen under nullb->lock, where it cannot sleep. > @@ -1026,7 +1023,6 @@ static struct nullb_page *null_insert_page(struct nullb *nullb, > if (cur) { > /* Somebody else inserted a page while the lock was dropped. */ > null_free_page(t_page); > - WARN_ON(cur->page->private != idx); > return cur; > } > if (!ignore_cache) > @@ -1040,17 +1036,15 @@ static struct nullb_page *null_insert_page(struct nullb *nullb, > return null_lookup_page(nullb, sector, true, ignore_cache); > } > > -static int null_flush_cache_page(struct nullb *nullb, struct nullb_page *c_page) > +static int null_flush_cache_page(struct nullb *nullb, struct nullb_page *c_page, > + unsigned long idx) > { > int i; > unsigned int offset; > - u64 idx; > struct nullb_page *t_page; > void *dst, *src; > > - idx = c_page->page->private; > - > - t_page = null_insert_page(nullb, idx << PAGE_SECTORS_SHIFT, true); > + t_page = null_insert_page(nullb, (sector_t)idx << PAGE_SECTORS_SHIFT, true); Overly long line.