From 3e37f7eb7964d7905c60eb246f31bed70ff44637 Mon Sep 17 00:00:00 2001 From: zab Date: Sun, 5 Oct 2003 16:29:33 +0000 Subject: [PATCH] b=2030 Queue IO in writepage when dirty pages first arrive there. Previously it was assumed that commit_write() was involved, which isn't the case for writes via mmap(). mmap() still isn't correct across the cluster, but at least pages won't get lost in writeback. In the process of adding a sanity test for this some mmap() operations are added to multiop and sanity gets a helper to find the page size. --- lustre/llite/rw24.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/lustre/llite/rw24.c b/lustre/llite/rw24.c index 9646a63..336d90f 100644 --- a/lustre/llite/rw24.c +++ b/lustre/llite/rw24.c @@ -73,6 +73,9 @@ void ll_complete_writepage_24(struct obd_client_page *ocp, int rc) static int ll_writepage_24(struct page *page) { struct obd_client_page *ocp; + struct obd_export *exp; + struct inode *inode = page->mapping->host; + int rc; ENTRY; LASSERT(!PageDirty(page)); @@ -86,7 +89,37 @@ static int ll_writepage_24(struct page *page) /* sadly, not all callers who writepage eventually call sync_page * (ahem, kswapd) so we need to raise this page's priority * immediately */ - RETURN(ll_sync_page(page)); + rc = ll_sync_page(page); + + if (rc != -EAGAIN) + goto out; + + exp = ll_i2obdexp(inode); + if (exp == NULL) { + rc = -EINVAL; + goto out; + } + + /* mmap writepage() gets here without coming through commit_write(). + * so we just tried to raise the priority of an io that wasn't in + * flight. try again.. */ + ocp->ocp_io_completion = ll_complete_writeback; + ocp->ocp_set_io_ready = ll_ocp_set_io_ready; + ocp->ocp_update_io_args = ll_ocp_update_io_args; + ocp->ocp_update_obdo = ll_ocp_update_obdo; + ocp->ocp_brw_flag = OBD_BRW_CREATE; + ocp->ocp_flags = OCP_IO_READY|OCP_IO_URGENT; + + rc = obd_queue_async_io(OBD_BRW_WRITE, exp, ll_i2info(inode)->lli_smd, + NULL, ocp, NULL); + /* XXX fallback to sync? probably, when the api is more robust */ +out: + if (rc != 0) { + SetPageError(page); + unlock_page(page); + RETURN(rc); + } + RETURN(0); } static int ll_direct_IO_24(int rw, struct inode *inode, struct kiobuf *iobuf, -- 1.8.3.1