A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent files or records, but otherwise reserves all copyrights whatsoever.
TECHNICAL FIELD
This invention relates generally to a computer system for transmitting data on a computer network, and more specifically, to a method and system for transmitting data in raw mode.
BACKGROUND OF THE INVENTION
Local Area Networks (LANs) are very popular means for interconnecting computers, especially personal computers. These computers are interconnected, in part, so that data may be electronically transferred from one computer to another and so that users can share resources such as files.
Several different type computers and computer operating systems can exist on a given network. For example, some of the computers can run Microsoft's OS/2 operating system and other computers can run a Unix-based operating system. These different computer systems need to transfer information in a protocol. The use of protocols in diverse computer systems is somewhat analogous to the use of the transmission protocols of AM and FM radio. An AM radio can only receive AM protocol signals, an FM radio can only receive FM protocol signals. Similarly, diverse computer systems cannot communicate unless they use the same protocol.
One such protocol for computer system file sharing is defined in the document entitled "Microsoft Networks/OpenNET FILE SHARING PROTOCOL," which is available from Intel Corporation as Intel Part Number 138446, and is hereby incorporated by reference. Systems that use that protocol can obtain or provide remote file services in a network environment. This protocol is referred to as the System Message Block (SMB) protocol because the protocol defines how data is to be packaged with SMB headers to be transmitted on the network. The protocol defines a server which provides file services and a consumer that accesses those services.
The SMB protocol defines how typical file access functions are to be accomplished on a network. For example, to read data from a file the consumer formats an SMB-read request block and then sends the block to the server. When the server receives the request, it retrieves the data from its file system, formats an SMB-read data response message, and sends the message with the data to the consumer. The consumer would then repeat this process for the next part of the file to be read.
FIG. 2A shows how a consumer receives data from an SMB-read. In this example, an application program makes a call to the operating system requesting a file read and passing the address of the buffer 21 for the requested data. The kernel of the operating system determines that a file access is required and passes the call to the redirector, if the file is stored on network device.
The redirector effects the read request by calling the transport system and requesting the data be stored in the SMB-buffer 23. The SMB-buffer 23 may not be large enough to store the entire data requested. The application program may request a large portion of the file, for example, 64K bytes. A typical size of the SMB-buffer data area may be 4K. Consequently, the redirector will need to send 16 requests for 4K of data each. For each of the 16 requests, the redirector initializes a network control block (NCB) to point to an SMB-buffer that contains the SMB-read command. The NCB also contains a pointer to the SMB-buffer in which to store the requested data. The redirector then calls the transport system.
The transport system transports the SMB-read command to the file server. When the response to the read is received, the transport system stores the SMB data directly in the SMB buffer of the redirector and returns to the redirector. The received SMB data contains both header information and data.
The redirector then stores the 4k bytes of SMB-buffer data, not the header, in the application buffer. The redirector then proceeds to send an SMB request to get the next 4k of data and when it receives the data it copies the data into the appropriate location in the application buffer. This process continues until the entire 64K of data is received.
The use of the prior message protocol has several disadvantages. First, there is a high overhead associated with formatting and sending NCB and SMB block. Second, the use of small blocks is inefficient to transfer large blocks of data. Third, there is duplicate copying occurring as the transport system copies the data to the SMB buffer and then the redirector copies the data to the application buffer. It would be desirable to have a method and system for implementing a protocol in which data can be transferred without these disadvantages.
SUMMARY OF THE INVENTION
It is an object of the present invention to provide a method and system for sending a write request on a network and then sending the data directly from the application buffer to the network.
It is another object of the present invention to provide a method and system for receiving data from a network and storing the data directly in the application buffer.
It is another object of the present invention to provide a method in a computer system of requesting a read raw block transfer and a write raw block transfer in an efficient format.
These and other objects, which will become apparent as the invention is more fully described below, are obtained by an improved method and system for communication between a server and consumer.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows a consumer and server along with the different system layers.
FIG. 2A shows the receiving of the read data in prior systems.
FIG. 2B shows the receiving of the read data in a preferred embodiment of the present invention.
FIG. 3 shows a flow diagram of the read raw subroutine.
FIG. 4 shows a flow diagram of the write raw subroutine.
DETAILED DESCRIPTION OF THE INVENTION
The present invention provides a method and system for transmitting data on a network in raw mode. In a preferred embodiment, data is transmitted on the network without the overhead of the SMB header and the data is stored directly into an application buffer, rather than stored into an SMB buffer.
FIG. 1 shows the system layers for a consumer computer 101 that is connected to a server computer 107 through a virtual circuit (VC) 106. In a preferred embodiment, the redirector 104 implements an SMB protocol and the transport system 105 implements the network communication.
When data is transmitted in raw mode, the SMB-header blocks are not sent with the data. Thus, data can be written directly into an application buffer (not shown). However, the redirector 104 preferably ensures that no requests are pending on the virtual circuit 106 before raw data is sent. Otherwise, the redirector 104 would not know whether the data is the raw data or is data from another request because some data is sent directly to the application buffer.
In a preferred embodiment, the redirector 104 calls the read block raw and write block raw subroutines to implement the read raw and write raw protocols, respectively.
Read Block Raw
In a preferred embodiment of the present invention, the redirector 104 implements the read raw protocol. The implementation is generally transparent to the application program 102, the kernel 103, and the file system, except for improved performance. Referring to FIG. 2B, an application program makes a call to the operating system requesting a file read and passing the address of the buffer 24 for the requested data. The kernel 103 (not shown) of the operating system invokes the redirector 104. The redirector 104 effects the read request by calling the transport 105 and requesting the data be stored directly in the application buffer 24. The redirector 104 initializes a receive network control block (NCB) 25 to receive data into the buffer 24. When the transport 105 receives the next data from the server computer 107 (not shown), the transport system will store the data directly into the application buffer 24. The redirector 26 initializes the request NCB 26 to point to an SMB buffer 27 that contains the SMB read block raw command. The redirector 104 then requests the transport system 105 to send the request on the network to the server computer 107 (not shown). The receive NCB 25 is sent to the transport 105 before the request NCB 26 is sent to the server computer 107 (not shown) to ensure that a fast server computer 107 will not send the raw data before the consumer computer 101 (not shown) is ready to receive it.
Appendix 1 contains a preferred format of the SMB read block raw format along with a description of how the consumer and server interact.
FIG. 3 is a flow diagram of a read raw subroutine that is called by the redirector. In block 301, the system ensures that consumer has no outstanding requests on the virtual circuit (VC) and that the consumer will not issue any requests for the duration of the read raw request. In block 303, the system allocates an NCB and an SMB data structure for the sending of the raw request. In block 304, the system allocates an NCB for the receiving of the raw data. In block 305, the system initializes the SMB header data and the SMB raw request variables that are shown in Appendix 1. In block 306, the system initializes the request NCB to send the SMB raw request. In block 307, the system initializes the receive NCB to receive raw data. In block 308, the system locks the user buffer, which ensures that the buffer will stay in memory until unlocked. In block 309, the system passes to the transport system the receive NCB, which tells the transport system to store the next data it receives directly in the user buffer. In block 310, the system passes the transport system the request NCB. The transport system transmits to the request SMB to the server. In block 311, the system waits until the raw data is received. In block 312, the system unlocks the user buffer. In block 313, the system gets the length of the raw data received from the transport system. In block 314, the system deallocates the NCBs and the SMB and then the subroutine returns.
Write Block Raw
In a preferred embodiment of the present invention, the redirector implements the write raw protocol. The implementation is generally transparent to the application program, the kernel, and the file system, except for improved performance. An application program makes a call to the operating system requesting to write data in raw mode and passing the address of the data buffer that contains the data. The kernel of the operating system invokes the redirector. The redirector effects the write by calling the transport system and sending a write raw request to the server. The redirector first initializes a request NCB to point to an SMB buffer that contains the SMB write block raw command. When the server responds with a verification that it is ready to receive the raw data, the redirector then is ready to send the data. The redirector then initializes a send NCB that points to the application data buffer to write. The redirector then passes the send NCB to the redirector to send the data to the server.
Appendix 2 contains a preferred format of the SMB write block raw format along with a description of how the consumer and server interact.
FIG. 4 is a flow diagram of the write raw subroutine that is called by the redirector. In block 401, the system ensures that the consumer has no outstanding requests on the virtual circuit (VC) and that the consumer will not issue any requests for the duration of the write raw request. In block 402, the system allocates an NCB and an SMB. The system uses the same NCB for the write request and the write. In block 403, the system initializes the SMB header and the SMB write raw variables that are defined in Appendix 2. In block 404, the system initializes the NCB block to send the SMB to the server. In block 405, the system locks the user buffer, which ensures that the buffer will remain in memory at that location. In block 406, the system passes the NCB to the transport system, which transmits the SMB to the server. In block 407, the system waits for the server to acknowledge that it is ready to receive the raw data. In block 408, the system deallocates the SMB; the NCB is not deallocated at this point as it is used to send the raw data. In block 409, the system initializes the NCB to send the raw data; the NCB contains a pointer to the user buffer. In block 410, the system passes the NCB to the transport system, which transmits the raw data to the server. In block 411, the system unlocks the user buffer. In block 412, the system deallocates the NCB and the subroutine returns.
Although the present invention has been described in terms of a preferred embodiment, it is not intended that the invention be limited to this embodiment. Modifications within the spirit of the invention will be apparent to those skilled in the art. The scope of the present invention is defined by the claims which follow.