Whamcloud - gitweb
Added .cvsignore files to the repository
authorbraam <braam>
Thu, 2 Dec 1999 20:36:42 +0000 (20:36 +0000)
committerbraam <braam>
Thu, 2 Dec 1999 20:36:42 +0000 (20:36 +0000)
lustre/.cvsignore
lustre/obdclass/.cvsignore [new file with mode: 0644]
lustre/obdclass/genops.c
lustre/obdfs/.cvsignore [new file with mode: 0644]

index 15be996..886797f 100644 (file)
@@ -4,3 +4,6 @@ config.mk
 .depfiles
 .prereq.ok
 .ready
+*~
+TAGS
+Xrefs
diff --git a/lustre/obdclass/.cvsignore b/lustre/obdclass/.cvsignore
new file mode 100644 (file)
index 0000000..886797f
--- /dev/null
@@ -0,0 +1,9 @@
+config.h
+config.out
+config.mk
+.depfiles
+.prereq.ok
+.ready
+*~
+TAGS
+Xrefs
index 929dc88..3eaa05d 100644 (file)
 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
 
 /* map connection to client */
-struct obd_client *gen_client(struct obd_conn *conn)
+struct obd_client *gen_client(int cli_id)
 {
-       struct obd_device * obddev = conn->oc_dev;
+       struct obd_device * obddev;
        struct list_head * lh, * next;
        struct obd_client * cli;
+       int a;
 
-       lh = next = &obddev->obd_gen_clients;
-       while ((lh = lh->next) != &obddev->obd_gen_clients) {
-               cli = list_entry(lh, struct obd_client, cli_chain);
-               
-               if (cli->cli_id == conn->oc_id)
-                       return cli;
+       for (a = 0; a < MAX_OBD_DEVICES; a++) {
+               obddev = &obd_dev[a];
+
+               lh = next = &obddev->obd_gen_clients;
+               while ((lh = lh->next) != &obddev->obd_gen_clients) {
+                       cli = list_entry(lh, struct obd_client, cli_chain);
+                       
+                       if (cli->cli_id == cli_id)
+                               return cli;
+               }
        }
 
        return NULL;
@@ -44,46 +49,47 @@ struct obd_client *gen_client(struct obd_conn *conn)
 
 
 /* a connection defines a context in which preallocation can be managed. */ 
-int gen_connect (struct obd_conn *conn)
+int gen_connect (struct obd_device *obddev, 
+                       struct obd_conn_info * conninfo)
 {
        struct obd_client * cli;
 
        OBD_ALLOC(cli, struct obd_client *, sizeof(struct obd_client));
        if ( !cli ) {
                printk("obd_connect (minor %d): no memory!\n", 
-                      conn->oc_dev->obd_minor);
+                      obddev->obd_minor);
                return -ENOMEM;
        }
 
        INIT_LIST_HEAD(&cli->cli_prealloc_inodes);
        /* this should probably spinlocked? */
-       cli->cli_id = ++conn->oc_dev->obd_gen_last_id;
+       cli->cli_id = ++obddev->obd_gen_last_id;
        cli->cli_prealloc_quota = 0;
-       cli->cli_obd = conn->oc_dev;
-       list_add(&(cli->cli_chain), conn->oc_dev->obd_gen_clients.prev);
+       cli->cli_obd = obddev;
+       list_add(&(cli->cli_chain), obddev->obd_gen_clients.prev);
 
        CDEBUG(D_IOCTL, "connect: new ID %u\n", cli->cli_id);
-       conn->oc_id = cli->cli_id;
+       conninfo->conn_id = cli->cli_id;
        return 0;
 } /* gen_obd_connect */
 
 
-int gen_disconnect(struct obd_conn *conn)
+int gen_disconnect(unsigned int conn_id)
 {
        struct obd_client * cli;
+
        ENTRY;
 
-       if (!(cli = gen_client(conn))) {
+       if (!(cli = gen_client(conn_id))) {
                CDEBUG(D_IOCTL, "disconnect: attempting to free "
-                      "nonexistent client %u\n", conn->oc_id);
+                      "nonexistent client %u\n", conn_id);
                return -EINVAL;
        }
 
-
        list_del(&(cli->cli_chain));
        OBD_FREE(cli, sizeof(struct obd_client));
 
-       CDEBUG(D_IOCTL, "disconnect: ID %u\n", conn->oc_id);
+       CDEBUG(D_IOCTL, "disconnect: ID %u\n", conn_id);
 
        EXIT;
        return 0;
@@ -98,11 +104,12 @@ int gen_disconnect(struct obd_conn *conn)
 int gen_multi_setup(struct obd_device *obddev, int len, void *data)
 {
        int i;
+       struct obd_device *rdev = obddev->obd_multi_dev[0];
 
        for (i = 0 ; i < obddev->obd_multi_count ; i++ ) {
                int rc;
-               struct obd_conn *ch_conn = &obddev->obd_multi_conn[i];
-               rc  = OBP(ch_conn->oc_dev, connect)(ch_conn);
+               struct obd_device *child = rdev + i;
+               rc  = OBP(child, connect)(child, &rdev->obd_multi_conns[i]);
 
                if ( rc != 0 ) {
                        /* XXX disconnect others */
@@ -112,8 +119,27 @@ int gen_multi_setup(struct obd_device *obddev, int len, void *data)
        return 0;
 }
 
+int gen_multi_cleanup(struct obd_device * obddev)
+{
+       int i;
+       struct obd_device **rdev = obddev->obd_multi_dev;
+
+       for (i = 0 ; i < obddev->obd_multi_count ; i++ ) {
+               int rc;
+               struct obd_device *child = *(rdev + i);
+               rc  = OBP(child, cleanup)(child);
+               *(rdev + i) = NULL;
+
+               if ( rc != 0 ) {
+                       /* XXX disconnect others */
+                       return -EINVAL;
+               }
+       }
+       gen_cleanup(obddev);
+       return 0;
+} /* sim_cleanup_obddev */
+
 
-#if 0
 int gen_multi_attach(struct obd_device *obddev, int len, void *data)
 {
        int i;
@@ -130,7 +156,7 @@ int gen_multi_attach(struct obd_device *obddev, int len, void *data)
        }
        return 0;
 }
-#endif
+
 
 
 /*
@@ -138,18 +164,22 @@ int gen_multi_attach(struct obd_device *obddev, int len, void *data)
  *    close all connections to lower devices
  *    needed for forced unloads of OBD client drivers
  */
-int gen_multi_cleanup(struct obd_device *obddev)
+int gen_multi_cleanup_device(struct obd_device *obddev)
 {
        int i;
+       struct obd_device **rdev;
 
+       rdev =  obddev->obd_multi_dev;
        for (i = 0 ; i < obddev->obd_multi_count ; i++ ) {
-               struct obd_conn *ch_conn = &obddev->obd_multi_conn[i];
                int rc;
-               rc  = OBP(ch_conn->oc_dev, disconnect)(ch_conn);
+               struct obd_device *child = *(rdev + i);
+               rc  = OBP(child, disconnect)
+                       (obddev->obd_multi_conns[i].conn_id);
 
                if ( rc != 0 ) {
-                       printk("OBD multi cleanup dev: disconnect failure %d\n", ch_conn->oc_dev->obd_minor);
+                       printk("OBD multi cleanup dev: disconnect failure %d\n", child->obd_minor);
                }
+               *(rdev + i) = NULL;
        }               
        return 0;
 } /* gen_multi_cleanup_device */
@@ -172,64 +202,116 @@ int gen_cleanup(struct obd_device * obddev)
                cli = list_entry(tmp, struct obd_client, cli_chain);
                CDEBUG(D_IOCTL, "Disconnecting obd_connection %d, at %p\n",
                       cli->cli_id, cli);
+               OBP(obddev, disconnect)(cli->cli_id);
        }
-       return 0;
+
+       return OBP(obddev, cleanup_device)(obddev);
 } /* sim_cleanup_device */
 
-void ___wait_on_page(struct page *page)
+/* 
+ * Wait for a page to get unlocked.
+ *
+ * This must be called with the caller "holding" the page,
+ * ie with increased "page->count" so that the page won't
+ * go away during the wait..
+ */
+static void my__wait_on_page(struct page *page)
 {
-        struct task_struct *tsk = current;
-        DECLARE_WAITQUEUE(wait, tsk);
-
-        add_wait_queue(&page->wait, &wait);
-        do {
-                run_task_queue(&tq_disk);
-                set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-                if (!PageLocked(page))
-                        break;
-                schedule();
-        } while (PageLocked(page));
-        tsk->state = TASK_RUNNING;
-        remove_wait_queue(&page->wait, &wait);
+       struct task_struct *tsk = current;
+       DECLARE_WAITQUEUE(wait, tsk);
+
+       add_wait_queue(&page->wait, &wait);
+       do {
+               run_task_queue(&tq_disk);
+               set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+               if (!PageLocked(page))
+                       break;
+               schedule();
+       } while (PageLocked(page));
+       tsk->state = TASK_RUNNING;
+       remove_wait_queue(&page->wait, &wait);
 }
 
-void lck_page(struct page *page)
+/*
+ * Get an exclusive lock on the page..
+ */
+static void lck_page(struct page *page)
 {
-        while (TryLockPage(page))
-                ___wait_on_page(page);
+       while (TryLockPage(page))
+               my__wait_on_page(page);
 }
 
-int gen_copy_data(struct obd_conn *conn, obdattr *src, obdattr *tgt)
+/* obdo's must be correctly filled in by caller! */
+int gen_copy_data(struct obd_device *obddev, int conn_id, 
+                      obdattr *source, obdattr *target)
 {
        struct page *page;
+<<<<<<< genops.c
+       int res;
+       int err;
+       int i;
+=======
        unsigned long index = 0;
        int rc;
+>>>>>>> 1.5
 
+<<<<<<< genops.c
+       page = __get_pages(GFP_USER, 0);
+       if (!page) 
+               return EIO;
+       lck_page(page);
+=======
        page = alloc_page(GFP_USER);
        if ( !page ) 
                return -ENOMEM;
-
+>>>>>>> 1.5
+
+       err = 0;
+       i = 0;
+       while (1) {
+               CDEBUG(D_IOCTL, "i %d, size %ld\n", i, source->i_size);
+               err = 0;
+               if ( i >= (source->i_size >> PAGE_SHIFT) ) 
+                       break;
        
+<<<<<<< genops.c
+               page->offset = i << PAGE_SHIFT;
+               err = -EIO;
+               CDEBUG(D_IOCTL, "i %d, offset %ld, size %ld\n", i, 
+                      page->offset, source->i_size);
+               res = OBP(obddev, brw)(READ, conn_id, source, page, 0);
+               CDEBUG(D_IOCTL, "Result reading %d\n", res);
+               if ( res < 0 ) 
+                       break;
+=======
        lck_page(page);
        
        while (index < ((src->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
                
                page->index = index;
                rc = OBP(conn->oc_dev, brw)(READ, conn, src, page, 0);
+>>>>>>> 1.5
 
-               if ( rc != PAGE_SIZE ) 
+               res = OBP(obddev, brw)(WRITE, conn_id, target, page, 1);
+               CDEBUG(D_IOCTL, "Result writing %d\n", res);
+               if ( res < 0 ) 
                        break;
 
+<<<<<<< genops.c
+               i++;
+=======
                rc = OBP(conn->oc_dev,brw)(WRITE, conn, tgt, page, 1);
                if ( rc != PAGE_SIZE)
                        break;
                
                index ++;
+>>>>>>> 1.5
        }
-       tgt->i_size = src->i_size;
-       tgt->i_blocks = src->i_blocks;
        UnlockPage(page);
        __free_page(page);
 
-       return 0;
+       target->i_size = source->i_size;
+       OBP(obddev, setattr)(conn_id, target);
+
+       return err;
 }
diff --git a/lustre/obdfs/.cvsignore b/lustre/obdfs/.cvsignore
new file mode 100644 (file)
index 0000000..886797f
--- /dev/null
@@ -0,0 +1,9 @@
+config.h
+config.out
+config.mk
+.depfiles
+.prereq.ok
+.ready
+*~
+TAGS
+Xrefs