CVS: rdesktop disk.c,1.61,1.62 rdpdr.c,1.50,1.51

Peter Åstrand <[email protected]> Tue, 10 Apr 2007 04:22:13 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14329

Modified Files:
	disk.c rdpdr.c 
Log Message:
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. 



Index: disk.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/disk.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** disk.c	4 Apr 2007 12:28:57 -0000	1.61
--- disk.c	10 Apr 2007 11:22:10 -0000	1.62
***************
*** 494,498 ****
  	strncpy(g_fileinfo[handle].path, path, PATH_MAX - 1);
  	g_fileinfo[handle].delete_on_close = False;
! 	g_notify_stamp = True;
  
  	*phandle = handle;
--- 494,500 ----
  	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;
***************
*** 507,511 ****
  	pfinfo = &(g_fileinfo[handle]);
  
! 	g_notify_stamp = True;
  
  	rdpdr_abort_io(handle, 0, RD_STATUS_CANCELLED);
--- 509,514 ----
  	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);

Index: rdpdr.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpdr.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** rdpdr.c	8 Jan 2007 04:47:05 -0000	1.50
--- rdpdr.c	10 Apr 2007 11:22:10 -0000	1.51
***************
*** 646,651 ****
  					in_uint32_le(s, info_level);	/* notify mask */
  
- 					g_notify_stamp = True;
- 
  					status = disk_create_notify(file, info_level);
  					result = 0;
--- 646,649 ----


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV