[Ocfs2-commits] mfasheh commits r1671 - branches/dlm-glue/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Nov 23 16:47:58 CST 2004
Author: mfasheh
Date: 2004-11-23 16:47:56 -0600 (Tue, 23 Nov 2004)
New Revision: 1671
Modified:
branches/dlm-glue/src/journal.c
branches/dlm-glue/src/ocfs.h
branches/dlm-glue/src/ocfs_journal.h
branches/dlm-glue/src/super.c
Log:
* ocfs_wait was only used in commit thread, open code that wait loop instead
Modified: branches/dlm-glue/src/journal.c
===================================================================
--- branches/dlm-glue/src/journal.c 2004-11-23 22:46:43 UTC (rev 1670)
+++ branches/dlm-glue/src/journal.c 2004-11-23 22:47:56 UTC (rev 1671)
@@ -60,6 +60,7 @@
static int __ocfs_recovery_thread(void *arg);
static int ocfs_commit_cache (ocfs_super * osb);
static int ocfs_wait_on_mount(ocfs_super *osb);
+static int ocfs2_commit_thread_sleep(ocfs_super *osb);
static void ocfs_handle_cleanup_locks(ocfs_journal *journal,
ocfs_journal_handle *handle,
int set_id);
@@ -781,8 +782,8 @@
if (osb->commit && osb->commit->c_task) {
/* Wait for the commit thread */
LOG_TRACE_STR ("Waiting for ocfs2commit to exit....");
- atomic_set (&osb->flush_event_woken, 1);
- wake_up (&osb->flush_event);
+ atomic_set (&osb->needs_checkpoint, 1);
+ wake_up (&osb->checkpoint_event);
wait_for_completion(&osb->commit->c_complete);
osb->commit->c_task = NULL;
kfree(osb->commit);
@@ -1455,6 +1456,40 @@
goto retry;
}
+static int ocfs2_commit_thread_sleep(ocfs_super *osb)
+{
+ int status;
+ signed long timeout = OCFS_CHECKPOINT_INTERVAL;
+ DECLARE_WAITQUEUE(wait, current);
+
+ if (atomic_read(&osb->needs_checkpoint))
+ return 0;
+
+ status = 0;
+ add_wait_queue(&osb->checkpoint_event, &wait);
+ while (1) {
+ set_current_state(TASK_INTERRUPTIBLE);
+
+ if (atomic_read(&osb->needs_checkpoint))
+ break;
+
+ if (!signal_pending(current)) {
+ timeout = schedule_timeout(timeout);
+ if (!timeout) {
+ status = -ETIMEDOUT;
+ break;
+ }
+ continue;
+ }
+ status = -EINTR;
+ break;
+ }
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(&osb->checkpoint_event, &wait);
+
+ return status;
+}
+
int ocfs_commit_thread(void *arg)
{
int status = 0, misses = 0;
@@ -1471,15 +1506,12 @@
misses = 0;
while (1) {
- status = ocfs_wait (osb->flush_event,
- atomic_read (&osb->flush_event_woken),
- OCFS_CHECKPOINT_INTERVAL);
+ status = ocfs2_commit_thread_sleep(osb);
+ atomic_set (&osb->needs_checkpoint, 0);
- atomic_set (&osb->flush_event_woken, 0);
-
switch (status) {
case -ETIMEDOUT:
- LOG_TRACE_STR("FLUSH_EVENT: timed out");
+ LOG_TRACE_STR("timed out");
break;
case -EINTR:
LOG_ERROR_STR("Commit thread got a signal!");
@@ -1491,10 +1523,10 @@
}
break;
case 0:
- LOG_TRACE_STR("FLUSH_EVENT: woken!!!");
+ LOG_TRACE_STR("woken\n");
break;
default:
- LOG_TRACE_STR("FLUSH_EVENT: ??????");
+ LOG_ERROR_STR("invalid status!\n");
break;
}
Modified: branches/dlm-glue/src/ocfs.h
===================================================================
--- branches/dlm-glue/src/ocfs.h 2004-11-23 22:46:43 UTC (rev 1670)
+++ branches/dlm-glue/src/ocfs.h 2004-11-23 22:47:56 UTC (rev 1671)
@@ -364,8 +364,8 @@
struct semaphore recovery_lock;
int recovery_launched;
int disable_recovery;
- wait_queue_head_t flush_event;
- atomic_t flush_event_woken;
+ wait_queue_head_t checkpoint_event;
+ atomic_t needs_checkpoint;
struct _ocfs_journal *journal;
atomic_t clean_buffer_seq;
spinlock_t clean_buffer_lock;
@@ -456,56 +456,6 @@
#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
#define NAMEI_RA_INDEX(c,b) (((c) * NAMEI_RA_BLOCKS) + (b))
-#define __ocfs_wait(wq, condition, timeo, ret) \
-do { \
- ocfs_timeout __to; \
- \
- DECLARE_WAITQUEUE(__wait, current); \
- DECLARE_WAITQUEUE(__to_wait, current); \
- \
- ocfs_init_timeout(&__to); \
- \
- if (timeo) { \
- ocfs_set_timeout(&__to, timeo); \
- if (__to.timed_out) { \
- ocfs_clear_timeout(&__to); \
- } \
- } \
- \
- add_wait_queue(&wq, &__wait); \
- add_wait_queue(&__to.wait, &__to_wait); \
- do { \
- ret = 0; \
- set_current_state(TASK_INTERRUPTIBLE); \
- if (condition) \
- break; \
- ret = -ETIMEDOUT; \
- if (__to.timed_out) \
- break; \
- schedule(); \
- if (signal_pending(current)) { \
- ret = -EINTR; \
- break; \
- } \
- } while (1); \
- \
- set_current_state(TASK_RUNNING); \
- remove_wait_queue(&wq, &__wait); \
- remove_wait_queue(&__to.wait, &__to_wait); \
- \
- if (timeo) \
- ocfs_clear_timeout(&__to); \
- \
-} while(0)
-
-#define ocfs_wait(wq, condition, timeout) \
-({ \
- int __ret = 0; \
- if (!(condition)) \
- __ocfs_wait(wq, condition, timeout, __ret); \
- __ret; \
-})
-
static inline unsigned long ino_from_blkno(struct super_block *sb,
u64 blkno)
{
Modified: branches/dlm-glue/src/ocfs_journal.h
===================================================================
--- branches/dlm-glue/src/ocfs_journal.h 2004-11-23 22:46:43 UTC (rev 1670)
+++ branches/dlm-glue/src/ocfs_journal.h 2004-11-23 22:47:56 UTC (rev 1671)
@@ -30,7 +30,7 @@
#include <linux/jbd.h>
#define OCFS_JOURNAL_CURRENT_VERSION 1
-#define OCFS_CHECKPOINT_INTERVAL 8000
+#define OCFS_CHECKPOINT_INTERVAL (8 * HZ)
enum ocfs_journal_state {
OCFS_JOURNAL_FREE = 0,
@@ -200,8 +200,8 @@
int ocfs2_mark_dead_nodes(ocfs_super *osb);
static inline void ocfs_start_checkpoint(struct _ocfs_super *osb)
{
- atomic_set(&osb->flush_event_woken, 1);
- wake_up(&osb->flush_event);
+ atomic_set(&osb->needs_checkpoint, 1);
+ wake_up(&osb->checkpoint_event);
}
/*
Modified: branches/dlm-glue/src/super.c
===================================================================
--- branches/dlm-glue/src/super.c 2004-11-23 22:46:43 UTC (rev 1670)
+++ branches/dlm-glue/src/super.c 2004-11-23 22:47:56 UTC (rev 1671)
@@ -1185,8 +1185,8 @@
osb->disable_recovery = 0;
osb->recovery_launched = 0;
- init_waitqueue_head (&osb->flush_event);
- atomic_set (&osb->flush_event_woken, 0);
+ init_waitqueue_head (&osb->checkpoint_event);
+ atomic_set (&osb->needs_checkpoint, 0);
atomic_set (&osb->clean_buffer_seq, 1);
spin_lock_init (&osb->clean_buffer_lock);
More information about the Ocfs2-commits
mailing list