CN109032519A - Data storage method and storage equipment - Google Patents

Data storage method and storage equipment Download PDF

Info

Publication number
CN109032519A
CN109032519A CN201810820831.1A CN201810820831A CN109032519A CN 109032519 A CN109032519 A CN 109032519A CN 201810820831 A CN201810820831 A CN 201810820831A CN 109032519 A CN109032519 A CN 109032519A
Authority
CN
China
Prior art keywords
block
data
storage device
target block
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810820831.1A
Other languages
Chinese (zh)
Inventor
郑善龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Electronic Information Industry Co Ltd
Original Assignee
Inspur Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Electronic Information Industry Co Ltd filed Critical Inspur Electronic Information Industry Co Ltd
Priority to CN201810820831.1A priority Critical patent/CN109032519A/en
Publication of CN109032519A publication Critical patent/CN109032519A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)

Abstract

the method comprises the steps that a storage device writes effective data into a first target data block, wherein a logic address L BA and a physical address PBA of the effective data are effective addresses, and if the first target block is not full within a preset time length, the storage device writes first filling data into a residual storage space of the first target block except the effective data, wherein the L BA and the PBA of the first filling data are invalid addresses.

Description

Data storage method and storage equipment
Technical Field
The present application relates to the field of data storage, and in particular, to a data storage method and a storage device.
Background
Flash memory (flash memory) is a long-life nonvolatile memory, is widely used in various portable digital devices at present, and becomes the basis of storage media of various portable digital devices. Flash memories may be classified into NOR type Flash memories and NAND type Flash memories. NOR flash is suitable for frequent random access, and is usually used to store program codes and run directly in flash, and NAND flash is mainly used to store data. The minimum unit of flash memory read-write is a page (page), the minimum unit of erase is a block (block), and each block comprises a plurality of pages.
Due to the electrical characteristics of NAND-type flash memory, a block in NAND-type flash memory needs to be fully written within a predetermined time once the block is turned on (at least one page is written), otherwise the data storage on the last page written by the block is unstable.
When the flash memory works, random writing is often performed, and in the process of writing data into a block, the block is often not fully written within a preset time, so that the data storage of a page written last on the block is unstable.
Disclosure of Invention
The embodiment of the application provides a data storage method, which is used for improving the stability of data stored in a storage device when the data is stored in the storage device.
In a first aspect, the present embodiment provides a data storage method, which may include:
writing effective data in a first target data block (DST) by the storage device, wherein a Logical Base Address (LBA) and a Physical Base Address (PBA) of the effective data are effective addresses;
and in a preset time length, if the first target block is not fully written, the storage device writes first filling data in a residual storage space of the first target block except the valid data, wherein the LBA and PBA of the first filling data are invalid addresses.
Optionally, in some embodiments of the present invention, the method may further include:
when garbage collection is carried out, the storage device determines a first source data block (SCR) and a first target block;
the writing, by the storage device, valid data in the first target data block may include:
the storage device writes the valid data of the first source block into the first target block;
and the storage equipment performs erasing operation on the first source block to obtain a target empty block.
Optionally, in some embodiments of the present invention, the storage device includes a current empty block, where the current empty block includes the target empty block, and after the storage device performs an erasing operation on the first source block to obtain the target empty block, the method may further include:
if the number of the current empty blocks is smaller than or equal to a preset threshold value and the first target block is not full, the storage device writes effective data of a second source block into the first target block within the preset time length;
or,
if the number of the current empty blocks is smaller than or equal to a preset threshold value and the first target block is fully written, the storage device writes effective data of a second source block into the second target block;
or,
if the number of the current empty blocks is larger than a preset threshold value and the first target block is not full, the storage device writes filling data into the first target block;
or,
and if the number of the current empty blocks is larger than a preset threshold value and the first target block is fully written, stopping garbage collection by the storage equipment.
Optionally, in some embodiments of the present invention, after the storage device writes valid data in the first target data block, the method may further include:
the storage device updates a logical address to physical address (L2P) corresponding to the valid data.
Optionally, in some embodiments of the present invention, the method may further include:
the storage equipment acquires a garbage recycling stop signal;
if the first target block is not full, the storage device writes filling data into the first target block according to the garbage collection stop signal.
In a second aspect, the present embodiment provides a storage device, which may include:
a write-in unit, configured to write valid data in a first target data block, where a logical address LBA and a physical address PBA of the valid data are valid addresses; and writing first filling data into the residual storage space of the first target block except the valid data within a preset time length if the first target block is not full, wherein the LBA and PBA of the first filling data are invalid addresses.
Optionally, in some embodiments of the present invention, the storage device may further include:
the determining unit is used for determining a first source block and a first target block when garbage collection is carried out;
the write unit is specifically configured to write valid data of the first source block into the first target block;
and the erasing unit is used for erasing the first source block to obtain a target empty block.
Optionally, in some embodiments of the invention, the storage device may include a current empty block, the current empty block may include the target empty block,
the writing unit is further configured to write valid data of a second source block into the first target block within the preset time length if the number of the current empty blocks is less than or equal to a preset threshold and the first target block is not full; if the number of the current empty blocks is less than or equal to a preset threshold value and the first target block is fully written, writing effective data of a second source block into the second target block; if the number of the current empty blocks is larger than a preset threshold value and the first target block is not full, writing second filling data into the first target block;
the storage device may further include:
and the stopping unit is used for stopping garbage recovery if the number of the current empty blocks is greater than a preset threshold value and the first target block is fully written.
Optionally, in some embodiments of the present invention, the storage device may further include:
and the updating unit is used for updating the logical-physical mapping table corresponding to the effective data.
Optionally, in some embodiments of the present invention, the storage device may further include:
an acquisition unit for acquiring a garbage collection stop signal;
the writing unit is further configured to write third padding data into the first target block according to the garbage collection stop signal if the first target block is not full.
In a third aspect, an embodiment of the present application provides a storage device, where the storage device includes: a processor, a memory; the memory is to store instructions; the processor is configured to execute the instructions in the memory, so that the storage device performs the method as described in the foregoing first aspect and any optional implementation manner.
In a fourth aspect, embodiments of the present application provide a computer program product, which when run on a computer, causes the computer to perform the method as described in the first aspect and any one of the alternative implementations.
In a fifth aspect, embodiments of the present application provide a computer storage medium, which includes instructions that, when executed on a computer, cause the computer to perform the method as described in the first aspect and any one of the optional implementations.
The computer storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
According to the technical scheme, the embodiment of the application has the following advantages:
when effective data is written into a block of the storage device, if the block cannot be fully written within a preset time length, filling data is written into the block, and the block is filled in time by writing the filling data, so that the situation that the storage stability of the effective data is poor due to the fact that the block is not fully written within the preset time length is avoided.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a data storage method in an embodiment of the present application;
FIG. 2 is a schematic diagram of another embodiment of a data storage method in the embodiment of the present application;
FIG. 3 is a schematic diagram of an embodiment of a storage device in an embodiment of the present application;
FIG. 4 is a schematic diagram of another embodiment of a storage device in the embodiment of the present application;
FIG. 5 is a schematic diagram of another embodiment of a storage device in the embodiment of the present application;
FIG. 6 is a schematic diagram of another embodiment of a storage device in the embodiment of the present application;
FIG. 7 is a schematic diagram of another embodiment of a storage device in the embodiment of the present application;
fig. 8 is a schematic diagram of another embodiment of the storage device in the embodiment of the present application.
Detailed Description
Flash memory (Flash memory) is a non-volatile memory, generally referred to as "Flash" for short, and can be classified into NOR type and NAND type Flash memories. The NOR flash memory technology was proposed by Intel corporation in 1988, and is more suitable for frequent random access, and is usually used for storing program codes and directly running on a flash memory card, while the NAND flash memory technology was proposed by toshiba corporation in 1989, and at present, the NAND flash memory is mainly used for storing data. The memory unit of the NAND type flash memory adopts a serial structure, the data operation of the memory unit is carried out by taking pages (pages) and blocks as units, one page comprises a plurality of bytes, and a plurality of pages form one block. When data is read and written, reading and writing are performed in units of pages, and when data is erased, erasing is performed in units of blocks.
The flash memory can hold data for a long time without current supply, and has a storage characteristic equivalent to a hard disk, and based on the characteristic, the flash memory becomes the basis of storage media of various storage devices, such as a mobile memory, an MP3 player, a digital camera, a palm computer and other storage devices.
The storage device mentioned in this embodiment and the following embodiments is described as a storage device using a NAND-type flash memory as a storage medium.
Referring to fig. 1 in detail, fig. 1 is a schematic diagram of an embodiment of a data storage method in an embodiment of the present application, and the method may include:
101. the storage device writes valid data in the first target data block.
In this embodiment, when the storage device writes data into a new block, the storage device records a time when the block is opened, and performs timing. The written valid data may refer to user data stored when the user normally uses the flash memory, or other data generated when the flash memory runs, for example, updated data written during a Garbage Collection (GC) process in the flash memory. The LBA of the valid data is valid, that is, the valid data can be read through the LBA index.
102. And in a preset time length, if the first target block is not fully written, the storage equipment writes filling data in the residual storage space of the first target block except the valid data.
In this embodiment, since the storage device uses the NAND flash memory as a storage medium, the electrical characteristics of the NAND flash memory cause that an open block must be written to full within a period of time, otherwise, the data storage of a last page written in the data stored in the block is unstable, and the period of time may be referred to as a stable storage time length. The stable storage time period is related to the type of flash memory and the production process of the flash memory, such as the manufacturing process, the flash memory grain type, and the like. It should be noted that, in this embodiment, the preset duration is smaller than the stable holding duration, and specifically, the preset duration may be set by itself in use.
In this embodiment, the padding data may be invalid data, that is, data that has been marked as data that needs to be deleted, according to the size of the remaining storage space of the first target block excluding the written valid data, invalid data of a corresponding size is queried from other blocks, and the invalid data is written into the remaining storage space.
In addition, the filling data may also be existing valid data, the source of the valid data may be other blocks or the first target block, the size of the valid data to be filled is determined according to the size of the remaining storage space of the first target block excluding the written valid data, the existing valid data is obtained after the determination, and the valid data is copied and written into the remaining storage space. If the padded data is already valid data, the storage device acquires an instruction after padding, and the storage device sets the LBA of the padded data to invalid according to the instruction.
In this embodiment, the source of the padding data is not limited herein.
103. The storage device obtains an update logical physical mapping table instruction.
In this embodiment, when a data frame is written into the first target block, the storage device obtains an instruction for updating the logical-physical mapping table corresponding to the data frame. It should be noted that, if the data frame corresponds to valid data, that is, the LBA is valid, the update logical physical mapping table instruction is valid, and if the data frame corresponds to padding data, that is, the LBA is invalid, the update logical physical mapping table instruction is invalid for the data frame.
104. And the storage equipment updates the logical-physical mapping table corresponding to the effective data.
In this embodiment, the logical-physical mapping table describes a correspondence between a logical address and a physical address of each data frame, and when a data frame is written into the first target block, a corresponding physical address in the first target block is generated. When the data frame is valid data, the LBA thereof is valid, and the storage device replaces the existing physical address with the physical address of the data frame in the first target block in the logical-physical mapping table corresponding to the data frame.
According to the technical scheme, the embodiment of the application has the following advantages:
when effective data is written into one block of the storage device, if the block is not fully written within the preset time length, filling data is written into the residual space of the block except the effective data, so that the condition that the effective data storage is unstable due to the fact that the block is not fully written within the preset time length is avoided.
Due to the storage characteristics of the NAND flash memory, when data in the NAND flash memory is deleted, the operating system of the storage device simply marks the internal file table of the NAND flash memory to indicate that the data has been deleted, but the deleted data still remains in the NAND flash memory. Over time, this can result in a large amount of stale data, also known as data spam. Because the data in the NAND flash memory cannot be directly written in an overwriting manner, when the data needs to be written in, if the storage position in the NAND flash memory has the data, the storage position needs to be erased first, and the data can be continuously written in. Therefore, when the data garbage is accumulated too much, the read-write performance of the NAND flash memory is also affected to some extent. In order to avoid that the invalid data occupies a large amount of storage space of the NAND flash memory, under a certain condition, the NAND flash memory can start a garbage collection mechanism, namely, valid data in each block is moved to an existing empty block, and then the block only with the invalid data is erased to the empty block. In the garbage recycling process, there are multiple writing processes for valid data, and the following description will be given by taking the garbage recycling process as an example.
Referring to fig. 2 in detail, fig. 2 is a schematic diagram of an embodiment of a data storage method in an embodiment of the present application, and the method may include:
201. when garbage collection is carried out, the storage device determines a first source block and a first target block.
In this embodiment, the storage device may determine whether to perform garbage collection by determining the number of current empty blocks. Before garbage collection, a preset value is set, and if the number of the hollow blocks in the storage device is lower than the preset value, garbage collection is carried out. It should be noted that garbage collection is an important mechanism for improving the operating efficiency of a flash memory, and triggering a storage device to perform garbage collection can be divided into various situations, for example, the number of empty blocks in the storage device is not enough than a preset value, a flash memory triggers a wear-leveling mechanism, or the flash memory performs error checking. In this embodiment, whether to perform garbage collection is determined by the number of empty blocks in the storage device as a determination method for performing garbage collection, it can be understood that performing garbage collection in other cases is also applicable to this embodiment, and details are not described here.
When garbage collection is carried out, the storage device is provided with a first source block and a first target block in a storage space of the storage device, wherein the first source block is a block containing valid data and invalid data in the storage device, the first target block is an empty block existing in the storage device, and the number of the first source block and the number of the first target block can be multiple or one.
202. The storage device writes valid data of the first source block to the first target block.
In this embodiment, after the first source block and the first target block are determined, the storage device writes the valid data of the first source block into the first target block. And when the valid data in the first source block are written into the first source block, the storage device erases the first source block into an empty block.
203. And the storage equipment performs erasing operation on the first source block to obtain a target empty block.
In this embodiment, after the valid data of the first source block has all been moved to the first target block, that is, when the data stored in the first source block is all invalid data, the storage device erases the first source block to obtain a target empty block.
204. And if the number of the current empty blocks is less than or equal to the preset threshold value and the first target block is not fully written, the storage equipment writes the effective data of the second source block into the first target block within a preset time length.
In this embodiment and subsequent embodiments, the current empty block includes an empty block already existing in the storage device and a target empty block generated after the first source block is erased before garbage collection is performed on the storage device. When the number of the current empty blocks is smaller than or equal to the preset threshold value, namely the garbage recycling is not finished, the storage device continues to select other source blocks for garbage recycling, and the size of the preset threshold value can be set by self.
Optionally, in some embodiments of the present application, if the number of empty blocks is less than or equal to the preset threshold and the first target block is full, the storage device writes the valid data of the second source block into the second target block.
In this embodiment, if the number of empty blocks is less than or equal to the preset threshold and the first target block is full, that is, garbage collection is not completed yet, but the first target block is full, the storage device selects a second target block from the current empty blocks, and writes valid data of the second source block into the second target block.
Optionally, in some embodiments of the present application, if the number of empty blocks is greater than a preset threshold and the first target block is not full, the storage device writes the filling data into the first target block.
In this embodiment, if the number of empty blocks is greater than the preset threshold and the first target block is not full, that is, garbage collection is completed, and in order to prevent garbage collection from continuously occupying the operating resources of the storage device, the storage device writes filling data into the first target block.
It should be noted that if the number of empty blocks is equal to the preset threshold and the first target block is not full, it may also be considered that garbage collection is completed, and the storage device writes the filling data into the first target block.
Optionally, in some embodiments of the present application, if the number of empty blocks is greater than a preset threshold and the first target block is full, the storage device stops garbage collection.
In this embodiment, if the number of empty blocks is greater than the preset threshold and the first target block is full, that is, garbage collection is completed, the storage device stops garbage collection.
It should be noted that if the number of empty blocks is equal to the preset threshold and the first target block is fully written, it may also be considered that garbage collection is completed, and the storage device stops garbage collection.
205. The storage device obtains an update logical physical mapping table instruction.
206. And the storage equipment updates the logical-physical mapping table corresponding to the effective data.
Step 205 and step 206 are similar to step 103 and step 104 in the embodiment shown in fig. 1, and are not described herein again.
Optionally, in some embodiments of the present application, the storage device acquires a garbage collection stop signal.
In this embodiment, since a large amount of device resources need to be occupied during garbage collection, the garbage collection process can be terminated during the garbage collection process. The storage device acquires the garbage collection stop signal, so that the garbage collection process is stopped according to the garbage collection stop signal. It should be noted that, terminating garbage collection may be setting a condition in advance by the storage device, for example, according to a current operating condition of the storage device: when garbage collection is carried out, if the storage device detects that user data is being written, the storage device automatically acquires a garbage collection stop signal and suspends the garbage collection process. The garbage collection can be terminated by the storage device receiving an externally sent garbage collection stop signal and stopping the garbage collection process.
Optionally, in some embodiments of the present application, if the first target block is not full, the storage device writes the filler data in the first target block according to a garbage collection stop signal.
In this embodiment, when the storage device obtains the garbage collection stop signal, the storage device queries whether the first target block is full according to the garbage collection stop signal, and if not, the storage device determines a remaining space of the first block, obtains filling data corresponding to the remaining space, and writes the filling data into the remaining space.
Optionally, in some embodiments of the present application, if the storage device acquires the power-off instruction, the storage device writes the filling data in the first target block according to the power-off instruction.
In this embodiment, in the garbage collection process, if the storage device receives a power-off instruction, that is, the storage device needs to perform a power-off operation, the storage device stops the garbage collection process according to the power-off instruction, and if the first target block is not fully written, the storage device writes fill data into the first target block.
According to the technical scheme, the embodiment of the application has the following advantages:
in the garbage recycling process, when the storage device writes the valid data into the first target block, the storage device detects whether the storage device fully writes the first target block within a preset time length, and if the storage device is not fully written within the preset time length, the storage device writes filling data into the remaining space of the first target block except the valid data. Therefore, the first target block is fully written within the preset time length, and the stability of effective data storage is ensured.
In the above embodiment, a data storage method is explained, and a storage device in the present embodiment is explained below.
Referring to fig. 3 in detail, fig. 3 is a schematic diagram of an embodiment of a storage device in an embodiment of the present application, and the schematic diagram may include:
a write unit 301, configured to write valid data in a first target data block, where a logical address LBA and a physical address PBA of the valid data are effective addresses; and writing first filling data into the residual storage space of the first target block except the valid data within a preset time length if the first target block is not full, wherein the LBA and PBA of the first filling data are invalid addresses.
Optionally, in some embodiments of the present application, with reference to fig. 4 in particular, fig. 4 is a schematic diagram of another embodiment of a storage device in an embodiment of the present application, where the storage device may further include:
a determining unit 302, configured to determine a first source block and the first target block when performing garbage collection;
a writing unit 301, configured to write valid data of the first source block into the first target block;
and the erasing unit 303 is configured to perform an erasing operation on the first source block to obtain a target empty block.
Optionally, in some embodiments of the present application, with particular reference to fig. 5, fig. 5 is a diagram of another embodiment of a storage device in an embodiment of the present application, where the storage device may include a current empty block, the current empty block may include the target empty block,
the writing unit 301 is further configured to write valid data of a second source block into the first target block within the preset time length if the number of the current empty blocks is less than or equal to a preset threshold and the first target block is not full; if the number of the current empty blocks is less than or equal to a preset threshold value and the first target block is fully written, writing effective data of a second source block into the second target block; if the number of the current empty blocks is larger than a preset threshold value and the first target block is not full, writing second filling data into the first target block;
the storage device may further include:
a stopping unit 304, configured to stop garbage collection if the number of the current empty blocks is greater than a preset threshold and the first target block is full.
Optionally, in some embodiments of the present application, with reference to fig. 6 in particular, fig. 6 is a schematic diagram of another embodiment of a storage device in an embodiment of the present application, where the storage device may further include:
an updating unit 305, configured to update the logical-physical mapping table corresponding to the valid data.
Optionally, in some embodiments of the present application, with reference to fig. 7 in particular, fig. 7 is a schematic diagram of another embodiment of a storage device in an embodiment of the present application, where the storage device may further include:
an obtaining unit 306, configured to obtain a garbage collection stop signal;
the writing unit 301 is further configured to write third padding data into the first target block according to the garbage collection stop signal if the first target block is not full.
As shown in fig. 8, fig. 8 is a schematic view of another embodiment of a storage device in an embodiment of the present application, and the storage device may include:
a processor 801, a memory 802, and an input/output unit 803;
an input/output unit 803 for receiving or transmitting instructions;
a memory 802 for storing instructions;
a processor 801 configured to execute the instructions in the memory, so that the storage device executes the method described in the foregoing embodiments shown in fig. 1 or fig. 2 and any optional implementation manner.
The embodiment of the present application provides a computer program product, which when run on a computer, causes the computer to execute the method as described in the foregoing embodiment shown in fig. 1 or fig. 2 and any optional implementation manner.
The embodiment of the present application provides a computer storage medium, which includes instructions, when executed on a computer, cause the computer to perform the method as described in the foregoing embodiment shown in fig. 1 or fig. 2 and any optional implementation manner.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method of storing data, comprising:
writing effective data into a first target data block by the storage equipment, wherein a logical address LBA and a physical address PBA of the effective data are effective addresses;
and in a preset time length, if the first target block is not fully written, the storage device writes first filling data in a residual storage space of the first target block except the valid data, wherein the LBA and the PBA of the first filling data are invalid addresses.
2. The method of claim 1, further comprising:
when garbage collection is carried out, the storage device determines a first source block and a first target block;
the writing, by the storage device, valid data in the first target data block comprises:
the storage device writes the valid data of the first source block into the first target block;
and the storage equipment performs erasing operation on the first source block to obtain a target empty block.
3. The method of claim 2, wherein the storage device comprises a current empty block, wherein the current empty block comprises the target empty block, wherein after the storage device performs an erase operation on the first source block to obtain the target empty block, the method further comprises:
if the number of the current empty blocks is smaller than or equal to a preset threshold value and the first target block is not fully written, the storage device writes effective data of a second source block into the first target block within the preset time length;
or,
if the number of the current empty blocks is smaller than or equal to a preset threshold value and the first target block is fully written, the storage device writes effective data of a second source block into the second target block;
or,
if the number of the current empty blocks is larger than a preset threshold value and the first target block is not fully written, the storage device writes second filling data into the first target block;
or,
and if the number of the current empty blocks is larger than a preset threshold value and the first target block is fully written, stopping garbage collection by the storage equipment.
4. The method of any of claims 1 to 3, wherein the storage device writes valid data after a first target block of data, the method further comprising:
and the storage equipment updates a logical-physical mapping table corresponding to the effective data.
5. The method according to any one of claims 1 to 3, further comprising:
the storage equipment acquires a garbage recycling stop signal;
and if the first target block is not full, the storage device writes third filling data into the first target block according to the garbage collection stopping signal.
6. A storage device, comprising:
a write-in unit, configured to write effective data in a first target data block, where a logical address LBA and a physical address PBA of the effective data are effective addresses; and writing first filling data into a residual storage space of the first target block except the valid data within a preset time length if the first target block is not fully written, wherein LBA and PBA of the first filling data are invalid addresses.
7. The storage device of claim 6, further comprising:
the determining unit is used for determining a first source block and a first target block when garbage collection is carried out;
the writing unit is specifically configured to write valid data of the first source block into the first target block;
and the erasing unit is used for erasing the first source block to obtain a target empty block.
8. The storage device of claim 7, wherein the storage device comprises a current empty block, wherein the current empty block comprises the target empty block,
the writing unit is further configured to write valid data of a second source block into the first target block within the preset time length if the number of the current empty blocks is less than or equal to a preset threshold and the first target block is not fully written; if the number of the current empty blocks is smaller than or equal to a preset threshold value and the first target block is fully written, writing effective data of a second source block into the second target block; if the number of the current empty blocks is larger than a preset threshold value and the first target block is not full, writing second filling data into the first target block;
the storage device further includes:
and the stopping unit is used for stopping garbage recovery if the number of the current empty blocks is greater than a preset threshold value and the first target block is fully written.
9. The storage device according to any one of claims 6 to 8, further comprising:
and the updating unit is used for updating the logical-physical mapping table corresponding to the effective data.
10. The storage device according to any one of claims 6 to 8, further comprising:
an acquisition unit for acquiring a garbage collection stop signal;
the writing unit is further configured to write third filling data in the first target block according to the garbage collection stop signal if the first target block is not full.
CN201810820831.1A 2018-07-24 2018-07-24 Data storage method and storage equipment Pending CN109032519A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810820831.1A CN109032519A (en) 2018-07-24 2018-07-24 Data storage method and storage equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810820831.1A CN109032519A (en) 2018-07-24 2018-07-24 Data storage method and storage equipment

