Data writing and updating method, system, device and computer-readable storage medium
By determining the physical addresses to be written and written in the distributed storage system, and marking the written addresses as deletionable state, the write amplification problem is solved, the BlueStore's working performance is improved and the service life of the storage module is extended.
Patent Information
- Application Number
- CN202211293449.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-21
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-10-21
AI Technical Summary
In the prior art, when data writing and updating is written in distributed storage systems, there are write amplification problems and SSD performance impacts, resulting in BlueStore's operating performance degradation and shortening of service life.
During the data writing process, BlueStore determines the physical address to be written and the physical address that has been written in the overlay data, sends a deletion identifier and overwrite data to the storage module, marks the physical address that has been written in the deletion state, and writes the overwrite data to the address to be written, and updates the address mapping relationship to improve the utilization rate of the logical address.
During a data write process, the overwrite data write and physical address status marking are realized, avoid write amplification, improve BlueStore's working performance, and extend the service life of the storage module.
Smart Images

Figure CN115438062B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distributed storage systems, and in particular to a data writing and updating method, system, device and computer-readable storage medium. Background Art
[0002] The distributed storage system Ceph includes BlueStore and SSD (Solid State Disk), where BlueStore is the storage engine of the distributed storage system Ceph and is used for redirecting writes and other tasks. In the prior art, when there is a need to write data, assuming that data 1 is to be written, a logical address 1 is requested in BlueStore and eventually written to the corresponding physical address 1 in the SSD. Later, when data 2 corresponding to data 1 is to be written over the original data 1 for update, it is necessary to re-request logical address 2 in BlueStore and eventually write to the corresponding physical address 2 in the SSD. After data 2 is successfully written to physical address 2, there are two ways to mark the location corresponding to data 1 as deletable so that the location is eligible for reuse:
[0003] The first method is for BlueStore to send a trim command to the SSD again to mark physical address 1 as deletable. However, this method will cause write amplification. Originally, only one write I / O instruction was needed to complete the writing of data 2. However, sending the trim command again after the successful writing of data 2 will require an additional write I / O instruction. This will eventually cause write amplification of IOPS (the number of I / O requests processed per unit time), affecting the working performance of BlueStore.
[0004] The second method is that after data 2 is successfully written to physical address 2, the trim command is not sent, but the logical address 1 corresponding to data 1 is placed back into the BlueStore's reclaimable queue. However, since the trim command is not sent at this time, the SSD is unaware of this situation. For the SSD, data 1 stored at physical address 1 is still valid data and is in a non-deletable state. The SSD will not know this until the logical address 1 is re-applied, and then mark the physical address 1 as deletable. However, the time from the re-placement of logical address 1 to the BlueStore's reclaimable queue to its re-applying is usually long. During this period, the data 1 stored at physical address 1 is involved in the corresponding processing logic of valid data, which affects the working performance and service life of the SSD.
[0005] Therefore, how to find an effective way to implement data writing and updating in distributed storage systems is an urgent problem to be solved. Summary of the Invention
[0006] The purpose of the present invention is to provide a data writing and updating method, system, device and computer-readable storage medium, which can realize the writing of overwritten data and the marking of the working status of the written physical address during a data writing process, thereby improving the working performance of BlueStore, ensuring the working performance of the storage module, and extending the service life of the storage module.
[0007] To solve the above technical problems, the present invention provides a data writing and updating method, comprising:
[0008] Upon receiving a write request indicating that corresponding written data is updated with overlay data, BlueStore determines a physical address in the storage module where the overlay data is to be written;
[0009] Determining a written physical address of the written data in the storage module based on the write request and a pre-stored identifier-physical address correspondence;
[0010] The deletion identifier and the overwriting data are sent to the storage module so that the storage module marks the working state corresponding to the written physical address as a deletable state based on the deletion identifier and writes the overwriting data to the physical address to be written, wherein the deletion identifier is determined based on the written physical address.
[0011] Preferably, after sending the deletion mark and the overwriting data to the storage module, the method further includes:
[0012] The BlueStore adds the used logical address corresponding to the written data to a preset available logical address queue based on the address update information received from the storage module;
[0013] The preset address mapping relationship is updated based on the address update information so that the used logical address corresponds to the allocated writable physical address mapping in the idle state in the storage module.
[0014] Preferably, it also includes:
[0015] The storage module determines whether the storage utilization rate in the target storage block reaches a preset threshold, wherein the target storage block includes a plurality of physical addresses;
[0016] If so, the data stored in the physical address whose working state is in a non-deletable state is transferred to the transit storage block;
[0017] Erasing data on the target storage block.
[0018] Preferably, before determining whether the storage utilization rate of the target storage block reaches a preset threshold, the method further includes:
[0019] The storage module determines whether the target storage block is in a non-writing state indicating that no data is currently being written;
[0020] If so, proceed to the step of determining whether the storage utilization rate in the target storage block reaches a preset threshold.
[0021] Preferably, sending the deletion mark and the overwriting data to the storage module includes:
[0022] The BlueStore calls the write interface to send the deletion flag and the overlay data to the lower-layer driver component used to manage the storage module, so that the lower-layer driver component fills the deletion flag into the command word of the transmission protocol followed by the storage module and sends the updated command word and the overlay data to the storage module, so that the storage module writes the overlay data to the physical address to be written, obtains the deletion flag according to the updated command word, and marks the working state corresponding to the written physical address as a deletable state based on the deletion flag.
[0023] Preferably, the lower layer driver component fills the deletion flag into the command word of the transmission protocol followed by the storage module, including:
[0024] The lower layer driver component determines the position of the reserved command word in the command word of the transmission protocol followed by the storage module;
[0025] The deletion flag is written into the position of the reserved command word according to a preset filling rule to generate an updated command word.
[0026] Preferably, the storage module obtains the deletion flag according to the updated command word, including:
[0027] The storage module calls a preset parsing interface to parse the updated command word based on an inverse rule of the preset filling rule to obtain the deletion identifier.
[0028] To solve the above technical problems, the present invention further provides a data writing and updating system, comprising:
[0029] a to-be-written physical address determination unit, configured to determine, upon receiving a write request for updating corresponding written data with overwriting data, a to-be-written physical address of the overwriting data in the storage module;
[0030] a written physical address determining unit, configured to determine a written physical address of the written data in the storage module based on the write request and a pre-stored identifier-physical address correspondence;
[0031] A sending unit is used to send the deletion identifier and the overwriting data to the storage module, so that the storage module marks the working state corresponding to the written physical address as a deletable state based on the deletion identifier and writes the overwriting data to the physical address to be written, wherein the deletion identifier is determined based on the corresponding written physical address.
[0032] To solve the above technical problems, the present invention further provides a data writing and updating device, comprising:
[0033] memory for storing computer programs;
[0034] A processor is used to implement the steps of the data writing and updating method as described above when executing the computer program.
[0035] To solve the above technical problems, the present invention further provides a computer-readable storage medium, comprising:
[0036] The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the data writing and updating method described above.
[0037] The present application provides a data writing and updating method, system, device, and computer-readable storage medium. After written data is written to a storage module, upon receiving a write request indicating that the corresponding written data is updated with overwritten data, BlueStore determines the to-be-written physical address of the overwritten data in the storage module, determines the written physical address of the written data in the storage module, determines a deletion flag corresponding to the written physical address, and then sends both the deletion flag and the overwritten data to the storage module so that the storage module controls, based on the deletion flag, to mark the working state corresponding to the written physical address as deletable and writes the overwritten data to the to-be-written physical address. In a single data writing process, both the writing of the overwritten data and the marking of the working state of the written physical address are achieved. Compared with the prior art, this method avoids the write amplification problem caused by the additional resending of trim instructions after the overwritten data is successfully written, thereby improving the working performance of BlueStore. Moreover, the writing of the overwritten data and the marking of the working state are completed in a single write. Subsequently, the written physical address will not be treated as valid data and participate in the valid data processing logic, thereby ensuring the working performance of the storage module and extending the service life of the storage module. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the prior art and the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 A flow chart of a data writing and updating method provided by the present invention;
[0040] Figure 2 A structural diagram of a data writing and updating system provided by the present invention;
[0041] Figure 3 This is a structural diagram of a data writing and updating device provided by the present invention. DETAILED DESCRIPTION
[0042] The core of the present invention is to provide a data writing and updating method, system, device and computer-readable storage medium, which can realize the writing of overwritten data and the marking of the working status of the written physical address during a data writing process, thereby improving the working performance of BlueStore, ensuring the working performance of the storage module, and extending the service life of the storage module.
[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0044] Please refer to Figure 1 , Figure 1 The present invention provides a flow chart of a data writing and updating method.
[0045] BlueStore is a storage engine for a distributed storage system. In this embodiment, when BlueStore in a distributed storage system faces the need to write data, it needs to follow the redirected write method. Specifically, after data 1 is written to physical address 1, if data 2 corresponding to data 1 wants to overwrite the original data 1 for write update, data 2 will be written to physical address 2. After data 2 is successfully written to physical address 2, in order to mark the location corresponding to data 1 as deletable so that the location is eligible for reuse, the first method is for BlueStore to send a trim command to the SSD again. However, this method It will cause write amplification and affect the working performance of BlueStore; the second way is to re-place the logical address 1 corresponding to data 1 into the BlueStore's re-applicable queue, but at this time, since the trim command is not sent, the SSD is unaware of this situation. For the SSD, the data 1 stored at physical address 1 is still valid data. The SSD will not mark the physical address 1 as deletable until the logical address 1 is re-applied. However, the time from the re-placement of the logical address 1 to the re-applicable queue to the time it is re-applied is usually long. During this time, the data 1 stored at the physical address 1 participates in the corresponding processing logic of the valid data, affecting the working performance and service life of the SSD. In order to solve the above technical problems, the present application provides a data write update method, which realizes both the writing of overwritten data and the marking of the working status of the written physical address in a data write process.
[0046] The data writing update method includes:
[0047] S11: When receiving a write request indicating that the corresponding written data is updated with overlay data, BlueStore determines a physical address to be written to the overlay data in the storage module;
[0048] First of all, it should be noted that the data writing and updating method includes but is not limited to a distributed storage system applied in a computer device, and the computer device includes but is not limited to a server; specifically, the method can be run on a Linux platform; the storage module includes multiple storage blocks for data storage and software programs and program components that control the implementation of different functions according to the received information. The storage module specifically includes but is not limited to being installed in an SSD.
[0049] Specifically, BlueStore pre-stores a preset queue of applicable logical addresses and a preset address mapping relationship. The preset address mapping relationship essentially represents the mapping between the logical address in BlueStore and the physical address in the storage module. Therefore, when BlueStore receives the write request, due to the special way of redirecting writes by BlueStore itself, the written data is not directly written to the physical address on the storage module. Instead, it first determines the available logical address of the overlay data based on the preset queue of applicable logical addresses, and then determines the physical address to be written of the overlay data in the storage module based on the mapping relationship between the available logical address and the preset address.
[0050] S12: Determine the written physical address of the written data in the storage module based on the write request and the pre-stored identifier-physical address correspondence;
[0051] Specifically, the write request may include information representing the write request itself and unique identification information representing the overwritten data, and the unique identification information of the overwritten data is the same as the unique identification information of the written data, so as to represent that the above two are essentially the same type of data with an overwrite update relationship; BlueStore also pre-stores a pre-stored identifier-physical address correspondence relationship, which records the identification information of each data that has been written to the storage module and the corresponding physical address in the storage module. The written data is naturally also recorded therein, and the written physical address of the written data in the storage module can be determined based on this.
[0052] It should be noted that due to the special way of redirecting writes by BlueStore itself, for the written data, BlueStore's write processing method is still to first determine the available logical address for the written data based on the preset applicable logical address queue (that is, the used logical address described in the following embodiment), and then determine the available physical address corresponding to the written data in the storage module (that is, the written physical address) based on the mapping relationship between the logical address and the preset address, and then call the write interface to achieve the successful writing of the written data.
[0053] In addition, the physical address to be written and the physical address already written are not the same physical address.
[0054] S13: Send the deletion mark and overwriting data to the storage module, so that the storage module marks the working state corresponding to the written physical address as a deletable state based on the deletion mark and writes the overwriting data to the physical address to be written, wherein the deletion mark is determined based on the written physical address.
[0055] Specifically, BlueStore calls the write interface to send the deletion flag and the overwrite data to the storage module at one time. For the storage module, on the one hand, the overwrite data can be written to the physical address to be written to store and write the updated data; on the other hand, based on the received deletion flag, the working status corresponding to the written physical address can be directly marked as a deletable state, thereby ensuring that the written data in the written physical address will not participate in the processing steps for valid data as valid data.
[0056] It should also be noted that marking the working status corresponding to the written physical address as a deletable state does not mean that the content therein will be deleted directly. Instead, the data will be erased only when the corresponding garbage collection mechanism is subsequently triggered. This can be beneficial to the security of data storage. Because for the actual writing process of overwriting data, there is a certain possibility of a transmission interruption due to power failure of the device. At this time, the overwriting data written into the storage module is problematic. Since the working status corresponding to the written physical address is only marked as a deletable state and no actual data erasure is performed, it is convenient to roll back the data to the original written data, thereby ensuring the atomicity and storage security of the data.
[0057] In summary, the present application provides a data writing and updating method. After the written data is written to the storage module, when BlueStore receives a write request indicating that the corresponding written data is updated with overwritten data, it determines the physical address to be written of the overwritten data in the storage module, determines the written physical address of the written data in the storage module, and determines a deletion flag based on the written physical address. Then, the deletion flag and the overwritten data are sent to the storage module so that the storage module controls the working status corresponding to the written physical address to be marked as a deletable state based on the deletion flag and writes the overwritten data to the physical address to be written. In a single data writing process, both the writing of the overwritten data and the marking of the working status of the written physical address are achieved. Compared with the prior art, the write amplification problem caused by the additional resending of the trim command after the overwritten data is successfully written is avoided, thereby improving the working performance of BlueStore. Moreover, the writing of the overwritten data and the marking of the working status are completed in one write. Subsequently, the written physical address will not be used as valid data and participate in the processing logic of the valid data, thereby ensuring the working performance of the storage module, extending the service life of the storage module, and reducing maintenance costs.
[0058] Based on the above embodiment:
[0059] As a preferred embodiment, after sending the deletion mark and the overwriting data to the storage module, the method further includes:
[0060] Based on the address update information received from the storage module, BlueStore adds the used logical addresses corresponding to the written data to the preset available logical address queue;
[0061] The preset address mapping relationship is updated based on the address update information so that the used logical address is mapped to the allocated writable physical address in the idle state in the storage module.
[0062] In this embodiment, considering that after the deletion identifier and the overwrite data are sent to the storage module, the storage module will complete the writing of the overwrite data and marking the working status corresponding to the written physical address as a deletable state, BlueStore includes a limited number of logical addresses. In order to further improve the utilization rate of the logical addresses, the storage module can send address update information to BlueStore. The address update information includes two parts: the first part is the first update information representing that the used logical address corresponding to the written data is updated to an applicable state; the second part is the second update information determined according to its own storage space utilization. The second update information represents the allocated writable physical address remapped by the used logical address. The allocated writable physical address can specifically be one of the physical addresses in the storage module that are in an idle state where no data is written.
[0063] For BlueStore, when receiving the address update information, it can add the used logical address corresponding to the written data to the preset applicable logical address queue according to the address update information, and update the preset address mapping relationship so that the used logical address is mapped to the allocated writable physical address in the idle state in the storage module, thereby improving the utilization rate of the logical address in itself and better ensuring the working performance.
[0064] As a preferred embodiment, the present invention further comprises:
[0065] The storage module determines whether the storage utilization rate in the target storage block reaches a preset threshold, where the target storage block includes multiple physical addresses;
[0066] If so, the data stored in the physical address whose working state is in a non-deletable state is transferred to the transit storage block;
[0067] Erase data on the target storage block.
[0068] In this embodiment, the inventors further considered that in order to ensure effective use of the storage space of the storage module, data erasure may be performed after a certain level of data writing is achieved.
[0069] First of all, it should be noted that the storage module can be installed in an SSD. When erasing data in the SSD, the unit is block (i.e., storage block). A block (storage block) includes several pages (i.e., the physical addresses). The above-mentioned physical address to be written and the written physical address are both a page in a storage block in the storage module. The target storage block is one of the storage blocks in the storage module, and the target storage block specifically includes multiple physical addresses.
[0070] Therefore, the storage module determines whether the storage utilization rate in the target storage block reaches a preset threshold value, wherein the storage utilization rate represents whether data has been written to each physical address in the target storage block. The preset threshold value can be 70% or 80%, and there is no special limitation here. It can be set according to actual needs. Therefore, the working status of each physical address in the target storage block can be determined, and the data stored in the physical addresses whose working status is in a non-erasable state are all transferred to the transfer storage block. The non-erasable state here means that the data stored in the physical addresses in this state are valid data. Corresponding to the above embodiment, the working status corresponding to the physical address to be written is the non-erasable state, and the corresponding overwritten data is valid data; and since data erasure is based on block, that is, the entire data block, all of them are erased, so the transfer storage block is determined (the transfer storage block can specifically be one of the other storage blocks of the storage module and can accommodate the data stored in the above-mentioned physical addresses in a non-erasable state) to complete the data transfer work. Of course, it is also possible to record the specific location of the transferred data in the transfer storage block for subsequent application, which is not particularly limited here; finally, the target storage block can be erased, and the physical addresses in the target storage block after the data erasure can be reused to write new data.
[0071] As a preferred embodiment, before determining whether the storage utilization rate of the target storage block reaches a preset threshold, the method further includes:
[0072] The storage module determines whether the target storage block is in a non-writing state indicating that no data is currently being written;
[0073] If so, proceed to the step of determining whether the storage utilization rate of the target storage block reaches a preset threshold.
[0074] In this embodiment, the inventors further considered that if data erasure is performed during the data writing process, it will affect the reliability and integrity of data writing. Therefore, before determining whether the storage utilization rate in the target storage block has reached a preset threshold, the storage module needs to first determine whether the target storage block is in a non-writing state, that is, an idle state, indicating that no data is currently being written. If so, the step of determining whether the storage utilization rate in the target storage block has reached a preset threshold is entered; if not, it means that data is being written, and the garbage collection logic indicating data erasure is not triggered, which better ensures the reliable operation of the storage module and is beneficial to practical applications.
[0075] As a preferred embodiment, sending the deletion mark and the overwriting data to the storage module includes:
[0076] BlueStore calls the write interface to send the deletion flag and overwrite data to the lower-level driver component used to manage the storage module, so that the lower-level driver component fills the deletion flag into the command word of the transmission protocol followed by the storage module and sends the updated command word and overwrite data to the storage module, so that the storage module writes the overwrite data to the physical address to be written, obtains the deletion flag according to the updated command word, and marks the working state corresponding to the written physical address as a deletable state based on the deletion flag.
[0077] In this embodiment, the specific implementation process that the deletion flag and the overwriting data need to go through from BlueStore to the storage module is given. It can be understood that the write interface can be specifically a write() interface. The storage module is mounted on an SSD as an example for explanation:
[0078] For the distributed storage system Ceph, if BlueStore wants to send data to SSD, it needs to go through the lower-level driver component. Specifically, the lower-level driver component can be understood as the driver layer. According to actual needs, the data transmission process can also flow through the operating system layer. That is to say, if described in terms of hierarchy, the data flow corresponding to the hierarchical relationship here can be understood as BlueStore layer-operating system layer-driver layer-SSD layer; it should be noted that the data writing and updating method provided in this application does not require modifications to the operating system, that is, there is no need to add additional program components in the operating system layer, so the data transfer can be completed directly in the operating system layer according to the settings of actual needs.
[0079] The SSD follows the NVMe (Non-Volatile Memory Express) protocol. The lower-layer driver component can insert the deletion flag into the NVMe command word to obtain an updated command word and transmit it to the SSD. The SSD can, on the one hand, write the obtained overwritten data to the physical address to be written, and on the other hand, determine the physical address to be marked based on the obtained deletion flag, that is, mark the working state corresponding to the written physical address as deletable.
[0080] As a preferred embodiment, the lower-layer driver component fills the deletion flag into the command word of the transmission protocol followed by the storage module, including:
[0081] The lower layer driver component determines the position of the reserved command word in the command word of the transmission protocol followed by the storage module;
[0082] The deletion mark is written into the position of the reserved command word according to the preset filling rule to generate an updated command word.
[0083] In this embodiment, it is further considered that the command word of the transmission protocol may include inherent command words set by itself, and may also include the position of reserved command words set for subsequent research and development needs of technical personnel when the protocol is developed. Therefore, taking the storage module mounted on the SSD and following the NVMe protocol as an example, the command word of the transmission protocol is 64 bytes, which includes a part of the position of reserved command words for development and setting by R&D personnel. Therefore, in this application, the lower-level driver component can write the deletion mark into the position of the reserved command word according to the preset filling rule without additionally expanding the bytes of the command word of the transmission protocol to generate an updated command word (specifically, a corresponding program interface can be set in the lower-level driver component to realize the above function, which is not specifically limited here). The preset filling rule here is programmed according to actual needs and is not specifically limited here. It is sufficient to achieve the correspondence between the command word filling result and the deletion mark.
[0084] As a preferred embodiment, the storage module obtains the deletion flag according to the updated command word, including:
[0085] The storage module calls a preset parsing interface to parse the updated command word based on an inverse rule of a preset filling rule to obtain a deletion mark.
[0086] In this embodiment, a preset parsing interface (essentially a program component) is pre-programmed in the storage module, and an inverse rule corresponding to the preset filling rule is built in. Then, the storage module can implement the updated command word (such as the updated NVMe protocol command word) by calling the preset parsing interface. The result of the parsing is the deletion flag, which ultimately reliably realizes the marking of the working status corresponding to the written physical address.
[0087] Please refer to Figure 2 , Figure 2 This is a structural diagram of a data writing and updating system provided by the present invention.
[0088] This data is written to the update system and includes:
[0089] A to-be-written physical address determining unit 21 is configured to determine the to-be-written physical address of the overlay data in the storage module when BlueStore receives a write request indicating that the corresponding written data is updated with the overlay data;
[0090] A written physical address determining unit 22 is configured to determine a written physical address of the written data in the storage module based on the write request and a pre-stored identifier-physical address correspondence;
[0091] The sending unit 23 is used to send the deletion mark and the overwriting data to the storage module, so that the storage module marks the working state corresponding to the written physical address as a deletable state based on the deletion mark and writes the overwriting data to the physical address to be written, wherein the deletion mark is determined based on the written physical address.
[0092] For an introduction to the data writing and updating system provided in the present invention, please refer to the embodiment of the data writing and updating method described above, which will not be described in detail here.
[0093] As a preferred embodiment, the data writing and updating system further includes:
[0094] A first updating unit, configured to, after the sending unit 23, cause the BlueStore to add the used logical address corresponding to the written data to a preset available logical address queue based on the address update information received from the storage module;
[0095] The second updating unit is configured to update a preset address mapping relationship based on the address update information so that the used logical address corresponds to an allocated writable physical address in an idle state in the storage module.
[0096] As a preferred embodiment, the data writing and updating system further includes:
[0097] A first judgment unit is configured to determine whether the storage utilization rate of a target storage block reaches a preset threshold value, wherein the target storage block includes a plurality of physical addresses; if so, trigger the data transfer unit;
[0098] The data transfer unit is used to transfer the data stored in the physical address whose working state is in a non-deletable state to the transfer storage block;
[0099] A data erasing unit is used to erase data from the target storage block.
[0100] As a preferred embodiment, the data writing and updating system further includes:
[0101] The second judgment unit is used for, before the first judgment unit, the storage module to judge whether the target storage block is in a non-writing state indicating that no data is currently being written; if so, entering the first judgment unit.
[0102] As a preferred embodiment, the sending unit 23 specifically includes:
[0103] A first calling unit is configured to call the BlueStore write interface to send the deletion flag and the overlay data to a lower-layer driver component for managing the storage module, so that the lower-layer driver component fills the deletion flag into the command word of the transmission protocol followed by the storage module and sends the updated command word and the overlay data to the storage module, so that the storage module writes the overlay data to the physical address to be written, obtains the deletion flag according to the updated command word, and marks the working state corresponding to the written physical address as a deletable state based on the deletion flag.
[0104] Please refer to Figure 3 , Figure 3 This is a structural diagram of a data writing and updating device provided by the present invention.
[0105] The data is written to the update device, including:
[0106] Memory 31, for storing computer programs;
[0107] The processor 32 is configured to implement the steps of the data writing and updating method described above when executing the computer program.
[0108] For an introduction to the data writing and updating device provided in the present invention, please refer to the embodiment of the data writing and updating method described above, which will not be described in detail here.
[0109] The present invention also provides a computer-readable storage medium, comprising:
[0110] A computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the data writing and updating method described above are implemented.
[0111] For an introduction to the computer-readable storage medium provided in the present invention, please refer to the embodiment of the above-mentioned data writing and updating method, which will not be described in detail here.
[0112] In this specification, each embodiment is described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar parts between the embodiments can be referred to in conjunction with each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method section. In this specification, relational terms such as first and second are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article or device comprising the elements.
[0113] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. The above description of the disclosed embodiments enables professionals and technicians in this field to implement or use the present invention. Various modifications to these embodiments will be obvious to professionals and technicians in this field, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data writing and updating method, characterized in that: include: Upon receiving a write request indicating that the corresponding written data is updated with overlay data, BlueStore determines a physical address in the storage module where the overlay data is to be written; The write request includes the write request information itself and the unique identification information representing the overwritten data, and the unique identification information of the overwritten data is the same as the unique identification information of the written data; the BlueStore pre-stores a preset applicable logical address queue and a preset address mapping relationship; Determining a written physical address of the written data in the storage module based on the write request and a pre-stored identifier-physical address correspondence; The pre-stored identifier-physical address correspondence records the identifier information of each data that has been written to the storage module and the corresponding physical address; Sending a deletion flag and the overwriting data to the storage module, so that the storage module marks the working state corresponding to the written physical address as a deletable state based on the deletion flag and writes the overwriting data to the physical address to be written, wherein the deletion flag is determined based on the written physical address; Based on the received address update information sent by the storage module, the used logical address corresponding to the written data is added to a preset queue of applicable logical addresses; the address update information includes: first update information indicating that the used logical address corresponding to the written data is updated to an applicable state; and second update information determined based on the storage space utilization, the second update information indicating an allocated writable physical address to which the used logical address is remapped, the allocated writable physical address being specifically one of the physical addresses in the storage module that are in an idle state and to which no data is being written; The preset address mapping relationship is updated based on the address update information, so that the used logical address is mapped to an allocated writable physical address in an idle state in the storage module.
2. The data writing and updating method according to claim 1, wherein: Also includes: The storage module determines whether the storage utilization rate in the target storage block reaches a preset threshold, wherein the target storage block includes a plurality of physical addresses; If so, the data stored in the physical address whose working state is in a non-deletable state is transferred to the transit storage block; Erasing data on the target storage block.
3. The data writing and updating method according to claim 2, wherein: Before determining whether the storage utilization rate of the target storage block reaches a preset threshold, the method further includes: The storage module determines whether the target storage block is in a non-writing state indicating that no data is currently being written; If so, proceed to the step of determining whether the storage utilization rate in the target storage block reaches a preset threshold.
4. The data writing and updating method according to any one of claims 1 to 3, wherein: Sending the deletion flag and the overwriting data to the storage module includes: The BlueStore calls the write interface to send the deletion flag and the overlay data to the lower-layer driver component used to manage the storage module, so that the lower-layer driver component fills the deletion flag into the command word of the transmission protocol followed by the storage module and sends the updated command word and the overlay data to the storage module, so that the storage module writes the overlay data to the physical address to be written, obtains the deletion flag according to the updated command word, and marks the working state corresponding to the written physical address as a deletable state based on the deletion flag.
5. The data writing and updating method according to claim 4, wherein: The lower layer driver component fills the deletion flag into the command word of the transmission protocol followed by the storage module, including: The lower layer driver component determines the position of the reserved command word in the command word of the transmission protocol followed by the storage module; The deletion flag is written into the position of the reserved command word according to a preset filling rule to generate an updated command word.
6. The data writing and updating method according to claim 5, wherein: The storage module obtains the deletion flag according to the updated command word, including: The storage module calls a preset parsing interface to parse the updated command word based on an inverse rule of the preset filling rule to obtain the deletion identifier.
7. A data writing and updating system, characterized in that: include: a to-be-written physical address determination unit, configured to determine, upon receiving a write request for updating corresponding written data with overwriting data, a to-be-written physical address of the overwriting data in the storage module; The write request includes the write request information itself and the unique identification information representing the overwritten data, and the unique identification information of the overwritten data is the same as the unique identification information of the written data; the BlueStore pre-stores a preset applicable logical address queue and a preset address mapping relationship; a written physical address determining unit, configured to determine a written physical address of the written data in the storage module based on the write request and a pre-stored identifier-physical address correspondence; The pre-stored identifier-physical address correspondence records the identifier information of each data that has been written to the storage module and the corresponding physical address; a sending unit, configured to send a deletion flag and the overwriting data to the storage module, so that the storage module marks the working state corresponding to the written physical address as a deletable state based on the deletion flag and writes the overwriting data into the physical address to be written, wherein the deletion flag is determined based on the written physical address; a first updating unit, configured to add a used logical address corresponding to the written data to a preset requestable logical address queue based on address update information received from the storage module; the address update information comprising: first update information indicating that the used logical address corresponding to the written data is updated to a requestable state; and second update information determined based on storage space utilization, the second update information indicating an allocated writable physical address to which the used logical address is remapped, the allocated writable physical address being specifically one of physical addresses in the storage module that are in an idle state and to which no data is being written; The second updating unit is configured to update a preset address mapping relationship based on the address update information so that the used logical address corresponds to an allocated writable physical address in an idle state in the storage module.
8. A data writing and updating device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data writing and updating method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data writing and updating method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method and system for quickly writing data into storage equipment
CN110515552A
Data storage method and system and computer readable storage medium
CN114756178A