Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d79125b authored by Carsten Otte's avatar Carsten Otte Committed by Linus Torvalds
Browse files

[PATCH] xip: ext2: execute in place



These are the ext2 related parts.  Ext2 now uses the xip_* file operations
along with the get_xip_page aop when mounted with -o xip.

Signed-off-by: default avatarCarsten Otte <cotte@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ceffc078
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -50,6 +50,23 @@ config EXT2_FS_SECURITY
	  If you are not using a security module that requires using
	  extended attributes for file security labels, say N.

config EXT2_FS_XIP
	bool "Ext2 execute in place support"
	depends on EXT2_FS
	help
	  Execute in place can be used on memory-backed block devices. If you
	  enable this option, you can select to mount block devices which are
	  capable of this feature without using the page cache.

	  If you do not use a block device that is capable of using this,
	  or if unsure, say N.

config FS_XIP
# execute in place
	bool
	depends on EXT2_FS_XIP
	default y

config EXT3_FS
	tristate "Ext3 journalling file system support"
	help
+1 −0
Original line number Diff line number Diff line
@@ -10,3 +10,4 @@ ext2-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ext2-$(CONFIG_EXT2_FS_XATTR)	 += xattr.o xattr_user.o xattr_trusted.o
ext2-$(CONFIG_EXT2_FS_POSIX_ACL) += acl.o
ext2-$(CONFIG_EXT2_FS_SECURITY)	 += xattr_security.o
ext2-$(CONFIG_EXT2_FS_XIP)	 += xip.o
+2 −0
Original line number Diff line number Diff line
@@ -147,9 +147,11 @@ extern struct file_operations ext2_dir_operations;
/* file.c */
extern struct inode_operations ext2_file_inode_operations;
extern struct file_operations ext2_file_operations;
extern struct file_operations ext2_xip_file_operations;

/* inode.c */
extern struct address_space_operations ext2_aops;
extern struct address_space_operations ext2_aops_xip;
extern struct address_space_operations ext2_nobh_aops;

/* namei.c */
+18 −0
Original line number Diff line number Diff line
@@ -55,6 +55,24 @@ struct file_operations ext2_file_operations = {
	.sendfile	= generic_file_sendfile,
};

#ifdef CONFIG_EXT2_FS_XIP
struct file_operations ext2_xip_file_operations = {
	.llseek		= generic_file_llseek,
	.read		= do_sync_read,
	.write		= do_sync_write,
	.aio_read	= xip_file_aio_read,
	.aio_write	= xip_file_aio_write,
	.ioctl		= ext2_ioctl,
	.mmap		= xip_file_mmap,
	.open		= generic_file_open,
	.release	= ext2_release_file,
	.fsync		= ext2_sync_file,
	.readv		= xip_file_readv,
	.writev		= xip_file_writev,
	.sendfile	= xip_file_sendfile,
};
#endif

struct inode_operations ext2_file_inode_operations = {
	.truncate	= ext2_truncate,
#ifdef CONFIG_EXT2_FS_XATTR
+27 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <linux/mpage.h>
#include "ext2.h"
#include "acl.h"
#include "xip.h"

MODULE_AUTHOR("Remy Card and others");
MODULE_DESCRIPTION("Second Extended Filesystem");
@@ -594,6 +595,16 @@ out:
	if (err)
		goto cleanup;

	if (ext2_use_xip(inode->i_sb)) {
		/*
		 * we need to clear the block
		 */
		err = ext2_clear_xip_target (inode,
			le32_to_cpu(chain[depth-1].key));
		if (err)
			goto cleanup;
	}

	if (ext2_splice_branch(inode, iblock, chain, partial, left) < 0)
		goto changed;

@@ -691,6 +702,11 @@ struct address_space_operations ext2_aops = {
	.writepages		= ext2_writepages,
};

struct address_space_operations ext2_aops_xip = {
	.bmap			= ext2_bmap,
	.get_xip_page		= ext2_get_xip_page,
};

struct address_space_operations ext2_nobh_aops = {
	.readpage		= ext2_readpage,
	.readpages		= ext2_readpages,
@@ -910,7 +926,9 @@ void ext2_truncate (struct inode * inode)
	iblock = (inode->i_size + blocksize-1)
					>> EXT2_BLOCK_SIZE_BITS(inode->i_sb);

	if (test_opt(inode->i_sb, NOBH))
	if (mapping_is_xip(inode->i_mapping))
		xip_truncate_page(inode->i_mapping, inode->i_size);
	else if (test_opt(inode->i_sb, NOBH))
		nobh_truncate_page(inode->i_mapping, inode->i_size);
	else
		block_truncate_page(inode->i_mapping,
@@ -1110,11 +1128,16 @@ void ext2_read_inode (struct inode * inode)

	if (S_ISREG(inode->i_mode)) {
		inode->i_op = &ext2_file_inode_operations;
		inode->i_fop = &ext2_file_operations;
		if (test_opt(inode->i_sb, NOBH))
		if (ext2_use_xip(inode->i_sb)) {
			inode->i_mapping->a_ops = &ext2_aops_xip;
			inode->i_fop = &ext2_xip_file_operations;
		} else if (test_opt(inode->i_sb, NOBH)) {
			inode->i_mapping->a_ops = &ext2_nobh_aops;
		else
			inode->i_fop = &ext2_file_operations;
		} else {
			inode->i_mapping->a_ops = &ext2_aops;
			inode->i_fop = &ext2_file_operations;
		}
	} else if (S_ISDIR(inode->i_mode)) {
		inode->i_op = &ext2_dir_inode_operations;
		inode->i_fop = &ext2_dir_operations;
Loading