US 11,860,669 B2
Method and apparatus and computer program product for storing data in flash memory
Kuan-Yu Ke, Zhubei (TW)
Assigned to SILICON MOTION, INC., Zhubei (TW)
Filed by Silicon Motion, Inc., Zhubei (TW)
Filed on Jan. 25, 2021, as Appl. No. 17/157,368.
Claims priority of application No. 202011056071.5 (CN), filed on Sep. 29, 2020.
Prior Publication US 2022/0100373 A1, Mar. 31, 2022
Int. Cl. G06F 3/06 (2006.01); G06F 11/07 (2006.01)
CPC G06F 3/064 (2013.01) [G06F 3/0619 (2013.01); G06F 3/0644 (2013.01); G06F 3/0679 (2013.01); G06F 11/076 (2013.01)] 17 Claims
OG exemplary drawing
 
1. A method for storing data in flash memory, performed by a device side processing unit responsive to loading and executing program code, the method comprising:
receiving logical partitioning information describing a first logical partition type and a second logical partition type of storage from a file system run on a host side, wherein the logical partitioning information comprises a first length of the first logical partition type of storage and a second length of the second logical partition type of storage, the first length of the first logical partition type and the second length of the second logical partition type are represented by quantities of logical block address (LBA) numbers, the host side defines the first logical partition type and the second logical partition type, the host side defines to store a first type of files in the first logical partition type of storage, and the host side defines to store a second type of files in the second logical partition type of storage;
dividing storage space in a flash module into a first region and a second region, wherein the first region comprises a plurality of first physical blocks, the second region comprises a plurality of second physical blocks, each first physical block is programmed in a single level cell (SLC) mode only, each second physical block is programmed in the SLC mode or a non-SLC mode, the SLC mode is used to program a memory cell to store one of two states, and the non-SLC mode is used to program a memory cell to store one of at least four states;
programming data belonging to the first logical partition type, which is received from the host side, into a first physical block in the first region only;
programming data belonging to the second logical partition type, which is received from the host side, into either the first physical block in the first region or a second physical block in the second region;
reading data from a physical page of a data block in the first region, wherein the data block comprises the first physical block which has been fully programmed;
examining a status for the first region;
in response to the status for the first region meeting a condition, reading and collecting data stored in a plurality of first valid sectors of the data block, which belongs to the first logical partition type, and programming first collected data into a first current block in the first region in the SLC mode; and
in response to the status for the first region meeting the condition, reading and collecting data stored in a plurality of second valid sectors of the data block, which belongs to the second logical partition type, and programming second collected data into a second current block in the second region in the non-SLC mode, wherein a current block comprises a spare block selected for storing data,
wherein the status for the first region meeting the condition comprises an error-correcting rate of the data block being higher than a threshold.