CN108959118B - Data writing method and device - Google Patents

Data writing method and device Download PDF

Info

Publication number
CN108959118B
CN108959118B CN201810675600.6A CN201810675600A CN108959118B CN 108959118 B CN108959118 B CN 108959118B CN 201810675600 A CN201810675600 A CN 201810675600A CN 108959118 B CN108959118 B CN 108959118B
Authority
CN
China
Prior art keywords
target storage
data
target
storage device
blocks
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.)
Active
Application number
CN201810675600.6A
Other languages
Chinese (zh)
Other versions
CN108959118A (en
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology 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 Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201810675600.6A priority Critical patent/CN108959118B/en
Publication of CN108959118A publication Critical patent/CN108959118A/en
Application granted granted Critical
Publication of CN108959118B publication Critical patent/CN108959118B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a data writing method and device, which are used for improving the influence of garbage recovery efficiency on user writing performance in a storage device. The method comprises the following steps: judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, wherein the target storage equipment is storage equipment of data to be written; if yes, starting garbage collection on the target storage equipment; acquiring a target speed of garbage collection, wherein the target speed is an erasing speed of invalid data in the target storage equipment; judging whether the target speed is higher than a second threshold value; and when the target speed is lower than the second threshold value, writing the data to be written into the blocks in the target storage pool, wherein the target storage pool is preset, the target storage pool comprises at least one block which does not write data, and the at least one block which does not write data is a block in the target storage device.

Description

Data writing method and device
Technical Field
The present invention relates to the field of storage, and in particular, to a method and an apparatus for writing data.
Background
The solid state disk is composed of a main control unit and a solid state storage unit, and the solid state storage unit comprises a plurality of blocks, namely data blocks. Because the solid state disk has no rewriting mechanism, after a Block is full of data, the data in the Block needs to be erased, and new data can be written.
While the erase operation is very time consuming. In consideration of efficiency, when a user writes the same logical address, the solid state disk actually writes the same logical address into different physical addresses, which causes the situation that invalid data exists on an original address, and garbage collection is required to improve the space utilization rate.
Garbage collection is a data transfer technique for transferring valid data in a block in which invalid data and valid data are mixed to a new block in order to collect an available space, thereby freeing up the space occupied by the invalid data. However, the valid data of garbage collection and movement is closely related to the data writing mode of the user, and is difficult to predict, so that the speed of garbage collection and block recovery is suddenly fast and slow. When the storage space of the solid state disk is insufficient, a user writing operation needs garbage collection to provide a space, the garbage collection needs to write previous user data, and data writing needs to wait for the space given by the garbage collection, so that the writing performance of the user is affected by the garbage collection.
Disclosure of Invention
The embodiment of the invention provides a data writing method and device, which are used for improving the influence of garbage recovery efficiency on user writing performance in a storage device.
A first aspect of an embodiment of the present invention provides a data writing method, which is applied to a storage device, and specifically includes:
judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, wherein the target storage equipment is storage equipment of data to be written;
if yes, starting garbage collection on the target storage equipment;
acquiring a target speed of garbage collection, wherein the target speed is an erasing speed of invalid data in the target storage equipment;
judging whether the target speed is higher than a second threshold value;
and when the target speed is lower than the second threshold value, writing the data to be written into the blocks in the target storage pool, wherein the target storage pool is preset, the target storage pool comprises at least one block which does not write data, and the at least one block which does not write data is a block in the target storage device.
Optionally, before determining whether the space of unwritten data in the target storage device is smaller than the first threshold, the method further includes:
when the target storage device is initialized, the target storage pool having an association relationship with the target storage device is established.
Optionally, when the target speed is higher than the second threshold, the method further comprises:
and storing a preset number of blocks into a target storage pool, wherein the preset number of blocks are blocks of which data are not written in the target storage device.
Optionally, the initial number of blocks in the target storage pool has an associated relationship with the number of blocks of the reserved region of the target storage device.
A second aspect of the embodiments of the present invention provides a data writing apparatus, which is applied to a storage device, and specifically includes:
the first judging unit is used for judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, and the target storage equipment is storage equipment of data to be written;
the starting unit is used for starting garbage collection on the target storage device when the space of unwritten data in the target storage device is smaller than the first threshold;
an obtaining unit, configured to obtain a target speed of garbage collection, where the target speed is an erasing speed of invalid data in the target storage device;
a second judgment unit configured to judge whether the target speed is higher than a second threshold;
and a writing unit, configured to write the data to be written into a block in a target storage pool when the target speed is lower than the second threshold, where the target storage pool is preset, and the target storage pool includes at least one block in which data is not written, and the at least one block in which data is not written is a block in the target storage device.
Optionally, the apparatus further comprises:
an establishing unit, configured to establish the target storage pool having an association relationship with the target storage device when the target storage device is initialized.
Optionally, the apparatus further comprises:
and the storage unit is used for storing a preset number of blocks into a target storage pool when the target speed is higher than the second threshold, wherein the preset number of blocks are blocks of which data are not written in the target storage device.
Optionally, the initial number of blocks in the target storage pool has an associated relationship with the number of blocks of the reserved region of the target storage device.
A third aspect of embodiments of the present invention provides a processor for executing a computer program, where the computer program executes to perform the steps of the method according to the above aspects.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that: the computer program, when executed by a processor, performs the steps of the method of the aspects described above.
It can be seen from the foregoing technical solutions that, in the embodiment of the present invention, when data needs to be written to the target storage device and a space of the target storage device where the data is not written is smaller than the first threshold, garbage collection may be started, at this time, a target speed of the garbage collection may be obtained, and when the target speed is lower than the second threshold, the data to be written is written into the block in the target storage pool. In summary, since the target resource pool is set in the target storage device in advance, when the garbage collection speed is lower than the second threshold, the data to be written is directly written into the block in the target storage pool, so that the influence of the garbage collection efficiency lower than the second threshold on the writing performance of the user can be buffered.
Drawings
Fig. 1 is a schematic diagram illustrating an embodiment of a method for writing data according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an embodiment of a data writing apparatus according to the present invention;
fig. 3 is a schematic hardware structure diagram of a data writing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an embodiment of an electronic device according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a computer-readable storage medium according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a data writing method and related equipment, which are used for buffering the influence of low garbage recovery efficiency on the writing performance of a user.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The following describes a method of writing data from the perspective of a data writing device, which may be a server or a functional unit in the server, and is not particularly limited.
Referring to fig. 1, fig. 1 is a schematic diagram of an embodiment of a data writing method according to an embodiment of the present invention, including:
101. and judging whether the space of unwritten data in the target storage device is smaller than a first threshold, if so, executing the step 102, and if not, executing the step 106.
In this embodiment, when data needs to be written to a target storage device (for example, a solid state disk), at this time, a space of unwritten data in the target storage device may be first obtained, and it is determined whether the space of unwritten data in the target storage device is smaller than a first threshold (for example, 100M), if yes, step 102 is executed, and if no, step 106 is executed. The target storage device is a storage device to which data is to be written, that is, it is necessary to determine whether a storage space in the target storage device is sufficient before writing the data.
102. And starting garbage collection on the target storage device.
In this embodiment, when it is determined that the space of unwritten data in the target storage device is smaller than the first threshold, garbage collection is started for the target storage device, where garbage collection is a data moving technology for moving valid data in a block in which invalid data and valid data are mixed to a new block in order to collect an available space, so as to vacate a space occupied by the invalid data. That is, garbage collection is a technique of moving valid data in a block to a new block and erasing invalid data in the original block.
103. And acquiring the target speed of garbage recovery.
In this embodiment, a target speed of garbage collection may be obtained, where the target speed is an erasing speed of an invalid speed in a target storage device, and the target speed is closely related to a mode of writing data by a user, that is, if data stored in the storage device is dispersed into all blocks, that is, there is a possibility that invalid data exists in each block, when garbage collection is performed, a time for releasing a new block is relatively long, and a corresponding target speed is relatively low. Here, the mode of acquiring the target speed of garbage collection is not particularly limited.
104. And judging whether the target speed is higher than a second threshold value, if so, executing step 106, and if not, executing step 105.
In this embodiment, after the target speed for garbage collection is acquired, it may be determined whether the target speed is higher than a second threshold, when the target speed is higher than the second threshold, step 106 is executed, and when the target speed is lower than the second threshold, step 105 is executed.
105. And writing the data to be written into the blocks of the target storage pool.
In this embodiment, when the target speed is lower than the second threshold, the data to be written may be written into a block in the target storage, where the target storage pool is preset, and the target storage includes at least one block in which data is not written, and the at least one block in which data is not written is a block in the target storage device.
It should be noted that, when the target storage device is initialized, the target storage pool having an association relationship with the target storage device is established. That is, when the target storage device is initialized, all blocks in the target storage device are numbered, and a part of the numbers are taken out to form the target storage pool. The target storage pool is only a number logically comprising blocks, and the blocks in the target storage device are actually still in place. That is, in step 105, the data to be written is written into the block corresponding to the number stored in the target storage pool.
It is further noted that the initial number of blocks in the target storage pool has an associated relationship with the number of blocks in the reserved area of the target storage device. The target storage device comprises two areas, wherein the first area is a reserved area, the second area is a user area, the space of the reserved area is a space which is not open to a user and is used for storing data required by the operation of some storage devices, and the space of the user area is a space which is open to the user, namely the size of the space displayed by the storage devices in practice. The number of initial blocks in the target storage pool has an associated relationship with the reserved area, and if the reserved area occupies 1/5 of the target storage device space, the number of blocks in the target storage pool may be set to 20. The above values are for illustration and do not represent a limitation on the number of blocks in the reserved area and the target storage device.
106. Other operations are performed.
In this embodiment, when the space of the unwritten data in the target storage device is larger than the first threshold, the data to be written may be directly written into the target storage device. When the target speed is higher than the second threshold, a preset number of blocks may be stored in the target storage pool, where the preset number of blocks are blocks in the target storage device for which data is not written. That is, when the efficiency of garbage collection is higher than the second threshold, which is set to have an association relationship with the data writing speed of the target storage device, for example, the second threshold is the same as the data writing speed of the target storage device (although other settings may be used, here, the second threshold is set to be the same as the target storage device), when the target speed is higher than the second threshold, that is, the garbage collection speed is higher than the data writing speed, the numbers of some blocks in the target storage device that have not written data can be put into the target storage pool for standby at this time, so as to prevent the numbers of the blocks in the target storage pool from being taken out for use by the user when the garbage collection speed is low at the time of subsequent data writing.
In summary, in the embodiment of the present invention, because the target storage pool is set in advance in the target storage device, when the speed of garbage collection is lower than the second threshold, the data to be written is directly written into the block in the target storage pool, and when the speed of garbage collection is higher than the second threshold, a part of the blocks without writing data can be placed into the target storage pool, so as to prevent the number of the blocks in the target storage pool from being taken out for the user to use when the speed of garbage collection is low during subsequent data writing, thereby buffering the influence of the garbage collection efficiency on the performance of the data written by the user.
The embodiments of the present invention are described above from the viewpoint of a method of data writing, and the embodiments of the present invention are described below from the viewpoint of a data writing apparatus.
Referring to fig. 2, fig. 2 is a schematic diagram of an embodiment of a data writing apparatus according to an embodiment of the present invention, the data writing apparatus is applied to a storage device, and includes:
a first judging unit 201, configured to judge whether a space in a target storage device, where data is not written, is smaller than a first threshold, where the target storage device is a storage device to which data is to be written;
a starting unit 202, configured to start garbage collection for the target storage device when a space where data is not written in the target storage device is smaller than the first threshold;
an obtaining unit 203, configured to obtain a target speed of garbage collection, where the target speed is an erasing speed of invalid data in the target storage device;
a second judging unit 204, configured to judge whether the target speed is higher than a second threshold;
a writing unit 205, configured to write the data to be written into a block in a target storage pool when the target speed is lower than the second threshold, where the target storage pool is preset, and the target storage pool includes at least one block in which data is not written, and the at least one block in which data is not written is a block in the target storage device.
Optionally, the apparatus further comprises:
an establishing unit 206, configured to establish the target storage pool having an association relationship with the target storage device when the target storage device is initialized.
Optionally, the apparatus further comprises:
and a storage unit 207, configured to store a preset number of blocks into the target storage pool when the target speed is higher than the second threshold, where the preset number of blocks is a block in which data is not written in the target storage device.
Optionally, the initial number of blocks in the target storage pool has an associated relationship with the number of blocks of the reserved region of the target storage device.
The interaction manner among the units of the data writing device in this embodiment is as described in the embodiment shown in fig. 1, and is not described herein again.
In summary, in the embodiment of the present invention, because the target storage pool is set in advance in the target storage device, when the speed of garbage collection is lower than the second threshold, the data to be written is directly written into the block in the target storage pool, and when the speed of garbage collection is higher than the second threshold, a part of the blocks without writing data can be placed into the target storage pool, so as to prevent the number of the block in the target storage pool from being taken out for the user to use when the speed of garbage collection is low during subsequent data writing, thereby buffering the influence of the garbage collection efficiency on the performance of the data written by the user.
The data writing device in the embodiment of the present invention is described above from the perspective of the modular functional entity, and the data writing device in the embodiment of the present invention is described below from the perspective of hardware processing.
Referring to fig. 3, an embodiment of a data writing apparatus 300 according to the embodiment of the present invention includes:
an input device 301, an output device 302, a processor 303 and a memory 304 (wherein the number of the processor 303 may be one or more, and one processor 303 is taken as an example in fig. 3). In some embodiments of the present invention, the input device 301, the output device 302, the processor 303 and the memory 304 may be connected by a bus or other means, wherein the connection by the bus is exemplified in fig. 3.
Wherein, by calling the operation instruction stored in the memory 304, the processor 303 is configured to perform the following steps:
judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, wherein the target storage equipment is storage equipment of data to be written;
if yes, starting garbage collection on the target storage equipment;
acquiring a target speed of garbage collection, wherein the target speed is an erasing speed of invalid data in the target storage equipment;
judging whether the target speed is higher than a second threshold value;
and when the target speed is lower than the second threshold value, writing the data to be written into the blocks in the target storage pool, wherein the target storage pool is preset, the target storage pool comprises at least one block which does not write data, and the at least one block which does not write data is a block in the target storage device.
Optionally, before determining whether a space of unwritten data in a target storage device is smaller than a first threshold, when the target storage device is initialized, the target storage pool having an association relationship with the target storage device is established.
Optionally, when the target speed is higher than the second threshold, storing a preset number of blocks into a target storage pool, where the preset number of blocks is a block in the target storage device to which data is not written.
Optionally, the initial number of blocks in the target storage pool has an associated relationship with the number of blocks of the reserved region of the target storage device.
Referring to fig. 4, fig. 4 is a schematic view of an embodiment of an electronic device according to an embodiment of the invention.
As shown in fig. 4, an embodiment of the present invention provides an electronic device 400, which includes a memory 410, a processor 420, and a computer program 411 stored in the memory 410 and executable on the processor 420, and when the processor 420 executes the computer program 411, the following steps are implemented:
judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, wherein the target storage equipment is storage equipment of data to be written;
if yes, starting garbage collection on the target storage equipment;
acquiring a target speed of garbage collection, wherein the target speed is an erasing speed of invalid data in the target storage equipment;
judging whether the target speed is higher than a second threshold value;
and when the target speed is lower than the second threshold value, writing the data to be written into the blocks in the target storage pool, wherein the target storage pool is preset, the target storage pool comprises at least one block which does not write data, and the at least one block which does not write data is a block in the target storage device.
In a specific implementation, when the processor 420 executes the computer program 411, any of the embodiments corresponding to fig. 1 may be implemented.
Since the electronic device described in this embodiment is a device used for implementing the method for writing data in the embodiment of the present invention, based on the method described in this embodiment of the present invention, a person skilled in the art can understand the specific implementation manner of the electronic device of this embodiment and various variations thereof, so that how to implement the method in the embodiment of the present invention by the electronic device is not described in detail herein, and as long as the person skilled in the art implements the device used for implementing the method in the embodiment of the present invention, the device used for implementing the method in the embodiment of the present invention belongs to the protection scope of the present invention.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating an embodiment of a computer-readable storage medium according to the present invention.
As shown in fig. 5, the present embodiment provides a computer-readable storage medium 500 having a computer program 511 stored thereon, the computer program 511 implementing the following steps when executed by a processor:
judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, wherein the target storage equipment is storage equipment of data to be written;
if yes, starting garbage collection on the target storage equipment;
acquiring a target speed of garbage collection, wherein the target speed is an erasing speed of invalid data in the target storage equipment;
judging whether the target speed is higher than a second threshold value;
and when the target speed is lower than the second threshold value, writing the data to be written into the blocks in the target storage pool, wherein the target storage pool is preset, the target storage pool comprises at least one block which does not write data, and the at least one block which does not write data is a block in the target storage device.
In a specific implementation, the computer program 511 may implement any of the embodiments corresponding to fig. 1 when executed by a processor.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the apparatus and the module described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), block flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other matching elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present invention, and are not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (8)

