CN112379830A - Method and device for creating effective data bitmap, storage medium and electronic equipment - Google Patents

Method and device for creating effective data bitmap, storage medium and electronic equipment Download PDF

Info

Publication number
CN112379830A
CN112379830A CN202011208745.9A CN202011208745A CN112379830A CN 112379830 A CN112379830 A CN 112379830A CN 202011208745 A CN202011208745 A CN 202011208745A CN 112379830 A CN112379830 A CN 112379830A
Authority
CN
China
Prior art keywords
effective data
data bitmap
solid state
state disk
memory buffer
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.)
Granted
Application number
CN202011208745.9A
Other languages
Chinese (zh)
Other versions
CN112379830B (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.)
Chengdu Baiwei Storage Technology Co ltd
Original Assignee
Chengdu Baiwei Storage 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 Chengdu Baiwei Storage Technology Co ltd filed Critical Chengdu Baiwei Storage Technology Co ltd
Priority to CN202011208745.9A priority Critical patent/CN112379830B/en
Publication of CN112379830A publication Critical patent/CN112379830A/en
Application granted granted Critical
Publication of CN112379830B publication Critical patent/CN112379830B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
    • 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/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • 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/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0658Controller construction arrangements
    • 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]

Abstract

The invention discloses a method and a device for creating an effective data bitmap, a readable storage medium and electronic equipment, wherein all effective data bitmaps in a flash memory of a solid state disk are loaded into an HMB of the solid state disk, each time a mapping table is updated, the effective data bitmap corresponding to a host memory buffer is updated, the effective data bitmap corresponding to the HMB is updated while the mapping table is updated by utilizing the advantage of high HMB access speed, and after a garbage recovery request is received, the effective data bitmap corresponding to the garbage recovery is acquired from the HMB and loaded into a controller memory of the solid state disk, so that the creation of the effective data bitmap is realized, the efficiency of creating the effective data bitmap is greatly improved, and the problem that the effective data bitmap is created in a mode of scanning the mapping table in the garbage recovery process to cause the overlong garbage recovery time, The problem of low efficiency, and the efficiency of garbage recovery of the memory is greatly improved.

Description

