mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pankaj Raghav (Samsung)" <kernel@pankajraghav.com>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: willy@infradead.org, mcgrof@kernel.org, gost.dev@samsung.com,
	akpm@linux-foundation.org, kernel@pankajraghav.com,
	Christian Brauner <brauner@kernel.org>,
	Pankaj Raghav <p.raghav@samsung.com>
Subject: [PATCH 2/2] ramfs: enable block size > page size
Date: Tue, 24 Sep 2024 21:23:51 +0200	[thread overview]
Message-ID: <20240924192351.74728-3-kernel@pankajraghav.com> (raw)
In-Reply-To: <20240924192351.74728-1-kernel@pankajraghav.com>

From: Pankaj Raghav <p.raghav@samsung.com>

Use page cache's minimum folio order infrastructure to support block
size > page size.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 fs/ramfs/inode.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index d846345a0f4b1..5ac41115d9c62 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -74,6 +74,9 @@ struct inode *ramfs_get_inode(struct super_block *sb,
 		case S_IFREG:
 			inode->i_op = &ramfs_file_inode_operations;
 			inode->i_fop = &ramfs_file_operations;
+			mapping_set_folio_min_order(inode->i_mapping,
+						    sb->s_blocksize_bits -
+							    PAGE_SHIFT);
 			break;
 		case S_IFDIR:
 			inode->i_op = &ramfs_dir_inode_operations;
@@ -211,6 +214,8 @@ static int ramfs_show_options(struct seq_file *m, struct dentry *root)
 
 	if (fsi->mount_opts.mode != RAMFS_DEFAULT_MODE)
 		seq_printf(m, ",mode=%o", fsi->mount_opts.mode);
+	if (fsi->mount_opts.blocksize != PAGE_SIZE)
+		seq_printf(m, ",blocksize=%u", fsi->mount_opts.blocksize);
 	return 0;
 }
 
@@ -235,6 +240,7 @@ static int ramfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
 {
 	struct fs_parse_result result;
 	struct ramfs_fs_info *fsi = fc->s_fs_info;
+	size_t max_blocksize = mapping_max_folio_size_supported();
 	int opt;
 
 	opt = fs_parse(fc, ramfs_fs_parameters, param, &result);
@@ -263,8 +269,8 @@ static int ramfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
 
 		fsi->mount_opts.blocksize = rounddown_pow_of_two(result.uint_32);
 
-		if (fsi->mount_opts.blocksize > PAGE_SIZE)
-			fsi->mount_opts.blocksize = PAGE_SIZE;
+		if (fsi->mount_opts.blocksize > max_blocksize)
+			fsi->mount_opts.blocksize = max_blocksize;
 
 		if (fsi->mount_opts.blocksize < PAGE_SIZE)
 			fsi->mount_opts.blocksize = PAGE_SIZE;
-- 
2.44.1


  parent reply	other threads:[~2024-09-24 19:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 19:23 [PATCH 0/2] add block size > page size support to ramfs Pankaj Raghav (Samsung)
2024-09-24 19:23 ` [PATCH 1/2] ramfs: add blocksize mount option Pankaj Raghav (Samsung)
2024-09-24 19:23 ` Pankaj Raghav (Samsung) [this message]
2024-09-24 20:00 ` [PATCH 0/2] add block size > page size support to ramfs Matthew Wilcox
2024-09-24 20:24   ` Pankaj Raghav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240924192351.74728-3-kernel@pankajraghav.com \
    --to=kernel@pankajraghav.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®