# Patent

## Title
System and method for performing parity checks in disk storage system

## Abstract

A system for maintaining cyclic redundancy check (“CRC”) protection of XOR'ed data sectors includes a register that is initialized with a non-zero seed value used for generating sector CRC values. The system includes logic for combining CRC values of at least two sectors and storing a result of the combination modified with a non-zero seeded CRC value.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
The disclosure in this application is related to the provisional patent application filed on May 7, 2002, Ser. No. 60/378,471, entitled “System and Method for Performing parity Checks in Disk Storage Systems”, incorporated herein by reference in its entirety.


BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates generally to disk controllers, and more particularly to performing parity checks in disk storage systems using disk controllers.
2. Background
Conventional computer systems typically include several functional components. These components may include a central processing unit (CPU), main memory, input/output (“I/O”) devices, and disk drives. In conventional systems, the main memory is coupled to the CPU via a system bus or a local memory bus. The main memory is used to provide the CPU access to data and/or program information that is stored in main memory at execution time. Typically, the main memory is composed of random access memory (RAM) circuits. A computer system with the CPU and main memory is often referred to as a host system.
The main memory is typically smaller than disk drives and may be volatile. Programming data is often stored on the disk drive and read into main memory as needed. The disk drives are coupled to the host system via a disk controller that handles complex details of interfacing the disk drives to the host system. Communications between the host system and the disk controller is usually provided using one of a variety of standard I/O bus interfaces.
Typically, a disk drive includes one or more magnetic disks. Each disk typically has a number of concentric rings or tracks on which data is stored. The tracks themselves may be divided into sectors, which are the smallest accessible data units. A positioning head above the appropriate track accesses a sector. An index pulse typically identifies the first sector of a track. The start of each sector is identified with a sector pulse. Typically, the disk drive waits until a desired sector rotates beneath the head before proceeding a read or write operation. Data is accessed serially, one bit at a time and typically, each disk has its own read/write head.
The disk drive is connected to the disk controller that performs numerous functions, for example, converting digital data to analog head signals, disk formatting, error checking and fixing, logical to physical address mapping and data buffering. To perform the various functions for transferring data, the disk controller includes numerous components.
A conventional disk drive stores data bytes on disk drive platters in sets of a predetermined length. A disk drive controller or a host computer may generate error correction code (ECC) bytes and cyclic redundancy check (CRC) bytes for each set of data bytes. Sometimes, the host computer generates CRC bytes, and the disk controller generates its own set of CRC bytes. The CRC and the ECC bytes are appended to the end of the set of data bytes. The data bytes, CRC bytes and ECC bytes together make up a ‘sector’, and this sector is stored on the disk platter. When the disk drive controller reads a sector off the disk, the data bytes and CRC bytes are stored in a buffer unit (memory) in the disk drive. An ECC unit detects and corrects errors in the sector read off the platter. These corrections are made to the data bytes and CRC bytes stored in the buffer unit.
Conventional disk array storage systems may have multiple disk drives arranged and coordinated such that a single mass storage system is formed. This allows data to be stored at multiple disks and ensures continued operation if a disk fails. Data may be stored at multiple locations and if one component fails, data may be regenerated from redundant data stored at another component.
One way to achieve this redundancy is by using parity. In parity redundancy, redundant data is stored in one area of the storage system, however, the size of the redundant storage area is less than the remaining storage area used to store the original area.
A RAID (Redundant Array of Independent Disks) storage system is one technique, which is used to store redundant data. RAID includes various architectures, designated as RAID0, RAID1, RAID 2, RAID 3, RAID 4, and RAID 5.
A RAID 0 system is configured without any redundancy. RAID 1 has mirror redundancy.
RAID 2 through RAID 5 involves parity type redundant storage. For example, in RAID 5, the disks are divided into equally sized address areas (“blocks”) and a set of blocks is referred to as “stripes”. Each stripe has N blocks of data and one parity block, which contains redundant information.
Typically, to update a parity drive, old data from a storage media and new data for a write operation is compared (also referred to as XORed). The XOR operation is used to maintain data integrity.
FIG. 2A shows a simple example of a RAID topology that can use one aspect of the present invention, discussed below. FIG. 2 shows a RAID controller 220A coupled to plural disks 301, 302, 303 and 304 using ports 305 and 306. Data may be written from RAID system 300 to a host system 200 or vice-versa via RAID controller 220A.
One way to maintain data integrity is to use the CRC code. A typical circuit employing CRC error checking includes a CRC checker to verify integrity for old data and a CRC generator that generates CRC information for any new data.
Conventional techniques regenerate CRC on XOR data using logical block address (“LBA”) values. CRC is typically seeded with an LBA value that helps protect against mis-positioning errors in ID-less sector formats. Usually the firmware (code operating the disk controller) knows the LBA for the sector involved and can preset a counter that is linearly updated as each sector is XOR'ed. When Skip operations are used, more firmware intervention will be required, since skip operations present discontinuities in the LBA progression. Conventional systems use firmware to handle the complexity involved in skip operations. However, this solution is slow and hence is not commercially desirable.
Another drawback in the conventional techniques is that any failure in the XOR logic goes undetected because CRC is regenerated on XOR data using logical block address (“LBA”) values.
Therefore, what is desired is a system and method for efficiently performing XOR operation for maintaining data integrity.
SUMMARY OF THE INVENTION
In one aspect of the present invention, a system for maintaining cyclic redundancy check (“CRC”) protection of XOR'ed data sectors is provided. The system includes a register that is initialized with a seed value; and logic for XOR combining CRC values of at least two sectors and for storing a result of the combination as modified with a seeded CRC value.
In another aspect, a disk controller that maintains cyclic redundancy check (“CRC”) protection of XOR'ed data sectors is provided. The controller includes, a register that is conditioned with a seed value used for comparing plural sector CRC values; and logic for comparing CRC values of at least two sectors and storing a result of the comparison with a seeded CRC value.
In another aspect of the present invention, a method for maintaining CRC protection of XOR'ed data sectors is provided. The process includes, determining a CRC value (CRC′A) for a first sector with a seed value; determining a CRC value (CRC′B) for a second sector with a seed value; XOR combining the CRC value of the first sector calculated without a seed value (CRCA) with the CRC value of the first sector calculated with a seed value (CRC′A); and XOR combining the result with CRC′A and CRC′B.
In one aspect of the present invention, the process does not require any knowledge of LBA values. By XOR'ing the stored CRC values with those recalculated using a zero seed, and combining the result with corresponding CRC values generated for another sector, a high level of confidence is achieved that the data is correct.
In one aspect of the present invention, any errors that occur in the XOR function can be detected when the data is transmitted to a host.
In yet another aspect of the present invention, the process can be easily modeled as an XOR combination of pre-corrected data with a sector of correction data consisting of a zero seed CRC and all zeroes data except in the locations of corrected bits. The correction data CRC can be XOR'ed with the pre-correction data CRC and the result will be the same as a CRC computed on the post-correction data.
In yet another aspect of the present invention, the CRC/XOR technique described above may be used in a RAID environment for maintaining data integrity.
In another aspect of the present invention, a method for maintaining CRC protection on XOR'ed data sectors in RAID systems is provided. The method uses parity without the need for firmware intervention to seed the LBA values into the CRC. This improves performance by reducing the requirement for firmware intervention in seeding the CRC accumulators, which is particularly important for “Skip operations” where LBA values may not increase linearly but may have discontinuities. This provides increased data protection integrity since it can utilize the originally generated CRC values rather than run the risk of re-computing CRC values on data which may be corrupted during the XOR operation.
This brief summary has been provided so that the nature of the invention may be understood quickly. A more complete understanding of the invention can be obtained by reference to the following detailed description of the preferred embodiments thereof concerning the attached drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
The foregoing features and other features of the present invention will now be described with reference to the drawings of a preferred embodiment. In the drawings, the same components have the same reference numerals. The illustrated embodiment is intended to illustrate, but not to limit the invention. The drawings include the following Figures:
FIG. 1 shows a block diagram of a disk storage system;
FIG. 2A is a block diagram of a RAID topology;
FIG. 2B is a block diagram of a CRC circuit, according to one aspect of the present invention;
FIG. 3 is a block diagram showing seeded CRC values of data sectors, according to one aspect of the present invention; and
FIG. 4 is a flow diagram of executable process steps to XOR CRC vales, according to one aspect of the present invention.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
To facilitate an understanding of the preferred embodiment, the general architecture and operation of a disk drive will initially be described. The specific architecture and operation of the preferred embodiment will then be described with reference to the general architecture and operation of a disk drive.
The disk drive system of FIG. 1 is an example of an internal (hard) disk drive included in a computer system system. The host computer (not shown) and the disk drive communicate via port 102, which is connected to a data bus (not shown). In an alternate embodiment (not shown), the disk drive is an external storage device, which is connected to the host computer via a data bus. The data bus, for example, is a bus in accordance with a Small Computer System Interface (SCSI) specification. Those skilled in the art will appreciate that other communication buses known in the art can be used to transfer data between the disk drive and the host system.
As shown in FIG. 1, the disk drive includes disk controller 101, which is coupled to SCSI port 102, disk port 114, buffer memory 111 and microprocessor 100. Interface 118 serves to couple microprocessor bus 107 to microprocessor 100. A read only memory (“ROM”) omitted from the drawing is used to store firmware code executed by microprocessor 100. Disk port 114 couples disk controller 101 to hard disk assembly (als referred to herein as “disk”) 115.
As is standard in the industry, data is stored on disk 115 in sectors. Each sector is byte structured and includes various fields, referred to as the sector format. A typical sector format includes a logical block address (“LBA”) of about four bytes followed by a data field of about 512 bytes. The LBA contains position information. A field for a CRC checksum of 4 bytes typically follows the data field. A subsequent field for a number of ECC bytes, for example 40–80 bytes, is located at the end of the sector.
Controller 101 can be an integrated circuit (IC) that comprises of various functional modules, which provide for the writing and reading of data stored on disk 115. Microprocessor 100 is coupled to controller 101 via interface 118 to facilitate transfer of data, address, and control information. Buffer memory 111 is coupled to controller 101 via ports to facilitate transfer of data, and address information.
SCSI controller 105 includes programmable registers and state machine sequencers that interface with SCSI port 102 on one side and to a fast, buffered direct memory access (DMA) channel on the other side.
Sequencer 106 supports customized SCSI sequences, for example, by means of an instruction memory that allows users to customize command automation features. Sequencer 106 support's firmware and hardware interrupts schemes.
Disk formatter 112 is a disk interface controller and performs control operations when microprocessor 100 loads all required control information and parameter values into a writable control store (WCS) RAM (not shown) and issues a command. Disk formatter 112 executes the command with no microprocessor 100 intervention.
Buffer controller 108 can be a multi-channel, high speed DMA controller. Buffer controller 108 connects buffer memory 111 to disk formatter 112 and to an ECC channel of ECC module 109, a SCSI channel of SCSI controller 105 and micro-controller bus 107. Buffer controller 108 regulates data movement into and out of buffer memory 111.
To read data from disk 115, a host system sends a read command to disk controller 101, which interrupts Microprocessor 100 which then fetches the command from disk controller 101 and initializes the various functional blocks of disk controller 101. Data is read from disk 115 and is passed through disk formatter 112 simultaneously to buffer controller 108 and to ECC module 109. Thereafter, ECC module 109 provides the ECC correction pattern for correcting errors, which occurred during the read operation, while data is still in buffer controller 108. The error is corrected and corrected data is sent to buffer memory 111, and then passed to the host system.
To write data, a host system (200) sends a write command to disk controller 101 and is stored in buffer 111. Microprocessor 100 reads the command out of buffer 111 and sets up plural registers. Data is transferred from host and is first stored in buffer 111, before being written to disk 115. CRC values are calculated based on the LBA for the sector being written. Data is read out of buffer 111, appended with ECC code and written to disk 115.
XOR Operations:
To maintain data integrity, contents of plural buffers (buffers similar to buffer 111 or otherwise; or from multiple disks as in the RAID systems of FIG. 2B) are compared to each other. For example, contents of a first buffer (“New Data Buffer” or buffer 1) sent by the host system is summed modulo 2 to the contents of the second buffer (“Original Data Buffer” or buffer 2).
Modulo two summation is performed by means of an XOR operation and the resulting XOR value is stored in original data buffer (e.g. buffer 111). The purpose of the summation is to prepare the data for a parity drive. The parity drive contains sector by sector modulo-2 summation of data from all the drives included in a redundant drive set. For example in redundant drive set (similar to the drive set of FIG. 2A) may have three drives A, B, and C and a Parity Drive P (could be drive 3 303 of FIG. 2A if the set had two drives and a parity drive). Sector n on P drive=Sector n on A+sector n on B+sector n on C taken modulo two. The parity drive thus incorporates the modulo two summation of the redundant drive string taken sector by sector.
When a write operation is performed to one of the drive string, for example, drive A (drive 1 301, FIG. 2A), the data on drive A is changed to the “New” data. The Parity drive is also updated accordingly. One way to update is to subtract the “original” data that drive A contained and add the “new” data.
In modulo two arithmetic, addition and subtraction are identical, so the Parity drive is updated with the sum of the new and old data taken modulo 2. This is the XOR of the new and old data.
It is important to maintain the integrity of the data in these operations. The CRC bytes for the sector are stored along with the sector data in various buffers (for example, buffer 111) and can participate in the XOR operation to help evaluate the integrity of the XOR result.
Various registers may be used, according to one aspect of the present invention, to configure the XOF operations, as discussed below:
(1) XOR Buffer 1 Address Register: This register contains address pointer for the New Data Buffer from the host.
(2) XOR Buffer-2 Address: This contains address pointer for the Original Data Buffer.
(3) XOR Block Count: This determines the number of XOR blocks of data to transfer or XOR.
The foregoing registers may be located in buffer controller 108.
To understand the various adaptive aspects of the present invention, a brief understanding of CRC background is provided with respect to FIGS. 2B and 3 of the present invention.
Typically CRC applications are linear using mod-2 arithmetic, which implies that:

