# US 2017/0286289 A1 · Data storage device and flash memory control method

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2017/0286289 A1
- Document ID: US20170286289A1
- Status: Published application
- Kind: A1
- Application number: 15/629,892
- Filed: 2017-06-22
- Published: 2017-10-05
- Earliest claimed: 2013-08-30
- Assignees: Silicon Motion, Inc.
- Applicants: Silicon Motion, Inc.
- Inventors: Po-Chia CHU; Yen-Hung LIN
- Web page: https://patentgrep.com/patent/US20170286289A1

## CPC

- G06F 12/0246: {in block erasable memory, e.g. flash memory}
- G06F 2212/7211: Wear leveling
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A FLASH memory control technique with wear leveling between the different blocks of the FLASH memory. By a controller managing the blocks of a FLASH memory within a data storage device, some of the blocks are pushed into a spare queue waiting to be allocated as data blocks or system blocks. When the number of blocks within the spare queue is lower than a clean threshold and any block within the spare queue has an erase count greater than an overused lower threshold, the controller performs a garbage correction operation with wear leveling between the different blocks.

## Claims

### Claim 1

A data storage device, comprising:
a flash memory; and
a controller, for management of a spare queue for the flash memory, blocks within the spare queue contain no valid data and are waiting for allocation,
wherein:
the controller further manages a jail queue to freeze blocks whose erase counts are greater than an overused higher threshold;
the controller checks whether any of two specific conditions is true to perform a garbage collection operation with wear leveling accordingly;
one of the two specific conditions shows that the blocks frozen within the jail queue are more than a predetermined amount and another of the two specific condition shows that the flash memory is in a power-cycle routine; and
when performing the garbage collection operation with wear leveling, the controller selects one block from higher erase count blocks in the spare queue to collect valid data.

### Claim 2 (depends on 1)

The data storage device as claimed in claim 1, wherein:
the controller performs the garbage collection operation with wear leveling when any of the two specific conditions is true.

### Claim 3 (depends on 1)

The data storage device as claimed in claim 1, wherein:
the controller further checks whether the blocks within the spare queue are less than a clean threshold for performing the garbage collection operation with wear leveling accordingly.

### Claim 4 (depends on 3)

The data storage device as claimed in claim 3, wherein:
the controller performs the garbage collection operation with wear leveling when the blocks within the spare queue are less than the clean threshold and any of the two specific conditions is true.

### Claim 5 (depends on 3)

The data storage device as claimed in claim 3, wherein:
the controller further checks whether any block within the spare queue has an erase count greater than an overused lower threshold for performing the garbage collection operation with wear leveling accordingly.

### Claim 6 (depends on 5)

The data storage device as claimed in claim 5, wherein:
the controller performs the garbage collection operation with wear leveling when the blocks within the spare queue are less than the clean threshold, any block within the spare queue has an erase count greater than the overused lower threshold, and any of the two specific conditions is true.

### Claim 7 (depends on 1)

The data storage device as claimed in claim 1, wherein:
when performing the garbage collection operation with wear leveling, the controller cleans a data block having a lower erase count in comparison with most other data blocks.

### Claim 8 (depends on 1)

The data storage device as claimed in claim 1, wherein:
when performing the garbage collection operation with wear leveling, the controller cleans a data block having a lower erase count and having more invalid pages in comparison with most other data blocks.

### Claim 9 (depends on 1)

The data storage device as claimed in claim 1, wherein:
after the garbage collection operation with wear leveling is performed, the controller selects one block having the lowest erase count in the spare queue for write-data storage.

### Claim 10 (depends on 1)

The data storage device as claimed in claim 1, wherein:
after the garbage collection operation with wear leveling is performed, the controller selects one block from blocks having lower erase counts in the spare queue for write-data storage.

### Claim 11

A flash memory control method, comprising:
managing a spare queue for a flash memory, wherein blocks within the spare queue contain no valid data and are waiting for allocation;
managing a jail queue for the flash memory to freeze blocks whose erase counts are greater than an overused higher threshold; and
checking whether any of two specific conditions is true to perform a garbage collection operation with wear leveling accordingly,
wherein:
one of the two specific conditions shows that the blocks frozen within the jail queue are more than a predetermined amount and another of the two specific condition shows that the flash memory is in a power-cycle routine; and
when the garbage collection operation with wear leveling is performed, one block is selected from higher erase count blocks in the spare queue to collect valid data.

### Claim 12 (depends on 11)

The flash memory control method as claimed in claim 11, wherein:
the garbage collection operation with wear leveling is performed when any of the two specific conditions is true.

### Claim 13 (depends on 11)

The flash memory control method as claimed in claim 11, further comprising:
checking whether the blocks within the spare queue are less than a clean threshold for performing the garbage collection operation with wear leveling accordingly.

### Claim 14 (depends on 13)

The flash memory control method as claimed in claim 13, wherein:
the garbage collection operation with wear leveling is performed when the blocks within the spare queue are less than the clean threshold and any of the two specific conditions is true.

### Claim 15 (depends on 13)

The flash memory control method as claimed in claim 13, further comprising:
checking whether any block within the spare queue has an erase count greater than an overused lower threshold for performing the garbage collection operation with wear leveling accordingly.

### Claim 16 (depends on 15)

The flash memory control method as claimed in claim 15, wherein:
the garbage collection operation with wear leveling is performed when the blocks within the spare queue are less than the clean threshold, any block within the spare queue has an erase count greater than the overused lower threshold, and any of the two specific conditions is true.

### Claim 17 (depends on 11)

The flash memory control method as claimed in claim 11, wherein:
during the garbage collection operation with wear leveling, a data block having a lower erase count in comparison with most other data blocks is cleaned.

### Claim 18 (depends on 11)

The flash memory control method as claimed in claim 11, wherein:
during the garbage collection operation with wear leveling, a data block having a lower erase count and more invalid pages in comparison with most other data blocks is cleaned.

### Claim 19 (depends on 11)

The flash memory control method as claimed in claim 11, wherein:
after the garbage collection operation with wear leveling is performed, one block having the lowest erase count in the spare queue is selected for write-data storage.

### Claim 20 (depends on 11)

The flash memory control method as claimed in claim 11, wherein:
after the garbage collection operation with wear leveling is performed, one block is selected from blocks having lower erase counts in the spare queue for write-data storage.
