]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/recovery.c
touchscreen: Fix build of da9034
[linux-2.6-omap-h63xx.git] / fs / gfs2 / recovery.c
index d5e91f4f6a0b7aa88f36e5ce666c8781d31a5103..efd09c3d2b26975b5497b323497d2b3d802bd452 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
 #include <linux/lm_interface.h>
+#include <linux/kthread.h>
+#include <linux/freezer.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -583,13 +585,35 @@ fail:
        return error;
 }
 
+static struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp)
+{
+       struct gfs2_jdesc *jd;
+       int found = 0;
+
+       spin_lock(&sdp->sd_jindex_spin);
+
+       list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
+               if (jd->jd_dirty) {
+                       jd->jd_dirty = 0;
+                       found = 1;
+                       break;
+               }
+       }
+       spin_unlock(&sdp->sd_jindex_spin);
+
+       if (!found)
+               jd = NULL;
+
+       return jd;
+}
+
 /**
  * gfs2_check_journals - Recover any dirty journals
  * @sdp: the filesystem
  *
  */
 
-void gfs2_check_journals(struct gfs2_sbd *sdp)
+static void gfs2_check_journals(struct gfs2_sbd *sdp)
 {
        struct gfs2_jdesc *jd;
 
@@ -603,3 +627,25 @@ void gfs2_check_journals(struct gfs2_sbd *sdp)
        }
 }
 
+/**
+ * gfs2_recoverd - Recover dead machine's journals
+ * @sdp: Pointer to GFS2 superblock
+ *
+ */
+
+int gfs2_recoverd(void *data)
+{
+       struct gfs2_sbd *sdp = data;
+       unsigned long t;
+
+       while (!kthread_should_stop()) {
+               gfs2_check_journals(sdp);
+               t = gfs2_tune_get(sdp,  gt_recoverd_secs) * HZ;
+               if (freezing(current))
+                       refrigerator();
+               schedule_timeout_interruptible(t);
+       }
+
+       return 0;
+}
+