CPC G06F 11/1016 (2013.01) [G06F 3/0616 (2013.01); G06F 3/0647 (2013.01); G06F 3/0679 (2013.01); G06F 11/0727 (2013.01); G06F 11/1448 (2013.01)] | 17 Claims |
1. A read and write method, comprising: applying a read command to a memory device, the read command indicating address information; reading data to be read from a storage unit corresponding to the address information indicated by the read command; and if an error occurs in the data to be read, associating the address information indicated by the read command with a spare storage unit, and backing up the address information indicated by the read command and association information between the address information and the spare storage unit in a non-volatile storage unit based on a preset rule;
wherein a lookup table is provided, the address information of the storage unit and a numerical code corresponding to the address information are recorded in the lookup table, the numerical code being composed of a first type code and a second type code, the first type code being used to mark whether the address information is valid, the second type code being used to record an identification code for identifying the spare storage unit; and if the error occurs in the data to be read, then in the lookup table, the first type code of the numerical code corresponding to the address information indicated by the read command is modified to an invalid mark value, and the second type code is modified to the identification code for identifying the spare storage unit; and
the method further comprises: recording a number of times of modification of the second type code, and generating the identification code for identifying the spare storage unit according to the number of times of modification.
|