[PATCH] Fix core files so they make sense to gdb...
[powerpc.git] / fs / gfs2 / daemon.c
index cff8d53..cab1f68 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
- * Copyright (C) 2004-2005 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License v.2.
+ * of the GNU General Public License version 2.
  */
 
 #include <linux/sched.h>
 #include <linux/buffer_head.h>
 #include <linux/kthread.h>
 #include <linux/delay.h>
-#include <asm/semaphore.h>
+#include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
+#include "incore.h"
 #include "daemon.h"
 #include "glock.h"
 #include "log.h"
 #include "quota.h"
 #include "recovery.h"
 #include "super.h"
-#include "unlinked.h"
+#include "util.h"
 
 /* This uses schedule_timeout() instead of msleep() because it's good for
    the daemons to wake up more often than the timeout when unmounting so
    the user's unmount doesn't sit there forever.
-   
+
    The kthread functions used to start these daemons block and flush signals. */
 
 /**
@@ -41,7 +43,7 @@
 
 int gfs2_scand(void *data)
 {
-       struct gfs2_sbd *sdp = (struct gfs2_sbd *)data;
+       struct gfs2_sbd *sdp = data;
        unsigned long t;
 
        while (!kthread_should_stop()) {
@@ -63,20 +65,15 @@ int gfs2_scand(void *data)
 
 int gfs2_glockd(void *data)
 {
-       struct gfs2_sbd *sdp = (struct gfs2_sbd *)data;
-       DECLARE_WAITQUEUE(wait_chan, current);
+       struct gfs2_sbd *sdp = data;
 
        while (!kthread_should_stop()) {
                while (atomic_read(&sdp->sd_reclaim_count))
                        gfs2_reclaim_glock(sdp);
 
-               set_current_state(TASK_INTERRUPTIBLE);
-               add_wait_queue(&sdp->sd_reclaim_wq, &wait_chan);
-               if (!atomic_read(&sdp->sd_reclaim_count) &&
-                   !kthread_should_stop())
-                       schedule();
-               remove_wait_queue(&sdp->sd_reclaim_wq, &wait_chan);
-               set_current_state(TASK_RUNNING);
+               wait_event_interruptible(sdp->sd_reclaim_wq,
+                                        (atomic_read(&sdp->sd_reclaim_count) ||
+                                        kthread_should_stop()));
        }
 
        return 0;
@@ -90,7 +87,7 @@ int gfs2_glockd(void *data)
 
 int gfs2_recoverd(void *data)
 {
-       struct gfs2_sbd *sdp = (struct gfs2_sbd *)data;
+       struct gfs2_sbd *sdp = data;
        unsigned long t;
 
        while (!kthread_should_stop()) {
@@ -112,7 +109,7 @@ int gfs2_recoverd(void *data)
 
 int gfs2_logd(void *data)
 {
-       struct gfs2_sbd *sdp = (struct gfs2_sbd *)data;
+       struct gfs2_sbd *sdp = data;
        struct gfs2_holder ji_gh;
        unsigned long t;
 
@@ -125,7 +122,7 @@ int gfs2_logd(void *data)
                gfs2_ail1_empty(sdp, DIO_ALL);
 
                if (time_after_eq(jiffies, t)) {
-                       gfs2_log_flush(sdp);
+                       gfs2_log_flush(sdp, NULL);
                        sdp->sd_log_flush_time = jiffies;
                }
 
@@ -155,7 +152,7 @@ int gfs2_logd(void *data)
 
 int gfs2_quotad(void *data)
 {
-       struct gfs2_sbd *sdp = (struct gfs2_sbd *)data;
+       struct gfs2_sbd *sdp = data;
        unsigned long t;
        int error;
 
@@ -197,29 +194,3 @@ int gfs2_quotad(void *data)
        return 0;
 }
 
-/**
- * gfs2_inoded - Deallocate unlinked inodes
- * @sdp: Pointer to GFS2 superblock
- *
- */
-
-int gfs2_inoded(void *data)
-{
-       struct gfs2_sbd *sdp = (struct gfs2_sbd *)data;
-       unsigned long t;
-       int error;
-
-       while (!kthread_should_stop()) {
-               error = gfs2_unlinked_dealloc(sdp);
-               if (error &&
-                   error != -EROFS &&
-                   !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-                       fs_err(sdp, "inoded: error = %d\n", error);
-
-               t = gfs2_tune_get(sdp, gt_inoded_secs) * HZ;
-               schedule_timeout_interruptible(t);
-       }
-
-       return 0;
-}
-