Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9059340rwd; Wed, 21 Jun 2023 02:24:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ709Dfr1EQxZKruTzBpqBf04LatP4wcTJXaBcRRX9/5m5udDM2eFuKVNQZJdssSewiLGFd9 X-Received: by 2002:a17:902:d48f:b0:1af:ea40:34e6 with SMTP id c15-20020a170902d48f00b001afea4034e6mr5941915plg.60.1687339474204; Wed, 21 Jun 2023 02:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687339474; cv=none; d=google.com; s=arc-20160816; b=pPEhXtlcinlj3OlSG5suq10XOJgFTRP76IP+cR9opU5qygEI5qsveeotiBrS3tvC/i K2r8CMtptGe9mIUTRr6C9ms6RSjxE/O6EMraK9oFLU82QvjXfcCo/gdSN0w49wuLOY1u 8HtqpTnqM2DHOSpMmH0T/85vYOw4AXJlVei/m0b9xJVurUJPATKte9877VCEsCSBPIu2 qwGzBgiTUtSQtuw1jOPN2dOYjs0k0DMl+o7ODr0Zo5cuqeJd+MYxZp8CJEbnkIjuRLbE 6888rbpy9SBMfJ6pDT7MJFoRn/e/z110phcA6lkl2mOQz2mxZquvDkOeGseB51dT2FDo wnbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=ksn9DL4euc6H2A7h0Ot4A/++PR+e6lynq9oDzURShPo=; b=ghUVVwmcRQP3VdAIMvylvMjEkoNJe35fBKnAwDnZoTzP5FTs1kwmlGkSuDfCicimFA 3Ex8IOpIsvLkoKuUmx9ZMiVtOA75PYEXsXV5A/7Z3BIkkEs2gFJOHeKxNrgAsP1wNbTV 00QuO0GruwbUaz6wFC1ywpO0ubv+kQz3inaVG0dCSO7aCvVerTGUk0FTADkbtwxtBBb2 1ImHwtFU/H5U2ihb14JuAzqZZKECtrYqeyXzI4YmuDU3qGwmlSoaIkKnnAj4roBvWmus d57ENwnhdvnS9TRK0b58Cu6hzvX0M36bqqjwhQjRVt6f3/rzwUQt8ozCz4y16QlpXpwG J4MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=M3d8ITHP; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a170902e54a00b001b53d8f2cd1si4121049plf.29.2023.06.21.02.24.21; Wed, 21 Jun 2023 02:24:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=M3d8ITHP; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230080AbjFUJGG (ORCPT + 99 others); Wed, 21 Jun 2023 05:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbjFUJGE (ORCPT ); Wed, 21 Jun 2023 05:06:04 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D37DC; Wed, 21 Jun 2023 02:06:03 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 59E7A1F8A3; Wed, 21 Jun 2023 09:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687338362; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ksn9DL4euc6H2A7h0Ot4A/++PR+e6lynq9oDzURShPo=; b=M3d8ITHPE0eQFP41CM0oe7L1YsDpyF2PztoNJa72R3fLgwG2TNRKq1SrUFZfvEK69bPqmO Jv5G3RRXhFHu0FqM6t68PohmWxvVDpgHTui+88TIS7vrvz9G86SxicDdn/enkVF9N+ACZp 3YDj18nivxCKX79OeNy3Oo32lAkSbFw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687338362; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ksn9DL4euc6H2A7h0Ot4A/++PR+e6lynq9oDzURShPo=; b=3/sAVLJc0jdcEkOMSB3RJQHtquBP1wCVRLeofJGBp3FbYlVR3EotEGeZrZBATclUW7fwHI QiEesQlUbVqowHCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3F4B9134B1; Wed, 21 Jun 2023 09:06:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rqx7Dnq9kmTbZQAAMHmgww (envelope-from ); Wed, 21 Jun 2023 09:06:02 +0000 Message-ID: Date: Wed, 21 Jun 2023 11:05:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [RFC 3/4] block: set mapping order for the block cache in set_init_blocksize Content-Language: en-US To: Pankaj Raghav , willy@infradead.org, david@fromorbit.com Cc: gost.dev@samsung.com, mcgrof@kernel.org, hch@lst.de, jwong@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230621083823.1724337-1-p.raghav@samsung.com> <20230621083823.1724337-4-p.raghav@samsung.com> From: Hannes Reinecke In-Reply-To: <20230621083823.1724337-4-p.raghav@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/21/23 10:38, Pankaj Raghav wrote: > From: Luis Chamberlain > > Automatically set the minimum mapping order for block devices in > set_init_blocksize(). The mapping order will be set only when the block > device uses iomap based aops. > > Signed-off-by: Pankaj Raghav > Signed-off-by: Luis Chamberlain > --- > block/bdev.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/block/bdev.c b/block/bdev.c > index 9bb54d9d02a6..db8cede8a320 100644 > --- a/block/bdev.c > +++ b/block/bdev.c > @@ -126,6 +126,7 @@ static void set_init_blocksize(struct block_device *bdev) > { > unsigned int bsize = bdev_logical_block_size(bdev); > loff_t size = i_size_read(bdev->bd_inode); > + int order, folio_order; > > while (bsize < PAGE_SIZE) { > if (size & bsize) > @@ -133,6 +134,14 @@ static void set_init_blocksize(struct block_device *bdev) > bsize <<= 1; > } > bdev->bd_inode->i_blkbits = blksize_bits(bsize); > + order = bdev->bd_inode->i_blkbits - PAGE_SHIFT; > + folio_order = mapping_min_folio_order(bdev->bd_inode->i_mapping); > + > + if (!IS_ENABLED(CONFIG_BUFFER_HEAD)) { > + /* Do not allow changing the folio order after it is set */ > + WARN_ON_ONCE(folio_order && (folio_order != order)); > + mapping_set_folio_orders(bdev->bd_inode->i_mapping, order, 31); > + } > } > > int set_blocksize(struct block_device *bdev, int size) This really has nothing to do with buffer heads. In fact, I've got a patchset to make it work _with_ buffer heads. So please, don't make it conditional on CONFIG_BUFFER_HEAD. And we should be calling into 'mapping_set_folio_order()' only if the 'order' argument is larger than PAGE_ORDER, otherwise we end up enabling large folio support for _every_ block device. Which I doubt we want. Cheers, Hannes