From 75bd1939f87237e1627610c8b3d8f6ae8eb52537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Tue, 10 Apr 2007 11:22:10 +0000 Subject: [PATCH] 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 --- disk.c | 7 +++++-- rdpdr.c | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/disk.c b/disk.c index 8dc78b4..9d17780 100644 --- a/disk.c +++ b/disk.c @@ -493,7 +493,9 @@ 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; - g_notify_stamp = True; + + if (accessmask & GENERIC_ALL || accessmask & GENERIC_WRITE) + g_notify_stamp = True; *phandle = handle; return RD_STATUS_SUCCESS; @@ -506,7 +508,8 @@ disk_close(RD_NTHANDLE 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); diff --git a/rdpdr.c b/rdpdr.c index 9ebd17b..69224be 100644 --- a/rdpdr.c +++ b/rdpdr.c @@ -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;