Publications (1)

Publication Number Publication Date
CN109032519A true CN109032519A (en) 2018-12-18

Family

ID=64644760

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810820831.1A Pending CN109032519A (en) 2018-07-24 2018-07-24 Data storage method and storage equipment

Country Status (1)

Country Link
CN (1) CN109032519A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102841851A (en) * 2012-07-19 2012-12-26 深圳市江波龙电子有限公司 Flash memory management method and flash memory device
CN105260325A (en) * 2014-07-17 2016-01-20 广明光电股份有限公司 Method for collecting garbage blocks in solid state disks
CN105677244A (en) * 2015-12-31 2016-06-15 记忆科技(深圳)有限公司 Solid state disk write amplification method capable of reducing TLC flash memory
US20170075805A1 (en) * 2015-09-10 2017-03-16 HoneycombData Inc. Garbage collection in ssd drives
CN106528000A (en) * 2016-12-02 2017-03-22 郑州云海信息技术有限公司 Data storage device and read-write performance optimization method and system thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102841851A (en) * 2012-07-19 2012-12-26 深圳市江波龙电子有限公司 Flash memory management method and flash memory device
CN105260325A (en) * 2014-07-17 2016-01-20 广明光电股份有限公司 Method for collecting garbage blocks in solid state disks
US20170075805A1 (en) * 2015-09-10 2017-03-16 HoneycombData Inc. Garbage collection in ssd drives
CN105677244A (en) * 2015-12-31 2016-06-15 记忆科技(深圳)有限公司 Solid state disk write amplification method capable of reducing TLC flash memory
CN106528000A (en) * 2016-12-02 2017-03-22 郑州云海信息技术有限公司 Data storage device and read-write performance optimization method and system thereof

