Whamcloud - gitweb
cleanups coming from the new functions/macros
authorbraam <braam>
Mon, 21 Jan 2002 01:36:04 +0000 (01:36 +0000)
committerbraam <braam>
Mon, 21 Jan 2002 01:36:04 +0000 (01:36 +0000)
lustre/include/linux/obd_class.h
lustre/obdfs/namei.c
lustre/obdfs/rw.c
lustre/obdfs/super.c

index 80c2b15..6abae82 100644 (file)
@@ -287,6 +287,40 @@ static inline int obd_disconnect(struct obd_conn *conn)
        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 */
index e912050..56d4b36 100644 (file)
@@ -166,7 +166,7 @@ static struct inode *obdfs_new_inode(struct inode *dir, int mode)
 
         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);
         }
@@ -176,7 +176,7 @@ static struct inode *obdfs_new_inode(struct inode *dir, int mode)
                       (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);
index e881e4e..cfde0b3 100644 (file)
@@ -108,11 +108,6 @@ static int obdfs_brw(int rw, struct inode *inode, struct page *page, int create)
         int              err;
 
         ENTRY;
-        if (IOPS(inode, brw) == NULL) {
-                printk(KERN_ERR __FUNCTION__ ": no brw method!\n");
-                EXIT;
-                return -EIO;
-        }
 
         oa = obdo_alloc();
         if ( !oa ) {
@@ -122,8 +117,8 @@ static int obdfs_brw(int rw, struct inode *inode, struct page *page, int create)
        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 */
 
@@ -147,12 +142,6 @@ static int obdfs_commit_page(struct page *page, int create, int from, int to)
         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;
@@ -164,7 +153,7 @@ static int obdfs_commit_page(struct page *page, int create, int from, int to)
        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);
@@ -379,12 +368,6 @@ int obdfs_do_vec_wr(struct inode **inodes, obd_count num_io,
         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 */
@@ -399,7 +382,7 @@ int obdfs_do_vec_wr(struct inode **inodes, obd_count num_io,
                 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");
@@ -670,33 +653,17 @@ void obdfs_truncate(struct inode *inode)
         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);
         }
index e0ac338..71fca7d 100644 (file)
@@ -125,28 +125,19 @@ static struct super_block * obdfs_read_super(struct super_block *sb,
         } 
 
         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 */
@@ -260,7 +251,7 @@ static void obdfs_put_super(struct super_block *sb)
         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");
@@ -276,11 +267,6 @@ void obdfs_do_change_inode(struct inode *inode, int valid)
         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");
@@ -291,7 +277,7 @@ void obdfs_do_change_inode(struct inode *inode, int valid)
         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);
@@ -337,12 +323,6 @@ static void obdfs_delete_inode(struct inode *inode)
         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");
@@ -355,7 +335,7 @@ static void obdfs_delete_inode(struct inode *inode)
        /* 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) {
@@ -406,11 +386,6 @@ int obdfs_setattr(struct dentry *de, struct iattr *attr)
         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");
@@ -421,7 +396,7 @@ int obdfs_setattr(struct dentry *de, struct iattr *attr)
         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);
@@ -440,7 +415,7 @@ static int obdfs_statfs(struct super_block *sb, struct statfs *buf)
 
         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;