scoutfs: add basic file page cache read and write

Add basic file data support by implementing the address space file and
page read and write methods.  This passis basic read/write tests but is
only the seed of a final implementation.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-03-26 10:58:06 -07:00
parent 867d717d2b
commit 9cf87ee571
5 changed files with 260 additions and 6 deletions
+18 -2
View File
@@ -21,6 +21,7 @@
#include "inode.h"
#include "segment.h"
#include "dir.h"
#include "filerw.h"
/*
* XXX
@@ -68,10 +69,25 @@ void scoutfs_destroy_inode(struct inode *inode)
static void set_inode_ops(struct inode *inode)
{
switch (inode->i_mode & S_IFMT) {
/*
* I guess we add a reg.c for regular files? Or pagecache.c?
* I guess that makes more sense.
*
* - page dirtying makes sure there's a dirty item
* - sync writes back page cache pages
* - writepage copies to dirty item
* - crc calculated after copying
* - pages can be pretty large
* - tail items can be partial?
* - tracing all over the place
* - maybe just less than 4k is the answer?
* - so allocation pulls the value back
* - probably leave some overhead for header growth
*/
case S_IFREG:
// inode->i_mapping->a_ops = &scoutfs_file_aops;
inode->i_mapping->a_ops = &scoutfs_file_aops;
// inode->i_op = &scoutfs_file_iops;
// inode->i_fop = &scoutfs_file_fops;
inode->i_fop = &scoutfs_file_fops;
break;
case S_IFDIR:
inode->i_op = &scoutfs_dir_iops;