Whamcloud - gitweb
- Grammatical, LDLM updates to network.lyx
[fs/lustre-release.git] / lustre / obdfilter / filter.c
index 2268719..e2ceb0e 100644 (file)
 #define DEBUG_SUBSYSTEM S_FILTER
 
 #include <linux/module.h>
+#include <linux/lustre_dlm.h>
 #include <linux/obd_filter.h>
 #include <linux/ext3_jbd.h>
 #include <linux/quotaops.h>
+#include <linux/init.h>
 
 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
 long filter_memory;
@@ -352,29 +354,28 @@ static struct inode *filter_inode_from_obj(struct obd_device *obddev,
 }
 
 /* obd methods */
-static int filter_connect(struct obd_conn *conn, struct obd_device *obd)
+static int filter_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         int rc;
-
+        ENTRY;
         MOD_INC_USE_COUNT;
-        rc = gen_connect(conn, obd);
-
+        rc = class_connect(conn, obd);
         if (rc)
                 MOD_DEC_USE_COUNT;
-
-        return rc;
+        RETURN(rc);
 }
 
-static int filter_disconnect(struct obd_conn *conn)
+static int filter_disconnect(struct lustre_handle *conn)
 {
         int rc;
+        ENTRY;
 
-        rc = gen_disconnect(conn);
+        rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
 
         /* XXX cleanup preallocated inodes */
-        return rc;
+        RETURN(rc);
 }
 
 /* mount the file system (secretly) */
@@ -414,6 +415,11 @@ static int filter_setup(struct obd_device *obddev, obd_count len, void *buf)
                 GOTO(err_kfree, err);
         spin_lock_init(&filter->fo_lock);
 
+        obddev->obd_namespace =
+                ldlm_namespace_new("filter-tgt", LDLM_NAMESPACE_SERVER);
+        if (obddev->obd_namespace == NULL)
+                LBUG();
+
         RETURN(0);
 
 err_kfree:
@@ -443,6 +449,8 @@ static int filter_cleanup(struct obd_device * obddev)
                 RETURN(-EBUSY);
         }
 
+        ldlm_namespace_free(obddev->obd_namespace);
+
         sb = obddev->u.filter.fo_sb;
         if (!obddev->u.filter.fo_sb)
                 RETURN(0);
@@ -475,46 +483,26 @@ static inline void filter_from_inode(struct obdo *oa, struct inode *inode)
 
         if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
                 obd_rdev rdev = kdev_t_to_nr(inode->i_rdev);
-                CDEBUG(D_INODE, "copying device %x from inode to obdo\n",
-                       rdev);
-                *((obd_rdev *)oa->o_inline) = rdev;
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
+                oa->o_rdev = rdev;
+                oa->o_valid |= OBD_MD_FLRDEV;
         }
 
-#if 0
-        else if (filter_has_inline(inode)) {
-                CDEBUG(D_INFO, "copying inline from inode to obdo\n");
-                memcpy(oa->o_inline, inode->u.ext2_i.i_data,
-                       MIN(sizeof(inode->u.ext2_i.i_data),OBD_INLINESZ));
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-        }
-
-        if (filter_has_obdmd(inode)) {
-                /* XXX this will change when we don't store the obdmd in data */
-                CDEBUG(D_INFO, "copying obdmd from inode to obdo\n");
-                memcpy(oa->o_obdmd, inode->u.ext2_i.i_data,
-                       MIN(sizeof(inode->u.ext2_i.i_data),OBD_INLINESZ));
-                oa->o_obdflags |= OBD_FL_OBDMDEXISTS;
-                oa->o_valid |= OBD_MD_FLOBDMD;
-        }
-#endif
         EXIT;
 }
 
