Data transfer system having a channel adapter with varying data transfer lengths
BACKGROUND OF THE INVENTION 
     The present invention relates to a data transfer system achieving a transfer of data having a variable length between a channel apparatus or unit and a storage medium apparatus such as a magnetic disk device, and in particular, to a data transfer system having a channel adapter capable of effecting an efficient data transfer also in a case where the length of a signal cable is elongated between the channel apparatus and the magnetic disk device. 
     In the JP-A-61-187057 filed on Sept. 18, 1985 with the priority based on the U.S. Ser. No. 700,355 filed by Fredericks et al. on Feb. 11, 1985 or in the &#34;IBM Technical Disclosure Bulletin&#34;, Vol. 19, No. 8, January 1977, pp. 3139-3143, there has been proposed a channel adapter using an optical transfer technology in order to effect a data transfer through a long distance by elongating the length of a transfer cable between a channel apparatus and a magnetic disk device (a kind of peripheral storage device). 
     According to the system described in the literature cited above, between the channel apparatus or device and the magnetic disk device, there are disposed a channel adapter A on the channel device side and a channel adapter B and a magnetic disk controller on the magnetic disk side and these units are linked by use of signal cables. Particularly, the channel adapters A and B are connected to each other with an optical cable advantageous for a long-distance transmission because the signal attenuation and the effect of noise are considerably reduced as compared with the metal conductors. The channel adapters A and B are capable of effecting a conversion of a plurality of electric signals arranged in the parallel fashion into optical signals ordered in the bit serial manner so as to match the transmission format in the optical cable and vice versa. For the connecting cables between the channel adapter and the channel device as well as the magnetic disk controller, there can be employed a standard input interface described in the &#34;IBM System/360 and System/370 Interface Channel to Control Unit Original Equipment Manufactures&#39; Information&#34;. 
     In the system above, in order to write data having a variable length in a magnetic disk device, the data is transferred from the channel unit to the magnetic disk device as follows. 
     First, a write command, Channel Command Word (CCW) specifying the data length and data address of data to be transferred from the channel unit to the magnetic disk control unit is sent from the channel unit to the magnetic disk control unit. The magnetic disk unit then separately examines the track and sector position of the magnetic disk device in which the transferred data is to be written and the allowable data length thereof and then issues a request for the data via the channel adapters B and A to the channel unit. The magnetic disk controller, prior to a write operation of the data in the magnetic disk device, stores the data received from the channel unit in a temporary buffer memory for the following reason. In a case where there exists a very long connection length, for example, several hundred meters, between the channel unit and the magnetic disk controller, even if a data request is issued to the channel unit at a point of time when the recording head matches with the first recording position of the rotating magnetic disk, the data is not immediately transferred to the magnetic disk unit. There is a considerable delay of the response time that elapses from when the data request from the magnetic disk device reaches the channel unit and when data sent from the channel unit, after the request is decoded, arrives at the magnetic disk unit. As a consequence, during the period of the delay, since the magnetic disk is rotating, there arises an unused space on the track. In order to avoid the problem of the response delay time taking place in the long-distance transmission path, data with a capacity which can be written on the magnetic disk is transferred during the delay time of the transmission path from the channel device to the buffer memory of the magnetic disk controller so as to be temporarily stored therein. Since the magnetic disk controller is adjacent to the magnetic disk device or is located in a position relatively in the neighborhood of the magnetic disk device, the period of the signal transmission time therebetween is negligible, and hence when the magnetic disk issues a data transfer request to the magnetic disk controller, the data is almost instantaneously transferred therefrom to the magnetic disk device and is then recorded in a track of the disk. 
     However, in the system above, when the transmission route between the channel unit and the magnetic disk controller is elongated, the capacity of the buffer memory of the magnetic disk controller is naturally required to be increased. That is, in a system having different transmission routes, the capacity of the respective buffer memory varies; consequently, the compatibility of the magnetic disk units cannot be sustained, and a considerably great amount of buffer memory is necessary when the transmission route becomes long, which leads to a disadvantage with respect to system cost. 
     In order to solve the above problem, there has been proposed a system in which a buffer memory is also disposed in the channel adapter on the side of the magnetic disk controller. In this system, on receiving a write command CCW from the channel unit, the channel adapter B requests the channel unit to transfer data corresponding to the capacity of the data buffer without waiting for the data transfer request from the magnetic disk controller so as to store the data in the data buffer. When a transfer request from the magnetic disk controller is received, the channel adapter B transfers the data stored in the buffer memory thereof to the buffer memory of the magnetic disk controller. Each time the data is entirely outputted from the buffer memory, the channel adapter B issues a data transfer request to the channel unit thereby storing the data corresponding to the capacity of the data buffer memory. The signal path between the channel adapter B and the magnetic disk controller is short and the period of delay time associated with the response time to be elapsed from when the data transfer request from the magnetic disk controller is received to when the data is transferred is negligible. 
     In this system, the channel adapter B requests the channel unit to transfer data corresponding to the capacity of the buffer memory thereof. In consequence, when the data length requested by the magnetic disk device is smaller than that requested by the channel adapter B, the channel unit assumes the requested length to be an incorrect length and hence a software error is assumed so as to terminate the data transfer processing with an abnormal termination. In a case of a fixed data length, the capacity of the buffer memory of the channel adapter B need only be fixed to the predetermined data length; however, in a system in which variable-length data is to be transferred, it cannot be avoided that the abnormal termination disadvantageously takes place. 
     SUMMARY OF THE INVENTION 
     It is therefore an object of the present invention to solve the above problem above and to provide a data transfer system in which when transferring variable-length data between a channel unit and a data storing medium such as a magnetic disk device via a long-distance transmission path, the data transfer can be achieved without increasing the capacity of the data buffer in the recording medium control unit and without detecting an invalid data length error. 
     In order to achieve the above object above, the data transfer system according to the present invention includes a data buffer in a channel adapter for temporarily storing variable-length data transferred from a data sending side and means for recognizing a data length of data to be transferred from the channel adapter, namely, means for storing information representing the length of data to be transferred (data length information). Prior to a data transfer, the channel adapter obtains data length information from the control unit and memorizes the attained data length information so as to issue a data request to the data sending side for data of which the data length corresponds to the stored data length, thereby storing data from the data sending side in the data buffer of the channel adapter. In this case, the operation is effected such that the data length issued to the channel unit does not exceed the data length stored in the channel adapter. As a result, for a data request from the control unit, there does not appear a condition that a write operation of the data at the predetermined position is prevented due to a delay of the data transfer caused by a delay on the transmission path; in addition, there does not exist any fear that an invalid data length error is detected by the data sending side, thereby enabling the normal operation to be achieved. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The present invention will be apparent from the following detailed description taken in conjunction with the accompanying drawings in which: 
     FIG. 1 is a block diagram schematically showing the overall constitution of an embodiment of a data transfer system according to the present invention. 
     FIG. 2 is a timing chart useful to explain a data transfer operation of the system of FIG. 1. 
    
    
     DETAILED DESCRIPTION OF THE PRESENT INVENTION 
     FIG. 1 shows the overall configuration of an embodiment of a data transfer system according to the present invention. In this embodiment, a magnetic disk device is employed as the storing medium and the data is transferred in the direction of the magnetic disk. The system of FIG. 1 comprises a channel apparatus or unit 1, a magnetic disk controller (storing medium control unit) 2, a magnetic disk unit 3, a channel adapter A 4 on the side of the channel unit 1, a channel adapter B 5 on the side of the magnetic disk controller 2, interfaces 10 and 10&#39; respectively establishing connections between the channel unit 1 and the channel adapter A 4 and between the channel adapter B 5 and the magnetic disk controller 2, and an optical cable 11 for transmitting optical signals through a long distance. The channel adapters A 4 and B 5 each have functions to convert a plurality of electric signals arranged in the parallel relationship into optical signals formed in the bit serial fashion suitable for the transmission format of the transmission through the optical cable and vice versa. For the connecting cables between the channel adapter and the channel unit as well as the magnetic disk controller, there is adopted a standard input interface described above. In consequence, the channel unit 1 and the magnetic disk controller 2 can be regarded as equivalent to a system directly linked by use of the interface. Since the channel adapter A 4 is located in the channel unit 1 in an ordinary case, it may be considered that the channel unit 1 includes the function of the channel adapter A 4 and the channel adapter A 4 is omitted. In addition, the channel adapter B 5 can be located in the magnetic disk controller 2 or in the vicinity thereof. 
     Incidentally, the magnetic disk control unit 2 includes a buffer memory 20 having an area for temporarily storing data transferred from the channel adapter 5 and an area for storing the data length of the data stored. In addition, the channel adapter 5 comprises a byte counter 51 for storing therein the data length of data for which the transfer request is issued to the channel unit 1 and a buffer memory 50 for temporarily storing data transferred from the channel unit 1. 
     Referring next to FIG. 1, description will be given of the operation for transferring variable-length data from a main memory (not shown) to the magnetic disk device 3. 
     The channel unit 1 first supplies a sequence of input/output commands to the magnetic disk device 2. The input/output commands include a seek command to move the magnetic head to a position over a track of the magnetic disk in which the transferred data is to be written, a set sector search command to locate the magnetic head at the first position of a record in the track, a write command to designate a write instruction of data transferred from the main memory, and the like. The write command further includes a command code identifying the write command, a data address, and a data length (number of bytes). 
     The commands are delivered to the magnetic disk control unit 2 through the interface 10, the channel adapter A 4, the long-distance optical cable 11, and the channel adapter B 5. In response to the commands thus received, the magnetic disk control unit 2 decodes information (data byte count) related to the data length in the write command, stores the data length in an area where the data length is to be recorded in the buffer memory 20, causes the magnetic head to initiate a search operation for the magnetic disk device 3, and then issues a signal notifying the data length to the channel adapter B 5. In response to the data length signal from the magnetic disk control unit 2, the channel adapter B 5 reads the number of bytes of the data length from the buffer memory 20 in the magnetic disk control unit 2 and sets the obtained value to the counter 51. Thereafter, the channel adapter B 5 issues a request for the transfer data to be transferred to the magnetic disk to the channel unit 1 via the optical cable 11 and the channel adapter A 4. The data transfer request is effected in the unit of bytes. In consequence, for each data request to the channel unit 1, the channel adapter B 5 decrements the data length byte count of the counter 51. The data request is issued to the channel unit 1 until the value of the counter 51 becomes to be zero, thereby storing the data received in response to the requests in the buffer memory 50. Namely, in consequence, the buffer memory 50 of the channel adapter B 5 is loaded with data having a data length identical to the data length recorded in the buffer memory of the magnetic disk control unit 2. That is, regardless of the length of the transfer data, the channel adapter B 5 requests the channel unit 1 in any case to send data having the data length contained in the write command, and hence there does not occur an incorrect length error. 
     Next, when a certain period of time is elapsed (i.e. a period of time when the channel adapter B 5 is receiving the transferred data from the channel unit 1) after the data length is notified from the magnetic disk control unit 2 to the channel adapter B 5, the magnetic disk control unit 2 issues a data transfer request in the unit of bytes to the channel adapter B 5. In response to the data transfer request, the channel adapter B 5 transfers the data stored in the buffer memory 50 thereof to the data area of the buffer memory 20 of the magnetic disk control unit 2. The data temporarily stored in the buffer memory 20 of the magnetic disk control unit 2 is transferred in response to a data request from the magnetic disk device 3. Since the transmission distance of the interface 10&#39; and the distance between the magnetic disk control unit 2 and the magnetic disk device 3 are both short, a response delay in the data transfer in response to the data transfer request does not substantially take place. 
     Next, referring to the signal timing chart of FIG. 2, the operations described above will be concretely described. 
     The signal (a) is a data transfer request signal outputted from the magnetic disk controller 2 to the channel adapter B 5. In the data request signal (a), two leading bytes constitute a data length signal notifying the length of the data, whereas the third and subsequent bytes configure a signal for an actual data request. During a period of the blank between the data length signal and the data request signal, the channel adapter B 5 requests the channel unit 1 to transfer data so as to temporarily store the data in the buffer memory. In this embodiment, the data length signal is of two bytes because the portion defining the data length in the write command is assumed to comprise two bytes, which does not however restrict the present invention. The signal (b) is an answer signal transmitted from the channel adapter B 5 to the magnetic disk control unit 2 and indicates that a reply is being sent to the magnetic disk control unit 2 in response to the data transfer request signal (a). The signal (c) indicates the data length of data transmitted in response to the data length signal (two first bytes of the signal (a)) from the buffer memory 20 of the magnetic disk control unit 2 to the counter 51 of the channel adapter B 5. After transmitting the answer signal (b), the channel adapter B 5 sends a data request signal (e) in the unit of bytes to the channel unit 1. Actually, the channel adapter B 5 transmits the data request signal to the channel adapter A 4, which then issues the request signal (e) to the channel unit 1; however, in order to simplify the description, the operation of the channel adapter A 4 is omitted. In response to the data request signal (e) from the channel adapter B 5, the channel unit 1 sends an answer signal (f) to the channel adapter B 5, and during this period of time, data (h) having a data length (e) requested by the channel adapter B 5 is transferred to the buffer memory 50 of the channel adapter B 5. Thereafter, at a predetermined timing, the magnetic disk control unit 2 supplies a data transfer request (the third and subsequent bytes of the signal (a)) to the channel adapter B 5. In response thereto, the channel adapter B 5 sends the answer signal (the third and subsequent bytes of the signal (b)) to the magnetic disk control unit 2, and during this period of time, the data (d) stored in the buffer memory 50 is transferred to the buffer memory 20 of the magnetic disk control unit 2. When the magnetic head of the magnetic disk device 3 reaches the first position of the predetermined record, the magnetic disk control unit 2 transfers the data stored in the buffer memory 20 to the magnetic disk device 3. Through the procedure described above, the data from the channel unit 1 is transferred to the magnetic disk device 3 without causing the response delay and the data length error. The signal (g) represents data signal when the data is transferred from the channel adapter B 5 to the channel unit 1. This signal does not present in the present embodiment. 
     Incidentally, while the invention has been described with reference to the embodiment in which a magnetic disk device is employed as the data storing medium, it is not restricted by this embodiment, namely, the present invention can be applied to the data transfer to various peripheral storage devices such as a magnetic tape, an optical disk, and a magnetic drum. Furthermore, in FIG. 1, a set of the magnetic disk controller 2 and the magnetic disk device 3 is connected to the channel adapter B 5; however, in ordinary cases, a plurality of sets of the magnetic disk controller 2 and the magnetic disk device 3 are connected thereto. It is to be appreciated that the data transfer system according to the present invention is naturally applicable to such cases. The above description explains about the case where data is transferred from the channel unit 1 to the data storing medium 3. However, the present invention also can be applied to another case where the data is transferred from the data storing medium 3 to the channel unit 1. In this case, a counter and a data buffer memory are also provided in the channel adapter A 4 disposed adjacent to the channel unit 1.