Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1362467pxy; Fri, 23 Apr 2021 06:30:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ19gGTAmc58PqUNqUabxtikmUMH5nmjArFkVUZQ3Fk1uD2qRflIWteFNwyvebiquIqP68 X-Received: by 2002:a17:906:6683:: with SMTP id z3mr4319339ejo.390.1619184617532; Fri, 23 Apr 2021 06:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619184617; cv=none; d=google.com; s=arc-20160816; b=OvvZmaEgEXVBhJFF/LCKXagkZ5v3voRcCeB+zmSMxTPpFO8ckRrBYvP6j2hNSVyiZi a3wZA4RdMZM7TYQhX9vSOVEB77n3yQEWQJQQpv5uSfZwWgC9uOsXRnIaANuxRrJM28Qf JaJW1CyTv7xdZls9AloBmJtSzjmac/dbFdBZjZ8FByX4r+UFcQw65vvjX6+H+tn3H+uu Ia7UGERZgaf2vadaGt4UNcFUFie0aCb+QCdw5u0fQFhWz63Y9fjfCmwpzLoXhndpORqw R3FhQ+bhZUfwQC0mGsd3pr9hCKTm09eGFHU0Ez2NkDsztyv24nWqHce7cIlscgqpKTaH 4T1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=claGAAAwAkYoHJ+sqsBkV8q9uRfXIUJw7gSPqT2Dahw=; b=tPmOuFFgTNJJ2zum0iBpSBfUrDy7ylTbbpM4l7jTCNb+FIQRpnTRgLwDFpqwxbxXzD 1r84JwH74xLmRw+TZQ2kVIheVBJ4gdT6KZyhCEM5Jgn14wMrxQ7cH2aGszoGLQ7BQ5vn HosW9KeVTtSxIZm4Lyr7BapV8QYldYctzsOnGHeCQb0w0rV8iSFShaZwnwGoq3npPVpH NNnr4Aoar3/ehKbm6ipyavvVTnb2i5kfzUK1aKBgp9EqGkn6ycrq/YwiuKbBVI0RuH0t B1sdKA8mp+LNyI8MOSZb69OKOhidhzqyi0l+DBcqh9+bLjD6R7GphcHuugHmeG4OAkVk VHOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZoMTL8Cn; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si5038952eje.57.2021.04.23.06.29.55; Fri, 23 Apr 2021 06:30:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZoMTL8Cn; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242833AbhDWNaH (ORCPT + 99 others); Fri, 23 Apr 2021 09:30:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28640 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242829AbhDWN3v (ORCPT ); Fri, 23 Apr 2021 09:29:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619184542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=claGAAAwAkYoHJ+sqsBkV8q9uRfXIUJw7gSPqT2Dahw=; b=ZoMTL8CnIajAtGKBHyQ2lphIEudIBgiFwnyKr7l5a0VMwoo4ihTx3aUz2NKBischAtwT/L W8KrBwLl0dWp1AA4zYmQnEU7eQJgTnfL5kGHuNv1WwVXJ07V3VAoAwOM+4DF7zhB6LQgD6 Lthxw8FHL1FWi2M1pfo2UrVQsG2Jcp4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-491-WXdkg2GmMNCD2H-1gpZk4w-1; Fri, 23 Apr 2021 09:28:58 -0400 X-MC-Unique: WXdkg2GmMNCD2H-1gpZk4w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01D6E107ACCD; Fri, 23 Apr 2021 13:28:56 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-124.rdu2.redhat.com [10.10.112.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83D0F60C13; Fri, 23 Apr 2021 13:28:52 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH v7 05/31] mm/readahead: Handle ractl nr_pages being modified From: David Howells To: linux-fsdevel@vger.kernel.org Cc: Jeff Layton , "Matthew Wilcox (Oracle)" , dhowells@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Jeff Layton , David Wysochanski , "Matthew Wilcox (Oracle)" , Alexander Viro , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org Date: Fri, 23 Apr 2021 14:28:51 +0100 Message-ID: <161918453173.3145707.484012520187142542.stgit@warthog.procyon.org.uk> In-Reply-To: <161918446704.3145707.14418606303992174310.stgit@warthog.procyon.org.uk> References: <161918446704.3145707.14418606303992174310.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Matthew Wilcox (Oracle) Filesystems are not currently permitted to modify the number of pages in the ractl. An upcoming patch to add readahead_expand() changes that rule, so remove the check and resync the loop counter after every call to the filesystem. Tested-by: Jeff Layton Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: David Howells Link: https://lore.kernel.org/r/20210420200116.3715790-1-willy@infradead.org/ Link: https://lore.kernel.org/r/20210421170923.4005574-1-willy@infradead.org/ # v2 --- mm/readahead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index 2088569a947e..5b423ecc99f1 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -198,8 +198,6 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, for (i = 0; i < nr_to_read; i++) { struct page *page = xa_load(&mapping->i_pages, index + i); - BUG_ON(index + i != ractl->_index + ractl->_nr_pages); - if (page && !xa_is_value(page)) { /* * Page already present? Kick off the current batch @@ -210,6 +208,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, * not worth getting one just for that. */ read_pages(ractl, &page_pool, true); + i = ractl->_index + ractl->_nr_pages - index - 1; continue; } @@ -223,6 +222,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, gfp_mask) < 0) { put_page(page); read_pages(ractl, &page_pool, true); + i = ractl->_index + ractl->_nr_pages - index - 1; continue; } if (i == nr_to_read - lookahead_size)