From 271b9ad49ac034af9e979d020a048476a9fecbd4 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 1 Sep 2009 21:22:37 +0000 Subject: [PATCH] Enable the IO hook for both attribute and write overlay. Attribute overlay isn't concerned by it as it does not do file data, it simply passes the hook through. In the write_overlay case we check for write operations and for modified nodes. In both cases we return B_NOT_SUPPORTED which will cause a fallback to synchronous IO. The main problem with the fallback is not that it is synchronous but that the physical buffers of the request will be mapped and filled page wise, which makes it slow for various reasons. In any case with this setup all reads to write_overlay that can go through unmodified now do. This should speed up CD boot as there is no physical to virtual translation overhead and no limit to page wise reads. In the best case it should now read 256 blocks at the time instead of always falling back to 2. My tests show no side effects on creating, writing or partially modifying nodes so far. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32897 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../attribute_overlay/attribute_overlay.cpp | 6 +---- .../layers/write_overlay/write_overlay.cpp | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp index 5794653fa4..6c215f7d92 100644 --- a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp @@ -1187,14 +1187,12 @@ overlay_write_pages(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, } -#if 0 static status_t overlay_io(fs_volume *volume, fs_vnode *vnode, void *cookie, io_request *request) { OVERLAY_CALL(io, cookie, request) } -#endif static status_t @@ -1641,9 +1639,7 @@ static fs_vnode_ops sOverlayVnodeOps = { &overlay_read_pages, &overlay_write_pages, - // TODO: the io scheduler uses it when available but we may simply - // return B_UNSUPPORTED and I'm not sure it then falls back correctly - NULL, //&overlay_io, + &overlay_io, &overlay_cancel_io, &overlay_get_file_map, diff --git a/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp b/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp index cede3a4fcf..86c0530565 100644 --- a/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -1294,14 +1295,26 @@ overlay_write_pages(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, } -#if 0 static status_t overlay_io(fs_volume *volume, fs_vnode *vnode, void *cookie, io_request *request) { - OVERLAY_CALL(io, cookie, request) + if (io_request_is_write(request)) + return B_UNSUPPORTED; + + OverlayInode *node = (OverlayInode *)vnode->private_node; + if (node->IsModified()) + return B_UNSUPPORTED; + + TRACE("relaying op: io\n"); + fs_vnode *superVnode = node->SuperVnode(); + if (superVnode->ops->io != NULL) { + return superVnode->ops->io(volume->super_volume, superVnode, cookie, + request); + } + + return B_UNSUPPORTED; } -#endif static status_t @@ -1714,9 +1727,7 @@ static fs_vnode_ops sOverlayVnodeOps = { &overlay_read_pages, &overlay_write_pages, - // TODO: the io scheduler uses it when available but we may simply - // return B_UNSUPPORTED and I'm not sure it then falls back correctly - NULL, //&overlay_io, + &overlay_io, &overlay_cancel_io, &overlay_get_file_map,