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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 BC560C4320A for ; Thu, 22 Jul 2021 19:34:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9767460EB9 for ; Thu, 22 Jul 2021 19:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbhGVSyW (ORCPT ); Thu, 22 Jul 2021 14:54:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:55860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhGVSyW (ORCPT ); Thu, 22 Jul 2021 14:54:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2CA1660EB5; Thu, 22 Jul 2021 19:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626982497; bh=afHQgsU9EA77bBjM3zlqfDOIyqY+GB2FnMX0Ut033yk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NXad0qAwOTcXprN32IhIIwB3GUm7/PSBBwalNZp1oWzamipe+N+udatiL9wRZ4pRq Bt/ACLdCTOQL6tiI644Td6EpzCIqrue3XASiXQHeCTqzevqt7vuAUOPRU4ICo3vB7P mYXgOr/Z1FSswrXrYb35lqFaGWyQAzDSMRcY8tbmS8/TxRLx0HZodx/zOPcMqKgOc8 xlxHnwNF0drAnIlWTG8oLLGhYMgcnElLvtpKEXcXov9j2dhvCemoQ+gWIo9+vK5ATo oy756KKZZyqhMAJfpXppyDYbU4qHh739viz6T9I+tpOU4ccVIyZkPTnYnAf8oJzyRX V5cBzA/SUE/Tg== Date: Thu, 22 Jul 2021 12:34:56 -0700 From: "Darrick J. Wong" To: Christoph Hellwig Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Wilcox Subject: Re: [PATCH 1/2] iomap: simplify iomap_readpage_actor Message-ID: <20210722193456.GM559212@magnolia> References: <20210722054256.932965-1-hch@lst.de> <20210722054256.932965-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210722054256.932965-2-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Jul 22, 2021 at 07:42:55AM +0200, Christoph Hellwig wrote: > Now that the outstanding reads are counted in bytes, there is no need > to use the low-level __bio_try_merge_page API, we can switch back to > always using bio_add_page and simply iomap_readpage_actor again. s/simply/simplify/ ? > Signed-off-by: Christoph Hellwig > Reviewed-by: Matthew Wilcox (Oracle) With that corrected, Reviewed-by: Darrick J. Wong --D > --- > fs/iomap/buffered-io.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 0597f5c186a33f..7898c1c47370e6 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -245,7 +245,6 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, > struct iomap_readpage_ctx *ctx = data; > struct page *page = ctx->cur_page; > struct iomap_page *iop; > - bool same_page = false, is_contig = false; > loff_t orig_pos = pos; > unsigned poff, plen; > sector_t sector; > @@ -269,16 +268,10 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, > if (iop) > atomic_add(plen, &iop->read_bytes_pending); > > - /* Try to merge into a previous segment if we can */ > sector = iomap_sector(iomap, pos); > - if (ctx->bio && bio_end_sector(ctx->bio) == sector) { > - if (__bio_try_merge_page(ctx->bio, page, plen, poff, > - &same_page)) > - goto done; > - is_contig = true; > - } > - > - if (!is_contig || bio_full(ctx->bio, plen)) { > + if (!ctx->bio || > + bio_end_sector(ctx->bio) != sector || > + bio_add_page(ctx->bio, page, plen, poff) != plen) { > gfp_t gfp = mapping_gfp_constraint(page->mapping, GFP_KERNEL); > gfp_t orig_gfp = gfp; > unsigned int nr_vecs = DIV_ROUND_UP(length, PAGE_SIZE); > @@ -302,9 +295,8 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, > ctx->bio->bi_iter.bi_sector = sector; > bio_set_dev(ctx->bio, iomap->bdev); > ctx->bio->bi_end_io = iomap_read_end_io; > + __bio_add_page(ctx->bio, page, plen, poff); > } > - > - bio_add_page(ctx->bio, page, plen, poff); > done: > /* > * Move the caller beyond our range so that it keeps making progress. > -- > 2.30.2 >