# US 2017/0286306 A1 · Data accessing method and apparatus

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

- Number: US 2017/0286306 A1
- Document ID: US20170286306A1
- Status: Published application
- Kind: A1
- Application number: 15/630,105
- Filed: 2017-06-22
- Published: 2017-10-05
- Earliest claimed: 2014-12-24
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co.,Ltd.
- Inventors: Jianhua Zhou; Yan Li; Po Zhang; Fei Wang
- Web page: https://patentgrep.com/patent/US20170286306A1

## CPC

- G06F 12/0862: with prefetch
- G06F 3/06: Digital input from, or digital output to, record carriers {, e.g. RAID, emulated record carriers or networked record carriers}
- G06F 12/0238: {Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory}
- G06F 2212/1032: Reliability improvement, data loss prevention, degraded operation etc
- G06F 2212/251: Local memory within processor subsystem
- G06F 2212/602: Details relating to cache prefetching
- G06F 2212/7203: Temporary buffering, e.g. using volatile buffer or dedicated buffer blocks
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A data accessing method includes: determining whether a preset cache area has cached data that a read target address points to when receiving a read instruction that includes the read target address; and finding a cache address corresponding to the read target address according to a first mapping relationship if the preset cache area has cached the data that the read target address points to, and reading data that the cache address points to from the preset cache area, where the first mapping relationship is used to record a correspondence between the target address and the cache address; orreading, from non-volatile storage space, the data that the read target address points to if the preset cache area has not cached the data that the read target address points to. By means of the method, data read errors caused by write interference can be reduced.

## Claims

### Claim 1

A data accessing method, comprising:
receiving a read instruction that comprises a target address of read data;
determining whether a preset cache area has cached the read data that the target address points to; and
if the preset cached area has cached the read data, finding a cache address corresponding to the target address of the read data according to a first mapping relationship, and reading the read data from the preset cache area using the cache address, wherein the first mapping relationship specifies a correspondence between a storage address and a cache address, wherein the storage address is an address of the data stored in the non-volatile storage space and the cache address is an address of the data stored in the preset cache area; and
if the present cache area has not cached the read data, reading the read data from the non-volatile storage space.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising:
receiving a write instruction that comprises to be written data and a target address of the to be written data;
determining whether a storage area indicated by the target address belongs to a most significant bit (MSB) page in the non-volatile storage space; and
if the storage area does not belong to an MSB page in the non-volatile storage space, storing the to be written data in the preset cache area and the non-volatile storage space, and recording a mapping relationship between a cache address of the to be written data stored in the preset cache area and a storage address of the to be written data stored in the non-volatile storage space to the first mapping relationship; and
if the storage area belongs to an MSB page in the non-volatile storage space, storing the to be written data in the non-volatile storage space.

### Claim 3 (depends on 2)

The method according to claim 2, further comprising:
obtaining a page number difference between an MSB page and an LSB page of each group of shared pages in the non-volatile storage space, and obtaining a maximum page number difference m from the page number differences of all groups of shared pages, wherein m is a natural number, each group of shared page comprises an MSB page and an LSB page; and
allocating cache space with a size of at least n*p+m pages for the preset cache area, wherein p represents a quantity of shared pages of an MSB page in each group of shared page, the shared pages are the pages excepting the MSB page in each group of shared page, and n is a natural number and is at least 1.

### Claim 4 (depends on 3)

The method according to claim 3, further comprising:
if the storage area belongs to an MSB page in the non-volatile storage space, determining whether the MSB page in which the storage area is located is the last MSB page in a block;
if the MSB page in which the storage area is located is not the last MSB page in the block, obtaining an address of a shared page of the nth MSB page as counted forward from the MSB page in which the storage area is located, and using the obtained address as a data release address;
if the MSB page in which the storage area is located is the last MSB page in the block, obtaining addresses of shared pages of the last n+1 MSB pages in the block, and using the obtained addresses as the data release addresses; and
releasing data pointed by a corresponding cache address of the data release addresses from the preset cache area according to the first mapping relationship, and deleting the data release address from the first mapping relationship.

### Claim 5 (depends on 1)

The method according to claim 1, further comprising:
during a power-off process, copying data stored in the preset cache area to the non-volatile storage space, and establishing a second mapping relationship between a cache address of the copied data cached in the preset cache area and a stored address of the copied data stored in the non-volatile storage space; and
during a power-on process, caching the copied data stored in the non-volatile storage space to the preset cache area according to the second mapping relationship.

### Claim 6

A data accessing apparatus comprising:
a memory comprising instructions; and
one or more processors in communication with the memory that execute the instructions to:
receiving a read instruction that comprises a target address of read data;
determine whether a preset cache area has cached the read data that the target address points to; and
if the preset cached area has cached the read data, find a cache address corresponding to the target address of the read data according to a first mapping relationship, and read the read data from the preset cache area using the cache address, wherein the first mapping relationship specifies a correspondence between a storage address and a cache address, wherein the storage address is an address of the data stored in the non-volatile storage space and the cache address is an address of the data stored in the preset cache area; and
if the present cache area has not cached the read data, read the read data from the non-volatile storage space.

### Claim 7 (depends on 6)

