aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@sgi.com>2005-09-04 18:34:18 -0400
committerNathan Scott <nathans@sgi.com>2005-09-04 18:34:18 -0400
commit4df08c52582be558e12316ae60bf077ca8f17a1e (patch)
tree11d32ac6553e26198ec1be4b830f57c8668d7cca /fs/xfs/linux-2.6/xfs_super.c
parent2f926587512869ebf6bc820bd5f030e127aae774 (diff)
[XFS] Switch kernel thread handling to the kthread_ API
SGI-PV: 942063 SGI-Modid: xfs-linux:xfs-kern:198388a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 910e43bfc95b..0da87bfc9999 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -72,6 +72,7 @@
72#include <linux/mount.h> 72#include <linux/mount.h>
73#include <linux/mempool.h> 73#include <linux/mempool.h>
74#include <linux/writeback.h> 74#include <linux/writeback.h>
75#include <linux/kthread.h>
75 76
76STATIC struct quotactl_ops linvfs_qops; 77STATIC struct quotactl_ops linvfs_qops;
77STATIC struct super_operations linvfs_sops; 78STATIC struct super_operations linvfs_sops;
@@ -516,25 +517,16 @@ xfssyncd(
516{ 517{
517 long timeleft; 518 long timeleft;
518 vfs_t *vfsp = (vfs_t *) arg; 519 vfs_t *vfsp = (vfs_t *) arg;
519 struct list_head tmp;
520 struct vfs_sync_work *work, *n; 520 struct vfs_sync_work *work, *n;
521 LIST_HEAD (tmp);
521 522
522 daemonize("xfssyncd");
523
524 vfsp->vfs_sync_work.w_vfs = vfsp;
525 vfsp->vfs_sync_work.w_syncer = vfs_sync_worker;
526 vfsp->vfs_sync_task = current;
527 wmb();
528 wake_up(&vfsp->vfs_wait_sync_task);
529
530 INIT_LIST_HEAD(&tmp);
531 timeleft = (xfs_syncd_centisecs * HZ) / 100; 523 timeleft = (xfs_syncd_centisecs * HZ) / 100;
532 for (;;) { 524 for (;;) {
533 set_current_state(TASK_INTERRUPTIBLE); 525 set_current_state(TASK_INTERRUPTIBLE);
534 timeleft = schedule_timeout(timeleft); 526 timeleft = schedule_timeout(timeleft);
535 /* swsusp */ 527 /* swsusp */
536 try_to_freeze(); 528 try_to_freeze();
537 if (vfsp->vfs_flag & VFS_UMOUNT) 529 if (kthread_should_stop())
538 break; 530 break;
539 531
540 spin_lock(&vfsp->vfs_sync_lock); 532 spin_lock(&vfsp->vfs_sync_lock);
@@ -563,10 +555,6 @@ xfssyncd(
563 } 555 }
564 } 556 }
565 557
566 vfsp->vfs_sync_task = NULL;
567 wmb();
568 wake_up(&vfsp->vfs_wait_sync_task);
569
570 return 0; 558 return 0;
571} 559}
572 560
@@ -574,13 +562,11 @@ STATIC int
574linvfs_start_syncd( 562linvfs_start_syncd(
575 vfs_t *vfsp) 563 vfs_t *vfsp)
576{ 564{
577 int pid; 565 vfsp->vfs_sync_work.w_syncer = vfs_sync_worker;
578 566 vfsp->vfs_sync_work.w_vfs = vfsp;
579 pid = kernel_thread(xfssyncd, (void *) vfsp, 567 vfsp->vfs_sync_task = kthread_run(xfssyncd, vfsp, "xfssyncd");
580 CLONE_VM | CLONE_FS | CLONE_FILES); 568 if (IS_ERR(vfsp->vfs_sync_task))
581 if (pid < 0) 569 return -PTR_ERR(vfsp->vfs_sync_task);
582 return -pid;
583 wait_event(vfsp->vfs_wait_sync_task, vfsp->vfs_sync_task);
584 return 0; 570 return 0;
585} 571}
586 572
@@ -588,11 +574,7 @@ STATIC void
588linvfs_stop_syncd( 574linvfs_stop_syncd(
589 vfs_t *vfsp) 575 vfs_t *vfsp)
590{ 576{
591 vfsp->vfs_flag |= VFS_UMOUNT; 577 kthread_stop(vfsp->vfs_sync_task);
592 wmb();
593
594 wake_up_process(vfsp->vfs_sync_task);
595 wait_event(vfsp->vfs_wait_sync_task, !vfsp->vfs_sync_task);
596} 578}
597 579
598STATIC void 580STATIC void