aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2005-09-10 03:27:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-10 13:06:36 -0400
commit041e0e3b1970c508dc9a95b7dd9dc86271a7d7ac (patch)
tree41ff880a87412cf55eb12425e916fda57955ee5c /fs
parent373016e9e1353f2af871993d27d00768f08cc883 (diff)
[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: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/connect.c6
-rw-r--r--fs/jbd/transaction.c3
-rw-r--r--fs/lockd/clntproc.c3
-rw-r--r--fs/nfs/nfs3proc.c3
-rw-r--r--fs/nfs/nfs4proc.c12
-rw-r--r--fs/reiserfs/journal.c3
-rw-r--r--fs/smbfs/proc.c3
-rw-r--r--fs/xfs/linux-2.6/time.h3
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c6
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c12
10 files changed, 21 insertions, 33 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 3217ac5f6bd7..2335f14a1583 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3215,10 +3215,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
3215 } 3215 }
3216 3216
3217 cifs_sb->tcon = NULL; 3217 cifs_sb->tcon = NULL;
3218 if (ses) { 3218 if (ses)
3219 set_current_state(TASK_INTERRUPTIBLE); 3219 schedule_timeout_interruptible(msecs_to_jiffies(500));
3220 schedule_timeout(HZ / 2);
3221 }
3222 if (ses) 3220 if (ses)
3223 sesInfoFree(ses); 3221 sesInfoFree(ses);
3224 3222
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index c6ec66fd8766..49bbc2be3d72 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -1340,8 +1340,7 @@ int journal_stop(handle_t *handle)
1340 if (handle->h_sync) { 1340 if (handle->h_sync) {
1341 do { 1341 do {
1342 old_handle_count = transaction->t_handle_count; 1342 old_handle_count = transaction->t_handle_count;
1343 set_current_state(TASK_UNINTERRUPTIBLE); 1343 schedule_timeout_uninterruptible(1);
1344 schedule_timeout(1);
1345 } while (old_handle_count != transaction->t_handle_count); 1344 } while (old_handle_count != transaction->t_handle_count);
1346 } 1345 }
1347 1346
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 14b3ce87fa29..87332f30141b 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -299,8 +299,7 @@ nlmclnt_alloc_call(void)
299 return call; 299 return call;
300 } 300 }
301 printk("nlmclnt_alloc_call: failed, waiting for memory\n"); 301 printk("nlmclnt_alloc_call: failed, waiting for memory\n");
302 current->state = TASK_INTERRUPTIBLE; 302 schedule_timeout_interruptible(5*HZ);
303 schedule_timeout(5*HZ);
304 } 303 }
305 return NULL; 304 return NULL;
306} 305}
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 2681485cf2d0..edc95514046d 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -34,8 +34,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
34 res = rpc_call_sync(clnt, msg, flags); 34 res = rpc_call_sync(clnt, msg, flags);
35 if (res != -EJUKEBOX) 35 if (res != -EJUKEBOX)
36 break; 36 break;
37 set_current_state(TASK_INTERRUPTIBLE); 37 schedule_timeout_interruptible(NFS_JUKEBOX_RETRY_TIME);
38 schedule_timeout(NFS_JUKEBOX_RETRY_TIME);
39 res = -ERESTARTSYS; 38 res = -ERESTARTSYS;
40 } while (!signalled()); 39 } while (!signalled());
41 rpc_clnt_sigunmask(clnt, &oldset); 40 rpc_clnt_sigunmask(clnt, &oldset);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0c5a308e4963..9701ca8c9428 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2418,14 +2418,11 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
2418 *timeout = NFS4_POLL_RETRY_MAX; 2418 *timeout = NFS4_POLL_RETRY_MAX;
2419 rpc_clnt_sigmask(clnt, &oldset); 2419 rpc_clnt_sigmask(clnt, &oldset);
2420 if (clnt->cl_intr) { 2420 if (clnt->cl_intr) {
2421 set_current_state(TASK_INTERRUPTIBLE); 2421 schedule_timeout_interruptible(*timeout);
2422 schedule_timeout(*timeout);
2423 if (signalled()) 2422 if (signalled())
2424 res = -ERESTARTSYS; 2423 res = -ERESTARTSYS;
2425 } else { 2424 } else
2426 set_current_state(TASK_UNINTERRUPTIBLE); 2425 schedule_timeout_uninterruptible(*timeout);
2427 schedule_timeout(*timeout);
2428 }
2429 rpc_clnt_sigunmask(clnt, &oldset); 2426 rpc_clnt_sigunmask(clnt, &oldset);
2430 *timeout <<= 1; 2427 *timeout <<= 1;
2431 return res; 2428 return res;
@@ -2578,8 +2575,7 @@ int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4
2578static unsigned long 2575static unsigned long
2579nfs4_set_lock_task_retry(unsigned long timeout) 2576nfs4_set_lock_task_retry(unsigned long timeout)
2580{ 2577{
2581 current->state = TASK_INTERRUPTIBLE; 2578 schedule_timeout_interruptible(timeout);
2582 schedule_timeout(timeout);
2583 timeout <<= 1; 2579 timeout <<= 1;
2584 if (timeout > NFS4_LOCK_MAXTIMEOUT) 2580 if (timeout > NFS4_LOCK_MAXTIMEOUT)
2585 return NFS4_LOCK_MAXTIMEOUT; 2581 return NFS4_LOCK_MAXTIMEOUT;
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index a8e29e9bbbd0..4b15761434bc 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2868,8 +2868,7 @@ static void let_transaction_grow(struct super_block *sb, unsigned long trans_id)
2868 struct reiserfs_journal *journal = SB_JOURNAL(sb); 2868 struct reiserfs_journal *journal = SB_JOURNAL(sb);
2869 unsigned long bcount = journal->j_bcount; 2869 unsigned long bcount = journal->j_bcount;
2870 while (1) { 2870 while (1) {
2871 set_current_state(TASK_UNINTERRUPTIBLE); 2871 schedule_timeout_uninterruptible(1);
2872 schedule_timeout(1);
2873 journal->j_current_jl->j_state |= LIST_COMMIT_PENDING; 2872 journal->j_current_jl->j_state |= LIST_COMMIT_PENDING;
2874 while ((atomic_read(&journal->j_wcount) > 0 || 2873 while ((atomic_read(&journal->j_wcount) > 0 ||
2875 atomic_read(&journal->j_jlock)) && 2874 atomic_read(&journal->j_jlock)) &&
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c
index 220babe91efd..38ab558835c4 100644
--- a/fs/smbfs/proc.c
+++ b/fs/smbfs/proc.c
@@ -2397,8 +2397,7 @@ smb_proc_readdir_long(struct file *filp, void *dirent, filldir_t filldir,
2397 if (req->rq_rcls == ERRSRV && req->rq_err == ERRerror) { 2397 if (req->rq_rcls == ERRSRV && req->rq_err == ERRerror) {
2398 /* a damn Win95 bug - sometimes it clags if you 2398 /* a damn Win95 bug - sometimes it clags if you
2399 ask it too fast */ 2399 ask it too fast */
2400 current->state = TASK_INTERRUPTIBLE; 2400 schedule_timeout_interruptible(msecs_to_jiffies(200));
2401 schedule_timeout(HZ/5);
2402 continue; 2401 continue;
2403 } 2402 }
2404 2403
diff --git a/fs/xfs/linux-2.6/time.h b/fs/xfs/linux-2.6/time.h
index 6c6fd0faa8e1..b0d2873ab274 100644
--- a/fs/xfs/linux-2.6/time.h
+++ b/fs/xfs/linux-2.6/time.h
@@ -39,8 +39,7 @@ typedef struct timespec timespec_t;
39 39
40static inline void delay(long ticks) 40static inline void delay(long ticks)
41{ 41{
42 set_current_state(TASK_UNINTERRUPTIBLE); 42 schedule_timeout_uninterruptible(ticks);
43 schedule_timeout(ticks);
44} 43}
45 44
46static inline void nanotime(struct timespec *tvp) 45static inline void nanotime(struct timespec *tvp)
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 655bf4a78afe..e82cf72ac599 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1780,10 +1780,10 @@ xfsbufd(
1780 xfsbufd_force_sleep = 0; 1780 xfsbufd_force_sleep = 0;
1781 } 1781 }
1782 1782
1783 set_current_state(TASK_INTERRUPTIBLE); 1783 schedule_timeout_interruptible
1784 schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100); 1784 (xfs_buf_timer_centisecs * msecs_to_jiffies(10));
1785 1785
1786 age = (xfs_buf_age_centisecs * HZ) / 100; 1786 age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
1787 spin_lock(&pbd_delwrite_lock); 1787 spin_lock(&pbd_delwrite_lock);
1788 list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) { 1788 list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
1789 PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb)); 1789 PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb));
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 0da87bfc9999..2302454d8d47 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -467,7 +467,7 @@ xfs_flush_inode(
467 467
468 igrab(inode); 468 igrab(inode);
469 xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work); 469 xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work);
470 delay(HZ/2); 470 delay(msecs_to_jiffies(500));
471} 471}
472 472
473/* 473/*
@@ -492,7 +492,7 @@ xfs_flush_device(
492 492
493 igrab(inode); 493 igrab(inode);
494 xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work); 494 xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work);
495 delay(HZ/2); 495 delay(msecs_to_jiffies(500));
496 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC); 496 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
497} 497}
498 498
@@ -520,10 +520,9 @@ xfssyncd(
520 struct vfs_sync_work *work, *n; 520 struct vfs_sync_work *work, *n;
521 LIST_HEAD (tmp); 521 LIST_HEAD (tmp);
522 522
523 timeleft = (xfs_syncd_centisecs * HZ) / 100; 523 timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10);
524 for (;;) { 524 for (;;) {
525 set_current_state(TASK_INTERRUPTIBLE); 525 timeleft = schedule_timeout_interruptible(timeleft);
526 timeleft = schedule_timeout(timeleft);
527 /* swsusp */ 526 /* swsusp */
528 try_to_freeze(); 527 try_to_freeze();
529 if (kthread_should_stop()) 528 if (kthread_should_stop())
@@ -537,7 +536,8 @@ xfssyncd(
537 */ 536 */
538 if (!timeleft || list_empty(&vfsp->vfs_sync_list)) { 537 if (!timeleft || list_empty(&vfsp->vfs_sync_list)) {
539 if (!timeleft) 538 if (!timeleft)
540 timeleft = (xfs_syncd_centisecs * HZ) / 100; 539 timeleft = xfs_syncd_centisecs *
540 msecs_to_jiffies(10);
541 INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list); 541 INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list);
542 list_add_tail(&vfsp->vfs_sync_work.w_list, 542 list_add_tail(&vfsp->vfs_sync_work.w_list,
543 &vfsp->vfs_sync_list); 543 &vfsp->vfs_sync_list);