2007-06-20 18:39:47

by Christoph Lameter

[permalink] [raw]
Subject: [34/37] Large blocksize support in ramfs

The simplest file system to use for larg blocksize support is ramfs.
Add a mount parameter that specifies the page order of the pages
that ramfs should use.

Note that ramfs does not use the lower layers (buffer I/O etc) so this
case is useful for initial testing of changes to large buffer size
support if one just wants to exercise the higher layers.

If you apply this patch and then you can f.e. try this:

mount -tramfs -o10 none /media

Mounts a ramfs filesystem with order 10 pages (4 MB)

cp linux-2.6.21-rc7.tar.gz /media

Populate the ramfs. Note that we allocate 14 pages of 4M each
instead of 13508..

umount /media

Gets rid of the large pages again

Signed-off-by: Christoph Lameter <[email protected]>

---
fs/ramfs/inode.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

Index: linux-2.6.22-rc4-mm2/fs/ramfs/inode.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/fs/ramfs/inode.c 2007-06-19 19:34:10.000000000 -0700
+++ linux-2.6.22-rc4-mm2/fs/ramfs/inode.c 2007-06-19 20:01:04.000000000 -0700
@@ -60,7 +60,8 @@ struct inode *ramfs_get_inode(struct sup
inode->i_blocks = 0;
inode->i_mapping->a_ops = &ramfs_aops;
inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info;
- mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
+ mapping_setup(inode->i_mapping, GFP_HIGHUSER,
+ sb->s_blocksize_bits - PAGE_SHIFT);
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) {
default:
@@ -164,10 +165,15 @@ static int ramfs_fill_super(struct super
{
struct inode * inode;
struct dentry * root;
+ int order = 0;
+ char *options = data;
+
+ if (options && *options)
+ order = simple_strtoul(options, NULL, 10);

sb->s_maxbytes = MAX_LFS_FILESIZE;
- sb->s_blocksize = PAGE_CACHE_SIZE;
- sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
+ sb->s_blocksize = PAGE_CACHE_SIZE << order;
+ sb->s_blocksize_bits = order + PAGE_CACHE_SHIFT;
sb->s_magic = RAMFS_MAGIC;
sb->s_op = &ramfs_ops;
sb->s_time_gran = 1;

--


2007-06-20 20:50:25

by Andreas Dilger

[permalink] [raw]
Subject: Re: [34/37] Large blocksize support in ramfs

On Jun 20, 2007 11:29 -0700, [email protected] wrote:
> If you apply this patch and then you can f.e. try this:
>
> mount -tramfs -o10 none /media

> @@ -164,10 +165,15 @@ static int ramfs_fill_super(struct super
> + if (options && *options)
> + order = simple_strtoul(options, NULL, 10);

This is probably a bad name for a mount option. What about "order=10"?
Otherwise you prevent any other option from being used in the future.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

2007-06-20 21:29:32

by Christoph Lameter

[permalink] [raw]
Subject: Re: [34/37] Large blocksize support in ramfs

On Wed, 20 Jun 2007, Andreas Dilger wrote:

> On Jun 20, 2007 11:29 -0700, [email protected] wrote:
> > If you apply this patch and then you can f.e. try this:
> >
> > mount -tramfs -o10 none /media
>
> > @@ -164,10 +165,15 @@ static int ramfs_fill_super(struct super
> > + if (options && *options)
> > + order = simple_strtoul(options, NULL, 10);
>
> This is probably a bad name for a mount option. What about "order=10"?
> Otherwise you prevent any other option from being used in the future.

I tried to make it as simple as possible. The patch is primarily useful as
a debugging aid since it eliminates the lower layers from the game. I
think ramfs should be left as is sine it is intended as a minimal
implementation that should stay simpl.

If we really want such an option for good then it may best be added to
shmem or ramdisk drivers?