A storage controller, comprising a processor, a memory, and a communications interface, wherein: the processor is configured to: obtain K to-be-coded data chunks by using the communications interface, and cache the K data chunks into the memory, wherein each data chunk comprises R data code blocks, R+1 is a prime number, and R+1>K; the processor is further configured to execute program in the memory to perform the following operations: reading the K data chunks cached in the memory, and generating a first check chunk and a second check chunk according to a check matrix and the K data chunks, wherein each check chunk comprises R check code blocks; and separately storing, by using the communications interface, the K data chunks, the first check chunk, and the second check chunk into K+2 storage media in a storage system in which the storage controller is located; the check matrix comprises 2 ∗ R rows, each row of the check matrix represents an exclusive OR equation, the ((k-1) ∗ R+1) th column to the (k ∗ R) th column of the check matrix form a chunk column set of the k th data chunk in the K data chunks, wherein K≥k≥1; the (K ∗ R+1) th column to the ((K+1) ∗ R) th column of the check matrix form a chunk column set of the first check chunk, and the ((K+1) ∗ R+1) th column to the ((K+2) ∗ R) th column of the check matrix form a chunk column set of the second check chunk; and the check matrix is a standard check matrix H or is obtained after N exchange operations are performed on a standard check matrix H, wherein N≥1, and the exchange operation refers to an exchange of any two chunk column sets; and wherein for each value of i and each value of j, with 2 ∗ R≥i≥1 and (K+2) ∗ R≥j≥1, coordinates in the standard check matrix corresponding to the following first relations are set to be 1: if i<j, H i + 1 j ∗ R + R − j + i mod R + 1, and H R + i + 1 j + 1 ∗ R − R − j + i mod R; or if i>j, H i + 1 j ∗ R + R − 1 − j + i mod R + 1, and H R + i + 1 j + 1 ∗ R − R − 1 − j + i mod R and coordinates in the standard check matrix H that do not correspond to the first relations are set to be 0. the processor is configured to: obtain K to-be-coded data chunks by using the communications interface, and cache the K data chunks into the memory, wherein each data chunk comprises R data code blocks, R+1 is a prime number, and R+1>K; the processor is further configured to execute program in the memory to perform the following operations: reading the K data chunks cached in the memory, and generating a first check chunk and a second check chunk according to a check matrix and the K data chunks, wherein each check chunk comprises R check code blocks; and separately storing, by using the communications interface, the K data chunks, the first check chunk, and the second check chunk into K+2 storage media in a storage system in which the storage controller is located; reading the K data chunks cached in the memory, and generating a first check chunk and a second check chunk according to a check matrix and the K data chunks, wherein each check chunk comprises R check code blocks; and separately storing, by using the communications interface, the K data chunks, the first check chunk, and the second check chunk into K+2 storage media in a storage system in which the storage controller is located; the check matrix comprises 2 ∗ R rows, each row of the check matrix represents an exclusive OR equation, the ((k-1) ∗ R+1) th column to the (k ∗ R) th column of the check matrix form a chunk column set of the k th data chunk in the K data chunks, wherein K≥k≥1; the (K ∗ R+1) th column to the ((K+1) ∗ R) th column of the check matrix form a chunk column set of the first check chunk, and the ((K+1) ∗ R+1) th column to the ((K+2) ∗ R) th column of the check matrix form a chunk column set of the second check chunk; and the check matrix is a standard check matrix H or is obtained after N exchange operations are performed on a standard check matrix H, wherein N≥1, and the exchange operation refers to an exchange of any two chunk column sets; and wherein for each value of i and each value of j, with 2 ∗ R≥i≥1 and (K+2) ∗ R≥j≥1, coordinates in the standard check matrix corresponding to the following first relations are set to be 1: if i<j, H i + 1 j ∗ R + R − j + i mod R + 1, and H R + i + 1 j + 1 ∗ R − R − j + i mod R; or if i>j, H i + 1 j ∗ R + R − 1 − j + i mod R + 1, and H R + i + 1 j + 1 ∗ R − R − 1 − j + i mod R and coordinates in the standard check matrix H that do not correspond to the first relations are set to be 0. if i<j, H i + 1 j ∗ R + R − j + i mod R + 1, and H R + i + 1 j + 1 ∗ R − R − j + i mod R; or if i>j, H i + 1 j ∗ R + R − 1 − j + i mod R + 1, and H R + i + 1 j + 1 ∗ R − R − 1 − j + i mod R and coordinates in the standard check matrix H that do not correspond to the first relations are set to be 0.