commit 531ba7ba8246756622408755613b6b111750b411
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Thu Mar 22 15:13:57 2007 -0400

    moved sioa wait functions to sioq.c

diff --git a/fs/unionfs/sioq.c b/fs/unionfs/sioq.c
index 91413c7..a2cc293 100644
--- a/fs/unionfs/sioq.c
+++ b/fs/unionfs/sioq.c
@@ -100,6 +100,49 @@ void run_sioa(struct sioa_args *args, void (*work) 
(void*), signed long timeout)
        kernel_thread(__run_sioa, args, 0);
 }
 
+/* Synchronous wake up an sioa thread, makes sure the thread 
+ * finishes its work before the caller resumes
+ */
+void wake_up_and_wait_sioa(struct sioa_args *args)
+{
+       mutex_lock(&args->lock);
+       args->waiting = 1;
+       init_completion(&args->comp_work);
+       if (args->process)
+               wake_up_process(args->process);
+       schedule();
+       wait_for_completion(&args->comp_work);
+       mutex_unlock(&args->lock);
+}
+
+/* Asynchronously wake up an sioa thread */
+void wake_up_sioa(struct sioa_args *args)
+{
+       /* if the lock is being held by another thread, then this is most likely
+        * because of a synchronous call to wake_up_sioa, so if we wait for the
+        * lock here we'll end being a synchronous call as well. */
+       if (!mutex_trylock(&args->lock))
+               return; 
+       wake_up_process(args->process);
+       schedule();
+       mutex_unlock(&args->lock);
+}
+
+/* Marks an sioa thread as complete and waits for it to finish */
+void complete_sioa(struct sioa_args *args)
+{
+       mutex_lock(&args->lock);
+       args->complete = 1;
+
+       /* there might be the case that this is called before the */
+       /* thread actually runs and process is initialized */
+       if (args->process)
+               wake_up_process(args->process);
+       schedule();
+       wait_for_completion(&args->comp_thread);
+       mutex_unlock(&args->lock);
+}
+
 void __unionfs_create(struct work_struct *work)
 {
        struct sioq_args *args = container_of(work, struct sioq_args, work);
diff --git a/fs/unionfs/sioq.h b/fs/unionfs/sioq.h
index 078bf0f..d83bf45 100644
--- a/fs/unionfs/sioq.h
+++ b/fs/unionfs/sioq.h
@@ -71,44 +71,9 @@ extern int __init init_sioq(void);
 extern __exit void stop_sioq(void);
 extern void run_sioq(work_func_t func, struct sioq_args *args);
 extern void run_sioa(struct sioa_args *args, void (*work) (void*), signed long 
timeout);
-
-/* wakes up the process and makes sure it resumes before we do */
-static inline void wake_up_and_wait_sioa(struct sioa_args *args)
-{
-       mutex_lock(&args->lock);
-       args->waiting = 1;
-       init_completion(&args->comp_work);
-       if (args->process)
-               wake_up_process(args->process);
-       schedule();
-       wait_for_completion(&args->comp_work);
-       mutex_unlock(&args->lock);
-}
-static inline void wake_up_sioa(struct sioa_args *args)
-{
-       mutex_lock(&args->lock);
-       wake_up_process(args->process);
-       schedule();
-       mutex_unlock(&args->lock);
-}
-
-static inline void complete_sioa(struct sioa_args *args)
-{
-       mutex_lock(&args->lock);
-       args->complete = 1;
-
-       /* there might be the case that this is called before the */
-       /* thread actually runs and process is initialized */
-       if (args->process)
-               wake_up_process(args->process);
-       schedule();
-       wait_for_completion(&args->comp_thread);
-       mutex_unlock(&args->lock);
-}
-static inline void wait_for_sioa(struct sioa_args *args)
-{
-       wait_for_completion(&args->comp_thread);
-}
+extern void wake_up_and_wait_sioa(struct sioa_args *args);
+extern void wake_up_sioa(struct sioa_args *args);
+extern void complete_sioa(struct sioa_args *args);
 
 /* Extern definitions for our privlege escalation helpers */
 extern void __unionfs_create(struct work_struct *work);
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to