Whamcloud - gitweb
LU-4088 obdecho: Copy entire lsm, not just pointer size
[fs/lustre-release.git] / lustre / obdecho / echo_client.c
index 5eb750a..0b22468 100644 (file)
@@ -1301,22 +1301,17 @@ static int cl_echo_cancel(struct echo_device *ed, __u64 cookie)
         RETURN(rc);
 }
 
-static int cl_echo_async_brw(const struct lu_env *env, struct cl_io *io,
-                             enum cl_req_type unused, struct cl_2queue *queue)
+static void echo_commit_callback(const struct lu_env *env, struct cl_io *io,
+                               struct cl_page *page)
 {
-        struct cl_page *clp;
-        struct cl_page *temp;
-        int result = 0;
-        ENTRY;
+       struct echo_thread_info *info;
+       struct cl_2queue        *queue;
 
-        cl_page_list_for_each_safe(clp, temp, &queue->c2_qin) {
-                int rc;
-                rc = cl_page_cache_add(env, io, clp, CRT_WRITE);
-                if (rc == 0)
-                        continue;
-                result = result ?: rc;
-        }
-        RETURN(result);
+       info = echo_env_info(env);
+       LASSERT(io == &info->eti_io);
+
+       queue = &info->eti_queue;
+       cl_page_list_add(&queue->c2_qout, page);
 }
 
 static int cl_echo_object_brw(struct echo_object *eco, int rw, obd_off offset,
@@ -1394,8 +1389,10 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, obd_off offset,
 
                 async = async && (typ == CRT_WRITE);
                 if (async)
-                        rc = cl_echo_async_brw(env, io, typ, queue);
-                else
+                       rc = cl_io_commit_async(env, io, &queue->c2_qin,
+                                               0, PAGE_SIZE,
+                                               echo_commit_callback);
+               else
                        rc = cl_io_submit_sync(env, io, typ, queue, 0);
                 CDEBUG(D_INFO, "echo_client %s write returns %d\n",
                        async ? "async" : "sync", rc);
@@ -1427,7 +1424,7 @@ echo_copyout_lsm (struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob)
         if (nob > ulsm_nob)
                 return (-EINVAL);
 
-       if (copy_to_user (ulsm, lsm, sizeof(ulsm)))
+       if (copy_to_user (ulsm, lsm, sizeof(*ulsm)))
                 return (-EFAULT);
 
         for (i = 0; i < lsm->lsm_stripe_count; i++) {
@@ -3229,16 +3226,18 @@ int echo_client_init(void)
 
         lprocfs_echo_init_vars(&lvars);
 
-        rc = lu_kmem_init(echo_caches);
-        if (rc == 0) {
-                rc = class_register_type(&echo_client_obd_ops, NULL,
-                                         lvars.module_vars,
-                                         LUSTRE_ECHO_CLIENT_NAME,
-                                         &echo_device_type);
-                if (rc)
-                        lu_kmem_fini(echo_caches);
-        }
-        return rc;
+       rc = lu_kmem_init(echo_caches);
+       if (rc == 0) {
+               rc = class_register_type(&echo_client_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+                                       lvars.module_vars,
+#endif
+                                       LUSTRE_ECHO_CLIENT_NAME,
+                                       &echo_device_type);
+               if (rc)
+                       lu_kmem_fini(echo_caches);
+       }
+       return rc;
 }
 
 void echo_client_exit(void)
@@ -3265,10 +3264,13 @@ static int __init obdecho_init(void)
         if (rc != 0)
                 goto failed_0;
 
-        rc = class_register_type(&echo_obd_ops, NULL, lvars.module_vars,
-                                 LUSTRE_ECHO_NAME, NULL);
-        if (rc != 0)
-                goto failed_1;
+       rc = class_register_type(&echo_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+                               lvars.module_vars,
+#endif
+                               LUSTRE_ECHO_NAME, NULL);
+       if (rc != 0)
+               goto failed_1;
 # endif
 
         rc = echo_client_init();