From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86C61C4361B for ; Thu, 17 Dec 2020 12:12:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E5C83238EF for ; Thu, 17 Dec 2020 12:12:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5C83238EF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 227896B0068; Thu, 17 Dec 2020 07:12:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D7816B006C; Thu, 17 Dec 2020 07:12:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0ECC66B006E; Thu, 17 Dec 2020 07:12:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id E8E336B0068 for ; Thu, 17 Dec 2020 07:12:52 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AB26C8249980 for ; Thu, 17 Dec 2020 12:12:52 +0000 (UTC) X-FDA: 77602662984.19.soap80_2e12cb827434 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 8B95F1AD1B7 for ; Thu, 17 Dec 2020 12:12:52 +0000 (UTC) X-HE-Tag: soap80_2e12cb827434 X-Filterd-Recvd-Size: 3450 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Dec 2020 12:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=3NOq2HRM/zQR+du5IkXzjx0QWJZ13uHg9Yb/LeK0CWE=; b=pm8QvwY7Q1MhDBoMofSnx/S3f6 Vx5bKTtq/b0P+T11NZcf529UhTTfJIL9UXGGa6MprW9Vh6zPnFOEQBfUrHAWtqGZ8yLlnGtRyVWDP CicIeUfr1MmuRD/iRYsnlfz8N7f8i8Uxa28MGyos8E7qz4bkxMwvOVeAZMuDb/HGmyFIaUhP4t8ga wiZ2YtxcVE1AeMeukqHapi6Hyj1G0TJf1n58/yHV+eIhQo8P40ZQUQJ5y6XfcGyc3HDtw5qwbLh1m JyziCZhQoihHnSjeSob32qioA2mkrWubK8ZjFMH8P5OnLkeXgqitdOpurr1CzGhPx7LqCTjPGo0Is oplreC6g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kps9G-0000gM-4F; Thu, 17 Dec 2020 12:12:46 +0000 Date: Thu, 17 Dec 2020 12:12:46 +0000 From: Matthew Wilcox To: John Hubbard Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 18/25] btrfs: Use readahead_batch_length Message-ID: <20201217121246.GD15600@casper.infradead.org> References: <20201216182335.27227-1-willy@infradead.org> <20201216182335.27227-19-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Dec 17, 2020 at 01:15:10AM -0800, John Hubbard wrote: > On 12/16/20 10:23 AM, Matthew Wilcox (Oracle) wrote: > > Implement readahead_batch_length() to determine the number of bytes in > > the current batch of readahead pages and use it in btrfs. > > > > Signed-off-by: Matthew Wilcox (Oracle) > > --- > > fs/btrfs/extent_io.c | 6 ++---- > > include/linux/pagemap.h | 9 +++++++++ > > 2 files changed, 11 insertions(+), 4 deletions(-) > > > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > > index 6e3b72e63e42..42936a83a91b 100644 > > --- a/fs/btrfs/extent_io.c > > +++ b/fs/btrfs/extent_io.c > > @@ -4436,10 +4436,8 @@ void extent_readahead(struct readahead_control *rac) > > int nr; > > while ((nr = readahead_page_batch(rac, pagepool))) { > > - u64 contig_start = page_offset(pagepool[0]); > > - u64 contig_end = page_offset(pagepool[nr - 1]) + PAGE_SIZE - 1; > > - > > - ASSERT(contig_start + nr * PAGE_SIZE - 1 == contig_end); > > + u64 contig_start = readahead_pos(rac); > > + u64 contig_end = contig_start + readahead_batch_length(rac); > > Something in this tiny change is breaking btrfs: it hangs my Fedora 33 test > system (which changed over to btrfs) on boot. I haven't quite figured out > what's really wrong, but git bisect lands here, *and* turning the whole > extent_readahead() function into a no-op (on top of the whole series) > allows everything to work once again. > > Sorry for not actually solving the root cause, but I figured you'd be able > to jump straight to the answer, with the above information, so I'm sending > it out early. ehh ... probably an off-by-one. Does subtracting 1 from contig_end fix it? I'll spool up a test VM shortly and try it out.