Skip to contentSkip to conversation

reiser4 and swsusp2 (for 2004.03.26)

PATCH New Filipe Almeida 1 participant 1 message Mar 30, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiser4 and swsusp2 (for 2004.03.26)

Hi,
This patch adds swsusp2 software suspend support to reiser4 for those that use swsusp2 and reiser4.

This has been tested with 2.6.4 with the following patches applied in order:
software-suspend-linux-2.6.4-test5-whole.bz2 software-suspend-core-2.0-whole.bz2 software-suspend-core-2.0.0.37-incremental.bz2
all.diif.gz (from reiser4 2004.03.26 snapshot)

Regards,
Filipe Almeida

Signature · 2 lines
Filipe Almeida <[email protected]>
http://mega.ist.utl.pt/~filipe/

Add swsusp2 software suspend support to reiser4.
Suspending while the repacker is running it not supported yet, so don't try it.

Filipe Almeida <[email protected]>

fs/reiser4/ktxnmgrd.c renamed from fs/reiser4/ktxnmgrd.c.orig +8 -7
@@ -79,11 +79,16 @@
 	struct super_block * super;
 	ktxnmgrd_context *ctx;
 	txn_mgr * mgr;
+	DECLARE_SWSUSP_LOCAL_VAR;
 
 	/* standard kernel thread prologue */
 	me = current;
 	/* reparent_to_init() is done by daemonize() */
 	daemonize(__FUNCTION__);
+	current->flags |= PF_SYNCTHREAD;
+
+	SWSUSP_THREAD_FLAGS_RESET;
+	SWSUSP_ACTIVITY_START(PF_SYNCTHREAD);
 
 	/* block all signals */
 	spin_lock_irq(&me->sighand->siglock);
@@ -106,13 +111,6 @@
 	while (1) {
 		int result;
 
-		/* software suspend support. */
-		if (me->flags & PF_FREEZE) {
-			spin_unlock(&ctx->guard);
-			refrigerator(PF_IOTHREAD);
-			spin_lock(&ctx->guard);
-		}
-
 		set_comm("wait");
 		/* wait for @ctx -> timeout or explicit wake up.
 
@@ -121,8 +119,10 @@
 		   load-average. This doesn't require any special handling,
 		   because all signals were blocked.
 		*/
+		SWSUSP_ACTIVITY_SYNCTHREAD_PAUSING;
 		result = kcond_timedwait(&ctx->wait,
 					 &ctx->guard, ctx->timeout, 1);
+		SWSUSP_ACTIVITY_RESTARTING(PF_SYNCTHREAD);
 
 		if (result != -ETIMEDOUT && result != -EINTR && result != 0) {
 			/* some other error */
@@ -156,6 +156,7 @@
 
 	spin_unlock(&ctx->guard);
 
+	SWSUSP_ACTIVITY_END;
 	complete_and_exit(&ctx->finish, 0);
 	/* not reached. */
 	return 0;
fs/reiser4/entd.c renamed from fs/reiser4/entd.c.orig +9 -3
@@ -71,12 +71,17 @@
 	struct super_block *super;
 	struct task_struct *me;
 	entd_context       *ctx;
+	DECLARE_SWSUSP_LOCAL_VAR;
 
 	super = arg;
 	/* standard kernel thread prologue */
 	me = current;
 	/* reparent_to_init() is done by daemonize() */
 	daemonize("ent:%s", super->s_id);
+	current->flags |= PF_SYNCTHREAD;
+
+	SWSUSP_THREAD_FLAGS_RESET;
+	SWSUSP_ACTIVITY_START(PF_SYNCTHREAD);
 
 	/* block all signals */
 	spin_lock_irq(&me->sighand->siglock);
@@ -99,13 +104,13 @@
 	while (1) {
 		int result;
 
-		if (me->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
-
 		entd_set_comm(".");
 		spin_lock(&ctx->guard);
 		ctx->kicks_pending = 0;
+		
+		SWSUSP_ACTIVITY_SYNCTHREAD_PAUSING;
 		result = kcond_wait(&ctx->wait, &ctx->guard, 1);
+		SWSUSP_ACTIVITY_RESTARTING(PF_SYNCTHREAD);
 
 		/* we are asked to exit */
 		if (ctx->done) {
@@ -122,6 +127,7 @@
 			warning("nikita-3099", "Error: %i", result);
 	}
 
+	SWSUSP_ACTIVITY_END;
 	complete_and_exit(&ctx->finish, 0);
 	/* not reached. */
 	return 0;
fs/reiser4/repacker.c renamed from fs/reiser4/repacker.c.orig +0 -3
@@ -191,9 +191,6 @@
 	if (ret)
 		return ret;
 
-	if (current->flags & PF_FREEZE)
-		refrigerator(PF_IOTHREAD);
-
 	balance_dirty_pages_ratelimited(get_current_super_private()->fake->i_mapping);
 	begin_work();
 	cursor->count = get_current_super_private()->repacker->params.chunk_size;