public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: sfrench@samba.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] cifs: convert schedule_timeout to msleep and ssleep
Date: Sat, 15 Jan 2005 15:31:28 +0200	[thread overview]
Message-ID: <1105795888.9555.11.camel@localhost> (raw)
In-Reply-To: <1105795818.9555.9.camel@localhost>

This patch converts cifs code to use msleep() and ssleep() instead of
schedule_timeout().

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 cifsfs.c  |    9 ++++-----
 connect.c |   25 +++++++++----------------
 2 files changed, 13 insertions(+), 21 deletions(-)

Index: 2.6/fs/cifs/cifsfs.c
===================================================================
--- 2.6.orig/fs/cifs/cifsfs.c	2005-01-12 23:33:14.476445944 +0200
+++ 2.6/fs/cifs/cifsfs.c	2005-01-12 23:37:09.402731720 +0200
@@ -32,6 +32,7 @@
 #include <linux/seq_file.h>
 #include <linux/vfs.h>
 #include <linux/mempool.h>
+#include <linux/delay.h>
 #include "cifsfs.h"
 #include "cifspdu.h"
 #define DECLARE_GLOBALS_HERE
@@ -748,14 +749,12 @@
 
 	oplockThread = current;
 	do {
-		set_current_state(TASK_INTERRUPTIBLE);
-		
-		schedule_timeout(1*HZ);  
+		ssleep(1);
+
 		spin_lock(&GlobalMid_Lock);
 		if(list_empty(&GlobalOplock_Q)) {
 			spin_unlock(&GlobalMid_Lock);
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(39*HZ);
+			ssleep(39);
 		} else {
 			oplock_item = list_entry(GlobalOplock_Q.next, 
 				struct oplock_q_entry, qhead);
Index: 2.6/fs/cifs/connect.c
===================================================================
--- 2.6.orig/fs/cifs/connect.c	2005-01-12 23:33:14.479445488 +0200
+++ 2.6/fs/cifs/connect.c	2005-01-12 23:37:47.396955720 +0200
@@ -29,6 +29,7 @@
 #include <linux/ctype.h>
 #include <linux/utsname.h>
 #include <linux/mempool.h>
+#include <linux/delay.h>
 #include <asm/uaccess.h>
 #include <asm/processor.h>
 #include "cifspdu.h"
@@ -174,8 +175,7 @@
 					server->workstation_RFC1001_name);
 		}
 		if(rc) {
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(3 * HZ);
+			ssleep(3);
 		} else {
 			atomic_inc(&tcpSesReconnectCount);
 			spin_lock(&GlobalMid_Lock);
@@ -226,8 +226,7 @@
 
 		if (smb_buffer == NULL) {
 			cERROR(1,("Can not get memory for SMB response"));
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(HZ * 3); /* give system time to free memory */
+			ssleep(3);
 			continue;
 		}
 		iov.iov_base = smb_buffer;
@@ -308,8 +307,7 @@
 				} else {
 					/* give server a second to
 					clean up before reconnect attempt */
-					set_current_state(TASK_INTERRUPTIBLE);
-					schedule_timeout(HZ);
+					ssleep(1);
 					/* always try 445 first on reconnect
 					since we get NACK on some if we ever
 					connected to port 139 (the NACK is 
@@ -433,8 +431,7 @@
 	and get out of SendReceive.  */
 	wake_up_all(&server->request_q);
 	/* give those requests time to exit */
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(HZ/8);
+	msleep(125);
 
 	if(server->ssocket) {
 		sock_release(csocket);
@@ -471,17 +468,15 @@
 		}
 		spin_unlock(&GlobalMid_Lock);
 		read_unlock(&GlobalSMBSeslock);
-		set_current_state(TASK_INTERRUPTIBLE);
 		/* 1/8th of sec is more than enough time for them to exit */
-		schedule_timeout(HZ/8); 
+		msleep(125);
 	}
 
 	if (list_empty(&server->pending_mid_q)) {
 		/* mpx threads have not exited yet give them 
 		at least the smb send timeout time for long ops */
 		cFYI(1, ("Wait for exit from demultiplex thread"));
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(46 * HZ);	
+		ssleep(46);
 		/* if threads still have not exited they are probably never
 		coming home not much else we can do but free the memory */
 	}
@@ -497,8 +492,7 @@
 			GFP_KERNEL);
 	}
 
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(HZ/4);
+	msleep(250);
 	return 0;
 }
 
@@ -2924,8 +2918,7 @@
 	
 	cifs_sb->tcon = NULL;
 	if (ses) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(HZ / 2);
+		msleep(500);
 	}
 	if (ses)
 		sesInfoFree(ses);



      reply	other threads:[~2005-01-15 13:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-15 13:25 [PATCH 1/6] cifs: copy_to_user and copy_from_user fixes Pekka Enberg
2005-01-15 13:26 ` [PATCH 2/6] cifs: remove dead code Pekka Enberg
2005-01-15 13:28   ` [PATCH 3/6] cifs: enum conversion Pekka Enberg
2005-01-15 13:29     ` [PATCH 4/6] cifs: remove spurious casts Pekka Enberg
2005-01-15 13:30       ` [PATCH 5/6] cifs: reduce deep nesting Pekka Enberg
2005-01-15 13:31         ` Pekka Enberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1105795888.9555.11.camel@localhost \
    --to=penberg@cs.helsinki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox