Existing files in cramfs basically become ramfs files, and we use the ramfs_file_operations for them. Signed-off-by: Arnd Bergmann --- fs/cramfs/inode.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 8c3e8bb..0d3ac80 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,7 @@ static struct inode *get_cramfs_inode(struct super_block *sb, contents. 1 yields the right result in GNU find, even without -noleaf option. */ if (S_ISREG(mode)) { - inode->i_fop = &generic_ro_fops; + inode->i_fop = &ramfs_file_operations; inode->i_data.a_ops = &cramfs_aops; } else if (S_ISDIR(mode)) { inode->i_op = &cramfs_dir_inode_operations; @@ -531,6 +532,11 @@ static int cramfs_readpage(struct file *file, struct page * page) u32 maxblock, bytes_filled; void *pgdata; + /* FIXME: not enough we also need to handle sparse files + * that originally came from the disk */ + if (!inode->i_private) + return simple_readpage(file, page); + maxblock = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; bytes_filled = 0; if (page->index < maxblock) { @@ -568,7 +574,10 @@ static int cramfs_readpage(struct file *file, struct page * page) } static const struct address_space_operations cramfs_aops = { - .readpage = cramfs_readpage + .readpage = cramfs_readpage, + .write_begin = simple_write_begin, + .write_end = simple_write_end, + .set_page_dirty = __set_page_dirty_no_writeback, }; /* -- 1.5.4.3 -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/