# US 11,307,979 B2 · Data storage device and non-volatile 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 11,307,979 B2
- Document ID: US11307979B2
- Status: Granted
- Kind: B2
- Application number: 17/025,067
- Filed: 2020-09-18
- Published: 2021-06-03
- Granted: 2022-04-19
- Earliest claimed: 2019-11-29
- Assignees: Silicon Motion, Inc.
- Applicants: Silicon Motion, Inc.
- Inventors: Yu-Hsiang Chung
- Web page: https://patentgrep.com/patent/US11307979B2

## CPC

- G06F 12/0238: {Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory}
- G06F 3/0604: {Improving or facilitating administration, e.g. storage management}
- G06F 3/0652: {Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket}
- G06F 3/0685: {Hybrid storage combining heterogeneous device types, e.g. hierarchical storage, hybrid arrays}
- G06F 9/30047: {Prefetch instructions; cache control instructions}
- G06F 12/0246: {in block erasable memory, e.g. flash memory}
- G06F 12/0871: Allocation or management of cache space
- G06F 12/0873: Mapping of cache memory to specific storage devices or parts thereof
- G06F 12/0891: using clearing, invalidating or resetting means
- G06F 13/1668: {Details of memory controller}
- G06F 12/0866: for peripheral storage systems, e.g. disk cache
- G06F 2212/1016: Performance improvement
- G06F 2212/1044: Space efficiency improvement
- G06F 2212/222: Non-volatile memory
- G06F 2212/466: Metadata, control data
- G06F 2212/7201: Logical to physical mapping or translation of blocks or pages
- G06F 2212/7203: Temporary buffering, e.g. using volatile buffer or dedicated buffer blocks
- G06F 2212/7204: Capacity control, e.g. partitioning, end-of-life degradation
- G06F 2212/7205: Cleaning, compaction, garbage collection, erase control
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Efficient space trimming of data storage device is shown, which uses a controller to program a trimming tag that corresponds to a trimming command issued by a host into a cache area of a temporary storage device. The trimming tag, therefore, can be flushed from the cache area to the non-volatile memory for non-volatile storage. The update of the host-to-device mapping table based on the trimming tag can be postponed to the moment that the controller is free.

## Claims

### Claim 1

A data storage device, comprising:
a non-volatile memory; and
a controller and a temporary storage device which are coupled to the non-volatile memory, wherein, in response to a trimming command issued by a host, the controller is configured to program a trimming tag into a cache area allocated in the temporary storage device to be flushed into the non-volatile memory,
wherein:
the trimming command requests long-length trimming that is aligned to boundaries managed in units of a first length and is N times the first length, where N is a positive integer; and
the trimming tag includes N bits asserted to mark the long-length trimming.

### Claim 2 (depends on 1)

The data storage device as claimed in claim 1, wherein:
the controller manages a trimming bitmap on the temporary storage device;
the trimming bitmap includes a plurality of trimming bitmap sub-tables, wherein M trimming bitmap sub-tables are related to the N bits, and M is a positive integer; and
the M trimming bitmap sub-tables are also programmed into the cache area so that the N bits are programmed into the cache area.

### Claim 3 (depends on 2)

The data storage device as claimed in claim 2, wherein:
the controller further manages a trimming information flag bitmap on the temporary storage device corresponding to a plurality of cache entries in the cache area, wherein, corresponding to cache entries storing the M trimming bitmap sub-tables, flags within the trimming information flag bitmap are asserted; and
when flushing data from the cache area to the non-volatile memory, the controller further flushes the trimming information flag bitmap to the non-volatile memory.

### Claim 4 (depends on 3)

The data storage device as claimed in claim 3, wherein:
the controller further manages a storage information table on the temporary storage device corresponding to the plurality of cache entries in the cache area;
the controller updates the storage information table to store a logical address when the corresponding cache entry stores user data;
the controller updates the storage information table to store a trimming bitmap sub-table number when the corresponding cache entry stores a trimming bitmap sub-table; and
when flushing data from the cache area to the non-volatile memory, the controller further flushes the storage information table to the non-volatile memory.

### Claim 5 (depends on 4)

The data storage device as claimed in claim 4, wherein:
a size of a trimming bitmap sub-table is half a capacity of a cache entry;
when a first half of a cache entry stores a trimming bitmap sub-table, the corresponding trimming bitmap sub-table number is stored in the storage information table as a first half of storage information corresponding to the cache entry; and
when a second half of a cache entry stores a trimming bitmap sub-table, the corresponding trimming bitmap sub-table number is stored in the storage information table as a second half of storage information corresponding to the cache entry.

### Claim 6 (depends on 4)

The data storage device as claimed in claim 4, wherein:
the trimming command further requests medium-length trimming not exceeding the first length and aligned to boundaries managed in units of a second length;
the controller updates a host-to-device mapping table to record dummy mapping data corresponding to the medium-length trimming; and
the controller programs a starting logical address and a trimming length of the medium-length trimming into the cache area.

### Claim 7 (depends on 6)

The data storage device as claimed in claim 6, wherein:
the controller updates the trimming information flag bitmap to mark a cache entry storing the starting logical address and the trimming length of the medium-length trimming in the cache area.

### Claim 8 (depends on 7)

