Improve performance of (large) directory listings: Avoid

stat:ing each file many times.

The patch modifies rdesktop so that the g_notify_stamp is only set
when writing. Also, the stamp is not set before disk_create_notify(),
since this would mean that NotifyInfo would be called twice directly.

With this patch, the number of stat:s has dropped from 24 to 4, using
my tests.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1401 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2007-04-10 11:22:10 +00:00
parent 995f232b2b
commit 75bd1939f8
2 changed files with 5 additions and 4 deletions

3
disk.c
View File

@ -493,6 +493,8 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create
g_fileinfo[handle].accessmask = accessmask;
strncpy(g_fileinfo[handle].path, path, PATH_MAX - 1);
g_fileinfo[handle].delete_on_close = False;
if (accessmask & GENERIC_ALL || accessmask & GENERIC_WRITE)
g_notify_stamp = True;
*phandle = handle;
@ -506,6 +508,7 @@ disk_close(RD_NTHANDLE handle)
pfinfo = &(g_fileinfo[handle]);
if (pfinfo->accessmask & GENERIC_ALL || pfinfo->accessmask & GENERIC_WRITE)
g_notify_stamp = True;
rdpdr_abort_io(handle, 0, RD_STATUS_CANCELLED);

View File

@ -645,8 +645,6 @@ rdpdr_process_irp(STREAM s)
in_uint32_le(s, info_level); /* notify mask */
g_notify_stamp = True;
status = disk_create_notify(file, info_level);
result = 0;