Patent ID: 8806301

Claim:
A data writing method for ensuring data writing correctly from a host system into a flash memory chip, wherein the flash memory chip includes a plurality of physical blocks, and each of the physical blocks has a plurality of physical pages, the data writing method comprising: grouping the physical blocks into at least a data area, a spare area and a replacement area; receiving a host write command and write data corresponding to the host write command from the host system and executing the host write command by the flash memory controller; giving a data program command to the flash memory chip during the execution of the host write command to write the write data into one of the physical blocks of the spare area; and giving a read command to the flash memory chip before sending an acknowledgement message informing that the host write command is completed to the host system to determine whether at least a portion of data stored in one of the physical pages in the one of the physical blocks corresponding to the host write command has at least one error bit, wherein if the at least a portion of data stored in the one of the physical pages in the one of the physical blocks has the at least one error bit and the number of the at least one error bit is not larger than the maximum number of error correcting bits and is larger than an error bit threshold value, moving data stored in the one of the physical block to another physical block selected from the replacement area, and marking the one of the physical block as a bad physical block, wherein if the at least a portion of data stored in the one of the physical pages in the one of the physical blocks has the at least one error bit and the number of the at least one error bit is not larger than an error bit threshold value, marking the one of the physical block as an unreliable physical block, wherein the unreliable physical block is used for writing data only when the physical blocks of the replacement area are exhausted.