1. A method for writing data is applied to a storage device, and is characterized by comprising the following steps:
judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, wherein the target storage equipment is storage equipment of data to be written;
if yes, starting garbage collection on the target storage equipment;
acquiring a target speed of garbage collection, wherein the target speed is an erasing speed of invalid data in the target storage equipment;
judging whether the target speed is higher than a second threshold value;
when the target speed is lower than the second threshold value, writing the data to be written into a block in a target storage pool, wherein the target storage pool is preset and comprises at least one block which does not write data, and the at least one block which does not write data is a block in the target storage device;
and when the target speed is higher than the second threshold value, storing a preset number of blocks into a target storage pool, wherein the preset number of blocks are blocks of which data are not written in the target storage device.
2. The method of claim 1, wherein before determining whether the space of unwritten data in the target storage device is less than a first threshold, the method further comprises:
when the target storage device is initialized, the target storage pool having an association relationship with the target storage device is established.
3. The method of claim 1 or 2, wherein the initial number of blocks in the target storage pool has an associated relationship with the number of blocks in the reserved area of the target storage device.
4. A data writing apparatus applied to a storage device, comprising:
the first judging unit is used for judging whether the space of unwritten data in target storage equipment is smaller than a first threshold value, and the target storage equipment is storage equipment of data to be written;
the starting unit is used for starting garbage collection on the target storage device when the space of unwritten data in the target storage device is smaller than the first threshold;
an obtaining unit, configured to obtain a target speed of garbage collection, where the target speed is an erasing speed of invalid data in the target storage device;
a second judgment unit configured to judge whether the target speed is higher than a second threshold;
a writing unit, configured to write the data to be written into a block in a target storage pool when the target speed is lower than the second threshold, where the target storage pool is preset, and the target storage pool includes at least one block in which data is not written, and the at least one block in which data is not written is a block in the target storage device;
and the storage unit is used for storing a preset number of blocks into a target storage pool when the target speed is higher than the second threshold, wherein the preset number of blocks are blocks of which data are not written in the target storage device.
5. The apparatus of claim 4, further comprising:
an establishing unit, configured to establish the target storage pool having an association relationship with the target storage device when the target storage device is initialized.
6. The apparatus of claim 4 or 5, wherein the initial number of blocks in the target storage pool has an associated relationship with the number of blocks of the reserved region of the target storage device.
7. A processor for executing a computer program, the computer program executing the method according to any one of claims 1 to 3.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program realizing the steps of the method according to any one of claims 1 to 3 when executed by a processor.
CN201810675600.6A 2018-06-27 2018-06-27 Data writing method and device Active CN108959118B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810675600.6A CN108959118B (en) 2018-06-27 2018-06-27 Data writing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810675600.6A CN108959118B (en) 2018-06-27 2018-06-27 Data writing method and device

