return rc;
}
+static inline int obd_statfs(struct obd_conn *conn, struct statfs *buf)
+{
+ int rc;
+ OBD_CHECK_OP(conn,statfs);
+
+ rc = OBP(conn->oc_dev, statfs)(conn, buf);
+ EXIT;
+ return rc;
+}
+
+static inline int obd_punch(struct obd_conn *conn, struct obdo *tgt, obd_size count, obd_off offset)
+{
+ int rc;
+ OBD_CHECK_OP(conn,punch);
+
+ rc = OBP(conn->oc_dev, punch)(conn, tgt, count, offset);
+ EXIT;
+ return rc;
+}
+
+static inline int obd_brw(int rw, struct obd_conn *conn, obd_count num_oa,
+ struct obdo **oa, obd_count *oa_bufs, struct page **buf,
+ obd_size *count, obd_off *offset, obd_flag *flags)
+{
+ int rc;
+ OBD_CHECK_OP(conn,brw);
+
+ rc = OBP(conn->oc_dev, brw)(rw, conn, num_oa, oa, oa_bufs, buf,
+ count, offset, flags);
+ EXIT;
+ return rc;
+}
+
+
#endif
/* This value is not arbitrarily chosen. KIO_STATIC_PAGES from linux/iobuf.h */
if (!inode) {
printk("new_inode -fatal: %ld\n", (long)oa->o_id);
- IOPS(dir, destroy)(IID(dir), oa);
+ obd_destroy(IID(dir), oa);
EXIT;
return ERR_PTR(-EIO);
}
(long)oa->o_id,
atomic_read(&inode->i_count),
inode->i_nlink);
- IOPS(dir, destroy)(IID(dir), oa);
+ obd_destroy(IID(dir), oa);
iput(inode);
EXIT;
return ERR_PTR(-EIO);
int err;
ENTRY;
- if (IOPS(inode, brw) == NULL) {
- printk(KERN_ERR __FUNCTION__ ": no brw method!\n");
- EXIT;
- return -EIO;
- }
oa = obdo_alloc();
if ( !oa ) {
oa->o_valid = OBD_MD_FLNOTOBD;
obdfs_from_inode(oa, inode);
- err = IOPS(inode, brw)(rw, IID(inode), num_obdo, &oa, &bufs_per_obdo,
- &page, &count, &offset, &flags);
+ err = obd_brw(rw, IID(inode), num_obdo, &oa, &bufs_per_obdo,
+ &page, &count, &offset, &flags);
//if ( !err )
// obdfs_to_inode(inode, oa); /* copy o_blocks to i_blocks */
int err;
ENTRY;
- if (IOPS(inode, brw) == NULL) {
- printk(KERN_ERR __FUNCTION__ ": no brw method!\n");
- EXIT;
- return -EIO;
- }
-
oa = obdo_alloc();
if ( !oa ) {
EXIT;
CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n",
from, to, count);
- err = IOPS(inode, brw)(WRITE, IID(inode), num_obdo, &oa, &bufs_per_obdo,
+ err = obd_brw(WRITE, IID(inode), num_obdo, &oa, &bufs_per_obdo,
&page, &count, &offset, &flags);
if ( !err ) {
SetPageUptodate(page);
int err;
ENTRY;
- if (IOPS(inodes[0], brw) == NULL) {
- printk(KERN_ERR __FUNCTION__ ": no brw method!\n");
- EXIT;
- return -EIO;
- }
-
CDEBUG(D_INFO, "writing %d page(s), %d obdo(s) in vector\n",
num_io, num_obdos);
if (obd_debug_level & D_INFO) { /* DEBUGGING */
printk("\n");
}
- err = IOPS(inodes[0], brw)(WRITE, IID(inodes[0]), num_obdos, obdos,
+ err = obd_brw(WRITE, IID(inodes[0]), num_obdos, obdos,
oa_bufs, pages, counts, offsets, flags);
CDEBUG(D_INFO, "BRW done\n");
ENTRY;
//obdfs_dequeue_pages(inode);
-
- if (IOPS(inode, punch) == NULL) {
- printk(KERN_ERR __FUNCTION__ ": no punch method!\n");
- EXIT;
- return;
- }
-
oa = obdo_alloc();
if ( !oa ) {
- /* XXX This would give an inconsistent FS, so deal with it as
- * best we can for now - an obdo on the stack is not pretty.
- */
- struct obdo obdo;
-
- printk(__FUNCTION__ ": obdo_alloc failed - using stack!\n");
-
- obdo.o_valid = OBD_MD_FLNOTOBD;
- obdfs_from_inode(&obdo, inode);
-
- err = IOPS(inode, punch)(IID(inode), &obdo, 0, obdo.o_size);
+ err = -ENOMEM;
+ printk(__FUNCTION__ ": obdo_alloc failed!\n");
} else {
oa->o_valid = OBD_MD_FLNOTOBD;
obdfs_from_inode(oa, inode);
CDEBUG(D_INFO, "calling punch for %ld (%Lu bytes at 0)\n",
(long)oa->o_id, oa->o_size);
- err = IOPS(inode, punch)(IID(inode), oa, oa->o_size, 0);
+ err = obd_punch(IID(inode), oa, oa->o_size, 0);
obdo_free(oa);
}
}
CDEBUG(D_INFO, "\n");
- obddev = &obd_dev[devno];
-
- CDEBUG(D_INFO, "\n");
- if ( ! (obddev->obd_flags & OBD_ATTACHED) ||
- ! (obddev->obd_flags & OBD_SET_UP) ){
- printk("device %s not attached or not set up (%d)\n",
- device, MINOR(devno));
- EXIT;
- goto ERR;;
- }
- CDEBUG(D_INFO, "\n");
+ obddev = &obd_dev[devno];
sbi->osi_obd = obddev;
sbi->osi_ops = sbi->osi_obd->obd_type->typ_ops;
-
sbi->osi_conn.oc_dev = obddev;
+
err = obd_connect(&sbi->osi_conn);
if ( err ) {
printk("OBDFS: cannot connect to %s\n", device);
EXIT;
goto ERR;
}
+
connected = 1;
CDEBUG(D_INFO, "\n");
/* list of dirty inodes, and a mutex to hold while modifying it */
sbi = (struct obdfs_sb_info *) &sb->u.generic_sbp;
//obdfs_flush_reqs(&sbi->osi_inodes, ~0UL);
- OPS(sb,disconnect)(ID(sb));
+ obd_disconnect(ID(sb));
list_del(&sbi->osi_list);
printk(KERN_INFO "OBDFS: Bye bye.\n");
int err;
ENTRY;
- if (IOPS(inode, setattr) == NULL) {
- printk(KERN_ERR __FUNCTION__ ": no setattr method!\n");
- EXIT;
- return;
- }
oa = obdo_alloc();
if ( !oa ) {
printk(__FUNCTION__ ": obdo_alloc failed\n");
oa->o_valid = OBD_MD_FLNOTOBD & (valid | OBD_MD_FLID);
obdfs_from_inode(oa, inode);
oa->o_mode = inode->i_mode;
- err = IOPS(inode, setattr)(IID(inode), oa);
+ err = obd_setattr(IID(inode), oa);
if ( err )
printk(__FUNCTION__ ": obd_setattr fails (%d)\n", err);
int err;
ENTRY;
- if (IOPS(inode, destroy) == NULL) {
- printk(KERN_ERR __FUNCTION__ ": no destroy method!\n");
- EXIT;
- return;
- }
-
oa = obdo_alloc();
if ( !oa ) {
printk(__FUNCTION__ ": obdo_alloc failed\n");
/* XXX how do we know that this inode is now clean? */
printk("delete_inode ------> link %d\n", inode->i_nlink);
ODEBUG(oa);
- err = IOPS(inode, destroy)(IID(inode), oa);
+ err = obd_destroy(IID(inode), oa);
obdo_free(oa);
clear_inode(inode);
if (err) {
int err;
ENTRY;
- if (IOPS(inode, setattr) == NULL) {
- printk(KERN_ERR __FUNCTION__ ": no setattr method!\n");
- EXIT;
- return -EIO;
- }
oa = obdo_alloc();
if ( !oa ) {
printk(__FUNCTION__ ": obdo_alloc failed\n");
oa->o_id = inode->i_ino;
oa->o_mode = inode->i_mode;
obdo_from_iattr(oa, attr);
- err = IOPS(inode, setattr)(IID(inode), oa);
+ err = obd_setattr(IID(inode), oa);
if ( err )
printk(__FUNCTION__ ": obd_setattr fails (%d)\n", err);
ENTRY;
- err = OPS(sb,statfs)(ID(sb), &tmp);
+ err = obd_statfs(ID(sb), &tmp);
if ( err ) {
printk(__FUNCTION__ ": obd_statfs fails (%d)\n", err);
return err;