Method and device for creating effective data bitmap, storage medium and electronic equipment
Technical Field
The present invention relates to the field of memory data management, and in particular, to a method and an apparatus for creating an effective data bitmap, a readable storage medium, and an electronic device.
Background
In a Dynamic Random Access Memory (DRAM-less) type Solid State Disk (SSD) product, since a controller Memory space of the DRAM-less type product is smaller than a general Solid State Disk controller Memory space, when a controller Memory of a Solid State Disk is smaller than a hard Disk storage capacity, a time space changing means is generally used to reasonably utilize a space when the Solid State Disk is garbage-recovered. In the case of time-space conversion, a Valid data Bitmap (VBMP) is usually used for garbage processing, and units for garbage collection are super blocks, so each super block needs to correspond to one VBMP, and Valid data can be found in the garbage collection process for moving.
Assuming that a NAND (a computer flash memory device) has 1000 superblocks, each superblock has 32 blocks (data blocks), each block has 768 pages (data pages), and one page is 16k, assuming that mapping is performed with 4k as a basic data unit, the number of data units of one superblock is: 32 x 768 x 4 ═ 98304. VBMP one bit is used to indicate whether data of one 4k data unit is valid, so that one VBMP size is 98304/8-12288 Byte, and VBMP size of 1000 superblocks is 12288-1000-12288000 Byte, i.e. VBMP of 1000 superblocks requires approximately 12M memory space. However, for the Dram-less solid state disk, the memory space is generally about 5M, so there is no way to put down all VBMPs.
Therefore, at present, after determining a super block requiring garbage collection, data with a physical address on the super block is found out by scanning mapping of a mapping table, and a bit of a VBMP corresponding to the physical address is marked as valid. However, this method of creating the superblock VBMP to be reclaimed by scanning the mapping table may account for 20% of the time of the whole garbage reclamation process, resulting in inefficient garbage reclamation.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method and the device for creating the effective data bitmap, the readable storage medium and the electronic equipment are provided, and the garbage recycling efficiency is improved.
In order to solve the technical problems, the invention adopts the technical scheme that:
a method for creating a valid data bitmap includes the steps:
loading effective data bitmaps corresponding to each super block in a flash memory of a solid state disk into a host memory buffer of the solid state disk;
when the mapping table is updated, updating the corresponding effective data bitmap in the memory buffer of the host;
receiving a garbage collection request, and determining a target super block corresponding to garbage collection according to the garbage collection request;
and loading the effective data bitmap corresponding to the target super block in the host memory buffer into a controller memory of the solid state disk.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
an apparatus for creating a valid data bitmap, comprising:
the loading module is used for loading the effective data bitmap corresponding to each super block in the flash memory of the solid state disk into a host memory buffer of the solid state disk;
the updating module is used for updating the corresponding effective data bitmap in the host memory buffer when the mapping table is updated;
the receiving module is used for receiving a garbage collection request and determining a target super block corresponding to garbage collection according to the garbage collection request;
and the creating module is used for loading the effective data bitmap corresponding to the target super block in the host memory buffer into the controller memory of the solid state disk.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the above-mentioned method of creating a valid data bitmap.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
an electronic device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the steps of the method for creating the effective data bitmap.
The invention has the beneficial effects that: all effective data bitmaps in a flash Memory of the solid state disk are loaded into a Host Memory Buffer (HMB) of the solid state disk, and when a mapping table is updated each time, updating the effective data bitmap corresponding to the memory buffer of the host computer, utilizing the advantage of high access speed of the HMB and updating the corresponding effective data bitmap in the HMB while updating the mapping table, after receiving the garbage collection request, only the corresponding effective data bitmap is acquired from the HMB according to the target superblock corresponding to garbage collection and is loaded into the controller memory of the solid state disk, namely, the creation of the effective data bitmap is realized, thereby greatly improving the efficiency of creating the effective data bitmap, avoiding the creation of the effective data bitmap by using a scanning mapping table in the garbage recycling process, the problems of overlong recovery time and low efficiency of the whole garbage are caused, and the garbage recovery efficiency is greatly improved.
Drawings
FIG. 1 is a flowchart illustrating steps of creating an effective data bitmap according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an effective data bitmap creation apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
FIG. 4 is a distribution diagram of VBMP of a super block according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a mapping table update according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a data write of a first model in an update mapping table according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating a data write of a second model in an update mapping table according to an embodiment of the present invention.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
As shown in fig. 1, an embodiment of the present invention provides a method for creating an effective data bitmap, including the steps of:
loading effective data bitmaps corresponding to each super block in a flash memory of a solid state disk into a host memory buffer of the solid state disk;
when the mapping table is updated, updating the corresponding effective data bitmap in the memory buffer of the host;
receiving a garbage collection request, and determining a target super block corresponding to garbage collection according to the garbage collection request;
and loading the effective data bitmap corresponding to the target super block in the host memory buffer into a controller memory of the solid state disk.
As can be seen from the above description, the beneficial effects of the present invention are: the method comprises the steps of loading all effective data bitmaps in a flash memory of a solid state disk into an HMB of the solid state disk, updating the effective data bitmaps corresponding to a host memory buffer when a mapping table is updated every time, acquiring the corresponding effective data bitmaps from the HMB according to target superblocks corresponding to garbage recovery after a garbage recovery request is received, and loading the effective data bitmaps into a controller memory of the solid state disk, so that the effective data bitmaps are created, the problems that the whole garbage recovery time is too long and the efficiency is low due to the fact that the effective data bitmaps are created in a mode of scanning the mapping table in the garbage recovery process are solved, and the garbage recovery efficiency of a memory is greatly improved.
Further, when updating the mapping table, updating the corresponding valid data bitmap in the host memory buffer includes:
determining an old physical address and a new physical address corresponding to the logical address from the mapping table according to the currently written logical address;
marking the bit of the corresponding effective data bitmap in the host memory buffer as a first preset value according to the old physical address;
marking the bit of the corresponding effective data bitmap in the host memory buffer as a second preset value according to the new physical address;
the first preset value is different from the second preset value.
It can be known from the description that, when the mapping table is updated, the bits on the effective data bitmap in the host memory buffer are marked and updated, the effective data bitmap in the host memory buffer is updated in time, and the effective data bitmap is updated while data is written, so that the controller of the solid state disk can directly acquire the latest effective data bitmap during garbage collection, thereby avoiding scanning the mapping table during garbage collection and improving the garbage collection efficiency.
Further, the loading the effective data bitmap corresponding to each super block in the flash memory of the solid state disk into the host memory buffer of the solid state disk includes:
sequentially reading effective data bitmaps corresponding to each super block in a flash memory of the solid state disk and storing the effective data bitmaps into a controller memory of the solid state disk;
and sending a host memory buffer write command to write the effective data bitmap corresponding to each super block into the host memory buffer.
As can be seen from the above description, the effective data bitmap of each superblock is read out and stored in the controller memory of the solid state disk, and then the effective data bitmap in the memory is written into the host memory buffer by the write command, so that the effective data bitmaps of all superblocks are reliably and effectively loaded into the host memory buffer.
Further, determining the size of the effective data bitmap which is read out each time and stored in the controller memory of the solid state disk according to the size of the controller memory buffer of the solid state disk;
and writing the stored corresponding effective data bitmap into the host memory buffer after the effective data bitmap is stored in the controller memory of the solid state disk once, and executing the operation of reading and storing the effective data bitmap for the next time until the effective data bitmap corresponding to each super block in the solid state disk is written into the host memory buffer.
It can be known from the above description that reading and writing are performed according to the size of the memory buffer of the controller of the current storage, so that the problem that corresponding reading and writing operations cannot be performed due to insufficient memory buffer when the data volume is too large is avoided, the data reading and writing process can be ensured to be normally operated, the problem that the memory size is smaller than the size of all effective data bitmaps is solved through multiple times of carrying, and all effective data bitmaps are loaded into the memory buffer of the host.
Further, writing the updated mapping table to the flash memory of the solid state disk each time, and writing the effective data bitmap in the host memory buffer to the flash memory of the solid state disk at the same time;
after updating the mapping table and writing the updated mapping table into the flash memory of the solid state disk each time, determining the last physical address of the updated mapping table as a boundary point and recording the boundary point;
and when abnormal power failure is detected and a notice of power-on again is received, reconstructing the effective data bitmap in the host memory buffer according to the boundary point and the effective data bitmap stored in the flash memory of the solid state disk.
It can be known from the above description that the updated effective data bitmap is synchronously written into the flash memory of the solid state disk while the updated mapping table is written into the flash memory of the solid state disk each time, and the last physical address of the updated mapping table stored in the flash memory of the solid state disk is recorded as a boundary point after the mapping table is updated each time, so that the effective data bitmap in the host memory buffer can be effectively reconstructed according to the effective data bitmap in the flash memory and the boundary point when the solid state disk is abnormally powered off, and the stability and reliability of the solid state disk in the use process are ensured.
Further, the reconstructing the effective data bitmap in the host memory buffer according to the boundary point and the effective data bitmap stored in the flash memory of the solid state disk includes:
loading the effective data bitmap in the flash memory of the solid state disk into the host memory buffer;
reading a data page after the boundary point;
and updating the mapping table according to the data page, and updating a corresponding effective data bitmap in the memory buffer of the host.
As can be seen from the above description, when the effective data bitmap is reconstructed, the effective data bitmap in the solid state disk flash memory is loaded into the host memory buffer, and then the mapping relationship that is not stored in the flash memory due to abnormal power failure is reconstructed by reading the data page after the boundary point, the mapping table is updated, and the corresponding effective data bitmap is updated synchronously, so that the effective data bitmap in the host memory buffer can be reconstructed quickly and reliably.
Further, the updating the mapping table according to the data page and the updating the corresponding effective data bitmap in the host memory buffer includes:
traversing and reading all written data pages from the first physical address behind the boundary point, and determining the mapping relation between the physical address and the logical address corresponding to all the written data pages;
and updating the mapping table according to the mapping relation, and updating a corresponding effective data bitmap in the memory buffer of the host.
As can be seen from the above description, the mapping table and the effective data bitmap are updated by obtaining the mapping relationship between the logical address and the physical address of the written data page after the boundary point, so that the efficiency of the reconstruction process of the effective data bitmap is improved, and the stability of the solid state disk in the use process is ensured.
As shown in fig. 2, another embodiment of the present invention provides an apparatus for creating an effective data bitmap, including:
the loading module is used for loading the effective data bitmap corresponding to each super block in the flash memory of the solid state disk into a host memory buffer of the solid state disk;
the updating module is used for updating the corresponding effective data bitmap in the host memory buffer when the mapping table is updated;
the receiving module is used for receiving a garbage collection request and determining a target super block corresponding to garbage collection according to the garbage collection request;
and the creating module is used for loading the effective data bitmap corresponding to the target super block in the host memory buffer into the controller memory of the solid state disk.
Another embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method for creating a valid data bitmap described above.
As shown in fig. 3, another embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the method for creating an effective data bitmap.
The method, the apparatus, the computer-readable storage medium, and the electronic device for creating the effective data bitmap according to the present invention can be applied to various types of solid state disks, and particularly, for a solid state disk with a relatively small memory, such as a DRAM-less solid state disk, the following description is provided by specific embodiments:
example one
Referring to fig. 1, a method for creating an effective data bitmap includes the steps of:
s1, loading the effective data bitmap corresponding to each super block in the flash memory of the solid state disk into a host memory buffer of the solid state disk;
after the SSD is successfully opened, a VBMP (valid data bitmap) corresponding to each super block is initialized, the VBMP corresponding to each super block is represented by a bit array, each bit corresponds to a 4k storage space of a specific page, all bits in the VBMP are set to be invalid, a specific value can be set to be invalid according to a requirement, for example, the specific value can be set to be invalid when the bit array is 0, the specific value can be set to be valid when the bit array is 1, the specific value can also be set to be invalid when the bit array is 1, and the specific value can be valid when the bit array is 0;
for example, 10000 pieces of 4K data are stored in each super block, bit data can be used as VBMP corresponding to the super block, bit 0 represents the first 4K data of the super block 0, bit 9999 represents the last 4K data of the super block 0, and bit 10000 represents the first 4K data of the super block 1;
after the initialization is completed, all VBMPs are written into the NAND of the SSD, that is, the flash memory of the SSD, as shown in fig. 4, there are 1000 superblocks in total, and there are 1000 VBMPs corresponding to the superblocks one to one;
after the SSD is powered on every time, all VBMPs in the SSD flash memory are loaded into a host memory buffer HMB of the solid state disk;
specifically, effective data bitmaps corresponding to each super block in a flash memory of a solid state disk are sequentially read out and stored in a controller memory of the solid state disk;
sending a host memory buffer write command to write the effective data bitmap corresponding to each super block into the host memory buffer;
for example, VBMPs corresponding to superblocks 0 to 999 are sequentially read and placed in a controller memory, and then an HMB write instruction is sent to load the VBMP corresponding to each superblock to the HMB, that is, a read part and a write part are realized, and finally all VBMPs are written in the HMB;
determining the size of an effective data bitmap which is read out each time and stored in a controller memory of the solid state disk according to the size of the controller memory buffer of the solid state disk;
after the controller memory of the solid state disk stores the effective data bitmap once, writing the stored corresponding effective data bitmap into the host memory buffer, and executing the operation of reading and storing the effective data bitmap for the next time until the effective data bitmap corresponding to each super block in the solid state disk is written into the host memory buffer;
for example, if the buffer of the control memory is 12K, the VBMP in the flash memory is loaded into the host memory cache according to the size of 12K each time;
s2, when updating the mapping table, updating the corresponding effective data bitmap in the host memory buffer;
the updating process of the mapping table refers to a process of finding the position of the current written logical address in the mapping table and updating the corresponding old physical address to the current new physical address, as shown in fig. 5, the mapping relationship originally stored in the mapping table is: LAA 0-PAA 0, LAA 1-PAA 1; when the physical address of the updated LAA0 is PAA5, it is found that the original LAA0 is stored in PAA0, at this time, in the mapping table, LAA 0-PAA 0 is updated to LAA 0-PAA 5, and similarly, when the physical address of the updated LAA1 is PAA6, the physical address of the updated LAA 1-PAA 1 in the mapping table is updated to LAA 1-PAA 6;
specifically, when the mapping table is updated, updating the corresponding valid data bitmap in the host memory buffer includes:
determining an old physical address and a new physical address corresponding to the logical address from the mapping table according to the currently written logical address;
marking the bit of the corresponding effective data bitmap in the host memory buffer as a first preset value according to the old physical address;
marking the bit of the corresponding effective data bitmap in the host memory buffer as a second preset value according to the new physical address;
the first preset value is different from the second preset value;
as shown in fig. 5, while updating the mapping table, for example, when the LAA 0-PAA 0 is updated to LAA 0-PAA 5, the old physical address PAA0 and the new physical address PAA5 corresponding to the LAA0 are determined according to the written logical address LAA0, at this time, the bit in the VBMP corresponding to the PAA0 is set to be invalid, in this embodiment, set to 0, and the bit in the VBMP corresponding to the PAA5 is set to be valid, in this embodiment, set to 1;
if the newly established mapping relationship between the logical address and the physical address is written into the mapping table and the replacement of the new physical address and the old physical address is not involved, the new physical address and the old physical address are the same physical address at the moment, and the bit of the VBMP corresponding to the physical address is updated to be 1;
specifically, as shown in fig. 6, when data is written at logical address 0, the corresponding physical addresses are physical block 0 and page0, and the mapping table does not have the mapping relationship of logical address 0, the mapping relationship is stored in the mapping table: logical address 0 corresponds to physical block 0, page0 in the physical address;
correspondingly marking the bit positions corresponding to the physical block 0 and the page0 in the effective data bitmap in the host memory buffer as second preset values, namely, the data are effective data;
when data is written at logical address 1, the corresponding physical addresses are physical block 0 and page1, and the mapping table does not have the mapping relationship of logical address 1, and the mapping relationship is stored in the mapping table as follows: logical address 1 corresponds to physical block 0, page1 in the physical address;
correspondingly marking the bit positions corresponding to the physical block 0 and the page1 in the effective data bitmap in the host memory buffer as second preset values, namely, the data are effective data;
as shown in fig. 7, the currently written logical address is logical address 0, and the corresponding physical addresses are physical block 0 and page2, at this time, the mapping table update corresponds to the following relationship: logical address 0 corresponds to physical block 0, page2 in the physical address;
correspondingly marking the bit positions corresponding to the physical block 0 and the page2 in the effective data bitmap in the host memory buffer as second preset values, namely, the data are effective data; marking the bit corresponding to the physical block 0 and the page0 in the effective data bitmap in the host memory buffer as a first preset value, namely, the data is invalid data;
when data is written at logical address 2, the corresponding physical addresses are physical block 0 and page3, and the mapping table does not have the mapping relationship of logical address 2, then the mapping relationship is stored in the mapping table: logical address 2 corresponds to physical block 0, page3 in the physical address;
correspondingly marking the bit positions corresponding to the physical block 0 and the page3 in the effective data bitmap in the host memory buffer as second preset values, namely, the data are effective data;
s3, receiving a garbage collection request, and determining a target super block corresponding to garbage collection according to the garbage collection request;
the garbage collection request includes a super block to be collected, and a target super block corresponding to garbage collection can be determined according to the garbage collection request, for example, the target super block is a target super block N;
s4, loading the effective data bitmap corresponding to the target super block in the host memory buffer into the controller memory of the solid state disk;
and determining a VBMP corresponding to the target super block N in a host memory buffer according to the target super block N, and then loading the corresponding VBMP into a controller memory of the solid state disk, so that when garbage collection is required, the VBMP corresponding to the target super block is directly obtained from the controller memory, and therefore which storage units on the target super block N are effective is obtained according to the VBMP, data in the effective storage units are moved to new data blocks, and then the target super block N is collected.
Example two
The difference between this embodiment and the first embodiment is that how to reconstruct the mapping table and the valid data bitmap after abnormal power failure is further defined:
writing the effective data bitmap in the host memory buffer into the flash memory of the solid state disk while writing the updated mapping table into the flash memory of the solid state disk each time;
after the mapping table is updated and the updated mapping table is written into the flash memory of the solid state disk each time, determining the last physical address of the updated mapping table as a boundary point, storing the boundary point into the flash memory of the solid state disk, knowing through the boundary point that all the physical addresses corresponding to the data written before the boundary point are updated into the mapping table and written into the flash memory, if abnormal power failure occurs, only reading the boundary point from the flash memory of the solid state disk, and then reading the data page behind the boundary point for reconstruction;
when abnormal power failure is detected and a notification of power-up again is received, reconstructing an effective data bitmap in a host memory buffer according to the boundary point and an effective data bitmap stored in a flash memory of the solid state disk;
the reconstructing the effective data bitmap in the host memory buffer according to the boundary point and the effective data bitmap stored in the flash memory of the solid state disk comprises:
loading the effective data bitmap in the flash memory of the solid state disk into the host memory buffer;
reading a data page after the boundary point;
updating the mapping table according to the data page, and updating a corresponding effective data bitmap in the host memory buffer;
the updating the mapping table according to the data page and the updating the corresponding effective data bitmap in the host memory buffer includes:
traversing and reading all written data pages from the first physical address behind the boundary point, and determining the mapping relation between the physical addresses and the logical addresses corresponding to all the written data pages according to the read data;
and updating the mapping table according to the mapping relationship, and updating the corresponding effective data bitmap in the host memory buffer, which is the same as the updating process in the first embodiment.
EXAMPLE III
Referring to fig. 2, an apparatus for creating an effective data bitmap includes:
the loading module is used for loading the effective data bitmap corresponding to each super block in the flash memory of the solid state disk into a host memory buffer of the solid state disk;
the updating module is used for updating the corresponding effective data bitmap in the host memory buffer when the mapping table is updated;
the receiving module is used for receiving a garbage collection request and determining a target super block corresponding to garbage collection according to the garbage collection request;
and the creating module is used for loading the effective data bitmap corresponding to the target super block in the host memory buffer into the controller memory of the solid state disk.
Example four
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of a method for creating an effective data bitmap according to any one of the first to second embodiments.
EXAMPLE five
Referring to fig. 3, an electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps of the method for creating an effective data bitmap according to any one of the first to second embodiments.
To sum up, the method, the apparatus, the readable storage medium and the electronic device for creating an effective data bitmap provided by the present invention load all effective data bitmaps in a flash memory of a solid state disk into an HMB of the solid state disk, update the effective data bitmap corresponding to a host memory buffer each time a mapping table is updated, write the updated effective data bitmap in the host memory buffer into the flash memory of the solid state disk, determine that a last physical address in the updated mapping table stored in the flash memory is a boundary point and record the boundary point in the flash memory of the solid state disk, ensure reconstruction of the mapping table and the effective data bitmap after an abnormal power failure, update the effective data bitmap corresponding to the HMB while updating the mapping table by using the advantage of a fast HMB access speed, and after a garbage collection request is received, only need to acquire the corresponding effective data bitmap from the HMB according to a target superblock corresponding to garbage collection, the method is loaded into a controller memory of the solid state disk, so that the creation of the effective data bitmap is realized, the efficiency of creating the effective data bitmap is greatly improved, the VBMP can be quickly obtained in the garbage recovery process, the problems that the whole garbage recovery time is too long and the efficiency is low due to the fact that the effective data bitmap is created in a scanning mapping table mode in the garbage recovery process are solved, the method is simple and easy to operate, and the garbage recovery efficiency of the solid state disk is greatly improved.
In the above embodiments provided in the present application, it should be understood that the disclosed method, apparatus, computer-readable storage medium, and electronic device may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical division, and other divisions may be realized in practice, for example, a plurality of components or modules may be combined or integrated into another apparatus, 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 components or modules, and may be in an electrical, mechanical or other form.
The components described as separate parts may or may not be physically separate, and parts displayed as components may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the components can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each component may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module 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 invention may be embodied in the form of 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 invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present invention is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no acts or modules are necessarily required of the invention.
In the above 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.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for creating a valid data bitmap, comprising the steps of:
loading effective data bitmaps corresponding to each super block in a flash memory of a solid state disk into a host memory buffer of the solid state disk;
when the mapping table is updated, updating the corresponding effective data bitmap in the memory buffer of the host;
receiving a garbage collection request, and determining a target super block corresponding to garbage collection according to the garbage collection request;
and loading the effective data bitmap corresponding to the target super block in the host memory buffer into a controller memory of the solid state disk.
2. The method as claimed in claim 1, wherein said updating the corresponding valid data bitmap in the host memory buffer when updating the mapping table comprises:
determining an old physical address and a new physical address corresponding to the logical address from the mapping table according to the currently written logical address;
marking the bit of the corresponding effective data bitmap in the host memory buffer as a first preset value according to the old physical address;
marking the bit of the corresponding effective data bitmap in the host memory buffer as a second preset value according to the new physical address;
the first preset value is different from the second preset value.
3. The method for creating the valid data bitmap according to claim 1, wherein the loading the valid data bitmap corresponding to each superblock in the flash memory of the solid state disk into the host memory buffer of the solid state disk comprises:
sequentially reading effective data bitmaps corresponding to each super block in a flash memory of the solid state disk and storing the effective data bitmaps into a controller memory of the solid state disk;
and sending a host memory buffer write command to write the effective data bitmap corresponding to each super block into the host memory buffer.
4. The method for creating the effective data bitmap according to claim 3, wherein the size of the effective data bitmap read out each time and stored in the controller memory of the solid state disk is determined according to the size of the controller memory buffer of the solid state disk;
and writing the stored corresponding effective data bitmap into the host memory buffer after the effective data bitmap is stored in the controller memory of the solid state disk once, and executing the operation of reading and storing the effective data bitmap for the next time until the effective data bitmap corresponding to each super block in the solid state disk is written into the host memory buffer.
5. The method for creating a valid data bitmap according to any one of claims 1 to 4, further comprising the steps of:
writing the effective data bitmap in the host memory buffer into the flash memory of the solid state disk while writing the updated mapping table into the flash memory of the solid state disk each time;
after updating the mapping table and writing the updated mapping table into the flash memory of the solid state disk each time, determining the last physical address of the updated mapping table as a boundary point and recording the boundary point;
and when abnormal power failure is detected and a notice of power-on again is received, reconstructing the effective data bitmap in the host memory buffer according to the boundary point and the effective data bitmap stored in the flash memory of the solid state disk.
6. The method of claim 5, wherein the effective data bitmap,
the reconstructing the effective data bitmap in the host memory buffer according to the boundary point and the effective data bitmap stored in the flash memory of the solid state disk comprises:
loading the effective data bitmap in the flash memory of the solid state disk into the host memory buffer;
reading a data page after the boundary point;
and updating the mapping table according to the data page, and updating a corresponding effective data bitmap in the memory buffer of the host.
7. The method as claimed in claim 6, wherein the updating the mapping table according to the data page and the updating the corresponding valid data bitmap in the host memory buffer includes:
traversing and reading all written data pages from the first physical address behind the boundary point, and determining the mapping relation between the physical address and the logical address corresponding to all the written data pages;
and updating the mapping table according to the mapping relation, and updating a corresponding effective data bitmap in the memory buffer of the host.
8. An apparatus for creating a valid data bitmap, comprising:
the loading module is used for loading the effective data bitmap corresponding to each super block in the flash memory of the solid state disk into a host memory buffer of the solid state disk;
the updating module is used for updating the corresponding effective data bitmap in the host memory buffer when the mapping table is updated;
the receiving module is used for receiving a garbage collection request and determining a target super block corresponding to garbage collection according to the garbage collection request;
and the creating module is used for loading the effective data bitmap corresponding to the target super block in the host memory buffer into the controller memory of the solid state disk.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of a method for creating a valid data bitmap according to any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of a method of creating a valid data bitmap as claimed in any one of claims 1 to 7 when executing the computer program.
CN202011208745.9A 2020-11-03 2020-11-03 Method and device for creating effective data bitmap, storage medium and electronic equipment Active CN112379830B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011208745.9A CN112379830B (en) 2020-11-03 2020-11-03 Method and device for creating effective data bitmap, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011208745.9A CN112379830B (en) 2020-11-03 2020-11-03 Method and device for creating effective data bitmap, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112379830A true CN112379830A (en) 2021-02-19
CN112379830B CN112379830B (en) 2022-07-26

