Storage data processing method, system, equipment and medium
By adding an ordered identifier to the data write request and optimizing the data writing and reading process in storage technology, the problem of low data processing efficiency in the prior art is solved, and multiple copies of data with the same logical address are realized in the cache at the same time , improves business processing and reading efficiency.
Patent Information
- Application Number
- CN202411227998.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-03
AI Technical Summary
When existing storage technology processes data writing, the cache can only cache one copy of data with the same logical address, resulting in low data processing efficiency and cannot cache multiple copy of data with the same logical address at the same time, affecting the efficiency of business processing.
By adding an ordered identifier to the data write request, parsing and storing the data to be stored in the cache, after detecting the flash disk task, find the target to be written logical address within the maximum logical address range based on the ordered identifier, and write the target data to be written. Hard disk allows multiple copies of data to be written in the cache to be saved, optimizing data writing and reading efficiency.
It improves data processing efficiency, allows multiple copies of data with the same logical address to be saved in the cache, reduces waiting time, ensures that the data hit in the cache is up-to-date when reading data, and improves data reading efficiency.
Smart Images

Figure CN119127575A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a storage data processing method, system and device. Background Art
[0002] In the era of data explosion, data has become an important new production factor and asset, which is very important; therefore, how to achieve data security protection has gradually become a key technology. Currently, snapshot technology is a widely used technology for data protection and data backup, which performs data protection and backup based on time points. Usually, after receiving data, the storage device first puts it in the cache in order to respond to the host as quickly as possible, and then the storage software gradually writes the data in the cache to the specific disk.
[0003] The existing solution usually waits for the old data to be flushed to the storage disk before pushing the new data to be stored into the cache, that is, the existing cache can only cache one copy of the data with the same logical address; the existing technology has the problem of low data processing efficiency.
[0004] Therefore, there is an urgent need for a storage data processing method that improves processing efficiency to solve the above technical problems. Summary of the invention
[0005] Based on this, it is necessary to provide a storage data processing method, system, device and medium to address the above technical issues.
[0006] In a first aspect, the present application provides a storage data processing method, the method comprising:
[0007] In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule;
[0008] Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule;
[0009] In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address;
[0010] The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
[0011] In some embodiments, parsing the data write request to obtain the data to be stored, and storing the data to be stored in the cache according to a preset storage rule, includes:
[0012] Parsing the data write request to obtain a to-be-written logical address, a data length, to-be-stored data, and an ordered identifier corresponding to the data write request;
[0013] Generate transitional storage data according to the acquired logical address to be written, data length, data to be stored and ordered identifier;
[0014] The transitional storage data is stored in the cache using the to-be-written logical address as an index.
[0015] In some embodiments, before writing the first target data into the matching target to-be-written logical address, the method includes:
[0016] In response to detecting that the granularity integrity of the first target data is missing, determining that the first target data is data to be supplemented;
[0017] Acquire the latest mapping metadata on the target to-be-written logical address corresponding to the to-be-complemented data, wherein the mapping metadata includes a mapping relationship between the logical address and the physical address;
[0018] According to the latest mapping metadata, query the stored data at the physical address matching the target logical address to be written;
[0019] The first target data lacking granular integrity is updated according to the stored data and the supplementary data.
[0020] In some embodiments, the method further comprises:
[0021] In response to detecting that the first target data is written to a physical address on the hard disk corresponding to the target logical address to be written;
[0022] Determine second target data in the cache that matches the latest mapping metadata at the target logical address to be written;
[0023] Clear the data to be stored in the cache that matches the target logical address to be written except the second target data.
[0024] In some embodiments, after searching the target to-be-written logical address within the maximum logical address range according to the ordered identifier, the method further includes:
[0025] Detecting whether there is matching data to be stored at a logical address to be written adjacent to the target logical address to be written;
[0026] If it is detected that the adjacent logical address to be written has a matching piece of data to be stored, the adjacent logical address to be written is defined as a target logical address to be written, and the data to be stored that matches the adjacent logical address to be written is defined as a first target data;
[0027] If it is detected that there are multiple matching data to be stored in the adjacent logical address to be written, the adjacent logical address to be written is defined as the target logical address to be written, and the data to be stored with the smallest ordered identifier among the multiple data to be stored that match the adjacent logical address to be written is obtained, and the data to be stored with the smallest ordered identifier is defined as the first target data.
[0028] In some embodiments, the method further comprises:
[0029] In response to receiving a data read request, obtaining a read logical address corresponding to the data read request;
[0030] Detecting whether the read logical address is included in the maximum logical address range;
[0031] If the read logical address is not included in the maximum logical address range, return null and issue an abnormal alarm;
[0032] If the read logical address is included in the maximum logical address range, detecting whether the to-be-written logical address that is the same as the read logical address in the cache stores second target data correspondingly;
[0033] If the second target data is stored in correspondence with the to-be-written logical address which is the same as the read logical address, then the second target data is read and fed back;
[0034] If the to-be-written logical address that is the same as the read logical address does not store the second target data, acquiring the latest mapping metadata that matches the read logical address;
[0035] According to the latest mapping metadata, the stored data at the physical address matching the read logical address is queried and fed back.
[0036] In some embodiments, in response to receiving the data write request, adding an ordered identifier to the data write request according to a preset rule includes:
[0037] In response to receiving a data write request, detecting whether a snapshot exists;
[0038] If no snapshot is detected, adding a first ordered identifier to the data write request;
[0039] If a snapshot is detected, adding a second ordered identifier to the data write request according to the number of currently existing snapshots;
[0040] There is a sequence relationship between the first ordered identifier and the second ordered identifier.
[0041] In a second aspect, the present application provides a storage data processing system, the system comprising:
[0042] A preprocessing module, configured to, in response to receiving a data write request, add an ordered identifier to the data write request according to a preset rule;
[0043] A cache processing module, used for parsing the data write request to obtain the data to be stored, and storing the data to be stored in the cache according to a preset storage rule;
[0044] A data processing module, configured to search for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address according to the ordered identifier in response to detecting that a disk flushing task is started;
[0045] The data writing module writes the first target data into a physical address on the hard disk corresponding to the target logical address to be written.
[0046] In a third aspect, the present application provides a computer program product, including a computer program, which implements the steps of the following method when executed by a processor:
[0047] In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule;
[0048] Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule;
[0049] In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address;
[0050] The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
[0051] In a fourth aspect, the present application provides an electronic device, the electronic device comprising:
[0052] one or more processors;
[0053] and a memory associated with one or more processors, the memory being used to store program instructions, which, when read and executed by the one or more processors, perform the following operations:
[0054] In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule;
[0055] Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule;
[0056] In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address;
[0057] The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
[0058] In a fifth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program enables a computer to perform the following operations:
[0059] In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule;
[0060] Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule;
[0061] In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address;
[0062] The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
[0063] The beneficial effects achieved by this application are:
[0064] The present application provides a method for processing stored data, including: in response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule; parsing the data write request to obtain the data to be stored, and storing the data to be stored in a cache according to the preset storage rule; in response to detecting the start of a disk flushing task, searching for a target to-be-written logical address within the maximum logical address range and a first target data corresponding to the target to-be-written logical address according to the ordered identifier; writing the first target data to a physical address on a hard disk corresponding to the target to-be-written logical address. Multiple copies of the to-be-stored data of the same to-be-written logical address can be stored in the cache, without the need for serial waiting processing, which can improve business processing efficiency; at the same time, when eliminating the data that has been flushed, the data corresponding to the mapping metadata with the smallest generation time is released first, which can ensure that if the data is hit in the cache when reading, it is the latest data, and there is no need to query whether there is a mapping metadata and its data with a larger time series value, which can improve the efficiency of data reading. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work, among which:
[0066] Figure 1 It is a schematic diagram of storage data processing provided by an embodiment of the present application;
[0067] Figure 2 This is a schematic diagram of storage data in a cache provided by an embodiment of the present application;
[0068] Figure 3 This is a schematic diagram of storage data in a cache after a disk flush provided by an embodiment of the present application;
[0069] Figure 4 This is a storage data processing system architecture diagram provided by an embodiment of the present application;
[0070] Figure 5 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0072] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like in the entire specification and claims should be interpreted as inclusive rather than exclusive or exhaustive; that is, the meaning of "including but not limited to".
[0073] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0074] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0075] As shown in the background technology, snapshot technology is currently used to protect and back up storage data based on time points. For example, snapshot data is generated for the data in a volume at a certain moment, that is, a copy of the data of this volume at the current moment is generated; when the volume data needs to be restored after being damaged, it can be rolled back based on the snapshot of the storage volume to restore the volume data to the state at the moment the snapshot data was generated.
[0076] Among them, snapshots are mainly implemented in two ways: Copy On Write (COW) and Redirect On Write (ROW). The technical principle of Copy On Write (COW) is: when the data of the source volume changes, the original data is first read and copied to the corresponding data block on the snapshot volume, and then the source volume data is rewritten. The technical principle of Redirect On Write (ROW) is: when the data of the source volume changes, the data will be directly saved first, but not saved in the original storage location, but saved to a new storage location, that is, redirected to a new storage location, and the old data is still retained and becomes snapshot data. Since ROW does not have a data copy process when the source volume data changes, the impact on the source volume is small, so it has a wider range of uses.
[0077] In the prior art, if the source volume is snapshotted, within the same logical address range, the old data may still be in the cache, and new data is received because the data are in the same logical address range, but at different times. The current cache can only cache one copy of the data with the same logical address, so the new data may have to wait for the old data to be flushed to the disk before entering the cache, so the data processing efficiency is not high; and if the cache can cache multiple copies of the same LBA data at the same time, then if the newly written data with the new time sequence number is not grain aligned or is not an integer multiple of the grain size, it is necessary to read the old data for completion, and the old data may be data with a smaller time sequence number, and this data may still be in the cache, so it is necessary to check from the cache first. If there is no old data corresponding to the grain or only part of it, it is necessary to query the LP metadata of the old time sequence number again, and then read the data from the disk, which requires multiple steps to complete, and the processing is relatively complex and time-consuming.
[0078] The present application provides a storage data processing method based on the above-mentioned write-time redirection method to improve data storage efficiency.
[0079] Embodiment 1
[0080] The embodiment of the present application provides a method for processing stored data. Specifically, the method disclosed in the embodiment of the present application is used to process the data to be stored, including the following contents:
[0081] S1. In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule.
[0082] After receiving the data write request sent by the host, the storage volume adds an ordered mark to the data write request to distinguish the data write requests generated at different time points. The above-mentioned adding an ordered mark to the data write request according to the preset rules specifically includes:
[0083] In response to receiving a data write request, detecting whether a snapshot exists; if no snapshot is detected, adding a first ordered identifier to the data write request; if a snapshot is detected, adding a second ordered identifier to the data write request according to the number of snapshots currently existing; wherein the first ordered identifier and the second ordered identifier have a sequential relationship.
[0084] It is understandable that after receiving a data write request, by detecting whether there is a snapshot, it can be determined whether the data write request is the first write. If there is a snapshot, it means that this write is not the first write. If there is no snapshot, it means that this write is the first write. Among them, the first ordered identifier can be understood as a serial number, letter or number that represents a certain order and represents the most initial identifier. The second ordered identifier starts from the first ordered identifier and increases in sequence arithmetic and the number of increases corresponds to the number of snapshots. Through the ordered identifier, the time nodes of the generation of different data write requests can be distinguished; this application does not limit the specific identification form. For example, the first ordered identifier can be set to 0; when a snapshot is detected, the second ordered identifier of the corresponding data write request is set to 1; when two snapshots are detected, the second ordered identifier of the corresponding data write request is set to 2, ...; in some other scenarios, the first ordered identifier can be set to 0; when a snapshot is detected, the second ordered identifier of the corresponding data write request is set to 2; when two snapshots are detected, the second ordered identifier of the corresponding data write request is set to 4, ...; in some other scenarios, the first ordered identifier can be set to a; when a snapshot is detected, the second ordered identifier of the corresponding data write request is set to b; when two snapshots are detected, the second ordered identifier of the corresponding data write request is set to c; .... Reference Figure 2 T0 and T1 in the figure are also one of the manifestations.
[0085] S2. Parse the data write request to obtain the data to be stored, and store the data to be stored in the cache according to a preset storage rule.
[0086] Specifically, the above-mentioned cache is usually a cache cache, or it can be other conventional caches, which is not limited in this application; after receiving the data, the storage device generally puts it into the cache cache first in order to respond to the host as soon as possible, and then responds to the host's data write request.
[0087] In a specific embodiment, reference Figure 2, the above-mentioned parsing of the data write request to obtain the data to be stored, and storing the data to be stored in the cache according to the preset storage rules, includes: parsing the data write request to obtain the logical address to be written, the data length, the data to be stored and the ordered identifier corresponding to the data write request; generating transitional storage data according to the acquired logical address to be written, the data length, the data to be stored and the ordered identifier; using the logical address to be written as an index, storing the transitional storage data in the cache. The data to be stored in the data write request initiated by the host and the data information including the logical address, data length and ordered identifier to be written by the write request are stored in the data structure in the cache; at the same time, the logical address is used as an index to facilitate later data search and further improve the efficiency of data writing and reading. It should be noted that the above-mentioned logical address to be written is identified as an address range divided by grain granularity, wherein the starting address and the ending address of the logical address to be written are both integer multiples of the grain granularity size, and the address range identified is also an integer multiple of the grain granularity size; wherein, grain refers to the size granularity of the LBA range for processing business data.
[0088] It is understandable that before generating transitional storage data, the following operations need to be performed: detect whether the ordered identifier corresponding to the transitional storage data stored in the current cache at the same logical address to be written as the currently received data write request is the same as the ordered identifier contained in the data write request; if the ordered identifier of the transitional storage data at the same address as the logical address to be written in the cache is the same as the ordered identifier corresponding to the currently received data write request, then the original transitional storage data is directly overwritten with the data to be stored contained in the latest write request, that is, directly overwritten in the cache; if the transitional storage data at the same logical address to be written and the ordered identifier corresponding to the currently received data write request are different, then a new transitional storage data is generated for the currently received write request. The newly generated transitional storage data and the original transitional storage data are linked together, and then the data write request is returned to the host to complete. The linking method can be a linked list, and this application does not limit the specific linking method. Reduce cache storage pressure and improve cache performance.
[0089] S3. In response to detecting that the disk flushing task is started, searching for a target to-be-written logical address within the maximum logical address range and first target data corresponding to the target to-be-written logical address according to the ordered identifier.
[0090] The above-mentioned searching for the target to-be-written logical address within the maximum logical address range according to the ordered identifier means determining the target to-be-written logical address according to the smallest ordered identifier among the ordered identifiers contained in all transitional storage data within the maximum logical address range stored in the cache; it is worth noting that the range size represented by the target to-be-written logical address is consistent with the grain. If the range size of the to-be-written logical address identifier matched by the smallest ordered identifier is a multiple of the grain, then it can be split into multiple target to-be-written logical addresses. Figure 2 The maximum logical address range is from LAB:0-LAB:size.
[0091] S4. Write the first target data into a physical address on the hard disk corresponding to the target logical address to be written.
[0092] In a specific embodiment, before writing the first target data to the matching target to-be-written logical address, the method includes: in response to detecting that the granular integrity of the first target data is missing, determining that the first target data is data to be supplemented; obtaining the latest mapping metadata on the target to-be-written logical address corresponding to the data to be supplemented, wherein the mapping metadata includes a mapping relationship between the logical address and the physical address; querying the stored data on the physical address matching the target to-be-written logical address according to the latest mapping metadata; updating the first target data with missing granular integrity according to the stored data and the supplemented data. During business processing, the volume logical space is generally divided according to a certain size granularity (such as 8KB). This granularity is the minimum granularity for business processing, called grain. The actual business data will also be divided into multiple small blocks according to the grain granularity. When the size of the small block is less than the grain size, it needs to be padded. If the small block data has been written in the LBA range corresponding to the grain, the previous data and the latest data are merged; if the data has not been written, it is padded with all-0 data. It can be understood that the criterion for judging the granularity integrity is whether the data in the set grain is fully written or aligned. In this embodiment, it is only necessary to query the latest mapping metadata and read the data from the physical address contained in the latest mapping metadata to complete the data, thereby simplifying the business processing flow, reducing the probability of errors, and improving data processing efficiency.
[0093] In a specific embodiment, the present application also proposes that after searching the target to-be-written logical address within the maximum logical address range according to the ordered identifier, the method also includes: detecting whether there is matching data to be stored in the adjacent to-be-written logical address of the target to-be-written logical address; if it is detected that there is a matching data to be stored in the adjacent to-be-written logical address, the adjacent to-be-written logical address is defined as the target to-be-written logical address, and the data to be stored matching the adjacent to-be-written logical address is defined as the first target data; if it is detected that there are multiple matching data to be stored in the adjacent to-be-written logical address, the adjacent to-be-written logical address is defined as the target to-be-written logical address, and the data to be stored with the smallest ordered identifier among the multiple data to be stored matching the adjacent to-be-written logical address is obtained, and the data to be stored with the smallest ordered identifier is defined as the first target data. The data to be stored of adjacent grains generated at different times can be written to disk together, which can reduce the number of disk downloads and improve processing efficiency.
[0094] Specifically, ROW has two processing methods for the mapping metadata of the original data (LP, mapping relationship from LBA to PBA) when the source volume data changes; the first method is to copy the original LP to the metadata space related to the snapshot, and the original LP in the source volume is overwritten by the newly generated LP; the other method is to distinguish the LPs generated at different times by setting up identifiers; the second method has a wider application range. The storage software background gradually writes the data in the cache to a physical address location on the disk and generates LP metadata. In the second method, the time serial number of the LP generated by the source volume before the snapshot is created is represented by 0. When the first snapshot is created, the time serial number of the LP generated is 1, then the LP with a time serial number of 0 (i.e. less than 1) is the LP related to the first snapshot, and the corresponding data is the data protected by the snapshot, and the latest data of the source volume is the data of the LP with a time serial number of 1, or the data of the LP with no time serial number 1 but with a time serial number of 0. After the second snapshot is created, the time sequence number of the LP generated is 2. Then, the LPs with time sequence number 1 or without sequence number 1 but with sequence number 0 (that is, the maximum time sequence number less than 2) are all LPs related to the second snapshot, and the corresponding data is the data protected by the second snapshot. The latest data of the source volume is the data corresponding to the LP with the maximum time sequence number of the same LBA, that is, the data of the LP with time sequence number 2, or the data of the LP with sequence number 1 but without sequence number 2, or the data of the LP with sequence number 0 but without sequence number 2 and sequence number 1.
[0095] refer to Figure 3, after flushing the data to be stored contained in the data write request to the physical disk, the storage data processing method disclosed in the present application also includes: in response to detecting that the first target data is written to the physical address on the hard disk corresponding to the target logical address to be written; determining the second target data matching the latest mapping metadata on the target logical address to be written in the cache; clearing the data to be stored in the cache except the second target data that matches the target logical address to be written. That is, only the transitional storage data with the largest ordered identifier of each LP is retained within the logical address range corresponding to each grain granularity, and the transitional storage data corresponding to other ordered identifiers are released. The release of the data after flushing to the disk is realized in chronological order, and the orderly release of the redundant data in the cache is realized, which can ensure that if the cache is hit when reading data, it is the latest data.
[0096] In addition, in a specific implementation, when it is necessary to read the stored data, the present application discloses a specific method: in response to receiving a data read request, obtaining a read logical address corresponding to the data read request; detecting whether the read logical address is included in the maximum logical address range; if the read logical address is not included in the maximum logical address range, returning null and issuing an abnormal alarm; if the read logical address is included in the maximum logical address range, detecting whether the logical address to be written in the cache that is the same as the read logical address corresponds to the second target data stored; if the logical address to be written that is the same as the read logical address corresponds to the second target data stored, reading and feeding back the second target data; if the logical address to be written that is the same as the read logical address does not store the second target data, obtaining the latest mapping metadata matching the read logical address; based on the latest mapping metadata, querying and feeding back the stored data at the physical address matching the read logical address.
[0097] In summary, in the storage data processing method disclosed in the embodiment of the present application, the cache can cache multiple copies of the to-be-stored data generated at different time points of the same grain, which can improve business processing efficiency and performance; writing to the disk according to the ordered identifier can make it possible to write non-full grain or non-grain-aligned data to the disk, only need to query the LP metadata of the maximum time sequence number of the LBA and read the data stored on the disk to complete it, which simplifies the business processing flow, can reduce the error probability, and improve processing efficiency; at the same time, combined with the release of the data flushed to the disk according to the time sequence number, it can be ensured that the data cached in the cache must be the latest data of the source volume, which can improve the processing efficiency of the host read request; adjacent grain data with different ordered identifiers can be written to the disk together, which can reduce the number of times the disk is downloaded and improve processing efficiency.
[0098] Embodiment 2
[0099] Corresponding to the above-mentioned embodiment 1, as Figure 4As shown, the embodiment of the present application also provides a storage data processing system, including:
[0100] A preprocessing module 410, configured to, in response to receiving a data write request, add an ordered identifier to the data write request according to a preset rule;
[0101] The cache processing module 420 is used to parse the data write request to obtain the data to be stored, and store the data to be stored in the cache according to a preset storage rule;
[0102] The data processing module 430 is used for searching, in response to detecting that the disk flushing task is started, a target to-be-written logical address within the maximum logical address range and first target data corresponding to the target to-be-written logical address according to the ordered identifier;
[0103] The data writing module 440 writes the first target data into a physical address on the hard disk corresponding to the target logical address to be written.
[0104] In some implementation scenarios, the cache processing module 420 is also used to parse the data write request to obtain the logical address to be written, data length, data to be stored and ordered identifier corresponding to the data write request; generate transitional storage data based on the acquired logical address to be written, data length, data to be stored and ordered identifier; and store the transitional storage data to the cache using the logical address to be written as an index.
[0105] In some implementation scenarios, the data processing module 430 is also used to, in response to detecting that the granularity integrity of the first target data is missing, determine that the first target data is data to be supplemented; obtain the latest mapping metadata on the target logical address to be written corresponding to the data to be supplemented, wherein the mapping metadata includes a mapping relationship between the logical address and the physical address; based on the latest mapping metadata, query the stored data on the physical address that matches the target logical address to be written; and update the first target data that is missing granularity integrity based on the stored data and the supplementary data.
[0106] In some implementation scenarios, the data processing module 430 is also used to, in response to detecting that the first target data is written to a physical address on the hard disk corresponding to the target logical address to be written; determine the second target data in the cache that matches the latest mapping metadata on the target logical address to be written; and clear the data to be stored in the cache that matches the target logical address to be written except the second target data.
[0107] In some implementation scenarios, the data processing module 430 is also used to detect whether there is any matching data to be stored in an adjacent logical address to be written to the target logical address to be written; if it is detected that there is a matching data to be stored in the adjacent logical address to be written, the adjacent logical address to be written is defined as the target logical address to be written, and the data to be stored that matches the adjacent logical address to be written is defined as the first target data; if it is detected that there are multiple matching data to be stored in the adjacent logical address to be written, the adjacent logical address to be written is defined as the target logical address to be written, and the data to be stored with the smallest ordered identifier among the multiple data to be stored that match the adjacent logical address to be written is obtained, and the data to be stored with the smallest ordered identifier is defined as the first target data.
[0108] In some implementation scenarios, the system also includes a data reading module 450 (not shown in the figure), and the data reading module 450 is used to obtain a read logical address corresponding to the data read request in response to receiving a data read request; detect whether the read logical address is included in the maximum logical address range; if the read logical address is not included in the maximum logical address range, return null and issue an abnormal alarm; if the read logical address is included in the maximum logical address range, detect whether the logical address to be written in the cache that is the same as the read logical address corresponds to the second target data stored; if the logical address to be written that is the same as the read logical address corresponds to the second target data stored, read and feedback the second target data; if the logical address to be written that is the same as the read logical address does not store the second target data, obtain the latest mapping metadata matching the read logical address; based on the latest mapping metadata, query and feedback the stored data on the physical address matching the read logical address.
[0109] In some implementation scenarios, the preprocessing module 410 is also used to detect whether there is a snapshot in response to receiving a data write request; if no snapshot is detected, add a first ordered identifier to the data write request; if a snapshot is detected, add a second ordered identifier to the data write request based on the number of snapshots currently existing; wherein the first ordered identifier and the second ordered identifier have a sequential relationship.
[0110] Embodiment 3
[0111] Corresponding to all the above embodiments, the embodiments of the present application further provide a computer program product, which, when executed by a processor, implements the steps of the method described below:
[0112] In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule;
[0113] Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule;
[0114] In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address;
[0115] The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
[0116] Embodiment 4
[0117] Corresponding to all the above embodiments, an embodiment of the present application provides an electronic device, including: one or more processors; and a memory associated with the one or more processors, the memory is used to store program instructions, and when the program instructions are read and executed by the one or more processors, the following operations are performed:
[0118] In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule;
[0119] Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule;
[0120] In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address;
[0121] The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
[0122] in, Figure 5 The architecture of the electronic device is shown as an example, which may include a processor 510, a video display adapter 511, a disk drive 512, an input / output interface 513, a network interface 514, and a memory 520. The processor 510, the video display adapter 511, the disk drive 512, the input / output interface 513, the network interface 514, and the memory 520 may be communicatively connected via a bus 530.
[0123] Among them, the processor 510 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solution provided in this application.
[0124] The memory 520 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 520 can store an operating system 521 for controlling the execution of the electronic device 500, and a basic input and output system (BIOS) 522 for controlling the low-level operations of the electronic device 500. In addition, a web browser 523, a data storage management system 524, and an icon font processing system 525, etc. can also be stored. The above-mentioned icon font processing system 525 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided in the present application is implemented by software or firmware, the relevant program code is stored in the memory 520 and is called and executed by the processor 510.
[0125] The input / output interface 513 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0126] The network interface 514 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0127] The bus 530 comprises a pathway for transmitting information between the various components of the device (eg, the processor 510, the video display adapter 511, the disk drive 512, the input / output interface 513, the network interface 514, and the memory 520).
[0128] In addition, the electronic device 500 can also obtain information on specific collection conditions from the virtual resource object collection condition information database for use in condition judgment, etc.
[0129] It should be noted that, although the above device only shows a processor 510, a video display adapter 511, a disk drive 512, an input / output interface 513, a network interface 514, a memory 520, a bus 530, etc., in the specific implementation process, the device may also include other components necessary for normal execution. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.
[0130] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for a computer device (which can be a personal computer, a cloud service end, or a network device, etc.) to execute the methods of various embodiments of the present application or certain parts of the embodiments.
[0131] Embodiment 5
[0132] Corresponding to all the above embodiments, the embodiments of the present application further provide a computer-readable storage medium, characterized in that it stores a computer program, and the computer program enables a computer to perform the following operations:
[0133] In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule;
[0134] Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule;
[0135] In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address;
[0136] The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
[0137] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0138] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for processing stored data, characterized in that: The method comprises: In response to receiving a data write request, adding an ordered identifier to the data write request according to a preset rule; Parsing the data write request to obtain data to be stored, and storing the data to be stored in a cache according to a preset storage rule; In response to detecting that the disk flushing task is started, searching, according to the ordered identifier, for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address; The first target data is written into a physical address on the hard disk corresponding to the target logical address to be written.
2. The method according to claim 1, characterized in that The parsing of the data write request to obtain the data to be stored, and storing the data to be stored in the cache according to a preset storage rule, includes: Parsing the data write request to obtain a to-be-written logical address, a data length, to-be-stored data, and an ordered identifier corresponding to the data write request; Generate transitional storage data according to the acquired logical address to be written, data length, data to be stored and ordered identifier; The transitional storage data is stored in the cache using the to-be-written logical address as an index.
3. The method according to claim 2, characterized in that Before writing the first target data into the matching target to-be-written logical address, the method includes: In response to detecting that the granular integrity of the first target data is missing, determining that the first target data is data to be supplemented; Acquire the latest mapping metadata on the target to-be-written logical address corresponding to the to-be-complemented data, wherein the mapping metadata includes a mapping relationship between the logical address and the physical address; According to the latest mapping metadata, query the stored data at the physical address matching the target logical address to be written; The first target data lacking granular integrity is updated according to the stored data and the supplementary data.
4. The method according to claim 3, characterized in that The method further comprises: In response to detecting that the first target data is written to a physical address on the hard disk corresponding to the target logical address to be written; Determine second target data in the cache that matches the latest mapping metadata at the target logical address to be written; Clear the data to be stored in the cache that matches the target logical address to be written except the second target data.
5. The method according to any one of claims 1 to 4, characterized in that: After searching the target to-be-written logical address within the maximum logical address range according to the ordered identifier, the method further includes: Detecting whether there is matching data to be stored at a logical address to be written adjacent to the target logical address to be written; If it is detected that the adjacent logical address to be written has a matching piece of data to be stored, the adjacent logical address to be written is defined as a target logical address to be written, and the data to be stored that matches the adjacent logical address to be written is defined as a first target data; If it is detected that there are multiple matching data to be stored in the adjacent logical address to be written, the adjacent logical address to be written is defined as the target logical address to be written, and the data to be stored with the smallest ordered identifier among the multiple data to be stored that match the adjacent logical address to be written is obtained, and the data to be stored with the smallest ordered identifier is defined as the first target data.
6. The method according to claim 3, characterized in that The method further comprises: In response to receiving a data read request, obtaining a read logical address corresponding to the data read request; Detecting whether the read logical address is included in the maximum logical address range; If the read logical address is not included in the maximum logical address range, return null and issue an abnormal alarm; If the read logical address is included in the maximum logical address range, detecting whether the to-be-written logical address that is the same as the read logical address in the cache stores second target data correspondingly; If the second target data is stored in correspondence with the to-be-written logical address which is the same as the read logical address, then the second target data is read and fed back; If the to-be-written logical address that is the same as the read logical address does not store the second target data, acquiring the latest mapping metadata that matches the read logical address; According to the latest mapping metadata, the stored data at the physical address matching the read logical address is queried and fed back.
7. The method according to any one of claim 6, characterized in that: In response to receiving the data write request, adding an ordered identifier to the data write request according to a preset rule includes: In response to receiving a data write request, detecting whether a snapshot exists; If no snapshot is detected, adding a first ordered identifier to the data write request; If a snapshot is detected, adding a second ordered identifier to the data write request according to the number of currently existing snapshots; There is a sequence relationship between the first ordered identifier and the second ordered identifier.
8. A storage data processing system, characterized in that: The system comprises: A preprocessing module, configured to, in response to receiving a data write request, add an ordered identifier to the data write request according to a preset rule; A cache processing module, used for parsing the data write request to obtain the data to be stored, and storing the data to be stored in the cache according to a preset storage rule; A data processing module, configured to search for a target to-be-written logical address within a maximum logical address range and first target data corresponding to the target to-be-written logical address according to the ordered identifier in response to detecting that a disk flushing task is started; The data writing module writes the first target data into a physical address on the hard disk corresponding to the target logical address to be written.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; And a memory associated with the one or more processors, the memory is used to store program instructions, and when the program instructions are read and executed by the one or more processors, the method according to any one of claims 1-7 is executed.
10. A computer-readable storage medium, characterized in that: The computer program stores a computer program, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data processing method and apparatus
CN103761190A
Metadata management method and device
CN110727403A
Method of writing data in storage device, storage device and storage system
CN111352581A
Snapshot creation method, computing device and storage medium
CN114328018A
SSD data processing method and device, storage medium and SSD equipment
CN114415972A
