Commit fec6fe9c authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] XFS updates for workqueues

parent a57e7142
...@@ -178,6 +178,11 @@ pagebuf_param_t pb_params = {{ HZ, 15 * HZ, 0, 0 }}; ...@@ -178,6 +178,11 @@ pagebuf_param_t pb_params = {{ HZ, 15 * HZ, 0, 0 }};
struct pbstats pbstats; struct pbstats pbstats;
/*
* Queue for delayed I/O completion.
*/
struct workqueue_struct *pagebuf_workqueue;
/* /*
* Pagebuf allocation / freeing. * Pagebuf allocation / freeing.
*/ */
...@@ -1167,7 +1172,7 @@ _pagebuf_wait_unpin( ...@@ -1167,7 +1172,7 @@ _pagebuf_wait_unpin(
* present, will be called as a side-effect. * present, will be called as a side-effect.
*/ */
void void
pagebuf_iodone_sched( pagebuf_iodone_work(
void *v) void *v)
{ {
page_buf_t *pb = (page_buf_t *)v; page_buf_t *pb = (page_buf_t *)v;
...@@ -1196,11 +1201,8 @@ pagebuf_iodone( ...@@ -1196,11 +1201,8 @@ pagebuf_iodone(
PB_TRACE(pb, PB_TRACE_REC(done), pb->pb_iodone); PB_TRACE(pb, PB_TRACE_REC(done), pb->pb_iodone);
if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) { if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) {
INIT_TQUEUE(&pb->pb_iodone_sched, INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb);
pagebuf_iodone_sched, (void *)pb); queue_work(pagebuf_workqueue, &pb->pb_iodone_work);
schedule_task(&pb->pb_iodone_sched);
} else { } else {
up(&pb->pb_iodonesema); up(&pb->pb_iodonesema);
} }
...@@ -1854,6 +1856,10 @@ pagebuf_daemon_start(void) ...@@ -1854,6 +1856,10 @@ pagebuf_daemon_start(void)
kernel_thread(pagebuf_daemon, (void *)pb_daemon, kernel_thread(pagebuf_daemon, (void *)pb_daemon,
CLONE_FS|CLONE_FILES|CLONE_VM); CLONE_FS|CLONE_FILES|CLONE_VM);
pagebuf_workqueue = create_workqueue("pagebuf");
if (!pagebuf_workqueue)
return -1;
} }
return 0; return 0;
} }
...@@ -1867,6 +1873,9 @@ STATIC void ...@@ -1867,6 +1873,9 @@ STATIC void
pagebuf_daemon_stop(void) pagebuf_daemon_stop(void)
{ {
if (pb_daemon) { if (pb_daemon) {
flush_workqueue(pagebuf_workqueue);
destroy_workqueue(pagebuf_workqueue);
pb_daemon->active = 0; pb_daemon->active = 0;
pb_daemon->io_active = 0; pb_daemon->io_active = 0;
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/tqueue.h> #include <linux/workqueue.h>
enum xfs_buffer_state { BH_Delay = BH_PrivateStart }; enum xfs_buffer_state { BH_Delay = BH_PrivateStart };
BUFFER_FNS(Delay, delay); BUFFER_FNS(Delay, delay);
...@@ -214,7 +214,7 @@ typedef struct page_buf_s { ...@@ -214,7 +214,7 @@ typedef struct page_buf_s {
size_t pb_buffer_length; /* size of buffer in bytes */ size_t pb_buffer_length; /* size of buffer in bytes */
size_t pb_count_desired; /* desired transfer size */ size_t pb_count_desired; /* desired transfer size */
void *pb_addr; /* virtual address of buffer */ void *pb_addr; /* virtual address of buffer */
struct tq_struct pb_iodone_sched; struct work_struct pb_iodone_work;
page_buf_iodone_t pb_iodone; /* I/O completion function */ page_buf_iodone_t pb_iodone; /* I/O completion function */
page_buf_relse_t pb_relse; /* releasing function */ page_buf_relse_t pb_relse; /* releasing function */
page_buf_bdstrat_t pb_strat; /* pre-write function */ page_buf_bdstrat_t pb_strat; /* pre-write function */
...@@ -395,4 +395,6 @@ static __inline__ int __pagebuf_iorequest(page_buf_t *pb) ...@@ -395,4 +395,6 @@ static __inline__ int __pagebuf_iorequest(page_buf_t *pb)
return pagebuf_iorequest(pb); return pagebuf_iorequest(pb);
} }
extern struct workqueue_struct *pagebuf_workqueue;
#endif /* __PAGE_BUF_H__ */ #endif /* __PAGE_BUF_H__ */
...@@ -2714,7 +2714,7 @@ xlog_state_put_ticket(xlog_t *log, ...@@ -2714,7 +2714,7 @@ xlog_state_put_ticket(xlog_t *log,
LOG_UNLOCK(log, s); LOG_UNLOCK(log, s);
} /* xlog_state_put_ticket */ } /* xlog_state_put_ticket */
void xlog_sync_sched( void xlog_sync_work(
void *v) void *v)
{ {
xlog_in_core_t *iclog = (xlog_in_core_t *)v; xlog_in_core_t *iclog = (xlog_in_core_t *)v;
...@@ -2773,13 +2773,12 @@ xlog_state_release_iclog(xlog_t *log, ...@@ -2773,13 +2773,12 @@ xlog_state_release_iclog(xlog_t *log,
* flags after this point. * flags after this point.
*/ */
if (sync) { if (sync) {
INIT_TQUEUE(&iclog->ic_write_sched, INIT_WORK(&iclog->ic_write_work, xlog_sync_work, iclog);
xlog_sync_sched, (void *) iclog);
switch (xlog_mode) { switch (xlog_mode) {
case 0: case 0:
return xlog_sync(log, iclog, 0); return xlog_sync(log, iclog, 0);
case 1: case 1:
pagebuf_queue_task(&iclog->ic_write_sched); queue_work(pagebuf_workqueue, &iclog->ic_write_work);
} }
} }
return (0); return (0);
......
...@@ -438,7 +438,7 @@ typedef struct xlog_iclog_fields { ...@@ -438,7 +438,7 @@ typedef struct xlog_iclog_fields {
int ic_bwritecnt; int ic_bwritecnt;
ushort_t ic_state; ushort_t ic_state;
char *ic_datap; /* pointer to iclog data */ char *ic_datap; /* pointer to iclog data */
struct tq_struct ic_write_sched; struct work_struct ic_write_work;
} xlog_iclog_fields_t; } xlog_iclog_fields_t;
typedef struct xlog_in_core2 { typedef struct xlog_in_core2 {
...@@ -458,7 +458,7 @@ typedef struct xlog_in_core { ...@@ -458,7 +458,7 @@ typedef struct xlog_in_core {
* Defines to save our code from this glop. * Defines to save our code from this glop.
*/ */
#define ic_forcesema hic_fields.ic_forcesema #define ic_forcesema hic_fields.ic_forcesema
#define ic_write_sched hic_fields.ic_write_sched #define ic_write_work hic_fields.ic_write_work
#define ic_next hic_fields.ic_next #define ic_next hic_fields.ic_next
#define ic_prev hic_fields.ic_prev #define ic_prev hic_fields.ic_prev
#define ic_bp hic_fields.ic_bp #define ic_bp hic_fields.ic_bp
......
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