Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 041e0e3b authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Linus Torvalds
Browse files

[PATCH] fs: fix-up schedule_timeout() usage



Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.  Also use helper
functions to convert between human time units and jiffies rather than constant
HZ division to avoid rounding errors.

Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 373016e9
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -3215,10 +3215,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
	}
	
	cifs_sb->tcon = NULL;
	if (ses) {
		set_current_state(TASK_INTERRUPTIBLE);
		schedule_timeout(HZ / 2);
	}
	if (ses)
		schedule_timeout_interruptible(msecs_to_jiffies(500));
	if (ses)
		sesInfoFree(ses);

+1 −2
Original line number Diff line number Diff line
@@ -1340,8 +1340,7 @@ int journal_stop(handle_t *handle)
	if (handle->h_sync) {
		do {
			old_handle_count = transaction->t_handle_count;
			set_current_state(TASK_UNINTERRUPTIBLE);
			schedule_timeout(1);
			schedule_timeout_uninterruptible(1);
		} while (old_handle_count != transaction->t_handle_count);
	}

+1 −2
Original line number Diff line number Diff line
@@ -299,8 +299,7 @@ nlmclnt_alloc_call(void)
			return call;
		}
		printk("nlmclnt_alloc_call: failed, waiting for memory\n");
		current->state = TASK_INTERRUPTIBLE;
		schedule_timeout(5*HZ);
		schedule_timeout_interruptible(5*HZ);
	}
	return NULL;
}
+1 −2
Original line number Diff line number Diff line
@@ -34,8 +34,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
		res = rpc_call_sync(clnt, msg, flags);
		if (res != -EJUKEBOX)
			break;
		set_current_state(TASK_INTERRUPTIBLE);
		schedule_timeout(NFS_JUKEBOX_RETRY_TIME);
		schedule_timeout_interruptible(NFS_JUKEBOX_RETRY_TIME);
		res = -ERESTARTSYS;
	} while (!signalled());
	rpc_clnt_sigunmask(clnt, &oldset);
+4 −8
Original line number Diff line number Diff line
@@ -2418,14 +2418,11 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
		*timeout = NFS4_POLL_RETRY_MAX;
	rpc_clnt_sigmask(clnt, &oldset);
	if (clnt->cl_intr) {
		set_current_state(TASK_INTERRUPTIBLE);
		schedule_timeout(*timeout);
		schedule_timeout_interruptible(*timeout);
		if (signalled())
			res = -ERESTARTSYS;
	} else {
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(*timeout);
	}
	} else
		schedule_timeout_uninterruptible(*timeout);
	rpc_clnt_sigunmask(clnt, &oldset);
	*timeout <<= 1;
	return res;
@@ -2578,8 +2575,7 @@ int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4
static unsigned long
nfs4_set_lock_task_retry(unsigned long timeout)
{
	current->state = TASK_INTERRUPTIBLE;
	schedule_timeout(timeout);
	schedule_timeout_interruptible(timeout);
	timeout <<= 1;
	if (timeout > NFS4_LOCK_MAXTIMEOUT)
		return NFS4_LOCK_MAXTIMEOUT;
Loading