Commit 646daae7 authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] avoid sleep_on in the sync code

SGI Modid: 2.5.x-xfs:slinx:148415a
parent 685cfe8b
...@@ -32,20 +32,12 @@ ...@@ -32,20 +32,12 @@
#include <xfs.h> #include <xfs.h>
static void sync_timeout(unsigned long __data)
{
struct task_struct * p = (struct task_struct *) __data;
wake_up_process(p);
}
#define SYNCD_FLAGS (SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR) #define SYNCD_FLAGS (SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR)
int syncd(void *arg) int syncd(void *arg)
{ {
vfs_t *vfsp = (vfs_t *) arg; vfs_t *vfsp = (vfs_t *) arg;
int error; int error;
struct timer_list timer;
daemonize("xfs_syncd"); daemonize("xfs_syncd");
...@@ -53,22 +45,20 @@ int syncd(void *arg) ...@@ -53,22 +45,20 @@ int syncd(void *arg)
wmb(); wmb();
wake_up(&vfsp->vfs_wait_sync_task); wake_up(&vfsp->vfs_wait_sync_task);
init_timer(&timer); for (;;) {
timer.data = (unsigned long)current; set_current_state(TASK_INTERRUPTIBLE);
timer.function = sync_timeout; schedule_timeout(xfs_params.sync_interval);
if (vfsp->vfs_flag & VFS_UMOUNT)
break;
if (vfsp->vfs_flag & VFS_RDONLY);
continue;
VFS_SYNC(vfsp, SYNCD_FLAGS, NULL, error);
}
do {
mod_timer(&timer, jiffies + xfs_params.sync_interval);
interruptible_sleep_on(&vfsp->vfs_sync);
if (!(vfsp->vfs_flag & VFS_RDONLY))
VFS_SYNC(vfsp, SYNCD_FLAGS, NULL, error);
} while (!(vfsp->vfs_flag & VFS_UMOUNT));
del_timer_sync(&timer);
vfsp->vfs_sync_task = NULL; vfsp->vfs_sync_task = NULL;
wmb(); wmb();
wake_up(&vfsp->vfs_wait_sync_task); wake_up(&vfsp->vfs_wait_sync_task);
return 0; return 0;
} }
...@@ -91,6 +81,6 @@ linvfs_stop_syncd(vfs_t *vfsp) ...@@ -91,6 +81,6 @@ linvfs_stop_syncd(vfs_t *vfsp)
vfsp->vfs_flag |= VFS_UMOUNT; vfsp->vfs_flag |= VFS_UMOUNT;
wmb(); wmb();
wake_up(&vfsp->vfs_sync); wake_up_process(vfsp->vfs_sync_task);
wait_event(vfsp->vfs_wait_sync_task, !vfsp->vfs_sync_task); wait_event(vfsp->vfs_wait_sync_task, !vfsp->vfs_sync_task);
} }
...@@ -239,7 +239,6 @@ vfs_allocate( void ) ...@@ -239,7 +239,6 @@ vfs_allocate( void )
vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP); vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
bhv_head_init(VFS_BHVHEAD(vfsp), "vfs"); bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
init_waitqueue_head(&vfsp->vfs_wait_sync_task); init_waitqueue_head(&vfsp->vfs_wait_sync_task);
init_waitqueue_head(&vfsp->vfs_sync);
return vfsp; return vfsp;
} }
......
...@@ -49,7 +49,6 @@ typedef struct vfs { ...@@ -49,7 +49,6 @@ typedef struct vfs {
bhv_head_t vfs_bh; /* head of vfs behavior chain */ bhv_head_t vfs_bh; /* head of vfs behavior chain */
struct super_block *vfs_super; /* Linux superblock structure */ struct super_block *vfs_super; /* Linux superblock structure */
struct task_struct *vfs_sync_task; struct task_struct *vfs_sync_task;
wait_queue_head_t vfs_sync;
wait_queue_head_t vfs_wait_sync_task; wait_queue_head_t vfs_wait_sync_task;
} vfs_t; } vfs_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment