Method for caching network and CD-ROM file accesses using a local hard disk

Abstract: A non-volatile caching system and a method for implement such a system is disclosed. The system is particularly applicable to rotating magnetic media such as hard disk drives. The system retains data even in the event of system shut-down and re-boot. The system is capable of rapidly caching data from large, randomly accessed files, such as databases, in a space-efficient manner. The cached data can be stored in nearly any standard or non-standard format on the magnetic media. A conversion routine (210) converts CD-ROM file names or network file names to local hard disk drive file names and back. A mini-database is created (213) for each cached file on the hard disk drive. The mini-database maps randomly accessed blocks of data within the cached file on the local hard disk drive.

Description: FIELD OF THE INVENTION: This invention relates to non-volatile caching systems for data processing systems, and methods for implementing such systems. DESCRIPTION OF RELATED ART: Caching has long been employed to increase performance of a relatively slow computer memory resource when a faster memory resource, which typically has a higher cost per stored bit, is available. Typically, a temporary memory block within the faster memory resource (i.e., a cache) is established for storing only a portion of the information stored within the slower memory resource. Rather than store within the faster memory resource an entire application program or an entire data file that may be resident on the slower memory resource, certain algorithms are employed to determine which portions of the program or data file are most likely to be accessed. When the system's central processing unit (CPU) calls a memory location that is not stored in the cache, the cache (if completely filled) must be at least partially overwritten with the required data from the slower memory resource. Likewise, when permanent changes are made to data, data in both the cache and the slower memory resource must be updated to reflect that change. Distributed data processing networks and the LANs within those distributed networks can often benefit from caching. Typically, data links between LANs of a distributed processing network are slower than the interconnections between the nodes (i.e., individual computers) of a LAN. Furthermore, though a distant memory resource (e.g. a disk drive on a distant server system) may be as fast or even faster than local memory resources, long distance interconnections over a data link can dramatically slow access time to that distant resource. Regardless of the type of link between the LANs of a distributed processing network, or between the nodes (i.e., individual systems) of a LAN, each data link has a given bandwidth which will permit only a finite amount of data to be simultaneously transferred over the link. Once the bandwidth is exceeded, as for example when more than a certain number of users are attempting to communicate over the same link (whether between LANs or within a LAN), response time over that link typically degrades as each user's request is delayed in order to evenly accommodate all competing requests. Consequently, caching of data read over a network can generally increase system performance both by reducing data link loading and by providing the end user with a cache of rapidly accessible data. Within the last several years, compact disc read-only-memory devices (CD-ROMs) have become extremely popular due to the availability of low-cost, high-capacity compact disk storage media and relatively low cost CD-ROM readers (drives). In fact, nearly all new personal computers being sold in the U.S. include an installed CD-ROM drive. Although current CD-ROM media are capable of storing approximately 450-500 megabytes of data, access to that data is considerably slower than data stored on a modern hard disk drive. For example, the current standard for a high-performance CD-ROM drive, known as a "6X" drive is capable of reading, at most, about 600 kilobytes of data per second. A modern high-speed IDE hard disk drive, on the other hand, is capable of reading about six megabytes per second--roughly ten times the speed of a 6X CD-ROM drive. Thus, CD-ROM drive performance may also be greatly enhanced through caching. Many graphical user interface (GUI) environments, such as Microsoft® Windows™ version 3.X, Microsoft Windows 95, Windows NT®, IBM Corporation's OS/2®, and Geoworks® have been developed over the years. Of the aforementioned products, only Windows NT and OS/2 are true operating systems, as Geoworks and Windows 3.x must be loaded and run under the venerable Microsoft MS-DOS operating system. Windows 95 is somewhat of a hybrid, as it also requires portions of MS-DOS for its operation. For the sake of simplicity, though, both Windows 3.X and Windows 95 are referred to hereinafter as operating systems. As this is written, Microsoft Windows version 3.X is far and away the most used GUI operating system, having been bundled with nearly every personal computer sold between 1989 and mid-1995. However, from the date of its release in 1995, the Microsoft Windows 95 operating system from Microsoft Corporation has been bundled with most new, high-performance personal computers. In less than a year, it has become the operating system of choice for most business applications, and is expected to rapidly supplant Windows 3.X as the most used operating system for personal computers. The potential exists for significantly increasing the performance of both CD-ROM drives and distributed processing networks operating under Windows 3.X and Windows 95 operating systems through caching. Shortly after the release of Windows 95, Sun MicroSystems, Inc. (hereinafter "Sun") set about to create a network and CD-ROM caching product that runs under both Windows 3.X and Windows 95, is completely transparent to end-users, and works with a wide variety of file systems running under both Windows 3.X and Windows 95. In order to fulfill these requirements in its recently released caching product, Sun utilizes the services provided by the Installable File System Manager (IFSMGR) virtual device driver. This process, though fully explained in our related European patent application serial number 97201081.3 will now be summarized. The PC-CacheFS caching product interfaces with a software module within the Microsoft Windows 95 operating system known as the Installable File System Manager (IFSMGR). The IFSMGR module is classified as a virtual device driver (VxD for short) by Microsoft Corporation. The PC-CacheFS product also fits the definition of a virtual device driver. The Windows 95 operating system is designed so that all file system input/output (I/O) requests are "hooked" to the IFSMGR VxD. In a preferred embodiment, the PC-CacheFS VxD is layered between the IFSMGR VxD and the generic file system of Windows 95. The PC-CacheFS VxD receives all file system I/O requests from the IFSMGR VxD and takes interim control of the I/O operation while implementing a caching scheme in accordance with set-up instructions which have been pre-programmed by the user of a local node. Rather than create separate caching products for Windows 3.X and Windows 95, the PC-CacheFS caching product has been designed so that it will run under both operating systems. However, the Windows 3.X operating system has no IFSMGR virtual device driver. Thus, an IFSMGR virtual device driver that will run under Windows 3.X has been written from scratch, following the Windows 95 IFSMGR VxD specification provided by Microsoft Corporation. Thus, neither the PC-CacheFS caching product (VxD) nor the Windows operating systems, themselves, need be rewritten for the sake of compatibility. WO-95 24685-A relates to the manner in which a workstation's local cache is updated as a result of the workstation receiving a file write command from an application that is connected to the workstation. A portable workstation client operates either connected to or disconnected from a local area network/wide area network (LAN/WAN). Such a client workstation has a cache manager that includes (1) a non-volatile client cache, (2) a volume information database, and (3) a modification log database. When a file write command is received by the workstation, if the file is in the workstation's cache the cache is updated, and then tested to see if the related volume is connected to the workstation. If it is not (i.e., if the workstation is disconnected from the LAN/WAN), then the write file command induced change is propagated back to the LAN/WAN server that contains the volume. If it is determined that the file that is relating to the file write command is not in the workstation's cache, then it is determined if the related volume is connected to the workstation. If yes, then the file is requested from the related volume, and the cache is updated. If no, then the file write request cannot be satisfied , and a failure is signaled to the application that issued the file write request. SUMMARY OF THE INVENTION The present invention provides a method, system and program product for caching in accordance with the claims which follow. Sun's new PC-CacheFS caching product employs a block of readable, writable and erasable cache memory resident on rotating, magnetic-media (e.g., a hard-disk drive). As a performance enhancement, it may also employ a block of readable, writable and erasable cache memory in the random access memory (RAM). This invention includes a non-volatile caching system for rotating magnetic media (e.g., hard disk drives) which retains data even in the event of system shut-down and re-boot. The system is capable of rapidly caching data from large, randomly accessed files, such as databases, in a space-efficient manner. The cached data can be stored in nearly any standard or non-standard format on the magnetic media. A conversion routine converts CD-ROM file names or network file names to local hard disk drive file names and back. A mini-database is created for each cached file on the hard disk drive. The mini-data base maps randomly-accessed blocks of data within the cached file on the local hard disk drive. Brief Description of Drawings Fig. 1 illustrates a computing system for performing the computer implemented steps of the method in accordance with the invention; and Fig. 2 is a flow chart depicting the logical operational flow for implementing the method for caching network and CD-ROM file accessusing a hard disk drive. Detailed Description of Preferred Embodiments The embodiments of the invention described herein may be implemented as logical operations in a distributed processing system having client and server computing systems. The logical operations of the present invention are implemented (1) as a sequence of computer implemented steps running on the computing system and (2) as interconnected machine modules within the computing system. The implementation is a matter of choice that is dependent on the performance requirements of the computing system implementing the invention. Accordingly, the logical operations making up the embodiments of the invention described herein are referred to variously as operations, steps or modules. The operating environment in which the present invention is used encompasses the general distributed computing system, wherein general purpose computers, workstations, or personal computers (hereinafter local nodes) are connected via communication links of various types, in a client-server arrangement, wherein programs and data, many in the form of objects, are made available by various members of the system. Some of the elements of a general purpose workstation computer are shown in Figure 1, wherein a processor 1 is shown, the processor having an input/output (I/O) section, a central processing unit (CPU) 3 and a memory section 4. The I/O section 2 is connected to a keyboard 5, a display unit 6, a disk storage unit 9 and a CD-ROM drive unit 7. The CD-ROM unit 7 can read a CD-ROM medium 8 which typically contains programs 10 and data. The computer program products containing mechanisms to effectuate the apparatus and methods of the present invention may reside in the memory section 4, or on a disk storage unit 9, or on the CD-ROM 8 of such a system. Examples of such systems include SPARC systems offered by Sun MicroSystems, Inc., personal computers offered by IBM Corporation and by other manufacturers of IBM-compatible personal computers, and systems running the UNIX operating system. The present invention has been incorporated in Sun's PC-CacheFS network and CD-ROM caching product. The invention includes both a non-volatile caching system for rotating magnetic media such as a hard disk drive and a method for implementing the non-volatile caching system. The caching system is designed so that cached data is retained even in the event of system shut-down and re-boot. The system is capable of rapidly caching data from large, randomly accessed files, such as databases, in a space-efficient manner. The cached data can be stored in nearly any standard or non-standard format on the magnetic media. A conversion routine, which will be explained below with reference to Figure 2, converts CD-ROM file names or network file names to local hard disk drive file names and back. A mini-database is created for each cached file on the hard disk drive. The mini-data base maps any randomly-accessed block of data within the cached file on the local hard disk drive. The pseudo-code flow chart of Figure 2 details the logical steps for the method utilized in implementing and maintaining a preferred embodiment of the Network and CD-ROM file caching system. Referring now to Step 1 of Figure 2, the method begins upon receipt by the caching VxD of a file I/O request from the IFSMGR VxD either directly or via a chain a hooked chain therefrom. In Step 2, a determination is made as to whether or not this is an instance of boot-time initialization. If it is, then Step 3 determines which local hard disk drive holds the on-disk cache. In Step 4, the name of the on-disk cache is constructed. The on-disk cache name is constructed by combining the drive identifier letter and the name "CFS.SYS". For example, if the set-up program for PC-CacheFS has been configured to place the on-disk cache on the "D" drive, the full name of the on-disk cache will be "D:\CFS.SYS". If this is the first time that the caching VxD is executed by the system, it will not yet have initialized an on-disk cache on drive "D". Therefore, the "D" drive directory is searched in Step 5 for the on-disk cache file name "D:\CFS.SYS". If the on-disk cache file name is not on the "D" drive, it is initialized (i.e., created) using standard operating system services. Once the on-disk cache is in existence, it is scanned in Step 7 to determine the amount of space consumed thereby on the disk drive. Both the output of Step 7 and the "No" output of Step 2 are fed to Step 8, which determines whether the incoming file I/O request involves data on a mass-storage device that has been designated for caching. If not the file I/O request is chained, in Step 9, to the next VxD "hooked" to the IFSMGR VxD, or to the IFSMGR VxD directly if there are no other VxDs in the chain of hooked VxDs. If, on the other hand, the file I/O request is one which should be cached, the full path name of the file containing the requested data is converted to its on-disk cache name in Step 10. As an example, a CD-ROM file request might be "R:\FULL\PATH\README.TXT". This full path name is converted to "D:\CFS.SYS\R\FULL\PATH\README.TXT". The conversion operation is simple, efficient and readily reversible in order to quickly determine the actual path of the original file at any time. Step 11 then determines whether or not the converted name exists in the on-disk cache directory. If it does not, the converted path name is written to the on-disk cache directory in Step 12, making any parent directories on the local hard disk drive as required for the new path. Step 13 then initializes a mini-database for the file name. The mini-database will be described in more detail below. Suffice it to say now that the mini-database is initialized to indicate that no blocks within the on-disk cache have yet been loaded with data for that file. In Step 14, the mini-database for the converted file name is processed to ascertain which data block numbers from the file are loaded within the cache. Step 15 determines whether a block number contained in the mini-database corresponds to the one in which requested data resides on the cached CD-ROM drive. If no such block number is present within the mini-database, data is read from the network or CD-ROM file system over the system data bus and written to a data block within the on-disk cache in Step 16, with the file's mini-database being updated to reflect the presence of file data in a cache block. In Step 17, data within the cache is accessed using the mini-database as a guide to find the appropriate block. In Step 18, the file I/O request is resolved by loading data retrieved from the on-disk cache onto the system data bus. To complete the process, control is then returned to the IFSMGR VxD in Step 19. As heretofore stated, each file cached within the non-volatile cache on the hard disk drive has associated therewith a "mini-database" that is initialized on the hard disk drive within the on-disk cache region. In a preferred embodiment of the invention, the mini-database contains 256 bytes of data. The mini-database hold PC-CacheFS version information so that the structure of the mini-database may be updated in the future if necessary. Also contained in the mini-database is cache consistency information, such as the size of the file on the cached mass-storage device and the time of last file update. The cache consistency information facilitates determining whether data stored within the cache is valid with regard to the data stored within the cached device. Also contained in the mini-database is direct and indirect block information. In a preferred embodiment of the invention, data is read from the cached mass-storage device and written to the cache in 8-kilobyte blocks. Each 8-kilobyte block in the original file is numbered as an offset from the first or "0" block of the file. For example, an offset of "5" would indicate the sixth block from the beginning of the file. In a preferred embodiment of the invention, the mini-database is able to directly identify (i.e., point to) 91 8-kilobyte blocks within the cache which pertain to the file being cached. The mini-database is also able to point to another 16 indirect blocks. An indirect block is initialized whenever the number of 8-kilobyte blocks for a file being cached exceeds 91. An indirect block is 8-kilobyte data block within the cache that has been converted to a supplemental mapping table. As each block designator requires two bytes, each 8-kilobyte indirect block can point to an additional 4,096 8-kilobyte data blocks which contain data for the file being cached. The mini-database has sufficient capacity to point to a maximum of 16 indirect blocks. Thus, with this data arrangement, the first 745,472 bytes of any cached file can be referenced directly by using the direct block designators within the mini-database. The 16 available indirect blocks provide for caching an additional 65,536 8-kilobyte blocks. Thus, files of up to about 525 megabytes in size may be cached. To get to a block with an offset of 4,000, the program code determines that this offset is not within the direct blocks (of which there are only 91), and computes (by subtracting 91 from 4000) that the pointer for the desired data block will be found within the first indirect block at the 3909th double byte value. The value at this location will point directly to the desired data block within the cache. As a means of enhancing data block location operations when the required double-byte pointer is found within an indirect block, the on-disk cache code records the last indirect block that is read in the event it is needed for a subsequent access. This technique improves performance when reading data from very large files. Thus, the heretofore disclosed method for caching network and CD-ROM file accesses using a hard disk drive provides efficient conversion between a cached file path name and a new path name which can be written to the hard disk directory and which identifies the file into which cached data will be loaded on the hard disk drive. In addition, it provides for the initialization of a cache structure on the hard disk drive which includes a mini-database for each cached file, the mini-database storing double-byte pointers, each of which either directly identifies the location of cached block of the original file or points to an indirect block which also stores double-byte pointers, each of which directly identifies the location of a cached block of the original file. While the invention has been particularly shown and described with reference to a preferred embodiment thereof, it will be understood by those skilled in the art that various other changes in the form and details may be made therein without departing from the scope of the invention.

