diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2005-09-10 03:27:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 13:06:36 -0400 |
commit | 041e0e3b1970c508dc9a95b7dd9dc86271a7d7ac (patch) | |
tree | 41ff880a87412cf55eb12425e916fda57955ee5c /fs/xfs | |
parent | 373016e9e1353f2af871993d27d00768f08cc883 (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/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/time.h | 3 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 6 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 12 |
3 files changed, 10 insertions, 11 deletions
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 | ||
40 | static inline void delay(long ticks) | 40 | static 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 | ||
46 | static inline void nanotime(struct timespec *tvp) | 45 | static 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); |