f(A)+f(B)=f(A+B) and

f(A)f(B)=f(AB)

CRCs are applied to message words as if the message word were coefficients of a polynomial. In addition, they are applied using mod-2 arithmetic. CRCs are computed by dividing the polynomial defined by the message word with an irreducible polynomial that defines the CRC characteristic. Since the message word is handled in its binary format, all arithmetic is performed by modulo 2, which is the same as modulo 2 subtraction, and is equivalent to the logical XOR operation.
For CRC, XOR operations on two data fields is equal to the modulo-2 addition of coefficients for each of the polynomials represented by data bits in the message words. Since a mod(x)+b mod(x)=(a+b) mod(x), the CRCs for XOR'ed data are equivalent to the XOR'ed values for the CRC of each data word.
FIG. 2B shows an example of a parallel CRC implementation, according to one aspect of the present invention. In the parallel CRC implementation, a CRC register 202 maintains a current CRC residue value. The CRC residue value is XOR'ed (added modulo 2) 204 to a current data value, which may be a 32 bit value. The sum is passed through feedback multiplier circuit 201. The remainder (the result of the modulo polynomial division in the feedback multiplier) is stored as the new residue in CRC register 202.
When CRC register 202 is initialized with a zero seed value, the first data word is passed through unaffected as input to feedback multiplier circuit 201. The existing CRC register 202 value prior to being applied at the feedback multiplier circuit 201 then conditions all subsequent words. The CRC is a running remainder of a division operation. XOR gate 204 subtracts the previous remainder from the next symbol set of the data polynomial prior to performing the modulo polynomial division in the feedback multiplier circuit 201.
When CRC register is primed with a non-zero seed value, the first data word of the message will have that value subtracted from its prior division, as described below with reference to FIG. 3.
FIG. 3 illustrates the linearity of CRC with respect to the application of a seed value. The effect of the seed can be modeled by viewing the Seeded CRC′A value as the sum of an unseeded CRCA on A0:An and the CRC′S on the seed followed by n words of zero.
Impact of non-zero seed values on XOR'ed sectors:
For illustration purposes, if two sectors, A and B are XOR'ed, then the relationship of their CRCs is computed, as described below. Assume that both sectors A and B have the same seed value, then:

