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

7
disk.c
View File

@ -493,7 +493,9 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create
g_fileinfo[handle].accessmask = accessmask; g_fileinfo[handle].accessmask = accessmask;
strncpy(g_fileinfo[handle].path, path, PATH_MAX - 1); strncpy(g_fileinfo[handle].path, path, PATH_MAX - 1);
g_fileinfo[handle].delete_on_close = False; g_fileinfo[handle].delete_on_close = False;
g_notify_stamp = True;
if (accessmask & GENERIC_ALL || accessmask & GENERIC_WRITE)
g_notify_stamp = True;
*phandle = handle; *phandle = handle;
return RD_STATUS_SUCCESS; return RD_STATUS_SUCCESS;
@ -506,7 +508,8 @@ disk_close(RD_NTHANDLE handle)
pfinfo = &(g_fileinfo[handle]); pfinfo = &(g_fileinfo[handle]);
g_notify_stamp = True; if (pfinfo->accessmask & GENERIC_ALL || pfinfo->accessmask & GENERIC_WRITE)
g_notify_stamp = True;
rdpdr_abort_io(handle, 0, RD_STATUS_CANCELLED); 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 */ in_uint32_le(s, info_level); /* notify mask */
g_notify_stamp = True;
status = disk_create_notify(file, info_level); status = disk_create_notify(file, info_level);
result = 0; result = 0;