From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ipmail06.adl6.internode.on.net ([150.101.137.145]:64816 "EHLO ipmail06.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbeEJBSB (ORCPT ); Wed, 9 May 2018 21:18:01 -0400 Date: Thu, 10 May 2018 11:17:58 +1000 From: Dave Chinner Subject: Re: [PATCH 11/33] iomap: add an iomap-based readpage and readpages implementation Message-ID: <20180510011758.GR10363@dastard> References: <20180509074830.16196-1-hch@lst.de> <20180509074830.16196-12-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180509074830.16196-12-hch@lst.de> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Christoph Hellwig Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org On Wed, May 09, 2018 at 09:48:08AM +0200, Christoph Hellwig wrote: > Simply use iomap_apply to iterate over the file and a submit a bio for > each non-uptodate but mapped region and zero everything else. Note that > as-is this can not be used for file systems with a blocksize smaller than > the page size, but that support will be added later. > > Signed-off-by: Christoph Hellwig ..... > +int > +iomap_readpages(struct address_space *mapping, struct list_head *pages, > + unsigned nr_pages, const struct iomap_ops *ops) > +{ > + struct iomap_readpage_ctx ctx = { .pages = pages }; > + 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; > + > + while (length > 0) { > + ret = iomap_apply(mapping->host, pos, length, 0, ops, > + &ctx, iomap_readpages_actor); > + if (ret <= 0) > + break; > + pos += ret; > + length -= ret; > + } > + > + ret = 0; This means the function will always return zero, regardless of whether iomap_apply returned an error or not. > + if (ctx.bio) > + submit_bio(ctx.bio); > + if (ctx.cur_page) { > + if (!ctx.cur_page_in_bio) > + unlock_page(ctx.cur_page); > + put_page(ctx.cur_page); > + } > + WARN_ON_ONCE(ret && !list_empty(ctx.pages)); And this warning will never trigger. Was this intended behaviour? If it is, it needs a comment, because it looks wrong.... Cheers, Dave. -- Dave Chinner david@fromorbit.com