CRCA+B=CRCA+CRCB+CRCS+CRCS=CRCA+CRCB 

However, the object is to include the seed in the XOR'ed data as well. If the CRC were computed on the XOR data, as performed by conventional techniques, the resulting CRC would again include CRCS. Therefore the CRC recomputed on the XOR data can be computed from the XOR'ed CRC if the value of CRCS is known:

CRCXOR(A,B)=CRCA+CRCB+CRCS=CRCA′+CRCB′+CRCS 

CRCS can be determined by calculating CRCA and/or the CRCB value as data is extracted from buffer 111 to be XOR'ed. Once CRCA is known it can be added to CRCA′ (which was stored with sector A in buffer 111 or any other buffer) to obtain CRCS 

CRCS=CRCA+CRCA′

The following procedure may be used to compute the CRC for the XOR'ed data that does not require the use of LBA data, as described below with respect to FIG. 4.
In step S400, the process stores sector A and sector B data in buffer 111 or any other buffer, including a XOR FIFO (not shown). The seeded CRC values (CRC′A and CRC′B) are stored along with Sector A and B having been seeded with the appropriate LBA values.
In Step S401, the process conditions CRC module (for example, register 202) with a ‘0’ seed. This is used to compute CRCA.
In step S402, the process reads out sector A with the stored CRC value (CRC′A), and stores it in temporary storage (not shown).
In step S403, the process reads Sector B with CRC′B. Sector B is XORed against any temporary intermediate stored values of Sector A (from step S402). Hence CRC′A and CRC′B are XORed which provides CRC′AB. The XORed result (CRC′AB) is stored in temporary storage.
In step S404, the process reads CRCA, and then XOR's CRCA with CRC′A and CRC′AB. The result is saved as CRCXOR(A,B).
The foregoing process does not require any knowledge of LBA values. By XOR'ing the stored CRC values with those recalculated using a zero seed, and comparing to the same values generated for sector B, a high level of confidence is achieved that the data is correct.
In one aspect of the present invention, any errors that occur in the XOR function can be detected when the data is transmitted to a host.
In another aspect of the present invention, the LBA value can be extracted if sector data and CRCA′ are known.
In yet another aspect, the foregoing CRC adjustment algorithm can be easily modeled as an XOR combination of pre-corrected data with a sector of correction data consisting of a zero seed CRC and all zeroes data except in the locations of corrected bits. The correction data CRC can be XOR'ed with the pre-correction data CRC and the result will be the same as a CRC computed on the post-correction data.
In yet another aspect, the CRC/XOR technique described above may be used in a RAID environment for data maintaining data integrity.
In another aspect, a method for maintaining CRC protection on XOR'ed data sectors in RAID systems is provided. The method uses parity without the need for firmware intervention to seed the LBA values into the CRC. This improves performance by reducing the requirement for firmware intervention in seeding the CRC accumulators, which is particularly important for “Skip operations” where LBA values may not increase linearly but may have discontinuities. This provides increased data protection integrity since it can utilize the originally generated CRC values rather than run the risk of re-computing CRC values on data which may be corrupted during the XOR operation.
The term storage device, system, disk, disk drive and drive are used interchangeably in this description. The terms specifically include magnetic storage devices having rotatable platter(s) or disk(s), digital video disks(DVD), CD-ROM or CD Read/Write devices, removable cartridge media whether magnetic, optical, magneto-optical and the like.
Although the present invention has been described with reference to specific embodiments, these embodiments are illustrative only and not limiting. Many other applications and embodiments of the present invention will be apparent in light of this disclosure and the following claims.

