CN115291805A - Method for establishing effective data bitmap and related equipment - Google Patents

Method for establishing effective data bitmap and related equipment Download PDF

Info

Publication number
CN115291805A
CN115291805A CN202210953531.7A CN202210953531A CN115291805A CN 115291805 A CN115291805 A CN 115291805A CN 202210953531 A CN202210953531 A CN 202210953531A CN 115291805 A CN115291805 A CN 115291805A
Authority
CN
China
Prior art keywords
bitmap
target
effective data
data
super block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210953531.7A
Other languages
Chinese (zh)
Inventor
刘露
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202210953531.7A priority Critical patent/CN115291805A/en
Publication of CN115291805A publication Critical patent/CN115291805A/en
Pending legal-status Critical Current

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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device

Landscapes

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

Abstract

The application provides a method and related equipment for establishing an effective data bitmap, which are used for solving the problem of low memory space utilization rate of a solid state disk. The method at least comprises the following steps: acquiring a bitmap identification of a target superblock matched with a physical address of effective data, wherein the bitmap identification is used for representing whether the target superblock is associated with an effective data bitmap or not and the establishment state of the effective data bitmap; when determining that the bitmap identification representation is not associated with the set effective data bitmap, allocating a corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap; and updating the bitmap identification to represent the associated valid data bitmap of the target super block, and the establishment state is incomplete, and updating the bitmap identification to represent the associated valid data bitmap of the target super block and the establishment state is complete until the traversal of the logical physical mapping table is completed.

Description