Publications (2)

Publication Number Publication Date
CN108959118A CN108959118A (en) 2018-12-07
CN108959118B true CN108959118B (en) 2021-11-19

Family

ID=64487301

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810675600.6A Active CN108959118B (en) 2018-06-27 2018-06-27 Data writing method and device

Country Status (1)

Country Link
CN (1) CN108959118B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857337B (en) * 2018-12-10 2022-04-22 浪潮(北京)电子信息产业有限公司 Writing speed control method, system, device and readable storage medium
CN111949560B (en) * 2019-05-16 2024-01-23 兆易创新科技集团股份有限公司 Data writing method and device and storage equipment
CN111949200A (en) * 2019-05-17 2020-11-17 北京兆易创新科技股份有限公司 Memory and control method and control device thereof
CN110515917B (en) * 2019-08-09 2022-12-02 苏州浪潮智能科技有限公司 Method, device and medium for controlling reconstruction speed
CN111880730B (en) * 2020-07-17 2022-07-05 北京浪潮数据技术有限公司 Method, device, equipment and medium for adjusting write IO of full flash memory array

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106155935A (en) * 2016-07-05 2016-11-23 深圳市瑞耐斯技术有限公司 The rubbish recovering method of solid state hard disc flash memory and device
CN106354660A (en) * 2016-08-30 2017-01-25 深圳市先天海量信息技术有限公司 Trash recycling method and device for solid-state storage equipment
CN106681935A (en) * 2016-12-29 2017-05-17 郑州云海信息技术有限公司 Trash recycling method for solid state disk
CN107145450A (en) * 2017-03-24 2017-09-08 深圳市江波龙电子有限公司 Video monitoring data storage method and device
CN107506136A (en) * 2017-08-07 2017-12-22 成都华为技术有限公司 A kind of method and apparatus of garbage reclamation

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8266503B2 (en) * 2009-03-13 2012-09-11 Fusion-Io Apparatus, system, and method for using multi-level cell storage in a single-level cell mode
US9146862B2 (en) * 2013-07-18 2015-09-29 International Business Machines Corporation Optimizing memory usage across multiple garbage collected computer environments

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106155935A (en) * 2016-07-05 2016-11-23 深圳市瑞耐斯技术有限公司 The rubbish recovering method of solid state hard disc flash memory and device
CN106354660A (en) * 2016-08-30 2017-01-25 深圳市先天海量信息技术有限公司 Trash recycling method and device for solid-state storage equipment
CN106681935A (en) * 2016-12-29 2017-05-17 郑州云海信息技术有限公司 Trash recycling method for solid state disk
CN107145450A (en) * 2017-03-24 2017-09-08 深圳市江波龙电子有限公司 Video monitoring data storage method and device
CN107506136A (en) * 2017-08-07 2017-12-22 成都华为技术有限公司 A kind of method and apparatus of garbage reclamation

