Reduced FS_Info cache disk reads

svn path=/trunk/; revision=1001
This commit is contained in:
Curtis Gedak 2008-12-08 18:23:30 +00:00
parent 4ef71e5004
commit 7a3fa5a7dd
4 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2008-12-08 Curtis Gedak <gedakc@gmail.com>
* include/FS_Info.h,
src/FS_Info.cc
src/GParted_Core.cc: Reduced FS_Info cache disk reads.
2008-12-07 Curtis Gedak <gedakc@gmail.com>
* include/Utils.h,

View File

@ -27,13 +27,14 @@ class FS_Info
{
public:
FS_Info() ;
FS_Info( bool do_refresh ) ;
~FS_Info() ;
Glib::ustring get_label( const Glib::ustring & path, bool & found ) ;
Glib::ustring get_uuid( const Glib::ustring & path ) ;
private:
void load_fs_info_cache() ;
Glib::ustring get_device_entry( const Glib::ustring & path ) ;
Glib::ustring fs_info_cache ;
static Glib::ustring fs_info_cache ;
};
}//GParted

View File

@ -20,8 +20,19 @@
namespace GParted
{
//initialize static data element
Glib::ustring FS_Info::fs_info_cache = "";
FS_Info::FS_Info()
{
//Ensure that cache has been loaded at least once
if ( fs_info_cache == "" )
load_fs_info_cache() ;
}
FS_Info:: FS_Info( bool do_refresh )
{
if ( do_refresh )
load_fs_info_cache() ;
}

View File

@ -143,6 +143,7 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
{
devices .clear() ;
Device temp_device ;
FS_Info fs_info( true ) ; //Refresh cache of file system information
init_maps() ;
@ -633,7 +634,7 @@ void GParted_Core::set_device_partitions( Device & device )
{
int EXT_INDEX = -1 ;
char * lp_path ;//we have to free the result of ped_partition_get_path()..
FS_Info fs_info ; //Build cache of file system information
FS_Info fs_info ; //Use cache of file system information
//clear partitions
device .partitions .clear() ;