Method for establishing effective data bitmap and related equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method for creating an effective data bitmap and a related device.
Background
With the continuous development of science and technology, more and more devices adopt the solid state disk to provide storage service, and the solid state disk can carry out data recovery by establishing an effective data bitmap so as to improve the utilization rate of a storage space.
In the related art, a method for establishing an effective data bitmap is to pre-allocate a memory space for each super block stored in a solid state disk, so that when effective data are stored in a plurality of data blocks associated with the super blocks, the storage positions of the effective data can be recorded in corresponding content spaces to obtain corresponding effective data bitmaps.
However, the storage resources of the device are limited, and when more superblocks are stored in the solid state disk, the device needs to allocate a large amount of memory space in advance. However, valid data is not stored in the plurality of data blocks associated with each super block, which may cause unnecessary occupation of a large amount of storage resources and low memory space utilization.
Therefore, in the related art, the memory space utilization rate of the solid state disk is low.
Disclosure of Invention
The embodiment of the application provides a method and a device for establishing an effective data bitmap, computer equipment and a storage medium, which are used for solving the problem of low memory space utilization rate of a solid state disk.
In a first aspect, a method for creating a valid data bitmap is provided, where the method is applied to a solid state disk, where the solid state disk is configured to store a plurality of superblocks and a plurality of data blocks associated with each superblock, each superblock is configured to store metadata of the associated plurality of data blocks, and each data block is configured to store valid data, and the method includes:
periodically traversing the logical physical mapping table within a preset time period, and sequentially determining the physical addresses of each effective data; for each determined physical address of valid data, the following operations are performed:
acquiring a bitmap identification of a target superblock matched with a physical address of effective data, wherein the bitmap identification is used for representing whether the target superblock is associated with an effective data bitmap or not and the establishment state of the effective data bitmap;
when the bitmap identification representation is determined to be not associated with a set effective data bitmap, distributing corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap;
and updating the bitmap identification to represent the associated set effective data bitmap of the target super block, wherein the establishment state is incomplete, and the bitmap identification is updated to represent the associated set effective data bitmap of the target super block until the traversal of the logical physical mapping table is completed, and the establishment state is complete.
Optionally, traversing the logical-physical mapping table within the periodic preset time period, and before sequentially determining the physical addresses of the effective data, the method further includes:
the solid state disk is powered on;
and respectively initializing the bitmap identifications of the plurality of superblocks into bitmaps representing the unassociated valid data of the corresponding superblocks.
Optionally, after obtaining the bitmap identification of the target superblock matching with the physical address of the valid data, the method further includes:
determining the bitmap identification representation association setting effective data bitmap, and determining the physical address of the memory space allocated for the effective data bitmap set for the target super block association based on the logical physical mapping table when the establishment state is incomplete;
and recording the storage position of the effective data in the target super block in the memory space in a recording format of an effective data bitmap based on the physical address of the memory space.
Optionally, after recording, in the memory space, a storage location of the valid data in the target superblock, the method further includes:
and when the logical-physical mapping table is determined to be completely traversed, updating the bitmap identification to represent that the target super block is associated with the set effective data bitmap, wherein the establishment state is complete.
Optionally, after the updating the bitmap identification to represent that the target superblock is associated with a set valid data bitmap and the establishing status is incomplete, the method further includes:
when determining that a plurality of target data blocks associated with the target super block do not contain valid data, acquiring a bitmap identification of the target super block;
when determining that the bitmap identification represents that the target super block is associated with the set effective data bitmap, releasing the memory space allocated to the target super block;
and updating the bitmap identification to represent the unassociated valid data bitmap of the target super block.
Optionally, after the updating the bitmap identification to represent that the target superblock has been associated with a set valid data bitmap, and the establishing state is completed, the method further includes:
after receiving a data recovery instruction for the target super block, acquiring a bitmap identification of the target super block;
determining that the bitmap identification represents that the target superblock is associated with a set effective data bitmap, and when the establishment state is established, determining storage positions of effective data contained in a plurality of target data blocks associated with the target superblock based on the effective data bitmap of the target superblock;
and performing data recovery on the target super block based on the storage position of the obtained effective data.
In a second aspect, an apparatus for creating a valid data bitmap is provided, where the apparatus is applied to a solid state disk, the solid state disk is configured to store a plurality of super blocks and a plurality of data blocks associated with each super block, each super block is configured to store metadata of the associated plurality of data blocks, and each data block is configured to store valid data, and the apparatus includes:
an acquisition module: the logical-physical mapping table is used for periodically traversing the logical-physical mapping table within a preset time period and sequentially determining the physical address of each effective data;
for each determined physical address of valid data, the following operations are performed:
the acquisition module is further configured to: acquiring a bitmap identification of a target superblock matched with a physical address of effective data, wherein the bitmap identification is used for representing whether the target superblock is associated with an effective data bitmap or not and the establishment state of the effective data bitmap;
a processing module: when the bitmap identification representation is not associated with the set effective data bitmap, allocating a corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap;
the processing module is further configured to: and updating the bitmap identification to represent the associated set effective data bitmap of the target super block, wherein the establishment state is incomplete, and the bitmap identification is updated to represent the associated set effective data bitmap of the target super block until the traversal of the logical physical mapping table is completed, and the establishment state is complete.
Optionally, the processing module is further configured to:
traversing the logical physical mapping table within the periodic preset time period, and powering on the solid state disk before sequentially determining the physical addresses of each effective data;
and respectively initializing the bitmap identifications of the plurality of superblocks into bitmaps representing the unassociated valid data of the corresponding superblocks.
Optionally, the processing module is further configured to:
after the bitmap identification of the target superblock matched with the physical address of the effective data is obtained, determining that the bitmap identification represents the effective data bitmap which is set in association, and when the establishment state is incomplete, determining the physical address of a memory space allocated for the effective data bitmap which is set in association with the target superblock based on the logical physical mapping table;
and recording the storage position of the effective data in the target super block in the memory space in a recording format of an effective data bitmap based on the physical address of the memory space.
Optionally, the processing module is further configured to:
after the storage position of the effective data in the target super block is recorded in the memory space, when the logical-physical mapping table is determined to be completely traversed, the bitmap identification is updated to represent that the target super block is associated with the effective data bitmap, and the establishment state is completed.
Optionally, the processing module is further configured to:
when the bitmap identification is updated to represent that the target superblock is associated with and set with an effective data bitmap and the establishment state is not completed, and a plurality of target data blocks associated with the target superblock do not contain effective data, acquiring the bitmap identification of the target superblock;
when determining that the bitmap identification represents that the target super block is associated with the set effective data bitmap, releasing the memory space allocated to the target super block;
and updating the bitmap identification to represent the unassociated and set effective data bitmap of the target superblock.
Optionally, the processing module is further configured to:
after the bitmap identification is updated to represent that the target superblock is associated with and provided with an effective data bitmap and the establishment state is completed, acquiring the bitmap identification of the target superblock after receiving a data recovery instruction for the target superblock;
determining that the bitmap identification represents that the target superblock is associated with a set effective data bitmap, and when the establishment state is established, determining storage positions of effective data contained in a plurality of target data blocks associated with the target superblock based on the effective data bitmap of the target superblock;
and performing data recovery on the target super block based on the storage position of the obtained effective data.
In a third aspect, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the method according to the first aspect.
In a fourth aspect, there is provided a computer device comprising:
a memory for storing program instructions;
a processor for calling the program instructions stored in the memory and executing the method according to the first aspect according to the obtained program instructions.
In a fifth aspect, there is provided a computer-readable storage medium having stored thereon computer-executable instructions for causing a computer to perform the method of the first aspect.
In the embodiment of the application, the logical physical mapping table is periodically traversed within a preset time period, the physical addresses of the effective data are sequentially determined, the effective data bitmap of each super block is established in the traversing process, the process of dynamically establishing the effective data bitmap is realized, and the flexibility of establishing the effective data bitmap is improved.
Further, when it is determined that the target super block contains valid data and the bitmap identification of the target super block indicates that the valid data bitmap is not set in association, the corresponding memory space is allocated to the target super block instead of allocating the corresponding memory space to all super blocks stored in the solid state disk in advance, so that the situation that the super block not containing valid data occupies a large amount of memory space is avoided, and the memory space utilization rate of the solid state disk is improved.
Furthermore, by setting bitmap identification for each super block, whether the corresponding super block is associated with and set with an effective data bitmap or not can be quickly determined, and the establishment state of the effective data bitmap can be quickly determined, so that whether memory space is allocated for a target super block or not can be efficiently determined, the effective data bitmap can be established, and the efficiency of dynamically establishing the effective data bitmap is improved.
Drawings
Fig. 1 is an application scenario of a method for establishing an effective data bitmap according to an embodiment of the present application;
fig. 2 is a first flowchart illustrating a method for creating an effective data bitmap according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a second method for creating an effective data bitmap according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an apparatus for creating an effective data bitmap according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for creating an effective data bitmap according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
It should be noted that, in the embodiments of the present application, data related to obtaining bitmap identification and the like is referred to, when the above embodiments of the present application are applied to specific products or technologies, each time data is obtained, user permission or consent needs to be obtained, and collection, use and processing of the related data need to comply with related laws and regulations and standards of related countries and regions.
The following briefly introduces an application field of the method for establishing an effective data bitmap provided in the embodiment of the present application.
With the continuous development of science and technology, more and more devices adopt the solid state disk to provide storage service, and the solid state disk can carry out data recovery by establishing an effective data bitmap so as to improve the utilization rate of a storage space.
For example, most Solid State Disks (SSD) use NAND Flash as a storage medium, and therefore, the working principle of SSD is mostly based on the Flash memory characteristic. Data reclamation occurs based on the "erase before write" feature of flash memory.
In the related art, a method for establishing an effective data bitmap is to pre-allocate a memory space for each super block stored in a solid state disk, so that when effective data are stored in a plurality of data blocks associated with the super blocks, the storage positions of the effective data can be recorded in corresponding content spaces to obtain corresponding effective data bitmaps.
However, the storage resources of the device are limited, and when more superblocks are stored in the solid state disk, the device needs to allocate a large amount of memory space in advance. However, valid data is not stored in the multiple data blocks associated with each super block, which may cause unnecessary occupation of a large amount of storage resources and low utilization of memory space.
For example, when recording the storage location of the Valid data, the Valid data bitmap (VBM) may be used for recording, so that the SSD may be processed for data recovery based on the Valid data bitmap, and therefore, each Super Block (SPB) may correspond to one VBM, which is convenient for recording the storage location of the Valid data, and thus the Valid data may be quickly found and moved during data recovery. However, the computing resources of the device are limited, and when the solid state disk allocates the corresponding memory space for each super block in advance by using the method for establishing the effective data bitmap, some super blocks not containing effective data occupy a large amount of storage resources, so that the memory space utilization rate of the solid state disk is low.
Therefore, in the related art, the memory space utilization rate of the solid state disk is low.
In order to solve the problem of low memory space utilization rate of the solid state disk, the application provides a method for establishing an effective data bitmap. The method is applied to the solid state disk, the solid state disk is used for storing a plurality of super blocks and a plurality of data blocks associated with each super block, each super block is used for storing metadata of the associated data blocks, and each data block is used for storing valid data.
Periodically traversing the logical-physical mapping table within a preset time period, and sequentially determining the physical address of each effective data; for each determined physical address of valid data, the following operations are performed:
and acquiring a bitmap identification of the target superblock matched with the physical address of the effective data, wherein the bitmap identification is used for representing whether the target superblock is associated with the effective data bitmap or not and the establishment state of the effective data bitmap. And when determining that the bitmap identification representation is not associated with the set effective data bitmap, allocating a corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap. And updating the bitmap identification to represent the associated valid data bitmap of the target super block, and the establishment state is incomplete, and updating the bitmap identification to represent the associated valid data bitmap of the target super block and the establishment state is complete until the traversal of the logical physical mapping table is completed.
In the embodiment of the application, the logical physical mapping table is periodically traversed within a preset time period, the physical addresses of the effective data are sequentially determined, the effective data bitmap of each super block is established in the traversing process, the process of dynamically establishing the effective data bitmap is realized, and the flexibility of establishing the effective data bitmap is improved.
Further, when it is determined that the target super block contains valid data and the bitmap identification of the target super block indicates that the valid data bitmap is not set in association, the corresponding memory space is allocated to the target super block instead of allocating the corresponding memory space to all super blocks stored in the solid state disk in advance, so that the situation that the super block not containing valid data occupies a large amount of memory space is avoided, and the memory space utilization rate of the solid state disk is improved.
Furthermore, by setting bitmap identification for each super block, whether the corresponding super block is associated with and set with an effective data bitmap or not can be quickly determined, and the establishment state of the effective data bitmap can be quickly determined, so that whether memory space is allocated for a target super block or not can be efficiently determined, the effective data bitmap can be established, and the efficiency of dynamically establishing the effective data bitmap is improved.
An application scenario of the method for establishing the effective data bitmap provided by the present application is described below.
Please refer to fig. 1, which is a schematic diagram of an application scenario of the method for creating an effective data bitmap according to the present application. The application scenario includes a client 101 and a server 102. Communication is possible between the client 101 and the server 102. The communication mode may be a wired communication technology, for example, communication is performed through a connection network line or a serial port line; the communication may also be performed by using a wireless communication technology, for example, communication is performed by using technologies such as bluetooth or wireless fidelity (WIFI), and the like, which is not limited specifically.
The client 101 generally refers to a device that can send instructions or display data to the server 102, for example, a terminal device, a third-party application accessible by the terminal device, or a web page accessible by the terminal device. The terminal devices include but are not limited to mobile phones, computers, intelligent transportation devices, intelligent appliances and the like. The server 102 generally refers to a device, such as a terminal device or a server, which can establish a valid data bitmap. Servers include, but are not limited to, cloud servers, local servers, or associated third party servers, etc. The client 101 and the server 102 can both adopt cloud computing to reduce the occupation of local computing resources; cloud storage can also be adopted to reduce occupation of local storage resources.
As an embodiment, the client 101 and the server 102 may be the same device, for example, the embodiment of the present application may be implemented only by the client 101, or may be implemented only by the server 102, and the like, which is not limited specifically. In the embodiment of the present application, the client 101 and the server 102 are taken as different devices, respectively, for example, for description.
Based on fig. 1, taking the server 102 as an example, the method for establishing the effective data bitmap provided in the embodiment of the present application is specifically described below. Please refer to fig. 2, which is a flowchart illustrating a method for creating an effective data bitmap according to an embodiment of the present application.
S201, periodically traversing the logical physical mapping table within a preset time period, and sequentially determining the physical addresses of the effective data.
Periodically traversing a Logical to Physical Mapping Table (L2P) within a preset time period, where Physical addresses of each valid data may be recorded in the Logical to Physical Mapping Table. According to the recording sequence of the logical-physical mapping table, sequentially determining the physical addresses of the effective data, for example, traversing the logical-physical mapping table in a preset time period from 1 point to 4 points in the morning every day, or in a preset time period in which the occupancy rate of the computing resources of the device is lower than a threshold occupancy rate threshold value every week, and the like, so that the process of establishing the effective data bitmap can be flexibly performed when the device is idle, and the condition that other tasks in the device cannot be executed due to the fact that the traversing process occupies more computing resources of the device is avoided.
If the logical-physical mapping table is not traversed in the preset time period of the current cycle, the remaining logical-physical mapping tables and the like may be continuously traversed in the preset time period of the next cycle, which is not limited specifically.
When the logical physical mapping table is traversed and the physical addresses of the effective data are sequentially determined, each time the physical address of the effective data is determined, the subsequent processing process of establishing the effective data bitmap can be carried out on the effective data, so that when the logical physical mapping table is traversed, the establishment of the effective data bitmaps of all super blocks stored in the solid state disk can be simultaneously completed, and the process of dynamically establishing the effective data bitmaps is realized.
Next, a process of subsequently establishing an effective data bitmap based on a physical address of effective data is described as an example, and the process of each effective data is similar and will not be described herein again, please refer to S202 to S204.
S202, acquiring the bitmap identification of the target superblock matched with the physical address of the effective data.
And determining a target data block corresponding to the physical address based on the physical address of the valid data, wherein the target data block is a data block for storing the valid data, so that the associated target super block can be determined based on the target data block. After the target superblock is determined, the bitmap identification of the target superblock may be obtained.
The bitmap identification is used for representing whether the target superblock is associated with and sets an effective data bitmap and the establishment state of the effective data bitmap. When the target superblock is associated with and sets the valid data bitmap, the valid data bitmap may be in an uncompleted state being established or in a completed state being established. The valid data bitmap is used for representing the storage positions of valid data stored in a plurality of target data blocks associated with the target super block in the target super block.
As an embodiment, when the solid state disk is used for the first time, the bitmap identifications of all superblocks stored in the solid state disk can be initialized to be unassociated with the valid data bitmap, so that when the valid data bitmap is periodically established, the bitmap identifications of the superblocks can be continuously updated, and the purpose of dynamically establishing the valid data bitmap is achieved.
As an embodiment, the bitmap identification may be represented in a numerical form, for example, 0 represents that the corresponding super block is not associated with the set valid data bitmap; 1, indicating that the corresponding super block is associated with and provided with an effective data bitmap, and the establishment state of the effective data bitmap is incomplete; 2, the corresponding super block is associated with the set valid data bitmap, and the establishment status of the valid data bitmap is completed, etc., and is not limited specifically. Therefore, after the solid state disk is powered on, the bitmap identification of each super block can be initialized to 0.
S203, when the bitmap identification representation is determined not to be associated with the set effective data bitmap, distributing corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap.
After obtaining the bitmap identification of the target superblock, it may be determined whether the bitmap identification represents an unassociated set valid data bitmap, and if the bitmap identification represents an unassociated set valid data bitmap, a memory space may be allocated for the target superblock based on the size of the target superblock, the memory space being used to store the valid data bitmap of the target superblock.
As an embodiment, after the solid state disk is powered on for the first time, in a preset time period of a first period, the bitmap identifier of each super block represents that an effective data bitmap is not set in association, so that each super block can be sequentially used as a target super block, and a memory space is sequentially allocated to each target super block. In the preset time period of other cycles, the bitmap identifier of each super block may have different updates, so that the allocated memory space also has corresponding updates, and the like.
After the memory space is allocated to the target super block, the storage position of the valid data in the target super block is recorded in the memory space in the recording format of the valid data bitmap, for example, the valid data is marked as valid on the corresponding bit of the valid data bitmap, for example, the 0 identifier is invalid, and the 1 identifier is invalid, so that the update of the valid data bitmap of the target super block based on the valid data is realized. The purpose of establishing the valid data bitmap may include sorting valid data, and releasing the storage space to be used by other subsequent valid data for deleting invalid data in the target data blocks, so as to improve the utilization rate of the storage space of the solid state disk.
As an embodiment, after obtaining the bitmap identifier of the target superblock matched with the physical address of the valid data, determining that the bitmap identifier represents that the association sets the valid data bitmap, and when the establishment state is incomplete, it indicates that the memory space has been allocated to the target superblock before, and the memory space is not repeatedly allocated to the target superblock. And recording the storage position of the effective data in the target super block in the memory space in a recording format of an effective data bitmap based on the physical address of the memory space.
As an embodiment, when determining that the bitmap identification represents that the association setting of the valid data bitmap is completed, and when the establishment state is incomplete, recording the storage position of the valid data in the target superblock in the memory space in the recording format of the valid data bitmap based on the physical address of the memory space of the target superblock, and when determining that traversing of the logical-physical mapping table is completed, updating the bitmap identification to represent that the target superblock has the association setting of the valid data bitmap, and when determining that the traversal of the logical-physical mapping table is completed, establishing the state as completed. When the logical-physical mapping table is determined to be completely traversed, it is indicated that all valid data recorded by the logical-physical mapping table are completely processed, and then the bitmap identification can be updated to represent that the target super block is associated with the set valid data bitmap, and the establishment state is complete.
And S204, updating the bitmap identification to represent that the target super block is associated with the set effective data bitmap, and the establishment state is incomplete, until the traversal of the logical-physical mapping table is completed, updating the bitmap identification to represent that the target super block is associated with the set effective data bitmap, and the establishment state is completed.
After the bitmap identification is determined to represent the unassociated valid data bitmap, the corresponding memory space is allocated for the target super block, the storage position of the valid data in the target super block is recorded in the memory space in the form of the valid data bitmap, and the valid data bitmap is already associated with the target super block, so that the bitmap identification can be updated to represent the associated valid data bitmap of the target super block, the establishment state is incomplete, and when the logical physical mapping table is traversed, the fact that all the valid data recorded by the logical physical mapping table are processed is shown to be completed, the bitmap identification can be updated to represent the associated valid data bitmap of the target super block, and the establishment state is completed.
And after the target super block is associated with and set with the effective data bitmap and the establishment state is completed, the effective data bitmap is updated along with the updating of effective data contained in a plurality of target data blocks associated with the target super block, and the effective data bitmap is updated and maintained in the solid state disk in real time. For example, when the storage location of valid data included in a certain target data block changes, or when valid data is newly added to a certain target data block, the valid data bitmap is updated in real time.
As an embodiment, for a super block whose bitmap identifier represents that valid data bitmaps are set in association, and whose status is set to be completed, when it is determined that a plurality of data blocks associated with the super block do not contain valid data, the memory space allocated for the super block may be released to avoid unnecessary occupation of memory space, and the bitmap identifier of the super block is updated to represent that the super block does not have valid data bitmaps set in association. In this embodiment of the present application, even if a memory space is allocated to a super block that does not contain valid data, the memory space is released and is not always occupied, so that the utilization rate of the memory space of the solid state disk is improved.
Taking a target super block as an example, updating a bitmap identification of the target super block to represent that the target super block is associated with and set with an effective data bitmap, and after the establishment state is completed, if a plurality of target data blocks associated with the target super block do not contain effective data in a manner of receiving an instruction and the like that the target data blocks do not contain effective data, acquiring the bitmap identification of the target super block. And releasing the memory space allocated for the target super block when the bitmap identification represents that the target super block is associated with the set effective data bitmap. And updating the bitmap identification into a bitmap for representing the unassociated valid data of the target super block. Therefore, the solid state disk only stores the effective data bitmap for the super blocks containing the effective data, and the effective data bitmap is not preset for all the super blocks, so that unnecessary occupation of storage resources is avoided.
For example, NAND Flash contains 32 super blocks (SPBs), each SPB containing 8 data blocks (blocks), each block containing 16 data pages (pages), each page containing 4 data operation units (cells), each cell being 4KB in size. One bit in the valid data bitmap is used to indicate whether a cell is valid. The size of the space occupied by the valid data bitmap of each superblock is then (8 x 16 x 4)/8 =256bits/8=32byte. If a valid data bitmap is preset for all superblocks, then 32 x 32byte of storage space is consumed. If only 2 of the 32 superblocks contain valid data, then only 2 x 32byte of storage space is actually needed.
As an embodiment, when the bitmap identification is updated to represent that the target superblock is associated with the set valid data bitmap, and the establishment state is incomplete, until the traversal of the logical-physical mapping table is completed, the bitmap identification is updated to represent that the target superblock is associated with the set valid data bitmap, and after the establishment state is completed, if a data recovery instruction for the target superblock is received, the data recovery can be directly performed on the target superblock based on the valid data bitmap dynamically established in advance, so that the data recovery efficiency is improved.
After obtaining the bitmap identification of the target superblock, the server may determine whether the bitmap identification of the target superblock represents that the target superblock is associated with setting a target valid data bitmap, and an establishment state of the valid data bitmap. If the bitmap identification of the target superblock is determined to represent the association setting effective data bitmap of the target superblock, and the establishment state of the effective data bitmap is completed, the storage positions of effective data contained in a plurality of target data blocks associated with the target superblock can be determined directly based on the effective data bitmap. If the bitmap identification of the target superblock is determined to represent that the target superblock is not associated with the set valid data bitmap, then a plurality of target data blocks associated with the target superblock need to be traversed, and valid data contained in the target data blocks and storage positions of the valid data are determined in real time.
After obtaining the storage locations of the valid data included in the plurality of target data blocks, data reclamation may be performed on the target super block based on the storage locations of the valid data.
In the following, an example of a method for establishing an effective data bitmap provided in the embodiment of the present application is described, please refer to fig. 3.
The server can preset three bitmap identifications (flag), and when the flag is 0, the server indicates that the super block is not associated with the set effective data bitmap; when flag is 1, the super block is associated with and sets an effective data bitmap, and the establishment state of the effective data bitmap is unfinished; and when the flag is 2, the super block association sets an effective data bitmap, and the establishment state of the effective data bitmap is completed.
S301, after the solid state disk is successfully electrified for the first time, the flag of all super blocks stored in the solid state disk is initialized to be 0.
S302, setting a timer, and traversing the L2P table periodically within a preset time period, sequentially determining the physical addresses of each valid data included in the L2P table, and performing the following operations each time a physical address of a valid data is determined, please refer to S303 to S307.
S303, the valid data is stored in the super block with the logical address x, and the physical address of the super block is determined to be m through the L2P table.
S304, acquiring the flag of the super block, and determining whether the bitmap identification representation of the super block m is associated with the set effective data bitmap or not and the establishment state of the effective data bitmap. When flag is 0, executing S305 to S307; when flag is 1, executing S306; and when the flag is 2, traversing the next super block.
S305, when the flag of the super block is 0, allocating a memory space with the size of 32 bytes from the memory of the solid state disk for the super block, initializing each bit in the effective data bitmap to be 0, and continuously executing S306-S307.
And S306, recording the storage position of the valid data in the super block in the valid data bitmap. If a data block contains multiple data pages, each containing multiple data manipulation units, then the physical address of the data block can be represented as block = i, page = j, cell = k. And each data operation unit in each data page in each data block is sequentially arranged, and different consequent bits in the effective data bitmap correspond to different data operation units. When a certain data operation unit is determined to be valid data, the bit sequence corresponding to the valid data bitmap is marked as 1, and the data operation unit corresponding to the position is indicated to be valid.
S307, updating the bitmap identification of the super block to 1.
And updating the bitmap identification of the superblock to be 2 until the L2P table traversal is completed.
In the traversal process, if the end time of the preset time period set by the timer is reached, all the valid data stored in the L2P table are not completely traversed, the traversal process is firstly suspended, and when the start time of the preset time period of the next cycle set by the timer is reached, the incomplete traversal process is continued, so that the device is not occupied by the traversal process for a long time to cause the situation that other tasks cannot be executed or are abnormally executed, and the like.
And for the super block in which the association setting is carried out, the establishment state of the effective data bitmap is completed, and the effective data bitmap is updated and maintained in real time in the memory of the solid state disk along with the update of the data stored in the data block. When the super block continuously updates data, each bit of the effective data bitmap is changed into 0, namely the super block does not contain effective data, the flag of the super block is updated from 2 to 0, and the memory space occupied by the effective data bitmap is released.
S308, after receiving the data recovery instruction aiming at the super block n, acquiring the flag of the super block n.
S309, when the flag is determined to be 2, obtaining an effective data bitmap associated with the super block n, and performing data recovery on the super block n based on the storage position of the effective data represented by the effective data bitmap.
And when the flag is determined not to be 2, traversing the super block n, determining each contained effective data, recording the storage position of the effective data, and then recovering the data of the super block n based on the recorded storage position of the effective data.
In the embodiment of the application, the dynamic creation of the effective data bitmap is realized, and the problem that the effective data bitmap occupies spaces such as a flash memory and an HMB for a long time is avoided by dynamically creating the effective data bitmap. After the system is powered on, SSD memory resources are dynamically allocated to the effective data bitmap needing to be established, the waste of resources such as a flash memory and an HMB is reduced, the speed of accessing the effective data bitmap is increased, and the data recovery efficiency is improved.
Based on the same inventive concept, the embodiment of the present application provides an apparatus for establishing an effective data bitmap, which can implement a function corresponding to the foregoing method for establishing an effective data bitmap. Referring to fig. 4, the apparatus includes an obtaining module 401 and a processing module 402, wherein:
the obtaining module 401: the method comprises the steps of traversing a logical physical mapping table periodically in a preset time period, and sequentially determining the physical address of each effective data;
for each determined physical address of valid data, the following operations are performed:
the obtaining module 401 is further configured to: acquiring a bitmap identification of a target superblock matched with a physical address of effective data, wherein the bitmap identification is used for representing whether the target superblock is associated with an effective data bitmap or not and the establishment state of the effective data bitmap;
the processing module 402: when the bitmap identification representation is determined to be not associated with the set effective data bitmap, distributing corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap;
the processing module 402 is further configured to: and updating the bitmap identification to represent the associated valid data bitmap of the target super block, and the establishment state is incomplete, and updating the bitmap identification to represent the associated valid data bitmap of the target super block and the establishment state is complete until the traversal of the logical physical mapping table is completed.
In a possible embodiment, the processing module 402 is further configured to:
traversing the logical physical mapping table within a preset time period periodically, and powering on the solid state disk before sequentially determining the physical addresses of each effective data;
and respectively initializing bitmap identifications of the plurality of superblocks into bitmaps representing unassociated valid data of the corresponding superblocks.
In a possible embodiment, the processing module 402 is further configured to:
after acquiring the bitmap identification of the target superblock matched with the physical address of the effective data, determining the bitmap identification representation association to set the effective data bitmap, and determining the physical address of the memory space allocated to the effective data bitmap set in association with the target superblock based on the logical physical mapping table when the establishment state is incomplete;
and recording the storage position of the effective data in the target super block in the memory space in a recording format of an effective data bitmap based on the physical address of the memory space.
In a possible embodiment, the processing module 402 is further configured to:
and after recording the storage position of the effective data in the target super block in the memory space, updating the bitmap identification to represent that the target super block is associated with the effective data bitmap and establishing the state as finished when the logic physical mapping table is determined to be finished.
In a possible embodiment, the processing module 402 is further configured to:
after the bitmap identification is updated to represent that the target super block is associated with the set effective data bitmap and the establishment state is incomplete, when a plurality of target data blocks associated with the target super block do not contain effective data, acquiring the bitmap identification of the target super block;
when determining that the bitmap identification represents that the target super block is associated with the set effective data bitmap, releasing the memory space allocated to the target super block;
and updating the bitmap identification into a bitmap for representing the unassociated valid data of the target super block.
In a possible embodiment, the processing module 402 is further configured to:
after the bitmap identification is updated to represent that the target superblock is associated with the set effective data bitmap and the establishment state is completed, acquiring the bitmap identification of the target superblock after receiving a data recovery instruction aiming at the target superblock;
determining a bitmap identification to represent that a target super block is associated with and provided with an effective data bitmap, and when the establishment state is established, determining storage positions of effective data contained in a plurality of target data blocks associated with the target super block based on the effective data bitmap of the target super block;
and performing data recovery on the target super block based on the obtained storage position of the valid data.
Referring to fig. 5, the above-mentioned means for creating the effective data bitmap may be run on a computer device 500, and the current version and the historical version of the data storage program and the application software corresponding to the data storage program may be installed on the computer device 500, where the computer device 500 includes a processor 580 and a memory 520. In some embodiments, the computer device 500 may include a display unit 540, the display unit 540 including a display panel 541 for displaying an interface for interaction by a user or the like.
In one possible embodiment, the Display panel 541 may be configured in the form of a Liquid Crystal Display (LCD) or an Organic Light-Emitting Diode (OLED) or the like.
The processor 580 is used for reading the computer program and then executing the method defined by the computer program, for example, the processor 580 reads the data storage program or file, etc., so as to run the data storage program on the computer device 500 and display the corresponding interface on the display unit 540. Processor 580 may include one or more general purpose processors, and may further include one or more DSPs (Digital Signal processors) for performing relevant operations to implement the technical solutions provided in the embodiments of the present application.
Memory 520 typically includes both internal and external memory, which may be Random Access Memory (RAM), read Only Memory (ROM), and CACHE (CACHE). The external memory can be a hard disk, an optical disk, a USB disk, a floppy disk or a tape drive. The memory 520 is used for storing a computer program including an application program and the like corresponding to each client, and other data, which may include data generated after an operating system or the application program is executed, including system data (e.g., configuration parameters of the operating system) and user data. The program instructions in the embodiment of the present application are stored in the memory 520, and the processor 580 executes the program instructions in the memory 520 to implement any one of the methods discussed in the previous figures.
The display unit 540 is used to receive input digital information, character information, or touch operation/non-touch gesture, and generate signal input related to user setting and function control of the computer device 500, and the like. Specifically, in the embodiment of the present application, the display unit 540 may include a display panel 541. The display panel 541, for example, a touch screen, may collect a touch operation performed by a user on or near the display panel 541 (for example, an operation performed by the user on the display panel 541 or on the display panel 541 using any suitable object or accessory such as a finger or a stylus), and drive a corresponding connection device according to a preset program.
In one possible embodiment, the display panel 541 may include two portions of a touch detection device and a touch controller. The touch detection device detects the touch direction of a player, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, and sends the touch point coordinates to the processor 580, and can receive and execute commands sent by the processor 580.
The display panel 541 can be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the display unit 540, in some embodiments, the computer device 500 may also include an input unit 530, which input unit 530 may include an image input device 531 and other input devices 532, where the other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
In addition to the above, the computer device 500 may also include a power supply 590, an audio circuit 560, a near field communication module 570, and an RF circuit 510 for powering the other modules. The computer device 500 may also include one or more sensors 550, such as acceleration sensors, light sensors, pressure sensors, and the like. The audio circuit 560 specifically includes a speaker 561, a microphone 562, and the like, and for example, the computer device 500 may collect voice of the user through the microphone 562, perform corresponding operations, and the like.
For one embodiment, the number of the processors 580 may be one or more, and the processors 580 and the memory 520 may be coupled or relatively independent.
As an embodiment, the processor 580 in fig. 5 may be used to implement the functions of the obtaining module 401 and the processing module 402 in fig. 4.
As an example, the processor 580 in fig. 5 may be used to implement the corresponding functions of the server or the terminal device discussed above.
Those of ordinary skill in the art will understand that: all or part of the steps of implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer-readable storage medium, and when executed, executes the steps including the method embodiments; and the aforementioned storage medium includes: a mobile storage device, 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.
Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on this understanding, the technical solutions of the embodiments of the present invention may be embodied in the form of a software product, for example, a computer program product stored in a storage medium and including instructions for causing a computer device to perform all or part of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic or optical disk, or various other media that can store program code.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method for establishing a valid data bitmap, wherein the method is applied to a solid state disk, the solid state disk is used for storing a plurality of super blocks and a plurality of data blocks associated with each super block, each super block is used for storing metadata of the associated plurality of data blocks, and each data block is used for storing valid data, and the method comprises the following steps:
periodically traversing the logical-physical mapping table within a preset time period, and sequentially determining the physical address of each effective data; for each determined physical address of valid data, the following operations are performed:
acquiring a bitmap identification of a target super block matched with a physical address of effective data, wherein the bitmap identification is used for representing whether the target super block is associated with an effective data bitmap or not and the establishment state of the effective data bitmap;
when the bitmap identification representation is determined to be not associated with a set effective data bitmap, distributing corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap;
and updating the bitmap identification to represent the target superblock is associated with the set effective data bitmap, and the establishment state is incomplete, until the logical physical mapping table is completely traversed, updating the bitmap identification to represent the target superblock is associated with the set effective data bitmap, and the establishment state is complete.
2. The method of claim 1, wherein before traversing the logical-physical mapping table periodically within a preset time period and sequentially determining the physical addresses of the valid data, the method further comprises:
the solid state disk is powered on;
and respectively initializing the bitmap identifications of the plurality of superblocks into bitmaps representing the unassociated valid data of the corresponding superblocks.
3. The method of claim 1, further comprising, after said obtaining the bitmap identification of the target superblock that matches the physical address of valid data:
determining the bitmap identification representation association setting effective data bitmap, and determining the physical address of the memory space allocated for the effective data bitmap set for the target super block association based on the logical physical mapping table when the establishment state is incomplete;
and recording the storage position of the effective data in the target super block in the memory space in a recording format of an effective data bitmap based on the physical address of the memory space.
4. The method of claim 3, wherein after said recording the storage location of the valid data in the target superblock in the memory space, further comprising:
and when the logical physical mapping table is determined to be completely traversed, updating the bitmap identification to represent that the target super block is associated with the set effective data bitmap, and setting the establishment state to be completed.
5. The method according to any one of claims 1 to 4, wherein after the updating the bitmap identification to characterize that the target superblock has been associated with a set valid data bitmap, and the establishing status is incomplete, the method further comprises:
when determining that a plurality of target data blocks associated with the target super block do not contain valid data, acquiring a bitmap identification of the target super block;
when the bitmap identification indicates that the target superblock is associated with the set effective data bitmap, releasing the memory space allocated to the target superblock;
and updating the bitmap identification to represent the unassociated valid data bitmap of the target super block.
6. The method of claim 1, wherein after the updating the bitmap identification to characterize the target superblock as having associated a set valid data bitmap, and the establishing status as completed, further comprising:
after receiving a data recovery instruction for the target superblock, acquiring a bitmap identifier of the target superblock;
determining that the bitmap identification represents that the target superblock is associated with a set effective data bitmap, and when the establishment state is established, determining storage positions of effective data contained in a plurality of target data blocks associated with the target superblock based on the effective data bitmap of the target superblock;
and performing data recovery on the target super block based on the obtained storage position of the valid data.
7. An apparatus for creating a valid data bitmap, applied to a solid state disk, wherein the solid state disk is configured to store a plurality of superblocks and a plurality of data blocks associated with each superblock, each superblock is configured to store metadata of the associated plurality of data blocks, and each data block is configured to store valid data, the apparatus comprising:
an acquisition module: the method comprises the steps of traversing a logical physical mapping table periodically in a preset time period, and sequentially determining the physical address of each effective data;
for each determined physical address of valid data, the following operations are performed:
the acquisition module is further configured to: acquiring a bitmap identification of a target super block matched with a physical address of effective data, wherein the bitmap identification is used for representing whether the target super block is associated with an effective data bitmap or not and the establishment state of the effective data bitmap;
a processing module: when the bitmap identification representation is not associated with the set effective data bitmap, allocating a corresponding memory space for the target super block, and recording the storage position of the effective data in the target super block in the memory space in the recording format of the effective data bitmap;
the processing module is further configured to: and updating the bitmap identification to represent the target superblock is associated with the set effective data bitmap, and the establishment state is incomplete, until the logical physical mapping table is completely traversed, updating the bitmap identification to represent the target superblock is associated with the set effective data bitmap, and the establishment state is complete.
8. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the method according to any one of claims 1 to 6.
9. A computer device, comprising:
a memory for storing program instructions;
a processor for calling program instructions stored in said memory and executing the method of any one of claims 1 to 6 in accordance with the obtained program instructions.
10. A computer-readable storage medium having stored thereon computer-executable instructions for causing a computer to perform the method of any one of claims 1 to 6.
CN202210953531.7A 2022-08-10 2022-08-10 Method for establishing effective data bitmap and related equipment Pending CN115291805A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210953531.7A CN115291805A (en) 2022-08-10 2022-08-10 Method for establishing effective data bitmap and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210953531.7A CN115291805A (en) 2022-08-10 2022-08-10 Method for establishing effective data bitmap and related equipment