Also Published As

Publication number Publication date
CN108959118A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN108959118B (en) Data writing method and device
US11106579B2 (en) System and method to manage and share managed runtime memory for java virtual machine
US8793427B2 (en) Remote memory for virtual machines
CN108763099A (en) Startup method, apparatus, electronic equipment and the storage medium of system
CN109753443B (en) Data processing method and device and electronic equipment
CN107608609B (en) Event object sending method and device
CN109033365B (en) Data processing method and related equipment
CN101706788A (en) Cross-area access method for embedded file system
CN106201652A (en) A kind of data processing method and virtual machine
CN106919620B (en) Single page processing method and device
CN104104705A (en) Access method and device of distributed storage system
KR101996641B1 (en) Apparatus and method for memory overlay
US9870400B2 (en) Managed runtime cache analysis
CN102508743B (en) Multi-point backup and real-time protection method for Linux file system
CN108228332B (en) Object pool access method and device
CN103678478A (en) Information processing apparatus, information processing method, and program
CN110058938B (en) Memory processing method and device, electronic equipment and readable medium
CN106202262B (en) Information processing method and electronic equipment
CN107766385B (en) Method and equipment for converting file format of virtual disk
US9600415B1 (en) Method, apparatus, and computer program stored in computer readable medium for managing storage server in database system
KR20190069134A (en) Apparatus and method for file sharing between applications
CN109508446B (en) Log processing method and device
CN109582938B (en) Report generation method and device
CN106021124A (en) Data storage method and data storage system
CN106201344B (en) Information processing method and electronic equipment

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
GR01 Patent grant
GR01 Patent grant