Commit 4e1eaa31 authored by Stephen Lord's avatar Stephen Lord Committed by Stephen Lord

[XFS] Close some holes in the metadata flush logic used during unmount,

make sure we have no pending I/O completion calls for metadata,
and that we only keep hold of metadata buffers for I/O completion
if we want to. Still not perfect, but better than it was.

SGI Modid: 2.5.x-xfs:slinx:158933a
parent 4bf690c2
......@@ -1677,6 +1677,9 @@ pagebuf_daemon(
break;
}
pb->pb_flags &= ~PBF_DELWRI;
pb->pb_flags |= PBF_WRITE;
list_del(&pb->pb_list);
list_add(&pb->pb_list, &tmp);
......@@ -1688,8 +1691,6 @@ pagebuf_daemon(
while (!list_empty(&tmp)) {
pb = list_entry(tmp.next, page_buf_t, pb_list);
list_del_init(&pb->pb_list);
pb->pb_flags &= ~PBF_DELWRI;
pb->pb_flags |= PBF_WRITE;
pagebuf_iostrategy(pb);
}
......@@ -1720,6 +1721,7 @@ pagebuf_delwri_flush(
int flush_cnt = 0;
pagebuf_runall_queues(pagebuf_dataio_workqueue);
pagebuf_runall_queues(pagebuf_logio_workqueue);
spin_lock(&pbd_delwrite_lock);
INIT_LIST_HEAD(&tmp);
......@@ -1742,28 +1744,23 @@ pagebuf_delwri_flush(
continue;
}
if (flags & PBDF_TRYLOCK) {
if (!pagebuf_cond_lock(pb)) {
pincount++;
continue;
}
}
list_del_init(&pb->pb_list);
if (flags & PBDF_WAIT) {
list_add(&pb->pb_list, &tmp);
pb->pb_flags &= ~PBF_ASYNC;
}
spin_unlock(&pbd_delwrite_lock);
if ((flags & PBDF_TRYLOCK) == 0) {
pagebuf_lock(pb);
}
pb->pb_flags &= ~PBF_DELWRI;
pb->pb_flags |= PBF_WRITE;
list_move(&pb->pb_list, &tmp);
}
/* ok found all the items that can be worked on
* drop the lock and process the private list */
spin_unlock(&pbd_delwrite_lock);
list_for_each_safe(curr, next, &tmp) {
pb = list_entry(curr, page_buf_t, pb_list);
if (flags & PBDF_WAIT)
pb->pb_flags &= ~PBF_ASYNC;
else
list_del_init(curr);
pagebuf_lock(pb);
pagebuf_iostrategy(pb);
if (++flush_cnt > 32) {
blk_run_queues();
......@@ -1773,12 +1770,6 @@ pagebuf_delwri_flush(
blk_run_queues();
if (pinptr)
*pinptr = pincount;
if ((flags & PBDF_WAIT) == 0)
return;
while (!list_empty(&tmp)) {
pb = list_entry(tmp.next, page_buf_t, pb_list);
......@@ -1788,6 +1779,9 @@ pagebuf_delwri_flush(
pagebuf_unlock(pb);
pagebuf_rele(pb);
}
if (pinptr)
*pinptr = pincount;
}
STATIC int
......
......@@ -368,7 +368,6 @@ extern int pagebuf_ispin( /* check if buffer is pinned */
/* Delayed Write Buffer Routines */
#define PBDF_WAIT 0x01
#define PBDF_TRYLOCK 0x02
extern void pagebuf_delwri_flush(
pb_target_t *,
unsigned long,
......
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