Changeset 1567


Ignore:
Timestamp:
May 31, 2011, 9:49:56 PM (14 years ago)
Author:
Steven Levine
Message:

Disable antique debug code in RemoveCnrItems - really speeds up container close

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1564 r1567  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2010 Steven H. Levine
     9  Copyright (c) 2001, 2011 Steven H. Levine
    1010
    1111  10 Jan 04 SHL ProcessDirectory: avoid most large drive failures
     
    8585  15 Nov 09 GKY Optimize some check code
    8686  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10).
    87                 Mostly cast CHAR CONSTANT * as CHAR *.
     87                Mostly cast CHAR CONSTANT * as CHAR *.
    8888  09 MAY 10 JBS Ticket 434 bug fixes, message box text improvements and parameter update
    89                 improvements.
     89                improvements.
    9090  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
    91                 entries in the tree container, fix related semaphore performance using
    92                 combination of event and mutex semaphores
     91                entries in the tree container, fix related semaphore performance using
     92                combination of event and mutex semaphores
    9393  30 May 11 GKY Fixed trap caused by passing a nonexistant pci to FillInRecordFromFFB in FillDir
    94                 because pci is limited to 65535 files. (nRecord is a USHORT) SHL's single loop
     94                because pci is limited to 65535 files. (nRecord is a USHORT) SHL's single loop
    9595  30 May 11 GKY Added SleepIfNeeded to DosFind and container load loops to improve WPS responsiveness
     96  31 May 11 SHL Disable antique debug code in RemoveCnrItems - really speeds up container close
    9697
    9798***********************************************************************/
     
    243244        IncrThreadUsage();
    244245        priority_normal();
    245         if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) {
    246           ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
    247 
    248           if ((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) ||
    249                (fRScanRemote && flags & DRIVE_REMOTE) ||
    250                (fRScanVirtual && flags & DRIVE_VIRTUAL)) {
    251             if (!(flags & ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) ||
    252                            (fRScanSlow ? 0 : DRIVE_SLOW)))) {
    253               UnFlesh(StubbyScan->hwndCnr, StubbyScan->pci);
    254               Flesh(StubbyScan->hwndCnr, StubbyScan->pci);
    255             }
    256           }
    257           else {
    258             Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
    259             //if (!ok)
    260              // FixedVolume--;
    261           }       
    262         }
     246        if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) {
     247          ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
     248
     249          if ((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) ||
     250               (fRScanRemote && flags & DRIVE_REMOTE) ||
     251               (fRScanVirtual && flags & DRIVE_VIRTUAL)) {
     252            if (!(flags & ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) ||
     253                           (fRScanSlow ? 0 : DRIVE_SLOW)))) {
     254              UnFlesh(StubbyScan->hwndCnr, StubbyScan->pci);
     255              Flesh(StubbyScan->hwndCnr, StubbyScan->pci);
     256            }
     257          }
     258          else {
     259            Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
     260            //if (!ok)
     261             // FixedVolume--;
     262          }
     263        }
    263264        WinDestroyMsgQueue(hmq);
    264265      }
     
    269270  } // if StubbyScan
    270271  ProcessDirCount++;
    271   //DbgMsg(pszSrcFile, __LINE__, "ProcessDirCount %i FixedVolume %i",
    272   //       ProcessDirCount, FixedVolume);
     272  // DbgMsg(pszSrcFile, __LINE__, "ProcessDirCount %i FixedVolume %i", ProcessDirCount, FixedVolume);
    273273  if (ProcessDirCount >= FixedVolume) {
    274274    DosReleaseMutexSem(hmtxScanning);
     
    277277       // Keep drive tree in sync with directory container
    278278      if (hwndMain) {
    279         //if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame)
    280           if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
    281             free(pszFocusDir);
     279        //if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame)
     280          if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
     281            free(pszFocusDir);
    282282      }
    283283      else {
    284         if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
    285           free(pszFocusDir);
     284        if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
     285          free(pszFocusDir);
    286286      }
    287287    }
     
    302302  HAB thab;
    303303  HMQ hmq = (HMQ) 0;
    304  
     304
    305305
    306306  DosError(FERR_DISABLEHARDERR);
     
    11151115        //priority_normal();
    11161116        if (rc)
    1117           DosError(FERR_DISABLEHARDERR);
    1118         SleepIfNeeded(&itdSleep, 1);
     1117          DosError(FERR_DISABLEHARDERR);
     1118        SleepIfNeeded(&itdSleep, 1);
    11191119      } while (!rc);
    11201120
     
    11301130          goto Abort;
    11311131
    1132         pci = NULL;
    1133         ullTotalBytes = 0;
    1134         pffbFile = paffbTotal;
    1135         for (x = 0; x < cAffbTotal; x++) {
    1136           ULONG ulRecsToInsert;
    1137 
    1138           if (pci ==NULL) {
    1139             ulRecsToInsert = cAffbTotal - x <  USHRT_MAX  ? cAffbTotal - x : USHRT_MAX;
    1140             pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD,
    1141                                   MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(ulRecsToInsert));
    1142 
    1143             if (!pciFirst) {
    1144               Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__,
    1145                         GetPString(IDS_CMALLOCRECERRTEXT));
    1146               ok = FALSE;
    1147               ullTotalBytes = 0;
    1148               break;
    1149             }
    1150             else {
    1151               // 04 Jan 08 SHL fixme like comp.c to handle less than ulSelCnt records
    1152               if (hwndStatus && dcd &&
    1153                   dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
    1154                 WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_PLEASEWAITCOUNTINGTEXT));
    1155               }
    1156               pci = pciFirst;
    1157             }
    1158           }
    1159           ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    1160                                         pffbFile, partial, dcd);
    1161           pci = (PCNRITEM) pci->rc.preccNextRecord;
    1162           ullTotalBytes += ullBytes;
    1163           // 15 Sep 09 SHL allow timed updates to see
    1164           if (dcd) {
    1165             dcd->totalfiles = x;
    1166             dcd->ullTotalBytes = ullTotalBytes;
    1167           }
    1168           // Can not use offset since we have merged lists - this should be equivalent
    1169           pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
    1170 
    1171           if (pci == NULL && ulRecsToInsert) {
     1132        pci = NULL;
     1133        ullTotalBytes = 0;
     1134        pffbFile = paffbTotal;
     1135        for (x = 0; x < cAffbTotal; x++) {
     1136          ULONG ulRecsToInsert;
     1137
     1138          if (pci ==NULL) {
     1139            ulRecsToInsert = cAffbTotal - x <  USHRT_MAX  ? cAffbTotal - x : USHRT_MAX;
     1140            pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD,
     1141                                  MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(ulRecsToInsert));
     1142
     1143            if (!pciFirst) {
     1144              Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__,
     1145                        GetPString(IDS_CMALLOCRECERRTEXT));
     1146              ok = FALSE;
     1147              ullTotalBytes = 0;
     1148              break;
     1149            }
     1150            else {
     1151              // 04 Jan 08 SHL fixme like comp.c to handle less than ulSelCnt records
     1152              if (hwndStatus && dcd &&
     1153                  dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
     1154                WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_PLEASEWAITCOUNTINGTEXT));
     1155              }
     1156              pci = pciFirst;
     1157            }
     1158          }
     1159          ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
     1160                                        pffbFile, partial, dcd);
     1161          pci = (PCNRITEM) pci->rc.preccNextRecord;
     1162          ullTotalBytes += ullBytes;
     1163          // 15 Sep 09 SHL allow timed updates to see
     1164          if (dcd) {
     1165            dcd->totalfiles = x;
     1166            dcd->ullTotalBytes = ullTotalBytes;
     1167          }
     1168          // Can not use offset since we have merged lists - this should be equivalent
     1169          pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
     1170
     1171          if (pci == NULL && ulRecsToInsert) {
    11721172            memset(&ri, 0, sizeof(RECORDINSERT));
    11731173            ri.cb = sizeof(RECORDINSERT);
     
    11891189                ullTotalBytes = 0;
    11901190                if (WinIsWindow((HAB) 0, hwndCnr))
    1191                   FreeCnrItemList(hwndCnr, pciFirst);
    1192                 pciFirst = NULL;
    1193                 break;
     1191                  FreeCnrItemList(hwndCnr, pciFirst);
     1192                pciFirst = NULL;
     1193                break;
    11941194              }
    11951195            }
    1196           }
    1197           SleepIfNeeded(&itdSleep, 1);
    1198         }
     1196          }
     1197          SleepIfNeeded(&itdSleep, 1);
     1198        }
    11991199        if (ok) {
    12001200          ullReturnBytes += ullTotalBytes;
     
    12741274  DosPostEventSem(CompactSem);
    12751275
    1276 #if 0 // fixme to be gone or to be configurable
     1276#if 0 // 2011-05-31 SHL fixme to be gone or to be configurable
    12771277  {
    12781278    int state = _heapchk();
     
    14181418
    14191419          if (~driveflags[iDrvNum] & DRIVE_REMOVABLE) {
    1420             // Fixed volume
    1421             if (~flags & DRIVE_INVALID && ~flags & DRIVE_NOPRESCAN)
    1422               FixedVolume++;
     1420            // Fixed volume
     1421            if (~flags & DRIVE_INVALID && ~flags & DRIVE_NOPRESCAN)
     1422              FixedVolume++;
    14231423            pci->attrFile |= FILE_DIRECTORY;
    14241424            DosError(FERR_DISABLEHARDERR);
     
    17681768             szSuggest);
    17691769      if (rc == MBID_YES) {
    1770         HOBJECT hFM2Object;
     1770        HOBJECT hFM2Object;
    17711771        char s[64];
    17721772        sprintf(s, "PARAMETERS=%s", szSuggest);
    1773         hFM2Object = WinQueryObject("<FM/2>");
    1774         if (hFM2Object) {
    1775           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1776         }
    1777         hFM2Object = WinQueryObject("<FM/2 LITE>");
    1778         if (hFM2Object) {
    1779           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1780         }
    1781         hFM2Object = WinQueryObject("<FM/2_AV/2>");
    1782         if (hFM2Object) {
    1783           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1784         }
    1785         hFM2Object = WinQueryObject("<FM/2_DIRSIZE>");
    1786         if (hFM2Object) {
    1787           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1788         }
    1789         hFM2Object = WinQueryObject("<FM/2_VTREE>");
    1790         if (hFM2Object) {
    1791           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1792         }
    1793         hFM2Object = WinQueryObject("<FM/2_VDIR>");
    1794         if (hFM2Object) {
    1795           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1796         }
    1797         hFM2Object = WinQueryObject("<FM/2_SEEALL>");
    1798         if (hFM2Object) {
    1799           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1800         }
    1801         hFM2Object = WinQueryObject("<FM/2_DATABAR>");
    1802         if (hFM2Object) {
    1803           rc = WinSetObjectData(hFM2Object, (PSZ)s);
    1804         }
     1773        hFM2Object = WinQueryObject("<FM/2>");
     1774        if (hFM2Object) {
     1775          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1776        }
     1777        hFM2Object = WinQueryObject("<FM/2 LITE>");
     1778        if (hFM2Object) {
     1779          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1780        }
     1781        hFM2Object = WinQueryObject("<FM/2_AV/2>");
     1782        if (hFM2Object) {
     1783          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1784        }
     1785        hFM2Object = WinQueryObject("<FM/2_DIRSIZE>");
     1786        if (hFM2Object) {
     1787          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1788        }
     1789        hFM2Object = WinQueryObject("<FM/2_VTREE>");
     1790        if (hFM2Object) {
     1791          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1792        }
     1793        hFM2Object = WinQueryObject("<FM/2_VDIR>");
     1794        if (hFM2Object) {
     1795          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1796        }
     1797        hFM2Object = WinQueryObject("<FM/2_SEEALL>");
     1798        if (hFM2Object) {
     1799          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1800        }
     1801        hFM2Object = WinQueryObject("<FM/2_DATABAR>");
     1802        if (hFM2Object) {
     1803          rc = WinSetObjectData(hFM2Object, (PSZ)s);
     1804        }
    18051805      }
    18061806      else if (rc == MBID_CANCEL) {
     
    20072007  PCNRITEM pci;
    20082008  ITIMER_DESC itdSleep = { 0 };         // 30 May 11 GKY
    2009      
     2009
    20102010
    20112011  if ((usCnt && !pciFirst) || (!usCnt && pciFirst)) {
     
    20292029      InitITimer(&itdSleep, 500);
    20302030      while (pci) {
    2031         // 12 Sep 07 SHL dwg drivebar crash testing - ticket# ???
     2031#if 0 // 12 Sep 07 SHL dwg drivebar crash testing - ticket# ??? - fixme to be gone
    20322032        static PCNRITEM pciLast;        // 12 Sep 07 SHL
    20332033        ULONG ulSize = sizeof(*pci);
     
    20372037          Dos_Error(MB_ENTER, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
    20382038                    "DosQueryMem failed pci %p pciLast %p", pci, pciLast);
    2039         FreeCnrItemData(pci);
     2039#endif
     2040        FreeCnrItemData(pci);
     2041#if 0 // 12 Sep 07 SHL dwg drivebar crash testing - ticket# ??? - fixme to be gone
    20402042        pciLast = pci;
     2043#endif
    20412044        pci = (PCNRITEM)pci->rc.preccNextRecord;
    20422045        if (remaining && --remaining == 0)
    2043           break;
    2044         SleepIfNeeded(&itdSleep, 1);
     2046          break;
     2047        SleepIfNeeded(&itdSleep, 1);
    20452048      }
    20462049    }
Note: See TracChangeset for help on using the changeset viewer.