-static int filter_getattr(struct obd_conn *conn, struct obdo *oa)
+static int filter_getattr(struct lustre_handle *conn, struct obdo *oa, 
+                          struct lov_stripe_md *md)
 {
-        struct obd_device *obddev = gen_conn2obd(conn);
+        struct obd_device *obddev = class_conn2obd(conn);
         struct dentry *dentry;
         ENTRY;
 
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "fatal: invalid client %u\n", conn->oc_id);
+        if (!class_conn2export(conn)) {
+                CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obddev = gen_conn2obd(conn);
+        obddev = class_conn2obd(conn);
         dentry = filter_fid2dentry(obddev, filter_parent(obddev, oa->o_mode),
                                    oa->o_id, oa->o_mode);
         if (IS_ERR(dentry))
@@ -527,25 +515,25 @@ static int filter_getattr(struct obd_conn *conn, struct obdo *oa)
         RETURN(0);
 }
 
-static int filter_setattr(struct obd_conn *conn, struct obdo *oa)
+static int filter_setattr(struct lustre_handle *conn, struct obdo *oa, 
+                          struct lov_stripe_md *md)
 {
         struct obd_run_ctxt saved;
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct dentry *dentry;
         struct iattr iattr;
         struct inode *inode;
         int rc;
         ENTRY;
 
-        dentry = filter_fid2dentry(obd, filter_parent(obd, oa->o_mode),
-                                   oa->o_id, oa->o_mode);
+        iattr_from_obdo(&iattr, oa);
+        iattr.ia_mode = (iattr.ia_mode & ~S_IFMT) | S_IFREG;
+        dentry = filter_fid2dentry(obd, filter_parent(obd, iattr.ia_mode),
+                                   oa->o_id, iattr.ia_mode);
         if (IS_ERR(dentry))
                 RETURN(PTR_ERR(dentry));
 
         inode = dentry->d_inode;
-        iattr_from_obdo(&iattr, oa);
-        iattr.ia_mode &= ~S_IFMT;
-        iattr.ia_mode |= S_IFREG;
         lock_kernel();
         if (iattr.ia_mode & ATTR_SIZE)
                 down(&inode->i_sem);
@@ -568,18 +556,19 @@ static int filter_setattr(struct obd_conn *conn, struct obdo *oa)
         RETURN(rc);
 }
 
-static int filter_open(struct obd_conn *conn, struct obdo *oa)
+static int filter_open(struct lustre_handle *conn, struct obdo *oa,
+                          struct lov_stripe_md *ea)
 {
         struct obd_device *obd;
         struct dentry *dentry;
         /* ENTRY; */
 
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "fatal: invalid client %u\n", conn->oc_id);
+        if (!class_conn2export(conn)) {
+                CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
         dentry = filter_fid2dentry(obd, filter_parent(obd, oa->o_mode),
                                    oa->o_id, oa->o_mode);
         if (IS_ERR(dentry))
@@ -588,18 +577,19 @@ static int filter_open(struct obd_conn *conn, struct obdo *oa)
         return 0;
 } /* filter_open */
 
-static int filter_close(struct obd_conn *conn, struct obdo *oa)
+static int filter_close(struct lustre_handle *conn, struct obdo *oa,
+                          struct lov_stripe_md *ea)
 {
         struct obd_device *obd;
         struct dentry *dentry;
         /* ENTRY; */
 
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "fatal: invalid client %u\n", conn->oc_id);
+        if (!class_conn2export(conn)) {
+                CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
         dentry = filter_fid2dentry(obd, filter_parent(obd, oa->o_mode),
                                    oa->o_id, oa->o_mode);
         if (IS_ERR(dentry))
@@ -614,18 +604,19 @@ static int filter_close(struct obd_conn *conn, struct obdo *oa)
         return 0;
 } /* filter_close */
 
