The attached is not that pleasant, but (I hope) solves fdo#47983
slow-down, while not loosing people's data on dodgy, modern
file-systems :-)
I'd love to get it into LibreOffice 3.5.3
Thanks,
Michael.
--
michael.meeks@suse.com <><, Pseudo Engineer, itinerant idiot
From a0b5ba2e821091b8053bfc1d2f9c99aca7431907 Mon Sep 17 00:00:00 2001
From: Michael Meeks <michael.meeks@suse.com>
Date: Sun, 15 Apr 2012 03:33:22 +0200
Subject: [PATCH] re-open output file on save to fsync to improve first-start
performance
---
sfx2/source/doc/docfile.cxx | 13 ++++++++++++-
ucb/source/ucp/file/shell.cxx | 4 ----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 0f30aab..ced1950 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1912,9 +1912,20 @@ void SfxMedium::Transfer_Impl()
xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
Reference<
::com::sun::star::ucb::XProgressHandler >() );
- if ( ::utl::LocalFileHelper::IsLocalFile( aDest.GetMainURL( INetURLObject::NO_DECODE ) )
|| !aDest.removeSegment() )
+ rtl::OUString aDestURL( aDest.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( ::utl::LocalFileHelper::IsLocalFile( aDestURL ) || !aDest.removeSegment() )
{
TransactedTransferForFS_Impl( aSource, aDest, xComEnv );
+
+ // Hideous - no clean way to do this, so we re-open the file just to fsync it
+ osl::File aFile( aDestURL );
+ if ( aFile.open( osl_File_OpenFlag_Write ) == osl::FileBase::E_None )
+ {
+ aFile.sync();
+ OSL_TRACE("fsync'd saved file '%s'\n",
+ rtl::OUStringToOString( aDestURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ aFile.close();
+ }
}
else
{
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 561e7f8..1cb03b3 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -1909,10 +1909,6 @@ shell::write( sal_Int32 CommandId,
}
} while( nReadBytes == nRequestedBytes );
- aFile.sync(); // fsync / flush it to disk.
- OSL_TRACE( "fsync'd file '%s'\n",
- rtl::OUStringToOString( aUnqPath, RTL_TEXTENCODING_UTF8 ).getStr() );
-
err = aFile.close();
if( err != osl::FileBase::E_None )
{
--
1.7.9
Context
- [PATCH-3-5] fsync less often ... · Michael Meeks
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.