Family

ID=74576590

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011208745.9A Active CN112379830B (en) 2020-11-03 2020-11-03 Method and device for creating effective data bitmap, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112379830B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168082A (en) * 2021-12-10 2022-03-11 深圳忆联信息系统有限公司 Method and device for avoiding depletion of SSD free block, computer equipment and storage medium
CN114721972A (en) * 2022-06-09 2022-07-08 深圳佰维存储科技股份有限公司 Garbage recycling method and device, readable storage medium and electronic equipment
CN116467224A (en) * 2022-01-12 2023-07-21 联芸科技(杭州)股份有限公司 L2P mapping table reconstruction method and solid state disk

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477492A (en) * 2009-01-21 2009-07-08 华中科技大学 Circulating rewriting flash memory equalization method used for solid state disk
CN107562646A (en) * 2017-08-28 2018-01-09 记忆科技(深圳)有限公司 A kind of method for lifting solid-state storage garbage reclamation performance
CN108021511A (en) * 2017-11-22 2018-05-11 深圳忆联信息系统有限公司 A kind of method and SSD of SSD performance boosts
US20180275887A1 (en) * 2017-03-27 2018-09-27 Silicon Motion, Inc. Data Storage Device and Operating Method of Data Storage Device
US20200089620A1 (en) * 2018-09-14 2020-03-19 Silicon Motion, Inc. Data storage device and method of writing logical-to-physical mapping table thereof
CN111399752A (en) * 2019-01-03 2020-07-10 慧荣科技股份有限公司 Control device and method for different types of storage units
US20200293676A1 (en) * 2019-03-12 2020-09-17 Toshiba Memory Corporation Memory system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477492A (en) * 2009-01-21 2009-07-08 华中科技大学 Circulating rewriting flash memory equalization method used for solid state disk
US20180275887A1 (en) * 2017-03-27 2018-09-27 Silicon Motion, Inc. Data Storage Device and Operating Method of Data Storage Device
CN107562646A (en) * 2017-08-28 2018-01-09 记忆科技(深圳)有限公司 A kind of method for lifting solid-state storage garbage reclamation performance
CN108021511A (en) * 2017-11-22 2018-05-11 深圳忆联信息系统有限公司 A kind of method and SSD of SSD performance boosts
US20200089620A1 (en) * 2018-09-14 2020-03-19 Silicon Motion, Inc. Data storage device and method of writing logical-to-physical mapping table thereof
CN111399752A (en) * 2019-01-03 2020-07-10 慧荣科技股份有限公司 Control device and method for different types of storage units
US20200293676A1 (en) * 2019-03-12 2020-09-17 Toshiba Memory Corporation Memory system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JINHUA CUI: "ShadowGC: Cooperative garbage collection with multi-level buffer for performance improvement in NAND flash-based SSDs", 《2018 DESIGN, AUTOMATION & TEST IN EUROPE CONFERENCE & EXHIBITION (DATE)》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168082A (en) * 2021-12-10 2022-03-11 深圳忆联信息系统有限公司 Method and device for avoiding depletion of SSD free block, computer equipment and storage medium
CN114168082B (en) * 2021-12-10 2023-07-04 深圳忆联信息系统有限公司 Method, device, computer equipment and storage medium for avoiding SSD idle block exhaustion
CN116467224A (en) * 2022-01-12 2023-07-21 联芸科技(杭州)股份有限公司 L2P mapping table reconstruction method and solid state disk
CN116467224B (en) * 2022-01-12 2023-10-31 联芸科技(杭州)股份有限公司 L2P mapping table reconstruction method and solid state disk
CN114721972A (en) * 2022-06-09 2022-07-08 深圳佰维存储科技股份有限公司 Garbage recycling method and device, readable storage medium and electronic equipment
CN114721972B (en) * 2022-06-09 2022-11-11 深圳佰维存储科技股份有限公司 Garbage recycling method and device, readable storage medium and electronic equipment

