[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240924192351.74728-3-kernel@pankajraghav.com>
Date: Tue, 24 Sep 2024 21:23:51 +0200
From: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
To: linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: willy@...radead.org,
mcgrof@...nel.org,
gost.dev@...sung.com,
akpm@...ux-foundation.org,
kernel@...kajraghav.com,
Christian Brauner <brauner@...nel.org>,
Pankaj Raghav <p.raghav@...sung.com>
Subject: [PATCH 2/2] ramfs: enable block size > page size
From: Pankaj Raghav <p.raghav@...sung.com>
Use page cache's minimum folio order infrastructure to support block
size > page size.
Signed-off-by: Pankaj Raghav <p.raghav@...sung.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
Powered by blists - more mailing lists