lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 20 Apr 2007 14:42:27 +0100
From:	mel@...net.ie (Mel Gorman)
To:	Christoph Lameter <clameter@....com>
Cc:	linux-kernel@...r.kernel.org,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Nick Piggin <nickpiggin@...oo.com.au>, Andi Kleen <ak@...e.de>,
	Paul Jackson <pj@....com>, Dave Chinner <dgc@....com>
Subject: Re: [RFC 7/8] Enhance ramfs to support higher order pages

On (19/04/07 09:35), Christoph Lameter didst pronounce:
> Variable Order Page Cache: Add support to ramfs
> 
> The simplest file system to use is ramfs. Add a mount parameter that
> specifies the page order of the pages that ramfs should use. If the
> order is greater than zero then disable mmap functionality.
> 
> This could be removed if the VM would be changes to support faulting
> higher order pages but for now we are content with buffered I/O on higher
> order pages.
> 
> Signed-off-by: Christoph Lameter <clameter@....com>
> 
> ---
>  fs/ramfs/file-mmu.c   |   11 +++++++++++
>  fs/ramfs/inode.c      |   15 ++++++++++++---
>  include/linux/ramfs.h |    1 +
>  3 files changed, 24 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.21-rc7/fs/ramfs/file-mmu.c
> ===================================================================
> --- linux-2.6.21-rc7.orig/fs/ramfs/file-mmu.c	2007-04-18 21:46:38.000000000 -0700
> +++ linux-2.6.21-rc7/fs/ramfs/file-mmu.c	2007-04-18 22:02:03.000000000 -0700
> @@ -45,6 +45,17 @@ const struct file_operations ramfs_file_
>  	.llseek		= generic_file_llseek,
>  };
>  
> +/* Higher order mappings do not support mmmap */
> +const struct file_operations ramfs_file_higher_order_operations = {
> +	.read		= do_sync_read,
> +	.aio_read	= generic_file_aio_read,
> +	.write		= do_sync_write,
> +	.aio_write	= generic_file_aio_write,
> +	.fsync		= simple_sync_file,
> +	.sendfile	= generic_file_sendfile,
> +	.llseek		= generic_file_llseek,
> +};
> +
>  const struct inode_operations ramfs_file_inode_operations = {
>  	.getattr	= simple_getattr,
>  };
> Index: linux-2.6.21-rc7/fs/ramfs/inode.c
> ===================================================================
> --- linux-2.6.21-rc7.orig/fs/ramfs/inode.c	2007-04-18 21:46:38.000000000 -0700
> +++ linux-2.6.21-rc7/fs/ramfs/inode.c	2007-04-18 22:02:03.000000000 -0700
> @@ -61,6 +61,7 @@ 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;
> +		inode->i_mapping->order = sb->s_blocksize_bits - PAGE_CACHE_SHIFT;
>  		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
>  		switch (mode & S_IFMT) {
>  		default:
> @@ -68,7 +69,10 @@ struct inode *ramfs_get_inode(struct sup
>  			break;
>  		case S_IFREG:
>  			inode->i_op = &ramfs_file_inode_operations;
> -			inode->i_fop = &ramfs_file_operations;
> +			if (inode->i_mapping->order)
> +				inode->i_fop = &ramfs_file_higher_order_operations;
> +			else
> +				inode->i_fop = &ramfs_file_operations;

So the difference here appears to be that specifying an order means you
can't mmap(). right?

That's fair enough for the moment but relaxing would make ramfs
potentially usable as a replacement for hugetlbfs so there would be just
one ram-based filesystem instead of two.

>  			break;
>  		case S_IFDIR:
>  			inode->i_op = &ramfs_dir_inode_operations;
> @@ -164,10 +168,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);
>  

Not the nicest option there but no harm for the moment.

>  	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;
> Index: linux-2.6.21-rc7/include/linux/ramfs.h
> ===================================================================
> --- linux-2.6.21-rc7.orig/include/linux/ramfs.h	2007-04-18 21:46:38.000000000 -0700
> +++ linux-2.6.21-rc7/include/linux/ramfs.h	2007-04-18 22:02:03.000000000 -0700
> @@ -16,6 +16,7 @@ extern int ramfs_nommu_mmap(struct file 
>  #endif
>  
>  extern const struct file_operations ramfs_file_operations;
> +extern const struct file_operations ramfs_file_higher_order_operations;
>  extern struct vm_operations_struct generic_file_vm_ops;
>  extern int __init init_rootfs(void);
>  

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