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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 25573C33CB1 for ; Wed, 15 Jan 2020 07:16:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECBC62084D for ; Wed, 15 Jan 2020 07:16:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="rq1x+uA6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726045AbgAOHQ3 (ORCPT ); Wed, 15 Jan 2020 02:16:29 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:50866 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgAOHQ3 (ORCPT ); Wed, 15 Jan 2020 02:16:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZA7aSJRjUkKNXdsi7RFinpN7JG4VTFMCW87jm3aI7ec=; b=rq1x+uA6PcOARY9hmPbjqCwFd gavBZBkHnr5F5ysyBa+tFubM4qgrsJpVURzhGus5HFZBWSf/eO8p7nWgHNsZs6ym8n84dhKhsS8ao AkG3un+KGEC7Gv9TOcEppEBz2An4a1zg5duAzJiYQgXEh8yKauqpi1etzl1RE00HHilAd98fg74HC 5MBzlqPS+UpWS4bW4J/U59Y3MbPTGXJfavWFR4RPmc+oOFRB0bXsLdi/v5wTLTbSjAnbHGjJ9ufr1 dDu3Lfx+Q2KeusipZTMx4ah84hvISR3ME2KYiuhijLPz3MRV084RMG0qGKiAvJhnixbVqdV3JvWDb xmYof6Djw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1ircui-0000Vw-LY; Wed, 15 Jan 2020 07:16:28 +0000 Date: Tue, 14 Jan 2020 23:16:28 -0800 From: Christoph Hellwig To: Matthew Wilcox Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Jeff Layton , Christoph Hellwig , Chris Mason Subject: Re: [PATCH v2 6/9] iomap,xfs: Convert from readpages to readahead Message-ID: <20200115071628.GA3460@infradead.org> References: <20200115023843.31325-1-willy@infradead.org> <20200115023843.31325-7-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200115023843.31325-7-willy@infradead.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Tue, Jan 14, 2020 at 06:38:40PM -0800, Matthew Wilcox wrote: > static loff_t > +iomap_readahead_actor(struct inode *inode, loff_t pos, loff_t length, > void *data, struct iomap *iomap, struct iomap *srcmap) > { > struct iomap_readpage_ctx *ctx = data; > @@ -410,10 +381,8 @@ iomap_readpages_actor(struct inode *inode, loff_t pos, loff_t length, > ctx->cur_page = NULL; > } > if (!ctx->cur_page) { > - ctx->cur_page = iomap_next_page(inode, ctx->pages, > - pos, length, &done); > - if (!ctx->cur_page) > - break; > + ctx->cur_page = readahead_page(inode->i_mapping, > + pos / PAGE_SIZE); Don't we at least need a sanity check for a NULL cur_page here? Also the readahead_page version in your previous patch seems to expect a byte offset, so the division above would not be required. (and should probably be replaced with a right shift anyway no matter where it ends up) > +unsigned > +iomap_readahead(struct address_space *mapping, pgoff_t start, > unsigned nr_pages, const struct iomap_ops *ops) > { > struct iomap_readpage_ctx ctx = { > - .pages = pages, > .is_readahead = true, > }; > - loff_t pos = page_offset(list_entry(pages->prev, struct page, lru)); > - loff_t last = page_offset(list_entry(pages->next, struct page, lru)); > - loff_t length = last - pos + PAGE_SIZE, ret = 0; > + loff_t pos = start * PAGE_SIZE; > + loff_t length = nr_pages * PAGE_SIZE; Any good reason not to pass byte offsets for start and length? > + return length / PAGE_SIZE; Same for the return value? For the file systems that would usually be a more natural interface than a page index and number of pages.