The data processing apparatus according to claim 6, wherein the one or more processors execute the instructions to:
receive a write instruction that comprises to be written data and a target address of the to be written data;
determine whether a storage area indicated by the target address belongs to a most significant bit (MSB) page in the non-volatile storage space; and
if the storage area does not belong to an MSB page in the non-volatile storage space, store the to be written data in the preset cache area and the non-volatile storage space, and record a mapping relationship between a cache address of the to be written data stored in the preset cache area and a storage address of the to be written data stored in the non-volatile storage space to the first mapping relationship; and
if the storage area belongs to an MSB page in the non-volatile storage space, store the to be written data in the non-volatile storage space.

### Claim 8 (depends on 7)

The data processing apparatus according to claim 7, wherein the one or more processors execute the instructions to:
obtain a page number difference between an MSB page and an LSB page of each group of shared pages in the non-volatile storage space, and obtaining a maximum page number difference m from the page number differences of all groups of shared pages, wherein m is a natural number, each group of shared page comprises an MSB page and an LSB page; and
allocate cache space with a size of at least n*p+m pages for the preset cache area, wherein p represents a quantity of shared pages of an MSB page in each group of shared page, the shared pages are the pages excepting the MSB page in each group of shared page, and n is a natural number and is at least 1.

### Claim 9 (depends on 8)

The data processing apparatus according to claim 8, wherein the one or more processors execute the instructions to:
if the storage area belongs to an MSB page in the non-volatile storage space, determine whether the MSB page in which the storage area is located is the last MSB page in a block;
if the MSB page in which the storage area is located is not the last MSB page in the block, obtain an address of a shared page of the nth MSB page as counted forward from the MSB page in which the storage area is located, and using the obtained address as a data release address;
if the MSB page in which the storage area is located is the last MSB page in the block, obtain addresses of shared pages of the last n+1 MSB pages in the block, and use the obtained addresses as the data release addresses; and
release data pointed by a corresponding cache address of the data release addresses from the preset cache area according to the first mapping relationship, and deleting the data release address from the first mapping relationship.

### Claim 10 (depends on 6)

The data processing apparatus according to claim 6, wherein the one or more processors execute the instructions to:
during a power-off process, copy data stored in the preset cache area to the non-volatile storage space, and establishing a second mapping relationship between a cache address of the copied data cached in the preset cache area and a stored address of the copied data stored in the non-volatile storage space; and
during a power-on process, cache the copied data stored in the non-volatile storage space to the preset cache area according to the second mapping relationship.

### Claim 11

A non-transitory computer-readable medium storing computer instructions that when executed by one or more processors cause the one or more processors to perform the steps of:
determine whether a preset cache area has cached the read data that the target address points to; and
if the preset cached area has cached the read data, find a cache address corresponding to the target address of the read data according to a first mapping relationship, and read the read data from the preset cache area using the cache address, wherein the first mapping relationship specifies a correspondence between a storage address and a cache address, wherein the storage address is an address of the data stored in the non-volatile storage space and the cache address is an address of the data stored in the preset cache area; and
if the present cache area has not cached the read data, read the read data from the non-volatile storage space.

### Claim 12 (depends on 11)

The computer-readable medium according to claim 11, wherein the one or more processors execute the instructions to:
receive a write instruction that comprises to be written data and a target address of the to be written data;
determine whether a storage area indicated by the target address belongs to a most significant bit (MSB) page in the non-volatile storage space; and
if the storage area does not belong to an MSB page in the non-volatile storage space, store the to be written data in the preset cache area and the non-volatile storage space, and record a mapping relationship between a cache address of the to be written data stored in the preset cache area and a storage address of the to be written data stored in the non-volatile storage space to the first mapping relationship; and
if the storage area belongs to an MSB page in the non-volatile storage space, store the to be written data in the non-volatile storage space.

### Claim 13 (depends on 12)

The computer-readable medium according to claim 12, wherein the one or more processors execute the instructions to:
obtain a page number difference between an MSB page and an LSB page of each group of shared pages in the non-volatile storage space, and obtaining a maximum page number difference m from the page number differences of all groups of shared pages, wherein m is a natural number, each group of shared page comprises an MSB page and an LSB page; and
allocate cache space with a size of at least n*p+m pages for the preset cache area, wherein p represents a quantity of shared pages of an MSB page in each group of shared page, the shared pages are the pages excepting the MSB page in each group of shared page, and n is a natural number and is at least 1.

### Claim 14 (depends on 13)

The computer-readable medium according to claim 13, wherein the one or more processors execute the instructions to:
if the storage area belongs to an MSB page in the non-volatile storage space, determine whether the MSB page in which the storage area is located is the last MSB page in a block;
if the MSB page in which the storage area is located is not the last MSB page in the block, obtain an address of a shared page of the nth MSB page as counted forward from the MSB page in which the storage area is located, and using the obtained address as a data release address;
if the MSB page in which the storage area is located is the last MSB page in the block, obtain addresses of shared pages of the last n+1 MSB pages in the block, and use the obtained addresses as the data release addresses; and
release data pointed by a corresponding cache address of the data release addresses from the preset cache area according to the first mapping relationship, and deleting the data release address from the first mapping relationship.

### Claim 15 (depends on 11)

The computer-readable medium according to claim 11, wherein the one or more processors execute the instructions to:
during a power-off process, copy data stored in the preset cache area to the non-volatile storage space, and establishing a second mapping relationship between a cache address of the copied data cached in the preset cache area and a stored address of the copied data stored in the non-volatile storage space; and
during a power-on process, cache the copied data stored in the non-volatile storage space to the preset cache area according to the second mapping relationship.
