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=-6.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 D2563C433DF for ; Thu, 2 Jul 2020 16:51:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8BE1820780 for ; Thu, 2 Jul 2020 16:51:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OxfWg8CZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BE1820780 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D87006B00BF; Thu, 2 Jul 2020 12:51:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D10616B00D1; Thu, 2 Jul 2020 12:51:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B62FA6B00DD; Thu, 2 Jul 2020 12:51:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0158.hostedemail.com [216.40.44.158]) by kanga.kvack.org (Postfix) with ESMTP id 9B3E16B00BF for ; Thu, 2 Jul 2020 12:51:39 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AC93D180AD806 for ; Thu, 2 Jul 2020 16:51:38 +0000 (UTC) X-FDA: 76993727076.16.shoe19_1e1803426e8a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 4CBA4100E692B for ; Thu, 2 Jul 2020 16:51:37 +0000 (UTC) X-HE-Tag: shoe19_1e1803426e8a X-Filterd-Recvd-Size: 8568 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jul 2020 16:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593708696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sRvSqiA63kUIbg8TR2a10APphiMEzUJywUYKdk62Smo=; b=OxfWg8CZLRv2ENhqouWV/zumiG7l/BSIAyMOPA9m2pcXag5jtOUnFjxxApI79lrYoHRY48 jOsDi2IaDKtIWqywd7g5znXY/Dqf4NqBB3wuhaAFuCD7+IkbndpUwPwQOO4znVTq+sMs7U v1zXQit9yjAVYLCcJzp7pIGa/XyBpSg= 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-156-SKvVqmjYNAKsXvMS_sg_TQ-1; Thu, 02 Jul 2020 12:51:34 -0400 X-MC-Unique: SKvVqmjYNAKsXvMS_sg_TQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 326B813E9C2; Thu, 2 Jul 2020 16:51:33 +0000 (UTC) Received: from max.home.com (unknown [10.40.192.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 697C379231; Thu, 2 Jul 2020 16:51:31 +0000 (UTC) From: Andreas Gruenbacher To: Matthew Wilcox Cc: Dave Chinner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andreas Gruenbacher Subject: [RFC 4/4] gfs2: Reinstate readahead conversion Date: Thu, 2 Jul 2020 18:51:20 +0200 Message-Id: <20200702165120.1469875-5-agruenba@redhat.com> In-Reply-To: <20200702165120.1469875-1-agruenba@redhat.com> References: <20200702165120.1469875-1-agruenba@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Rspamd-Queue-Id: 4CBA4100E692B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 Content-Transfer-Encoding: quoted-printable 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: Now that the locking order in gfs2 is fixed, switch back to using the ->readahead address space operation. With that, mpage_readpages is unused and can be removed. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/aops.c | 19 +++++------ fs/mpage.c | 75 ------------------------------------------- include/linux/mpage.h | 2 -- 3 files changed, 10 insertions(+), 86 deletions(-) diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 28f097636e78..68cd700a2719 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -541,7 +541,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *b= uf, loff_t *pos, } =20 /** - * gfs2_readpages - Read a bunch of pages at once + * gfs2_readahead - Read a bunch of pages at once * @file: The file to read from * @mapping: Address space info * @pages: List of pages to read @@ -554,16 +554,17 @@ int gfs2_internal_read(struct gfs2_inode *ip, char = *buf, loff_t *pos, * obviously not something we'd want to do on too regular a basis. * Any I/O we ignore at this time will be done via readpage later. * 2. We don't handle stuffed files here we let readpage do the honours. - * 3. mpage_readpages() does most of the heavy lifting in the common cas= e. + * 3. mpage_readahead() does most of the heavy lifting in the common cas= e. * 4. gfs2_block_map() is relied upon to set BH_Boundary in the right pl= aces. */ =20 -static int gfs2_readpages(struct file *file, struct address_space *mappi= ng, - struct list_head *pages, unsigned nr_pages) +static void gfs2_readahead(struct readahead_control *rac) { - if (!gfs2_is_stuffed(GFS2_I(mapping->host))) - return mpage_readpages(mapping, pages, nr_pages, gfs2_block_map); - return 0; + struct inode *inode =3D rac->mapping->host; + struct gfs2_inode *ip =3D GFS2_I(inode); + + if (!gfs2_is_stuffed(ip)) + mpage_readahead(rac, gfs2_block_map); } =20 /** @@ -782,7 +783,7 @@ static const struct address_space_operations gfs2_aop= s =3D { .writepage =3D gfs2_writepage, .writepages =3D gfs2_writepages, .readpage =3D gfs2_readpage, - .readpages =3D gfs2_readpages, + .readahead =3D gfs2_readahead, .bmap =3D gfs2_bmap, .invalidatepage =3D gfs2_invalidatepage, .releasepage =3D gfs2_releasepage, @@ -796,7 +797,7 @@ static const struct address_space_operations gfs2_jda= ta_aops =3D { .writepage =3D gfs2_jdata_writepage, .writepages =3D gfs2_jdata_writepages, .readpage =3D gfs2_readpage, - .readpages =3D gfs2_readpages, + .readahead =3D gfs2_readahead, .set_page_dirty =3D jdata_set_page_dirty, .bmap =3D gfs2_bmap, .invalidatepage =3D gfs2_invalidatepage, diff --git a/fs/mpage.c b/fs/mpage.c index 5243a065a062..830e6cc2a9e7 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -396,81 +396,6 @@ void mpage_readahead(struct readahead_control *rac, = get_block_t get_block) } EXPORT_SYMBOL(mpage_readahead); =20 -/** - * mpage_readpages - populate an address space with some pages & start r= eads against them - * @mapping: the address_space - * @pages: The address of a list_head which contains the target pages. = These - * pages have their ->index populated and are otherwise uninitialised. - * The page at @pages->prev has the lowest file offset, and reads shou= ld be - * issued in @pages->prev to @pages->next order. - * @nr_pages: The number of pages at *@pages - * @get_block: The filesystem's block mapper function. - * - * This function walks the pages and the blocks within each page, buildi= ng and - * emitting large BIOs. - * - * If anything unusual happens, such as: - * - * - encountering a page which has buffers - * - encountering a page which has a non-hole after a hole - * - encountering a page with non-contiguous blocks - * - * then this code just gives up and calls the buffer_head-based read fun= ction. - * It does handle a page which has holes at the end - that is a common c= ase: - * the end-of-file on blocksize < PAGE_SIZE setups. - * - * BH_Boundary explanation: - * - * There is a problem. The mpage read code assembles several pages, get= s all - * their disk mappings, and then submits them all. That's fine, but obt= aining - * the disk mappings may require I/O. Reads of indirect blocks, for exa= mple. - * - * So an mpage read of the first 16 blocks of an ext2 file will cause I/= O to be - * submitted in the following order: - * - * 12 0 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 - * - * because the indirect block has to be read to get the mappings of bloc= ks - * 13,14,15,16. Obviously, this impacts performance. - * - * So what we do it to allow the filesystem's get_block() function to se= t - * BH_Boundary when it maps block 11. BH_Boundary says: mapping of the = block - * after this one will require I/O against a block which is probably clo= se to - * this one. So you should push what I/O you have currently accumulated= . - * - * This all causes the disk requests to be issued in the correct order. - */ -int -mpage_readpages(struct address_space *mapping, struct list_head *pages, - unsigned nr_pages, get_block_t get_block) -{ - struct mpage_readpage_args args =3D { - .get_block =3D get_block, - .is_readahead =3D true, - }; - unsigned page_idx; - - for (page_idx =3D 0; page_idx < nr_pages; page_idx++) { - struct page *page =3D lru_to_page(pages); - - prefetchw(&page->flags); - list_del(&page->lru); - if (!add_to_page_cache_lru(page, mapping, - page->index, - readahead_gfp_mask(mapping))) { - args.page =3D page; - args.nr_pages =3D nr_pages - page_idx; - args.bio =3D do_mpage_readpage(&args); - } - put_page(page); - } - BUG_ON(!list_empty(pages)); - if (args.bio) - mpage_bio_submit(REQ_OP_READ, REQ_RAHEAD, args.bio); - return 0; -} -EXPORT_SYMBOL(mpage_readpages); - /* * This isn't called much at all */ diff --git a/include/linux/mpage.h b/include/linux/mpage.h index 181f1b0fbd83..f4f5e90a6844 100644 --- a/include/linux/mpage.h +++ b/include/linux/mpage.h @@ -16,8 +16,6 @@ struct writeback_control; struct readahead_control; =20 void mpage_readahead(struct readahead_control *, get_block_t get_block); -int mpage_readpages(struct address_space *, struct list_head *, unsigned= , - get_block_t); int mpage_readpage(struct page *page, get_block_t get_block); int mpage_writepages(struct address_space *mapping, struct writeback_control *wbc, get_block_t get_block); --=20 2.26.2