Commit 6ff86498 authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] get rid of pb_daemon/pagebuf_daemon_t

SGI Modid: 2.5.x-xfs:slinx:134787a
parent 3952101e
......@@ -118,7 +118,6 @@ pb_trace_func(
*/
STATIC kmem_cache_t *pagebuf_cache;
STATIC pagebuf_daemon_t *pb_daemon;
STATIC void pagebuf_daemon_wakeup(int);
STATIC struct workqueue_struct *pagebuf_workqueue;
......@@ -1547,13 +1546,17 @@ pagebuf_iomove(
* Pagebuf delayed write buffer handling
*/
STATIC int pbd_active = 1;
STATIC LIST_HEAD(pbd_delwrite_queue);
STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED;
void
pagebuf_delwri_queue(
page_buf_t *pb,
int unlock)
{
PB_TRACE(pb, PB_TRACE_REC(delwri_q), unlock);
spin_lock(&pb_daemon->pb_delwrite_lock);
spin_lock(&pbd_delwrite_lock);
/* If already in the queue, dequeue and place at tail */
if (!list_empty(&pb->pb_list)) {
if (unlock) {
......@@ -1562,9 +1565,9 @@ pagebuf_delwri_queue(
list_del(&pb->pb_list);
}
list_add_tail(&pb->pb_list, &pb_daemon->pb_delwrite_l);
list_add_tail(&pb->pb_list, &pbd_delwrite_queue);
PBP(pb)->pb_flushtime = jiffies + pb_params.p_un.age_buffer;
spin_unlock(&pb_daemon->pb_delwrite_lock);
spin_unlock(&pbd_delwrite_lock);
if (unlock && (pb->pb_flags & _PBF_LOCKABLE)) {
pagebuf_unlock(pb);
......@@ -1576,10 +1579,10 @@ pagebuf_delwri_dequeue(
page_buf_t *pb)
{
PB_TRACE(pb, PB_TRACE_REC(delwri_uq), 0);
spin_lock(&pb_daemon->pb_delwrite_lock);
spin_lock(&pbd_delwrite_lock);
list_del_init(&pb->pb_list);
pb->pb_flags &= ~PBF_DELWRI;
spin_unlock(&pb_daemon->pb_delwrite_lock);
spin_unlock(&pbd_delwrite_lock);
}
/* Defines for pagebuf daemon */
......@@ -1622,7 +1625,7 @@ pagebuf_daemon(
INIT_LIST_HEAD(&tmp);
do {
if (pb_daemon->active == 1) {
if (pbd_active == 1) {
del_timer(&pb_daemon_timer);
pb_daemon_timer.expires = jiffies +
pb_params.p_un.flush_interval;
......@@ -1630,14 +1633,14 @@ pagebuf_daemon(
interruptible_sleep_on(&pbd_waitq);
}
if (pb_daemon->active == 0) {
if (pbd_active == 0) {
del_timer(&pb_daemon_timer);
}
spin_lock(&pb_daemon->pb_delwrite_lock);
spin_lock(&pbd_delwrite_lock);
count = 0;
list_for_each_safe(curr, next, &pb_daemon->pb_delwrite_l) {
list_for_each_safe(curr, next, &pbd_delwrite_queue) {
pb = list_entry(curr, page_buf_t, pb_list);
PB_TRACE(pb, PB_TRACE_REC(walkq1), pagebuf_ispin(pb));
......@@ -1659,7 +1662,7 @@ pagebuf_daemon(
}
}
spin_unlock(&pb_daemon->pb_delwrite_lock);
spin_unlock(&pbd_delwrite_lock);
while (!list_empty(&tmp)) {
pb = list_entry(tmp.next, page_buf_t, pb_list);
list_del_init(&pb->pb_list);
......@@ -1675,9 +1678,9 @@ pagebuf_daemon(
pagebuf_run_queues(NULL);
force_flush = 0;
} while (pb_daemon->active == 1);
} while (pbd_active == 1);
pb_daemon->active = -1;
pbd_active = -1;
wake_up_interruptible(&pbd_waitq);
return 0;
......@@ -1693,10 +1696,10 @@ pagebuf_delwri_flush(
struct list_head *curr, *next, tmp;
int pincount = 0;
spin_lock(&pb_daemon->pb_delwrite_lock);
spin_lock(&pbd_delwrite_lock);
INIT_LIST_HEAD(&tmp);
list_for_each_safe(curr, next, &pb_daemon->pb_delwrite_l) {
list_for_each_safe(curr, next, &pbd_delwrite_queue) {
pb = list_entry(curr, page_buf_t, pb_list);
/*
......@@ -1727,7 +1730,7 @@ pagebuf_delwri_flush(
pb->pb_flags &= ~PBF_ASYNC;
}
spin_unlock(&pb_daemon->pb_delwrite_lock);
spin_unlock(&pbd_delwrite_lock);
if ((flags & PBDF_TRYLOCK) == 0) {
pagebuf_lock(pb);
......@@ -1738,10 +1741,10 @@ pagebuf_delwri_flush(
__pagebuf_iorequest(pb);
spin_lock(&pb_daemon->pb_delwrite_lock);
spin_lock(&pbd_delwrite_lock);
}
spin_unlock(&pb_daemon->pb_delwrite_lock);
spin_unlock(&pbd_delwrite_lock);
pagebuf_run_queues(NULL);
......@@ -1765,26 +1768,17 @@ pagebuf_delwri_flush(
STATIC int
pagebuf_daemon_start(void)
{
if (!pb_daemon) {
pb_daemon = (pagebuf_daemon_t *)
kmalloc(sizeof(pagebuf_daemon_t), GFP_KERNEL);
if (!pb_daemon) {
return -1; /* error */
}
pb_daemon->active = 1;
pb_daemon->pb_delwrite_lock = SPIN_LOCK_UNLOCKED;
int rval;
INIT_LIST_HEAD(&pb_daemon->pb_delwrite_l);
pagebuf_workqueue = create_workqueue("pagebuf");
if (!pagebuf_workqueue)
return -ENOMEM;
kernel_thread(pagebuf_daemon, (void *)pb_daemon,
CLONE_FS|CLONE_FILES|CLONE_VM);
rval = kernel_thread(pagebuf_daemon, NULL, CLONE_FS|CLONE_FILES);
if (rval < 0)
destroy_workqueue(pagebuf_workqueue);
pagebuf_workqueue = create_workqueue("pagebuf");
if (!pagebuf_workqueue)
return -1;
}
return 0;
return rval;
}
/*
......@@ -1795,19 +1789,10 @@ pagebuf_daemon_start(void)
STATIC void
pagebuf_daemon_stop(void)
{
if (pb_daemon) {
destroy_workqueue(pagebuf_workqueue);
pb_daemon->active = 0;
wake_up_interruptible(&pbd_waitq);
while (pb_daemon->active == 0) {
interruptible_sleep_on(&pbd_waitq);
}
kfree(pb_daemon);
pb_daemon = NULL;
}
pbd_active = 0;
wake_up_interruptible(&pbd_waitq);
wait_event_interruptible(pbd_waitq, pbd_active);
destroy_workqueue(pagebuf_workqueue);
}
......
......@@ -95,12 +95,6 @@ struct pagebuf_trace_buf {
#define PB_TRACE_BUFSIZE 1024
#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1))
typedef struct pagebuf_daemon {
int active;
spinlock_t pb_delwrite_lock;
struct list_head pb_delwrite_l;
} pagebuf_daemon_t;
/*
* Tunable pagebuf parameters
*/
......
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