## Claims

1. A system for maintaining cyclic redundancy check (“CRC”) protection of XOR'ed data sectors, comprising:
a register that is initialized with a non-zero seed value used for generating sector CRC values; and
logic for combining CRC values of at least two sectors and storing a result of the combination modified with a non-zero seeded CRC value.

2. The system of claim 1, wherein CRC data of a sector is XORed with CRC data of another sector.

3. The system of claim 1, wherein the logic for combining CRC values is XOR logic.

4. A disk controller that maintains cyclic redundancy check (“CRC”) protection of XOR'ed data sectors, comprising:
a register that is initialized with a non-zero seed value used for generating sector CRC values; and
logic for combining CRC values of at least two sectors and storing a result of the combination modified with a non-zero seeded CRC value.

5. The controller of claim 4, wherein CRC data of a sector is XORed with CRC data of another sector.

6. The controller of claim 5, wherein the logic for combining CRC values is XOR logic.

7. A method for maintaining CRC protection of XOR'ed data sectors, comprising:
determining a CRC value (CRC′A) for a first sector as calculated with a seed value;
determining a CRC value (CRC′B) for a second sector as calculated with a seed value;
combining the CRC value of the first sector calculated without a seed value (CRCA) with the CRC value of the first sector calculated with a seed value (CRC′A); and
combining the result with CRC′A and CRC′B.