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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B785CD13D2 for ; Mon, 18 Sep 2023 18:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbjIRSJK (ORCPT ); Mon, 18 Sep 2023 14:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjIRSJK (ORCPT ); Mon, 18 Sep 2023 14:09:10 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8533FFD; Mon, 18 Sep 2023 11:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=PSl3YIBcOMlI28KGljTBp5+6rpOLjzI4VlDZcO+V47g=; b=v51lvSCHJ27MH9SVEXRHAJB7qA w2bmT2C1j4sY40YT0/lBFqUnUQofZY/n9WBhFCJUODtoIRh1Yhi6dOTCfiid1DAA5T9ItyXXUffq4 69/1uJ9eBsRomdm0UojreSlngN5GpIIKlXYZaHSmiyDSTmmkIMIiiVlFRkStsGO2zmdKi1zUQ1h2X UXxxarA3pXN01KQqteWffiqwvCtCnZZm4fyutmKct5sD9jNukJltAcKA6UGwwL/ZKljZR3P/wzI82 KePlKSnNqxk7hiuBh+qjfn0mBcRw3fv4ieCqpCkY0JMkZM3bhv4I4UYRAZW/TlYeyKnXA6lPMOB0B 2/05ZOPw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qiIg8-00G33u-1d; Mon, 18 Sep 2023 18:09:00 +0000 Date: Mon, 18 Sep 2023 11:09:00 -0700 From: Luis Chamberlain To: Matthew Wilcox Cc: Daniel Gomez , "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "gost.dev@samsung.com" , Pankaj Raghav Subject: Re: [PATCH 1/6] filemap: make the folio order calculation shareable Message-ID: References: <20230915095042.1320180-1-da.gomez@samsung.com> <20230915095042.1320180-2-da.gomez@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Sep 15, 2023 at 02:40:07PM +0100, Matthew Wilcox wrote: > On Fri, Sep 15, 2023 at 09:51:23AM +0000, Daniel Gomez wrote: > > To make the code that clamps the folio order in the __filemap_get_folio > > routine reusable to others, move and merge it to the fgf_set_order > > new subroutine (mapping_size_order), so when mapping the size at a > > given index, the order calculated is already valid and ready to be > > used when order is retrieved from fgp_flags with FGF_GET_ORDER. > > > > Signed-off-by: Daniel Gomez > > --- > > fs/iomap/buffered-io.c | 6 ++++-- > > include/linux/pagemap.h | 42 ++++++++++++++++++++++++++++++++++++----- > > mm/filemap.c | 8 -------- > > 3 files changed, 41 insertions(+), 15 deletions(-) > > That seems like a lot of extra code to add in order to avoid copying > six lines of code and one comment into the shmem code. > > It's not wrong, but it seems like a bad tradeoff to me. The suggestion to merge came from me, mostly based on later observations that in the future we may want to extend this with a min order to ensure the index is aligned the the order. This check would only be useful for buffred IO for iomap, readahead. It has me wondering if buffer-heads support for large order folios come around would we a similar check there? So Willy, you would know better if and when a shared piece of code would be best with all these things in mind. Luis