Claims: A method for caching, on a designated local non-volatile mass storage device (9) on which data can be alterably stored, such as a hard disk drive, controlled by a computer system (1), file data stored on a mass storage device (8) having an access speed slower than that of the hard disk drive (9), said method being responsive to file input/output (I/O)-requests made by an operating system loaded on the computer system, characterized in that said method comprises the steps of: converting (210) a full path name of a file on the mass-storage device which contains data related to a received file I/O request to a file name which corresponds to a file name within a cache directory on the designated drive (9); determining (211) whether or not the converted name resides in a cache directory on the disk drive (9); if the converted name does not reside in the directory, then creating a cache directory if none exists, writing (212) the converted name to the cache directory, and creating (213), for a file associated with the converted name, a mini-database which identifies and points to mass-storage device (8) file data within the cache; processing (214) the mini-database associated with the on-disk cache name file to determine which portions of the mass-storage device (8) file are resident in the cache; determining (215) whether or not mass-storage device file (8) data associated with the received I/O request is in the cache; if the data associated with the received file I/O request is in the cache, then accessing (217) the associated data using the mini-database as a guide to its location, and if the associated data is not in the cache, then reading (216) the data from the mass-storage device (8) and writing it to the cache and updating the mini-database; and resolving (218) the received file I/O request with data in the cache. The method of Claim 1, which further comprises the steps of: determining (202), upon receipt (201) of a received file I/O request, whether or not the received request is being made during operating system boot-time inititialization; if the received request is being made during boot-time initialization, then constructing (204) a name which corresponds to a designated name for a cache on the designated drive, and determining (205) whether the constructed name already exists on the designated drive; and if the constructed name already exists on the designated drive, then presuming that a cache having the constructed name exists on the designated drive, and scanning the cache to determine (207) an amount of disk space taken up by the cache; and if the constructed name does not exist on the designated drive, then creating (206) a cache having the constructed name on the designated drive prior to scanning the cache. The method of Claim 1 or Claim 2, which also comprises the step of initializing (213) data within the mini-database immediately following its creation to indicate that no data for the file associated with the on-disk cache name has yet been written to the cache. The method of any one of Claims 1 to 3, which also comprises the steps of determining (208) whether or not the received file I/0 request should be cached; if the received file I/O request should not be cached, then terminating (209) the caching method, and if the received file I/O request should be cached, then converting (210) a full path name of a file on the mass-storage device which contains data related to the received file I/0 request to an on-disk cache name. A system for caching, on a designated local non-volatile mass storage device (9) on which data can be alterably stored, such as a hard disk drive, controlled by a computer system (1), file data stored on a mass storage device (8) having an access speed slower than that of the hard disk drive (9), said system being responsive to file input/output (I/O)-requests made by an operating system loaded on the computer system, characterized in that said system comprises: means for converting (210) a full path name of a file on the mass-storage device which contains data related to a received file I/O request to a file name which corresponds to a file name within a cache directory on the designated drive (9); means for determining (211) whether or not the converted name resides in a cache directory on the disk drive (9); if the converted name does not reside in the directory, then creating a cache directory if none exists, writing (212) the converted name to the cache directory, and creating (213), for a file associated with the converted name, a mini-database which identifies and points to mass-storage device (8) file data within the cache; means for processing (214) the mini-database associated with the on-disk cache name file to determine which portions of the mass-storage device (8) file are resident in the cache; means for determining (215) whether or not mass-storage device file (8) data associated with the received I/O request is in the cache; if the data associated with the received file I/O request is in the cache, then accessing (217) the associated data using the mini-database as a guide to its location, and if the associated data is not in the cache, then reading (216) the data from the mass-storage device (8) and writing it to the cache and updating the mini-database; and means for resolving (218) the received file I/O request with data in the cache. The caching system of Claim 5, wherein cached data stored in the cache directory is stored within data blocks of equal size, each block of cached data in the cache directory corresponding to an identically-sized block of data within a file stored on the slower mass storage device (8). The caching system of Claim 6, wherein each block of data which makes up a file stored on the slower mass storage device (8) is identified as a block offset from the beginning of the file. The caching system of Claim 6 or Claim 7, wherein the mini-database contains an ordered sequence of a number of direct block pointers, each direct block pointer sequentially corresponding to one of a first number of blocks of data within the file on the slower mass storage device (8). The caching system of Claim 8, wherein said mini-database further contains a number of indirect block pointers, each indirect block pointer being associated with a database block within the cache directory containing additional direct block pointers, each database block being identical in size to that of a data block. The caching system of any of Claims 5 to 9, wherein said mini-database also contains data which identifies a last recorded file size and update time for each file on the slower mass storage device (8) which has been cached on the local mass storage device (9). The caching system of any of Claims 5 to 10, wherein said local mass storage device (9) is a hard disk drive and the slower mass storage device (8) is a local CD-ROM drive. The caching system of any of Claims 5 to 10, wherein said local mass storage device (9) is a hard disk drive and the slower mass storage device (8) is a networked hard disk drive coupled to the computer system via a data link. The caching system of any of Claims 6 to 12, wherein each mini-database comprises 256 bytes, and each data block is 8-kilobytes in size. A computer program product comprising a computer usable medium having computer readable code embodied therein for implementing a process for caching, on a designated local non-volatile mass storage device (9) on which data can be alterably stored, such as a hard disk drive, controlled by a computer system (1), file data stored on a mass storage device (8) having an access speed slower than that of the hard disk drive (9), said process being responsive to file input/output (I/O) requests made by an operating system loaded on the computer, characterized in that said computer program product comprises: computer readable program code devices configured to cause the computer system to effect converting (210) a full path name of a file on the mass-storage device, which contains data related to a received file I/O request, to a file name which corresponds to a file name within a cache directory on the designated drive (9), computer readable program code devices configured to cause the computer system to effect determining (211) whether or not the converted name resides in a cache directory on the disk drive, computer readable program code devices configured to cause a computer, if the on-disk cache name does not reside in the directory, to effect creating a cache directory if none exists, and to effect writing (212) the converted name to the cache directory, and to effect creating (213), for a file associated with the on-disk cache name, a mini-database which identifies and points to mass-storage device (8) file data within the cache; computer readable program code devices configured to cause the computer system to effect processing (214) of the mini-database associated with the on-disk cache name file to determine which portions of the mass-storage device (8) file are resident in the cache; computer readable program code devices configured to cause the computer system to effect determining (215) whether or not mass-storage device (8) file data associated with the received I/O request is in the cache; computer readable program code devices configured to cause a computer, if the data associated with the received file I/O request is in the cache, then accessing (217) the associated data using the mini-database as a guide to its location, and if the associated data is not in the cache, to effect (216) reading the data from the mass-storage device (8) and writing it to the cache, and to effect updating the mini-database; and computer readable program code devices configured to cause the computer system to effect resolving (218) the received file I/O request with data in the cache. The computer program product of Claim 14, which further comprises: computer readable program code devices configured to cause the computer system to effect determining (202), upon receipt (201) of a file I/O request, whether or not the received request is being made during operating system hoot-time inititialization; computer readable program code devices configured to cause the computer system, if the received request is being made during boot-time initialization, to effect constructing (204) a name which corresponds to a designated name for a cache on the designated drive, and to effect determining (205) whether the constructed name already exists on the designated drive; and computer readable program code devices configured to cause the computer system, if the constructed name already exists on the designated drive, to effect presuming that a cache having the constructed name exists on the designated drive, and to effect scanning (207) the cache to determine an amount of disk space taken up by the cache: and computer readable program code devices configured to cause the computer system, if the constructed name does not exist on the designated drive, to effect creating (206) a cache having the constructed name on the designated drive prior to scanning the cache. The computer program product of Claim 14 or 15, which further comprises computer readable program code devices configured to cause the computer system to effect initializing (213) data within the mini-database immediately following its creation to indicate that no data for the file associated with the on-disk cache name has yet been written to the cache.

Inventors: BERLINER BRIAN, BERLINER, BRIAN
Applicants: SUN MICROSYSTEMS INC, SUN MICROSYSTEMS, INC.
Application year: 1997
Main classification: G06F12
IPC codes: G06F12, G06F17