Publications (1)

Publication Number Publication Date
CN115291805A true CN115291805A (en) 2022-11-04

Family

ID=83828354

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210953531.7A Pending CN115291805A (en) 2022-08-10 2022-08-10 Method for establishing effective data bitmap and related equipment

Country Status (1)

Country Link
CN (1) CN115291805A (en)

Similar Documents

Publication Publication Date Title
CN108021510B (en) Method of operating a storage device that manages multiple namespaces
EP3388946B1 (en) Memory collection method and device
CN110069219B (en) Data storage method and system, electronic equipment and storage medium
CN105740078B (en) Memory management method, device and terminal
CN104714893A (en) Method and system for garbage collection scaling
CN110554999B (en) Cold and hot attribute identification and separation method and device based on log file system and flash memory device and related products
CN105917303B (en) Controller, method for identifying stability of data block and storage system
CN111737221B (en) Data read-write method, device and equipment of cluster file system and storage medium
CN113625973B (en) Data writing method, device, electronic equipment and computer readable storage medium
EP3364303B1 (en) Data arrangement method, storage apparatus, storage controller and storage array
CN103677674A (en) Data processing method and device
CN115576501B (en) Node updating method, system and related device of RAID card
CN112445766A (en) Terminal fragment sorting method and device and terminal
WO2024087875A1 (en) Memory management method and apparatus, and medium and electronic device
WO2020192710A1 (en) Method for processing garbage based on lsm database, solid state hard disk, and storage apparatus
CN104156321A (en) Data pre-fetching method and device
WO2023193630A1 (en) Peak detection method and apparatus, and computer device and storage medium
CN108205559B (en) Data management method and equipment thereof
CN111061429B (en) Data access method, device, equipment and medium
CN115469806A (en) Data processing method, device, equipment and medium
CN110248023B (en) Intelligent terminal control method, device, equipment and medium
CN115291805A (en) Method for establishing effective data bitmap and related equipment
CN113821458B (en) Data operation method, device, computer equipment and storage medium
EP3819771A1 (en) Data processing method and device, apparatus, and system
CN111459848B (en) File fragment sorting method and device, storage medium 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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 1202, Floor 12, Building 3, No. 126, Yueda Lane, Changhe Street, Binjiang District, Hangzhou City, Zhejiang Province, 310053

Applicant after: Zhejiang Huayi Core Technology Co.,Ltd.

Address before: 310053 4th floor, building 1, No. 2952, South Ring Road, Puyan street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant before: Zhejiang Dahua Technology Co.,Ltd.