Whamcloud - gitweb
b=14230
authorpravins <pravins>
Wed, 9 Apr 2008 15:24:47 +0000 (15:24 +0000)
committerpravins <pravins>
Wed, 9 Apr 2008 15:24:47 +0000 (15:24 +0000)
i=h.huang
i=manoj.joseph

cleanup for umds, this patch replaces kernel api call with equivalent
api from lustre library.

lustre/fld/fld_request.c
lustre/include/lustre_lib.h
lustre/mdc/mdc_lib.c
lustre/mdt/mdt_capa.c
lustre/mdt/mdt_handler.c

index 8a6a186..1ec2b9c 100644 (file)
@@ -73,7 +73,7 @@ static void fld_enter_request(struct client_obd *cli)
         spin_lock(&cli->cl_loi_list_lock);
         if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) {
                 list_add_tail(&mcw.mcw_entry, &cli->cl_cache_waiters);
-                init_waitqueue_head(&mcw.mcw_waitq);
+                cfs_waitq_init(&mcw.mcw_waitq);
                 spin_unlock(&cli->cl_loi_list_lock);
                 l_wait_event(mcw.mcw_waitq, fld_req_avail(cli, &mcw), &lwi);
         } else {
@@ -99,7 +99,7 @@ static void fld_exit_request(struct client_obd *cli)
                 mcw = list_entry(l, struct mdc_cache_waiter, mcw_entry);
                 list_del_init(&mcw->mcw_entry);
                 cli->cl_r_in_flight++;
-                wake_up(&mcw->mcw_waitq);
+                cfs_waitq_signal(&mcw->mcw_waitq);
         }
         spin_unlock(&cli->cl_loi_list_lock);
 }
index 352205d..2b54888 100644 (file)
@@ -743,6 +743,7 @@ do {                                                                    \
 
 #endif /* __KERNEL__ */
 
+
 #define l_wait_event(wq, condition, info)                       \
 ({                                                              \
         int                 __ret;                              \
@@ -761,6 +762,15 @@ do {                                                                    \
         __ret;                                                  \
 })
 
+#define cfs_wait_event(wq, condition)                          \
+({                                                              \
+        int  __ret;                                                    \
+                                                                \
+        struct l_wait_info lwi = { 0 };                         \
+        l_wait_event(wq, condition, &lwi);                      \
+        __ret;                                                  \
+})
+
 #ifdef __KERNEL__
 #define LIBLUSTRE_CLIENT (0)
 #else
index de09e61..818a621 100644 (file)
@@ -495,7 +495,7 @@ void mdc_enter_request(struct client_obd *cli)
         spin_lock(&cli->cl_loi_list_lock);
         if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) {
                 list_add_tail(&mcw.mcw_entry, &cli->cl_cache_waiters);
-                init_waitqueue_head(&mcw.mcw_waitq);
+                cfs_waitq_init(&mcw.mcw_waitq);
                 spin_unlock(&cli->cl_loi_list_lock);
                 l_wait_event(mcw.mcw_waitq, mdc_req_avail(cli, &mcw), &lwi);
         } else {
@@ -521,7 +521,7 @@ void mdc_exit_request(struct client_obd *cli)
                 mcw = list_entry(l, struct mdc_cache_waiter, mcw_entry);
                 list_del_init(&mcw->mcw_entry);
                 cli->cl_r_in_flight++;
-                wake_up(&mcw->mcw_waitq);
+                cfs_waitq_signal(&mcw->mcw_waitq);
         }
         /* Empty waiting list? Decrease reqs in-flight number */
         
index 5e967b1..585f2ac 100644 (file)
@@ -276,14 +276,14 @@ int mdt_ck_thread_start(struct mdt_device *mdt)
         int rc;
 
         cfs_waitq_init(&thread->t_ctl_waitq);
-        rc = kernel_thread(mdt_ck_thread_main, mdt,
+        rc = cfs_kernel_thread(mdt_ck_thread_main, mdt,
                            (CLONE_VM | CLONE_FILES));
         if (rc < 0) {
                 CERROR("cannot start mdt_ck thread, rc = %d\n", rc);
                 return rc;
         }
 
-        wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_RUNNING);
+        cfs_wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_RUNNING);
         return 0;
 }
 
@@ -296,7 +296,7 @@ void mdt_ck_thread_stop(struct mdt_device *mdt)
 
         thread->t_flags = SVC_STOPPING;
         cfs_waitq_signal(&thread->t_ctl_waitq);
-        wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED);
+        cfs_wait_event(thread->t_ctl_waitq, thread->t_flags & SVC_STOPPED);
 }
 
 
index 6f2f035..a19234b 100644 (file)
@@ -1320,7 +1320,7 @@ static int mdt_writepage(struct mdt_thread_info *info)
 cleanup_lwi:
         OBD_FREE_PTR(lwi);
 cleanup_page:
-        __cfs_free_page(page);
+        cfs_free_page(page);
 desc_cleanup:
         ptlrpc_free_bulk(desc);
         RETURN(rc);
@@ -1381,7 +1381,7 @@ free_rdpg:
 
         for (i = 0; i < rdpg->rp_npages; i++)
                 if (rdpg->rp_pages[i] != NULL)
-                        __cfs_free_page(rdpg->rp_pages[i]);
+                        cfs_free_page(rdpg->rp_pages[i]);
         OBD_FREE(rdpg->rp_pages, rdpg->rp_npages * sizeof rdpg->rp_pages[0]);
 
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_SENDPAGE))