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 02BEAC33CB1 for ; Wed, 15 Jan 2020 07:16:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB7F02084D for ; Wed, 15 Jan 2020 07:16:32 +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" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB7F02084D 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 500168E0005; Wed, 15 Jan 2020 02:16:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B0EB8E0003; Wed, 15 Jan 2020 02:16:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C6C78E0005; Wed, 15 Jan 2020 02:16:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0131.hostedemail.com [216.40.44.131]) by kanga.kvack.org (Postfix) with ESMTP id 267148E0003 for ; Wed, 15 Jan 2020 02:16:32 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id CDCFB499605 for ; Wed, 15 Jan 2020 07:16:31 +0000 (UTC) X-FDA: 76379010582.25.pen04_560176fe75423 X-HE-Tag: pen04_560176fe75423 X-Filterd-Recvd-Size: 3716 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jan 2020 07:16:30 +0000 (UTC) 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 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 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.