From patchwork Sat Dec 14 03:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13908310 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E5CEE7716A for ; Sat, 14 Dec 2024 04:19:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB5716B007B; Fri, 13 Dec 2024 23:19:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C667F6B0083; Fri, 13 Dec 2024 23:19:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B53506B0085; Fri, 13 Dec 2024 23:19:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 97D506B007B for ; Fri, 13 Dec 2024 23:19:29 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0370A817FF for ; Sat, 14 Dec 2024 04:19:28 +0000 (UTC) X-FDA: 82892259198.03.A90EA3B Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf16.hostedemail.com (Postfix) with ESMTP id 4B5E7180004 for ; Sat, 14 Dec 2024 04:19:00 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="rBgMS/ly"; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=quarantine); spf=none (imf16.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734149955; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rV5AoYJPlny/7wnGoBOtLs3pAmaEJ9e3y3MRINCsK0A=; b=2hL6nEtJL7FLwG3rCrb8mHqO6qAlloXL4ZTlnZQQCj/inIRER39JVw6Pys9OfRRF1biIOe WpXr+REFqXKJe4W4qy+LLoqH9NM7fJppatakr51dhYMN+mztcTSyaRdQgJqmZrcRBozTz3 zNPmks7gY7QUVtB/Iz/D+1HXo0qiGZ0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734149955; a=rsa-sha256; cv=none; b=OLpPnGClUDwlhduwk7xvyOVbuQ7SJTck7WDJcke48qw2KQ5Zv9hZtLWkqYV6IGxG3gdxLO HZnoCs/nzJDGMuD+3bX3aOjSrp5n6M8COq1OxE1AAQ44ubD+oDcUG6nB1vkYzGJWGnqGcC Bv/YVVrcKiLzFRmNIKjNebZX9kiTocI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="rBgMS/ly"; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=quarantine); spf=none (imf16.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=rV5AoYJPlny/7wnGoBOtLs3pAmaEJ9e3y3MRINCsK0A=; b=rBgMS/lyjy3Ti+VMrwe1JNxiA8 eR0POwBQ7F9I7u0BreYHGzLgGHYo5au1bZKC4A+0HUDXIRpEPtKNdKPl/hg3NYWSWTTwsbxN1CFmk u4en09SHB4VOE44Qb3533cdPHpRkd9NUC5ozc6o1GJdedziqFC57uH9xNYHFqkHE3dHjwfOGvIIeK 7nV7Nug+EBDp5bnSB4J2mRCG6dhkXiUkNic0zADTIySpUwYdJqcqKKaesr25P1UGq21cts4hwc9ib mtMiz46VjuC3+q9iEz0GBO8iSLgOZcuy4HAHH1DYHuDv32yDA8/NKuGE2fj3/LwlDnmWlwrJ8d5SA fNZXHcCg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tMIYN-00000005c3n-4A6d; Sat, 14 Dec 2024 03:10:51 +0000 From: Luis Chamberlain To: willy@infradead.org, hch@lst.de, hare@suse.de, dave@stgolabs.net, david@fromorbit.com, djwong@kernel.org Cc: john.g.garry@oracle.com, ritesh.list@gmail.com, kbusch@kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, gost.dev@samsung.com, p.raghav@samsung.com, da.gomez@samsung.com, kernel@pankajraghav.com, mcgrof@kernel.org Subject: [RFC v2 08/11] block/bdev: enable large folio support for large logical block sizes Date: Fri, 13 Dec 2024 19:10:46 -0800 Message-ID: <20241214031050.1337920-9-mcgrof@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241214031050.1337920-1-mcgrof@kernel.org> References: <20241214031050.1337920-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Stat-Signature: m4t9y5sqxddodqjdh8fkx94y5r3koejb X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Rspamd-Queue-Id: 4B5E7180004 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspam: Yes X-HE-Tag: 1734149940-767348 X-HE-Meta: U2FsdGVkX18ak5MEzUcm7uIwsoDROb2OtgpaCh3GS7q6BH1ypranmocLP3Y6MRrj/9e5XWksagr12bV0o71n9k9xuXz+j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Uus4QTL71TerBV1UxTPlJDzKioTPuAbTIGd5XiNI0fKRYet6I9nayW3q3emcCmDgipvmsFAqRcpiS9BZ7cWNFYNeo2FVuKWqLnwU+guKtgM5Dn6i7FMGLZT114wItd51AniJvYXC03lYeyPZFnmJPVfT+ytI9sKmS1XCusnEoCTfUfckwbBhs7cAXT5lsDV9+f595+NOla8o32zF1oyG63P+pzrag6MLiF7UUizVbjq2vv37QnQ/MZKl9zHTKFarHNSJiKwO+a54TT0v9VdiW0fNQ+RVEpgUXKzmt+1A1uz6pkXRWLjkaMDS/7e X-Bogosity: Ham, tests=bogofilter, spamicity=0.001423, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Hannes Reinecke Call mapping_set_folio_min_order() when modifying the logical block size to ensure folios are allocated with the correct size. Signed-off-by: Hannes Reinecke --- block/bdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/bdev.c b/block/bdev.c index 738e3c8457e7..167d82b46781 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -148,6 +148,8 @@ static void set_init_blocksize(struct block_device *bdev) bsize <<= 1; } BD_INODE(bdev)->i_blkbits = blksize_bits(bsize); + mapping_set_folio_min_order(BD_INODE(bdev)->i_mapping, + get_order(bsize)); } int set_blocksize(struct file *file, int size) @@ -170,6 +172,7 @@ int set_blocksize(struct file *file, int size) if (inode->i_blkbits != blksize_bits(size)) { sync_blockdev(bdev); inode->i_blkbits = blksize_bits(size); + mapping_set_folio_min_order(inode->i_mapping, get_order(size)); kill_bdev(bdev); } return 0;