From 6829a19b3fc4c8fd42dd6d131f03dfc8404999d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 16 Sep 2002 16:09:36 +0000 Subject: [PATCH] Now bfs_write() also don't trigger any notifications during write access on uncached files (might be needed for the VM file). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1062 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../file_systems/bfs/kernel_interface.cpp | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index 97eb784933..6ae7aa0dd6 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -1174,21 +1174,25 @@ bfs_write(void *_ns, void *_node, void *_cookie, off_t pos, const void *buffer, if (status == B_OK) transaction.Done(); - // periodically notify if the file size has changed - // ToDo: should we better test for a change in the last_modified time only? - if (cookie->last_size != inode->Size() - && system_time() > cookie->last_notification + INODE_NOTIFICATION_INTERVAL) { - notify_listener(B_STAT_CHANGED, volume->ID(), 0, 0, inode->ID(), NULL); - cookie->last_size = inode->Size(); - cookie->last_notification = system_time(); - } + if ((inode->Flags() & INODE_NO_CACHE) == 0) { + // uncached files don't cause notifications during access, and + // never want to write back any cached blocks - // This will flush the dirty blocks to disk from time to time. - // It's done here and not in Inode::WriteAt() so that it won't - // add to the duration of a transaction - it might even be a - // good idea to offload those calls to another thread - if ((inode->Flags() & INODE_NO_CACHE) == 0) + // periodically notify if the file size has changed + // ToDo: should we better test for a change in the last_modified time only? + if (cookie->last_size != inode->Size() + && system_time() > cookie->last_notification + INODE_NOTIFICATION_INTERVAL) { + notify_listener(B_STAT_CHANGED, volume->ID(), 0, 0, inode->ID(), NULL); + cookie->last_size = inode->Size(); + cookie->last_notification = system_time(); + } + + // This will flush the dirty blocks to disk from time to time. + // It's done here and not in Inode::WriteAt() so that it won't + // add to the duration of a transaction - it might even be a + // good idea to offload those calls to another thread volume->WriteCachedBlocksIfNecessary(); + } return status; }