Also Published As

Publication number Publication date
CN112379830B (en) 2022-07-26

Similar Documents

Publication Publication Date Title
CN112379830B (en) Method and device for creating effective data bitmap, storage medium and electronic equipment
CN108733510B (en) Data storage device and mapping table reconstruction method
CN109977034B (en) Data storage device and non-volatile memory operation method
KR101631348B1 (en) Metadata redundancy schemes for non-volatile memories
US8909851B2 (en) Storage control system with change logging mechanism and method of operation thereof
CN109933545B (en) Data storage device and data processing method of memory device
WO2018194772A1 (en) Persistent memory for key-value storage
CN112988467B (en) Solid state disk, data recovery method thereof and terminal equipment
CN101364166B (en) Method and device for simulating Nand flash of 2048 byte page into hard disk
CN102667703A (en) System and method for optimized reclamation processing in a virtual tape library system
CN109976938B (en) Data storage device and non-volatile memory operation method
CN107203331B (en) Method and device for writing data
GB2517435A (en) Fast data back-up and restore between volatile and flash memory
CN112084070B (en) L2P mapping data recovery method and device, storage medium and electronic equipment
CN104281538A (en) Storage device capacity expanding and snapping method and storage devices
CN111966281B (en) Data storage device and data processing method
CN104408126B (en) A kind of persistence wiring method of database, device and system
CN112052193B (en) Garbage recycling method and device, readable storage medium and electronic equipment
CN115543865B (en) Power failure protection method and device, readable storage medium and electronic equipment
CN113778911B (en) L2P data caching method and device, readable storage medium and electronic equipment
CN109002265B (en) Data processing method and related device
TWI791966B (en) Data processing method and memory controller utilizing the same
CN109725853B (en) Data recovery method and device
CN111142792A (en) Power-down protection method of storage device
CN111338846A (en) Method and device for recovering L2P table based on multiple cores

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