# US 2012/0254505 A1 · System and method for managing flash memory

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

- Number: US 2012/0254505 A1
- Document ID: US20120254505A1
- Status: Published application
- Kind: A1
- Application number: 13/074,431
- Filed: 2011-03-29
- Published: 2012-10-04
- Earliest claimed: 2011-03-29
- Assignees: Research In Motion Limited
- Inventors: Suhaib Alam CHISHTIE; Puvikumar SINNATHAMBY
- Web page: https://patentgrep.com/patent/US20120254505A1

## CPC

- G06F 12/0246: {in block erasable memory, e.g. flash memory}
- G06F 2212/1052: Security improvement
- G06F 2212/7202: Allocation control and policies
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method for flash memory management is provided. In particular, the system and methods herein provide for management of flash memory, particularly NAND flash memory, in a manner that potentially reduces the number of write/erase cycles typically experienced by a data storage device. When unsecure data records are to be written to the flash memory, the new or updated unsecure data records are stored in the first available location in the flash memory (e.g. a block) providing a best fit for the data records. Where the data records are updates, the updated version is stored with an incremented version number to indicate that the updated version is the current version. Older versions of the data records are deleted during garbage collection. When secure data records are to be written to the flash memory, new or updated secure data records are stored in the location in the flash memory with the most available space. Any older versions of secure data records are immediately deleted.

## Claims

### Claim 1

A method of managing flash memory, the method comprising:
writing an unsecure data record to a first block of said flash memory, said first block being selected as having a best fit for said unsecure data record; and
writing a secure data record to a second block of said flash memory, said second block being selected as having a maximum available space for receiving a data record.

### Claim 2 (depends on 1)

The method of claim 1, wherein writing said unsecure data record comprises determining that said unsecure data record is a further version of a previous unsecure data record stored in the flash memory, and writing said unsecure data record with a record version value incremented from a record version value of said previous unsecure data record.

### Claim 3 (depends on 1)

The method of claim 1, wherein writing said secure data record comprises:
determining that said secure data record is a further version of a previous secure data record stored in another block of the flash memory;
writing said secure data record with a record version value incremented from a record version value of said previous secure data record;
moving any data records comprised in said other block, other than the previous secure data record, that are not marked for deletion; and
erasing said other block.

### Claim 4 (depends on 1)

The method of claim 1, wherein said first block comprises a smallest amount of available space for storage of said unsecure data record for all blocks within said flash memory.

### Claim 5 (depends on 1)

The method of claim 1, wherein said second block comprises a largest amount of available space for storage of said secure data record for all blocks within said flash memory.

### Claim 6 (depends on 1)

The method of claim 1, further comprising deleting said unsecure data record by writing a further version of said unsecure data record to a further block being selected as having a best fit for said unsecure data record, said further version being marked for deletion.

### Claim 7 (depends on 6)

The method of claim 6, wherein said further version is marked for deletion through an indication of a data length of zero.

### Claim 8 (depends on 1)

The method of claim 1, wherein the flash memory comprises NAND flash memory.

### Claim 9 (depends on 1)

The method of claim 1, further comprising:
for each data record in a block of a flash memory,
determining whether said data record comprises a version number that is the same as an active version number stored for said data record;
if so, copying said data record to a further block of said flash memory; and
erasing said block of flash memory.

### Claim 10 (depends on 9)

The method of claim 9, wherein said further block is determined to provide a best fit for said data record.

### Claim 11 (depends on 9)

The method of claim 9, wherein the flash memory comprises NAND flash memory.

### Claim 12

A data storage device, comprising:
flash memory; and
a processor configured to enable:
writing an unsecure data record to a first block of said flash memory, said first block being selected as having a best fit for said unsecure data record; and
writing a secure data record to a second block of said flash memory, said second block being selected as having a maximum available space for receiving a data record.

### Claim 13 (depends on 12)

The data storage device of claim 12, wherein said processor is further configured to determine that said unsecure data record is a further version of a previous unsecure data record stored in the flash memory, and to write said unsecure data record with a record version value incremented from a record version value of said previous unsecure data record.

### Claim 14 (depends on 12)

The data storage device of claim 12, wherein said processor is further configured to write said secure data record by:
determining that said secure data record is a further version of a previous secure data record stored in another block of the flash memory;
writing said secure data record with a record version value incremented from a record version value of said previous secure data record;
moving any data records comprised in said other block, other than the previous secure data record, that are not marked for deletion; and
erasing said other block.

### Claim 15 (depends on 12)

The data storage device of claim 12, wherein said first block comprises a smallest amount of available space for storage of said unsecure data record for all blocks within said flash memory.

### Claim 16 (depends on 12)

The data storage device of claim 12, wherein said second block comprises a largest amount of available space for storage of said secure data record for all blocks within said flash memory.

### Claim 17 (depends on 12)

The data storage device of claim 12, wherein the processor is further configured to delete said unsecure data record by writing a further version of said unsecure data record to a further block being selected as having a best fit for said unsecure data record, said further version being marked for deletion.

### Claim 18 (depends on 17)

The data storage device of claim 17, wherein said further version is marked for deletion through an indication of a data length of zero.

### Claim 19 (depends on 12)

The data storage device of claim 12, wherein the flash memory comprises NAND flash memory.

### Claim 20 (depends on 12)

The data storage device of claim 12, wherein the processor is further configured to:
for each data record in a block of a flash memory,
determine whether said data record comprises a version number that is the same as an active version number stored for said data record;
if so, copy said data record to a further block of said flash memory; and
erasing said block of flash memory.

### Claim 21 (depends on 12)

The data storage device of claim 12, wherein said further block is determined to provide a best fit for said data record.

### Claim 22 (depends on 20)

The data storage device of claim 20, wherein the flash memory comprises NAND flash memory.

### Claim 23

A computer program product comprising a non-transitory computer-readable medium storing code which, when executed by at least a processor of a data storage device, configures said data storage device to:
write an unsecure data record to a first block of said flash memory, said first block being selected as having a best fit for said unsecure data record; and
write a secure data record to a second block of said flash memory, said second block being selected as having a maximum available space for receiving a data record.