Similar Documents

Publication Publication Date Title
US11593259B2 (en) Directed sanitization of memory
US10657047B2 (en) Data storage device and method of performing partial garbage collection
JP5418808B2 (en) Adaptive hybrid density memory storage control method and adaptive hybrid density memory storage
TWI632457B (en) Method of wear leveling for data storage device
US9747202B1 (en) Storage module and method for identifying hot and cold data
CN110908925B (en) High-efficiency garbage collection method, data storage device and controller thereof
US20170262176A1 (en) Storage system, information processing system and method for controlling nonvolatile memory
TWI385669B (en) Wear leveling method and storage system and controller using the same
US9582416B2 (en) Data erasing method, memory control circuit unit and memory storage apparatus
US8174912B2 (en) Systems and methods for circular buffering control in a memory device
US9176865B2 (en) Data writing method, memory controller, and memory storage device
US8825946B2 (en) Memory system and data writing method
US8516184B2 (en) Data updating using mark count threshold in non-volatile memory
US10990325B2 (en) Write control method, associated data storage device and controller thereof
KR101718713B1 (en) Non-volatile memory system
CN107817943A (en) Data transmission method, memory storage apparatus and memorizer control circuit unit
CN113885808A (en) Mapping information recording method, memory control circuit unit and memory device
US20200097215A1 (en) Adaptive solid state device management based on data expiration time
US9501397B2 (en) Data writing method, memory controller, and memory storage apparatus
TW201537577A (en) Data writing method, memory control circuit unit and memory storage apparatus
US10346040B2 (en) Data merging management method based on data type, memory storage device and memory control circuit unit
CN107015764B (en) Data processing method and device for Nand flash and Nand flash
CN109032519A (en) Data storage method and storage equipment
US10896004B2 (en) Data storage device and control method for non-volatile memory, with shared active block for writing commands and internal data collection
TW202013183A (en) High efficiency garbage collection method, and associated data storage device and controller thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20181218

RJ01 Rejection of invention patent application after publication