#include <linux/pagemap.h>
#include <linux/smp_lock.h>
-#include <../obd/linux/obd_support.h>
-#include <../obd/linux/obd_sim.h>
-#include <obdfs.h>
+#include <linux/obd_support.h>
+#include <linux/obd_sim.h>
+#include <linux/obdfs.h>
int console_loglevel;
/* VFS super_block ops */
+#if 0
+int obdfs_brw(struct inode *dir, int rw, struct page *page, int create)
+{
+ return iops(dir)->o_brw(rw, iid(dir), dir, page, create);
+}
+#endif
+
/* returns the page unlocked, but with a reference */
-int obdfs_readpage(struct file *file, struct page *page)
+int obdfs_readpage(struct dentry *dentry, struct page *page)
{
- struct obdfs_sb_info *sbi;
- struct super_block *sb = file->f_dentry->d_inode->i_sb;
+ struct inode *inode = dentry->d_inode;
int rc;
ENTRY;
-
/* XXX flush stuff */
- sbi = sb->u.generic_sbp;
PDEBUG(page, "READ");
- rc = sbi->osi_ops->o_brw(READ, sbi->osi_conn_info.conn_id,
- file->f_dentry->d_inode, page, 0);
+ rc = iops(inode)->o_brw(READ, iid(inode),inode, page, 0);
if (rc == PAGE_SIZE ) {
SetPageUptodate(page);
UnlockPage(page);
}
+/* returns the page unlocked, but with a reference */
+static int obdfs_writepage(struct dentry *dentry, struct page *page)
+{
+ struct inode *inode = dentry->d_inode;
+ int rc;
+
+ ENTRY;
+ PDEBUG(page, "WRITEPAGE");
+ /* XXX flush stuff */
+
+ rc = iops(inode)->o_brw(WRITE, iid(inode), inode, page, 1);
+
+ SetPageUptodate(page);
+ PDEBUG(page,"WRITEPAGE");
+ return rc;
+}
+
/*
* This does the "real" work of the write. The generic routine has
* allocated the page, locked it, done all the page alignment stuff
int obdfs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
{
long status;
- struct obdfs_sb_info *sbi = file->f_dentry->d_inode->i_sb->u.generic_sbp;
+ struct inode *inode = file->f_dentry->d_inode;
ENTRY;
if ( !Page_Uptodate(page) ) {
- status = sbi->osi_ops->o_brw(READ,
- sbi->osi_conn_info.conn_id,
- file->f_dentry->d_inode,
- page, 1);
+ status = iops(inode)->o_brw(READ, iid(inode), inode, page, 1);
if (status == PAGE_SIZE ) {
SetPageUptodate(page);
} else {
if (bytes) {
lock_kernel();
- status = obdfs_writepage(file, page);
+ status = obdfs_writepage(file->f_dentry, page);
unlock_kernel();
}
EXIT;
-/* returns the page unlocked, but with a reference */
-int obdfs_writepage(struct file *file, struct page *page)
-{
- struct obdfs_sb_info *sbi = file->f_dentry->d_inode->i_sb->u.generic_sbp;
- int rc;
-
- ENTRY;
- PDEBUG(page, "WRITEPAGE");
- /* XXX flush stuff */
-
- rc = sbi->osi_ops->o_brw(WRITE, sbi->osi_conn_info.conn_id,
- file->f_dentry->d_inode, page, 1);
-
- SetPageUptodate(page);
- PDEBUG(page,"WRITEPAGE");
- return rc;
-}
-
void report_inode(struct page * page) {
struct inode *inode = (struct inode *)0;
struct page *page_cache;
struct page ** hash;
struct page * page;
- struct obdfs_sb_info *sbi;
- struct super_block *sb = inode->i_sb;
int rc;
ENTRY;
offset = offset & PAGE_CACHE_MASK;
- sbi = sb->u.generic_sbp;
CDEBUG(D_INODE, "\n");
page = NULL;
- rc = sbi->osi_ops->o_brw(READ, sbi->osi_conn_info.conn_id,
- inode, page, create);
+ rc = iops(inode)->o_brw(READ, iid(inode), inode, page, create);
if ( rc != PAGE_SIZE ) {
SetPageError(page);
UnlockPage(page);
struct file_operations obdfs_file_ops = {
NULL, /* lseek - default */
generic_file_read, /* read */
- obdfs_file_write, /* write - bad */
+ obdfs_file_write, /* write - bad */
obdfs_readdir, /* readdir */
NULL, /* poll - default */
NULL, /* ioctl */