-static int filter_create(struct obd_conn* conn, struct obdo *oa)
+static int filter_create(struct lustre_handle* conn, struct obdo *oa, 
+                         struct lov_stripe_md **ea)
 {
         char name[64];
         struct obd_run_ctxt saved;
         struct file *file;
         int mode;
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct iattr;
         ENTRY;
 
-        if (!gen_client(conn)) {
-                CERROR("invalid client %u\n", conn->oc_id);
+        if (!class_conn2export(conn)) {
+                CERROR("invalid client %Lx\n", conn->addr);
                 return -EINVAL;
         }
 
@@ -655,23 +646,25 @@ static int filter_create(struct obd_conn* conn, struct obdo *oa)
         return 0;
 }
 
-static int filter_destroy(struct obd_conn *conn, struct obdo *oa)
+static int filter_destroy(struct lustre_handle *conn, struct obdo *oa, 
+                          struct lov_stripe_md *ea)
 {
-        struct obd_run_ctxt saved;
         struct obd_device *obd;
+        struct filter_obd *filter;
+        struct obd_run_ctxt saved;
         struct obd_export *export;
         struct inode *inode;
         struct dentry *dir_dentry, *object_dentry;
         int rc;
         ENTRY;
 
-        if (!(export = gen_client(conn))) {
-                CERROR("invalid client %u\n", conn->oc_id);
+        if (!(export = class_conn2export(conn))) {
+                CERROR("invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        CDEBUG(D_INODE, "destroying object %Ld\n",oa->o_id);
-        obd = gen_conn2obd(conn);
+        CDEBUG(D_INODE, "destroying object %Ld\n", oa->o_id);
+        obd = class_conn2obd(conn);
 
         dir_dentry = filter_parent(obd, oa->o_mode);
         down(&dir_dentry->d_inode->i_sem);
@@ -682,13 +675,20 @@ static int filter_destroy(struct obd_conn *conn, struct obdo *oa)
                 GOTO(out, rc = -ENOENT);
 
         inode = object_dentry->d_inode;
+        if (inode == NULL) {
+                CERROR("trying to destroy negative inode %Ld!\n", oa->o_id);
+                GOTO(out, rc = -ENOENT);
+        }
+
         if (inode->i_nlink != 1) {
                 CERROR("destroying inode with nlink = %d\n", inode->i_nlink);
+                LBUG();
                 inode->i_nlink = 1;
         }
         inode->i_mode = S_IFREG;
 
-        push_ctxt(&saved, &obd->u.filter.fo_ctxt);
+        filter = &obd->u.filter;
+        push_ctxt(&saved, &filter->fo_ctxt);
 
         rc = vfs_unlink(dir_dentry->d_inode, object_dentry);
         pop_ctxt(&saved);
@@ -703,89 +703,96 @@ out:
 }
 
 /* NB count and offset are used for punch, but not truncate */
-static int filter_truncate(struct obd_conn *conn, struct obdo *oa,
-                           obd_size count, obd_off offset)
+static int filter_truncate(struct lustre_handle *conn, struct obdo *oa,
+                           struct lov_stripe_md *md,
+                           obd_off start, obd_off end)
 {
         int error;
         ENTRY;
 
-        CDEBUG(D_INODE, "calling truncate for object #%Ld, valid = %x, "
-               "o_size = %Ld\n", oa->o_id, oa->o_valid, oa->o_size);
-        error = filter_setattr(conn, oa);
+        if ( end != 0xffffffffffffffff ) { 
+                CERROR("PUNCH not supported, only truncate works\n"); 
+        }
 
+        CDEBUG(D_INODE, "calling truncate for object #%Ld, valid = %x, "
+               "o_size = %Ld\n", oa->o_id, oa->o_valid, start);
+        oa->o_size = start;
+        error = filter_setattr(conn, oa, NULL);
         RETURN(error);
 }
 
-static int filter_pgcache_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
-                               struct obdo **oa, obd_count *oa_bufs,
+static int filter_pgcache_brw(int cmd, struct lustre_handle *conn, 
+                               struct lov_stripe_md *md, obd_count oa_bufs,
                                struct page **pages, obd_size *count,
-                               obd_off *offset, obd_flag *flags, void *callback)
+                               obd_off *offset, obd_flag *flags,
+                               brw_callback_t callback, void *data)
 {
         struct obd_run_ctxt      saved;
         struct super_block      *sb;
-        int                      onum;          /* index to oas */
         int                      pnum;          /* index to pages (bufs) */
         unsigned long            retval;
         int                      error;
         struct file             *file;
-        struct obd_device      *obd = gen_conn2obd(conn);
+        struct obd_device      *obd = class_conn2obd(conn);
+        int pg;
         ENTRY;
 
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
+        if (!class_conn2export(conn)) {
+                CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
         sb = obd->u.filter.fo_sb;
         push_ctxt(&saved, &obd->u.filter.fo_ctxt);
         pnum = 0; /* pnum indexes buf 0..num_pages */
-        for (onum = 0; onum < num_oa; onum++) {
-                int pg;
-
-                file = filter_obj_open(obd, oa[onum]->o_id, oa[onum]->o_mode);
-                if (IS_ERR(file))
-                        GOTO(out, retval = PTR_ERR(file));
-
-                /* count doubles as retval */
-                for (pg = 0; pg < oa_bufs[onum]; pg++) {
-                        CDEBUG(D_INODE, "OP %d obdo no/pno: (%d,%d) (%ld,%ld) "
-                               "off count (%Ld,%Ld)\n",
-                               cmd, onum, pnum, file->f_dentry->d_inode->i_ino,
-                               (unsigned long)offset[pnum] >> PAGE_CACHE_SHIFT,
-                               (unsigned long long)offset[pnum],
-                               (unsigned long long)count[pnum]);
-                        if (cmd & OBD_BRW_WRITE) {
-                                loff_t off;
-                                char *buffer;
-                                off = offset[pnum];
-                                buffer = kmap(pages[pnum]);
-                                retval = file->f_op->write(file, buffer, count[pnum], &off);
-                                kunmap(pages[pnum]);
-                                CDEBUG(D_INODE, "retval %ld\n", retval);
+
+        file = filter_obj_open(obd, md->lmd_object_id, S_IFREG);
+        if (IS_ERR(file))
+                GOTO(out, retval = PTR_ERR(file));
+
+        /* count doubles as retval */
+        for (pg = 0; pg < oa_bufs; pg++) {
+                CDEBUG(D_INODE, "OP %d obdo pgno: (%d) (%ld,%ld) "
+                       "off count (%Ld,%Ld)\n",
+                       cmd, pnum, file->f_dentry->d_inode->i_ino,
+                       (unsigned long)offset[pnum] >> PAGE_CACHE_SHIFT,
+                       (unsigned long long)offset[pnum],
+                       (unsigned long long)count[pnum]);
+                if (cmd & OBD_BRW_WRITE) {
+                        loff_t off;
+                        char *buffer;
+                        off = offset[pnum];
+                        buffer = kmap(pages[pnum]);
+                        retval = file->f_op->write(file, buffer, count[pnum],
+                                                   &off);
+                        kunmap(pages[pnum]);
+                        CDEBUG(D_INODE, "retval %ld\n", retval);
+                } else {
+                        loff_t off = offset[pnum];
+                        char *buffer = kmap(pages[pnum]);
+
+                        if (off >= file->f_dentry->d_inode->i_size) {
+                                memset(buffer, 0, count[pnum]);
+                                retval = count[pnum];
                         } else {
-                                loff_t off = offset[pnum];
-                                char *buffer = kmap(pages[pnum]);
-
-                                if (off >= file->f_dentry->d_inode->i_size) {
-                                        memset(buffer, 0, count[pnum]);
-                                        retval = count[pnum];
-                                } else {
-                                        retval = file->f_op->read(file, buffer, count[pnum], &off);
-                                }
-                                kunmap(pages[pnum]);
-
-                                if (retval != count[pnum]) {
-                                        filp_close(file, 0);
-                                        GOTO(out, retval = -EIO);
-                                }
-                                CDEBUG(D_INODE, "retval %ld\n", retval);
+                                retval = file->f_op->read(file, buffer,
+                                                          count[pnum], &off);
                         }
-                        pnum++;
+                        kunmap(pages[pnum]);
+
+                        if (retval != count[pnum]) {
+                                filp_close(file, 0);
+                                GOTO(out, retval = -EIO);
+                        }
+                        CDEBUG(D_INODE, "retval %ld\n", retval);
                 }
-                /* sizes and blocks are set by generic_file_write */
-                /* ctimes/mtimes will follow with a setattr call */
-                filp_close(file, 0);
+                pnum++;
         }
+        /* sizes and blocks are set by generic_file_write */
+        /* ctimes/mtimes will follow with a setattr call */
+        filp_close(file, 0);
+
+        /* XXX: do something with callback if it is set? */
 
         EXIT;
 out:
@@ -795,9 +802,9 @@ out:
 }
 
 
-struct inode *ioobj_to_inode(struct obd_conn *conn, struct obd_ioobj *o)
+struct inode *ioobj_to_inode(struct lustre_handle *conn, struct obd_ioobj *o)
 {
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct super_block *sb = obd->u.filter.fo_sb;
         struct inode *inode = NULL;
         ENTRY;
@@ -1080,7 +1087,7 @@ static int filter_commit_write(struct page *page, unsigned from, unsigned to,
         return lustre_commit_write(page, from, to);
 }
 
-static int filter_preprw(int cmd, struct obd_conn *conn,
+static int filter_preprw(int cmd, struct lustre_handle *conn,
                          int objcount, struct obd_ioobj *obj,
                          int niocount, struct niobuf_remote *nb,
                          struct niobuf_local *res, void **desc_private)
@@ -1096,7 +1103,7 @@ static int filter_preprw(int cmd, struct obd_conn *conn,
         ENTRY;
 
         memset(res, 0, sizeof(*res) * niocount);
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
 
         push_ctxt(&saved, &obd->u.filter.fo_ctxt);
 
@@ -1211,7 +1218,7 @@ out:
         return rc;
 }
 
-static int filter_commitrw(int cmd, struct obd_conn *conn,
+static int filter_commitrw(int cmd, struct lustre_handle *conn,
                            int objcount, struct obd_ioobj *obj,
                            int niocount, struct niobuf_local *res,
                            void *private)
@@ -1219,7 +1226,7 @@ static int filter_commitrw(int cmd, struct obd_conn *conn,
         struct obd_run_ctxt saved;
         struct obd_ioobj *o = obj;
         struct niobuf_local *r = res;
-        struct obd_device *obd = gen_conn2obd(conn); 
+        struct obd_device *obd = class_conn2obd(conn); 
         void *journal_save;
         int found_locked = 0;
         int rc = 0;
@@ -1284,37 +1291,27 @@ out_ctxt:
         RETURN(0);
 }
 
-static int filter_statfs(struct obd_conn *conn, struct statfs * statfs)
+static int filter_statfs(struct lustre_handle *conn, struct statfs *statfs)
 {
-        struct super_block *sb;
-        int err;
-        ENTRY;
-
-        if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
-                RETURN(-EINVAL);
-        }
-
-        sb = gen_conn2obd(conn)->u.filter.fo_sb;
-
-        err = sb->s_op->statfs(sb, statfs);
-        RETURN(err);
-} /* filter_statfs */
+        struct obd_device *obd = class_conn2obd(conn);
 
+        ENTRY;
+        RETURN(vfs_statfs(obd->u.filter.fo_sb, statfs));
+}
 
-static int filter_get_info(struct obd_conn *conn, obd_count keylen,
+static int filter_get_info(struct lustre_handle *conn, obd_count keylen,
                            void *key, obd_count *vallen, void **val)
 {
         struct obd_device *obd;
         struct obd_export * export;
         ENTRY;
 
-        if (!(export = gen_client(conn))) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
+        if (!(export = class_conn2export(conn))) {
+                CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
 
         if ( keylen == strlen("blocksize") &&
              memcmp(key, "blocksize", keylen) == 0 ) {
@@ -1332,8 +1329,8 @@ static int filter_get_info(struct obd_conn *conn, obd_count keylen,
 
         if ( keylen == strlen("root_ino") &&
              memcmp(key, "root_ino", keylen) == 0 ){
-                *vallen = sizeof(long);
-                *val = (void *)(long)FILTER_ROOTINO;
+                *vallen = sizeof(obd_id);
+                *val = (void *)(obd_id)FILTER_ROOTINO;
                 RETURN(0);
         }
 
@@ -1341,6 +1338,73 @@ static int filter_get_info(struct obd_conn *conn, obd_count keylen,
         RETURN(-EINVAL);
 }
 
+int filter_copy_data(struct lustre_handle *dst_conn, struct obdo *dst,
+                  struct lustre_handle *src_conn, struct obdo *src,
+                  obd_size count, obd_off offset)
+{
+        struct page *page;
+        struct lov_stripe_md srcmd, dstmd; 
+        unsigned long index = 0;
+        int err = 0;
+
+        memset(&srcmd, 0, sizeof(srcmd));
+        memset(&dstmd, 0, sizeof(dstmd));
+        srcmd.lmd_object_id = src->o_id;
+        dstmd.lmd_object_id = dst->o_id;
+
+        ENTRY;
+        CDEBUG(D_INFO, "src: ino %Ld blocks %Ld, size %Ld, dst: ino %Ld\n",
+               (unsigned long long)src->o_id, (unsigned long long)src->o_blocks,
+               (unsigned long long)src->o_size, (unsigned long long)dst->o_id);
+        page = alloc_page(GFP_USER);
+        if (page == NULL)
+                RETURN(-ENOMEM);
+
+        while (TryLockPage(page))
+                ___wait_on_page(page);
+
+        /* XXX with brw vector I/O, we could batch up reads and writes here,
+         *     all we need to do is allocate multiple pages to handle the I/Os
+         *     and arrays to handle the request parameters.
+         */
+        while (index < ((src->o_size + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
+                obd_size         brw_count = PAGE_SIZE;
+                obd_off          brw_offset = (page->index) << PAGE_SHIFT;
+                obd_flag         flagr = 0;
+                obd_flag         flagw = OBD_BRW_CREATE;
+
+                page->index = index;
+                err = obd_brw(OBD_BRW_READ, src_conn, &srcmd, 1, &page,
+                              &brw_count, &brw_offset, &flagr, NULL, NULL);
+
+                if ( err ) {
+                        EXIT;
+                        break;
+                }
+                CDEBUG(D_INFO, "Read page %ld ...\n", page->index);
+
+                err = obd_brw(OBD_BRW_WRITE, dst_conn, &dstmd, 1, &page,
+                              &brw_count, &brw_offset, &flagw, NULL, NULL);
+
+                /* XXX should handle dst->o_size, dst->o_blocks here */
+                if ( err ) {
+                        EXIT;
+                        break;
+                }
+
+                CDEBUG(D_INFO, "Wrote page %ld ...\n", page->index);
+
+                index++;
+        }
+        dst->o_size = src->o_size;
+        dst->o_blocks = src->o_blocks;
+        dst->o_valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS);
+        UnlockPage(page);
+        __free_page(page);
+
+        RETURN(err);
+}
+
 
 static struct obd_ops filter_obd_ops = {
         o_get_info:    filter_get_info,
@@ -1362,7 +1426,7 @@ static struct obd_ops filter_obd_ops = {
 #if 0
         o_preallocate: filter_preallocate_inodes,
         o_migrate:     filter_migrate,
-        o_copy:        gen_copy_data,
+        o_copy:        filter_copy_data,
         o_iterate:     filter_iterate
 #endif
 };
@@ -1370,16 +1434,16 @@ static struct obd_ops filter_obd_ops = {
 
 static int __init obdfilter_init(void)
 {
-        printk(KERN_INFO "Filtering OBD driver  v0.001, braam@clusterfs.com\n");
-        return obd_register_type(&filter_obd_ops, OBD_FILTER_DEVICENAME);
+        printk(KERN_INFO "Filtering OBD driver  v0.001, info@clusterfs.com\n");
+        return class_register_type(&filter_obd_ops, OBD_FILTER_DEVICENAME);
 }
 
 static void __exit obdfilter_exit(void)
 {
-        obd_unregister_type(OBD_FILTER_DEVICENAME);
+        class_unregister_type(OBD_FILTER_DEVICENAME);
 }
 
-MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
+MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 MODULE_DESCRIPTION("Lustre Filtering OBD driver v1.0");
 MODULE_LICENSE("GPL");