The data storage device as claimed in claim 7, wherein:
the controller updates the storage information table to record medium-length trimming code for interpreting the cache entry storing the starting logical address and the trimming length of the medium-length trimming.

### Claim 9 (depends on 8)

The data storage device as claimed in claim 8, wherein:
the starting logical address and the trimming length of the medium-length trimming are combined with dummy cache data to occupy half of the cache entry;
when the starting logical address and the trimming length of the medium-length trimming is stored in the first half of the cache entry, the corresponding medium-length trimming code is stored in the storage information table as the first half of the storage information corresponding to the cache entry; and
when the starting logical address and the trimming length of the medium-length trimming is stored in the second half of the cache entry, the corresponding medium-length trimming code is stored in the storage information table as the second half of the storage information corresponding to the cache entry.

### Claim 10 (depends on 8)

The data storage device as claimed in claim 8, wherein:
the trimming command further requests short-length trimming shorter than the second length and within a logical address range managed as a unit in the second length;
the controller combines dummy user data corresponding to the short-length trimming with user data not to be trimmed in the logical address range to form a combined result, and programs the combined result into a partially-trimmed cache entry within the cache area; and
the controller updates the host-to-device mapping table to map the logical address range to the partially-trimmed cache entry.

### Claim 11

A method for controlling a non-volatile memory, comprising:
receiving a trimming command issued by a host; and
based on the trimming command, programing a trimming tag into a cache area allocated in a temporary storage device to be flushed into the non-volatile memory,
wherein:
the trimming command requests long-length trimming that is aligned to boundaries managed in units of a first length and is N times the first length, where N is a positive integer; and
the trimming tag includes N bits asserted to mark the long-length trimming.

### Claim 12 (depends on 11)

The method as claimed in claim 11, further comprising:
managing a trimming bitmap on the temporary storage device, wherein the trimming bitmap includes a plurality of trimming bitmap sub-tables, wherein M trimming bitmap sub-tables are related to the N bits, and M is a positive integer; and
the M trimming bitmap sub-tables are also programmed into the cache area so that the N bits are programmed into the cache area.

### Claim 13 (depends on 12)

The method as claimed in claim 12, further comprising:
managing a trimming information flag bitmap on the temporary storage device corresponding to a plurality of cache entries in the cache area, wherein, corresponding to cache entries storing the M trimming bitmap sub-tables, flags within the trimming information flag bitmap are asserted; and
when flushing data from the cache area to the non-volatile memory, further flushing the trimming information flag bitmap to the non-volatile memory.

### Claim 14 (depends on 13)

The method as claimed in claim 13, further comprising:
managing a storage information table on the temporary storage device corresponding to the plurality of cache entries in the cache area,
wherein:
the storage information table is updated to store a logical address when the corresponding cache entry stores user data;
the storage information table is updated to store a trimming bitmap sub-table number when the corresponding cache entry stores a trimming bitmap sub-table; and
when data is flushed from the cache area to the non-volatile memory, the storage information table is also flushed to the non-volatile memory.

### Claim 15 (depends on 14)

The method as claimed in claim 14, wherein:
the size of a trimming bitmap sub-table is half the capacity of the cache entry;
when the first half of the cache entry stores the trimming bitmap sub-table, the corresponding trimming bitmap sub-table number is stored in the storage information table as the first half of the storage information corresponding to the cache entry; and
when the second half of the cache entry stores the trimming bitmap sub-table, the corresponding trimming bitmap sub-table number is stored in the storage information table as the second half of the storage information corresponding to the cache entry.

### Claim 16 (depends on 14)

The method as claimed in claim 14, wherein:
the trimming command further requests medium-length trimming not exceeding the first length and aligned to boundaries managed in units of a second length;
a host-to-device mapping table is updated to record dummy mapping data corresponding to the medium-length trimming; and
a starting logical address and a trimming length of the medium-length trimming are programmed into the cache area.

### Claim 17 (depends on 16)

The method as claimed in claim 16, further comprising:
updating the trimming information flag bitmap to mark a cache entry storing the starting logical address and the trimming length of the medium-length trimming in the cache area.

### Claim 18 (depends on 17)

The method as claimed in claim 17, further comprising:
updating the storage information table to record medium-length trimming code for interpreting the cache entry storing the starting logical address and the trimming length of the medium-length trimming.

### Claim 19 (depends on 18)

The method as claimed in claim 18, further comprising:
the starting logical address and the trimming length of the medium-length trimming are combined with dummy cache data to occupy half of the cache entry;
when the starting logical address and the trimming length of the medium-length trimming is stored in the first half of the cache entry, the corresponding medium-length trimming code is stored in the storage information table as the first half of the storage information corresponding to the cache entry; and
when the starting logical address and the trimming length of the medium-length trimming is stored in the second half of the cache entry, the corresponding medium-length trimming code is stored in the storage information table as the second half of the storage information corresponding to the cache entry.

### Claim 20 (depends on 18)

The method as claimed in claim 18, further comprising:
the trimming command further requests short-length trimming shorter than the second length and within a logical address range managed as a unit in the second length;
dummy user data corresponding to the short-length trimming is combined with user data not to be trimmed in the logical address range to form a combined result, and the combined result is programmed into a partially-trimmed cache entry within the cache area; and
the host-to-device mapping table is updated to map the logical address range to the partially-trimmed cache entry.
