Data reading and writing method, device, equipment and medium of a storage medium

By judging the aging area in the storage medium and updating the read and write instructions, the read and write delay problem caused by the aging area is solved, and the balance between device stability and resource utilization is achieved.

CN114371817BActive Publication Date: 2025-07-22ZHEJIANG DAHUA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111580067.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2025-07-22
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

How to not waste storage resources when there are aging areas in the storage medium and improve device stability.

Method used

By receiving data read and write instructions, it is determined whether the position information is in the aging area. If so, the target replacement position information is determined based on the correspondence between the position information in the aging area and the replacement position information in the non-aging area, and the read and write instructions are updated to read and write data in the non-aging area.

Benefits of technology

Reduces read and write delays, improves device stability, and maximizes the use of storage resources, avoiding wasted storage resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114371817B_ABST
    Figure CN114371817B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, apparatus, device and medium for data reading and writing of a storage medium, which can neither waste storage resources nor improve device stability when performing data reading and writing on the storage medium. Since the present invention can convert the data reading and writing at the first position information corresponding to the data to be read and written in the storage medium in the read-write instruction into the data reading and writing at the target alternative position information in the corresponding non-aging area when the first position information is located in the aging area, the read-write delay can be reduced and the device stability can be improved; at the same time, when some areas in the storage medium are aging areas, the storage medium can still be used (accessed), making the most of the storage resources and not wasting the storage resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of storage media, and in particular, to a method, apparatus, device, and medium for reading and writing data of a storage medium. Background Art

[0002] Any available medium or data storage device that can be accessed (read and written) by a processor in an electronic device is generally referred to as a storage medium. Storage media include, but are not limited to, hard disks, Embedded Multi Media Cards (eMMC), non-volatile memories (NAND FLASH), solid state drives (SSD), etc.

[0003] Taking a hard disk in a storage medium as an example, a hard disk is a device with a magnetic medium as a carrier. As the hard disk is continuously read and written, the magnetic medium in the hard disk is constantly worn and aged. If the magnetic medium in a certain area of the disk is worn and aged relatively seriously, it is necessary to try many times to normally complete data input and output (IO) for this area, resulting in a relatively long time-consuming for one IO read and write in this area, that is, a relatively long read and write delay.

[0004] Currently, when there is an area with a relatively long read and write delay (aged area) in a hard disk, there are usually two processing methods. One processing method is to discard the hard disk in the aged area and no longer access it. However, the disadvantage of this processing method is that there is a large waste of storage resources. Another processing method is to not perform any optimization on the hard disk with an aged area and continue to access any area in this hard disk. The advantage of this processing method is that it saves storage resources; however, the disadvantage of this processing method is that it may cause a decline in device performance due to too long read and write delays, and even cause data loss, affecting the stability of the device.

[0005] Therefore, when there is an aged area in a storage medium, how to perform data reading and writing on this storage medium so as not to waste storage resources and improve the stability of the device is a technical problem that needs to be solved urgently at present. Summary of the Invention

[0006] The present invention provides a method, apparatus, device, and medium for reading and writing data of a storage medium, so as to neither waste storage resources nor improve the stability of the device when performing data reading and writing on the storage medium.

[0007] In a first aspect, the present invention provides a method for reading and writing data of a storage medium, the method comprising:

[0008] Receiving a data read and write instruction for the storage medium, wherein the read and write instruction carries first position information corresponding to the data to be read and written in the storage medium;

[0009] Determine whether the first position information is located within a pre-configured aging area;

[0010] If so, determine the target replacement position information corresponding to the first position information according to the correspondence between the position information within the pre-configured aging area and the replacement position information within the non-aging area;

[0011] Update the first position information in the read / write instruction according to the target replacement position information; and read and write the data in the storage medium according to the updated read / write instruction.

[0012] In a possible implementation manner, the process of pre-configuring the position information within the aging area includes:

[0013] For each statistical period, detect the read / write delay corresponding to each position information when reading and writing the data at any position information of the storage medium within this statistical period; and perform a descending order sorting on the read / write delays corresponding to each position information, and determine the position information corresponding to the top set number of read / write delays in the descending order sorting as the position information within the aging sub-area of this statistical period;

[0014] Based on the position information within the aging sub-area of each statistical period, determine the position information within the aging area.

[0015] In a possible implementation manner, the determining the position information within the aging area based on the position information within the aging sub-area of each statistical period includes:

[0016] Determine the position information within the aging sub-area of each statistical period as the position information within the aging area; or,

[0017] Update the currently saved position information within the aging area according to the position information within the aging sub-area of the current statistical period.

[0018] In a possible implementation manner, the process of pre-configuring the position information within the aging area includes:

[0019] Detect the read / write delay corresponding to a position information when reading and writing the data at any position information of the storage medium; determine whether the read / write delay corresponding to this position information exceeds the currently saved delay threshold, and if so, determine this position information as the position information within the aging area.

[0020] In a possible implementation manner, the process of configuring the delay threshold includes:

[0021] Detect the read / write latency corresponding to each location information when reading and writing data in any location information of the storage medium within the current statistical period; and perform a descending sort on the read / write latency corresponding to each location information;

[0022] Based on the top set number of read / write latencies in the descending sort, determine a candidate latency threshold;

[0023] Based on the candidate latency threshold and the currently saved latency threshold, determine a target latency threshold;

[0024] Update the currently saved latency threshold according to the target latency threshold.

[0025] In a possible implementation manner, detecting the read / write latency corresponding to a location information when reading and writing data in any location information of the storage medium includes:

[0026] For any location information, record the start time information when starting to read and write data in this location information and the end time information when finishing reading and writing data in this location information;

[0027] Determine the read / write latency corresponding to this location information according to the start time information and the end time information.

[0028] In a possible implementation manner, the corresponding relationship between the location information in the aging area and the alternative location information in the non-aging area is pre-configured at a set location of the storage medium.

[0029] In a possible implementation manner, the method further includes:

[0030] If the first location information is not located in the pre-configured aging area, read and write the data in the storage medium according to the received read / write instruction.

[0031] In a second aspect, the present invention provides a data read / write device for a storage medium, and the device includes:

[0032] A receiving module, configured to receive a data read / write instruction for the storage medium, where the read / write instruction carries the first location information corresponding to the data to be read / written in the storage medium;

[0033] A judging module, configured to judge whether the first location information is located in a pre-configured aging area;

[0034] A determining module, configured to, if the first location information is located in the pre-configured aging area, determine the target alternative location information corresponding to the first location information according to the corresponding relationship between the location information in the pre-configured aging area and the alternative location information in the non-aging area;

[0035] An update module, configured to update the first position information in the read / write instruction according to the target replacement position information;

[0036] A read / write module, configured to read and write data in the storage medium according to the updated read / write instruction.

[0037] In a possible implementation manner, the device further includes:

[0038] An aging area determination module, configured to, for each statistical period, detect the read / write delay corresponding to each position information when reading and writing data in any position information of the storage medium during this statistical period; and perform a descending order sorting on the read / write delays corresponding to each position information, and determine the position information corresponding to the top set number of read / write delays in the descending order sorting as the position information in the aging sub-area of this statistical period;

[0039] Determine the position information in the aging area based on the position information in the aging sub-area of each statistical period.

[0040] In a possible implementation manner, the aging area determination module is specifically configured to determine all the position information in the aging sub-area of each statistical period as the position information in the aging area; or,

[0041] Update the position information in the currently saved aging area according to the position information in the aging sub-area of the current statistical period.

[0042] In a possible implementation manner, the aging area determination module is further configured to detect the read / write delay corresponding to a position information when reading and writing data in any position information of the storage medium; determine whether the read / write delay corresponding to this position information exceeds a pre-configured delay threshold, and if so, determine this position information as the position information in the aging area.

[0043] In a possible implementation manner, the device further includes:

[0044] A delay threshold configuration module, configured to detect the read / write delay corresponding to each position information when reading and writing data in any position information of the storage medium during the current statistical period; and perform a descending order sorting on the read / write delays corresponding to each position information; determine a candidate delay threshold based on the top set number of read / write delays in the descending order sorting; determine a target delay threshold based on the candidate delay threshold and the currently saved delay threshold; and update the currently saved delay threshold according to the target delay threshold.

[0045] In a possible implementation, the aging area determination module is specifically configured to, for any position information, record the start time information when starting to read and write data in the position information and the end time information when finishing reading and writing data in the position information; and determine the read-write delay corresponding to the position information according to the start time information and the end time information.

[0046] In a possible implementation, the read-write module is further configured to, if the first position information is not located in the pre-configured aging area, read and write data in the storage medium according to the received read-write instruction.

[0047] In a third aspect, the present invention further provides an electronic device, which at least includes a processor and a memory. The processor is configured to implement the steps of the data read-write method of the storage medium as described in any one of the above when executing a computer program stored in the memory.

[0048] In a fourth aspect, the present invention further provides a storage medium, which stores a computer program. The computer program is configured to implement the steps of the data read-write method of the storage medium as described in any one of the above when executed by a processor.

[0049] Since the present invention can receive a data read-write instruction for a storage medium, where the read-write instruction carries the first position information corresponding to the data to be read and written in the storage medium; determine whether the first position information is located in a pre-configured aging area; if so, determine the target alternative position information corresponding to the first position information according to the correspondence between the position information in the pre-configured aging area and the alternative position information in the non-aging area, update the first position information in the read-write instruction according to the target alternative position information, and read and write data in the storage medium according to the updated read-write instruction. Since the present invention can convert reading and writing data in the first position information to reading and writing data in the target alternative position information in the corresponding non-aging area when the first position information corresponding to the data to be read and written in the storage medium carried in the read-write instruction is located in the aging area, the read-write delay can be reduced and the device stability can be improved; at the same time, when some areas in the storage medium are aging areas, the storage medium can still be used (accessed), maximizing the utilization of storage resources without wasting storage resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present invention or the implementation manners in related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings.

[0051] Figure 1 Schematic diagram of the data reading and writing process of the first storage medium provided by an embodiment of the present invention;

[0052] Figure 2 Schematic diagram of the process for determining the position information in the aging area provided by the first embodiment of the present invention;

[0053] Figure 3 Schematic diagram of the process for determining the position information in the aging area provided by the second embodiment of the present invention;

[0054] Figure 4 Schematic diagram of the data reading and writing process of the second storage medium provided by an embodiment of the present invention;

[0055] Figure 5 Schematic diagram of the process for determining the position information in the aging area provided by the third embodiment of the present invention;

[0056] Figure 6 Schematic diagram of the data reading and writing process of the third storage medium provided by an embodiment of the present invention;

[0057] Figure 7 Schematic diagram of the process for determining the position information in the aging area provided by the fourth embodiment of the present invention;

[0058] Figure 8 Schematic diagram of the process for determining the position information in the aging area provided by the fifth embodiment of the present invention;

[0059] Figure 9 Schematic diagram of the data reading and writing device of a storage medium provided by an embodiment of the present invention;

[0060] Figure 10 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0061] In order to neither waste storage resources nor improve device stability when reading and writing data to a storage medium, the present invention provides a data reading and writing method, device, equipment and medium for a storage medium.

[0062] To make the purpose and implementation manner of the present invention clearer, the following will clearly and completely describe the exemplary implementation manner of the present invention with reference to the drawings in the exemplary embodiments of the present invention. Obviously, the described exemplary embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.

[0063] It should be noted that the brief description of the terms in the present invention is only for the convenience of understanding the subsequent described implementation manner, rather than intending to limit the implementation manner of the present invention. Unless otherwise specified, these terms should be understood in their ordinary and common meanings.

[0064] In the present invention, terms such as "first", "second", "third", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar or like objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that such terms can be interchanged under appropriate circumstances.

[0065] The terms "comprising" and "having" and any variations thereof are intended to cover but not exclusively include. For example, a product or device comprising a series of components does not necessarily have to be limited to all the components clearly listed, but may include other components not clearly listed or inherent to these products or devices.

[0066] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or a combination of hardware and / or software code that can perform functions related to the element.

[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.

[0068] Embodiment 1:

[0069] Figure 1 It is a schematic diagram of the data reading and writing process of the first storage medium provided by an embodiment of the present invention. The process includes the following steps:

[0070] S101: Receive a data reading and writing instruction for the storage medium, where the reading and writing instruction carries first position information corresponding to the data to be read and written in the storage medium.

[0071] The data reading and writing method of the storage medium provided by the embodiment of the present invention is applied to an electronic device, and the electronic device may be, for example, a PC, a server, etc. A storage medium can be connected to the electronic device.

[0072] In a possible implementation, the electronic device can receive a data read / write instruction triggered by a user for a storage medium accessed in the electronic device. The read / write instruction may carry the position information (for convenience of description, referred to as the first position information) corresponding to the data to be read / written in the storage medium. Exemplarily, the read / write instruction may include a data input / output (I / O) read / write instruction. Among them, when data input is required in the storage medium, it can be considered that a data write instruction in the data read / write instruction is received. The data write instruction may carry the position information (the first position information) indicating which position in the storage medium the data to be written should be written to, that is, it carries the first position information corresponding to the data to be written in the storage medium. When data output is required in the storage medium, it can be considered that a data read instruction in the data read / write instruction is received. The data read instruction may carry the position information (the first position information) indicating which position in the storage medium the data to be read is located, that is, it carries the first position information corresponding to the data to be read in the storage medium. Among them, for convenience of description, the data write instruction and the data read instruction are collectively referred to as the data read / write instruction, and the data to be written and the data to be read are collectively referred to as the data to be read / written.

[0073] Among them, the first position information can be flexibly set according to requirements, and the present invention does not make specific limitations on this. Exemplarily, the first position information may include the starting position information and the length information (such as 1MB, 2MB, etc.) corresponding to the data to be read / written in the storage medium.

[0074] In a possible implementation, when at least two (multiple) storage media are accessed in the electronic device, the first position information may further include the position identification information of the storage medium where the data to be read / written is located. The electronic device can determine the storage medium corresponding to the position identification information from the storage media accessed by itself according to the position identification information of the storage medium included in the first position information.

[0075] S102: Determine whether the first position information is located within a pre-configured aging area; if so, perform S103; if not, perform S105.

[0076] In a possible implementation, the aging area in the storage medium can be determined (configured) in advance. After receiving the read / write instruction, the electronic device can determine whether the first position information carried in the read / write instruction is located within the pre-configured aging area of the storage medium.

[0077] S103: If the first position information is located within the pre-configured aging area, determine the target alternative position information corresponding to the first position information according to the correspondence between the position information within the pre-configured aging area and the alternative position information within the non-aging area.

[0078] In a possible implementation, when there is an aging area in the storage medium, in order to continue using the storage medium without wasting storage resources and reduce the read / write latency and improve the device stability, the correspondence between the location information in the aging area of the storage medium and the location information in the non-aging area of the storage medium (referred to as alternative location information for convenience of description) can be pre-configured. Among them, the correspondence between the location information in the aging area and the alternative location information in the non-aging area can be flexibly set according to requirements, and the present invention does not make specific limitations thereto.

[0079] Exemplarily, if the location information in the aging area includes start position information and length information, the alternative location information in the corresponding non-aging area may also include start position information and length information. In a possible implementation, the length information (size) of the location information in the aging area may be the same as the length information (size) of the alternative location information in the corresponding non-aging area. Exemplarily, when the length information of the location information in the aging area is 1MB, the length information of the alternative location information in the corresponding non-aging area may also be 1MB. When the length information of the location information in the aging area is 2MB, the length information of the alternative location information in the corresponding non-aging area may also be 2MB.

[0080] In a possible implementation, in the correspondence between the location information in the aging area of the pre-configured storage medium and the alternative location information in the non-aging area, the attribute information of the data in the location information in the aging area may be the same as the attribute information of the data in the corresponding alternative location information in the non-aging area. Exemplarily, if there is no data written in the location information in the aging area (for convenience of description, the attribute information of the data in the location information where no data is written is referred to as the attribute information of the data being empty), the attribute information of the data in the corresponding alternative location information in the non-aging area is also empty. If there is data written in the location information in the aging area, the data written in the location information in the aging area can be copied and backed up to the corresponding alternative location information in the non-aging area in advance, so that the attribute information of the data in the location information in the aging area is the same as the attribute information of the data in the corresponding alternative location information in the non-aging area.

[0081] In a possible implementation, if the first location information is located in the pre-configured aging area, the alternative location information corresponding to the first location information (referred to as the target alternative location information for convenience of description) can be determined according to the correspondence between the location information in the pre-configured aging area and the alternative location information in the non-aging area.

[0082] S104: Update the first position information in the read / write instruction according to the target replacement position information; and read and write the data in the storage medium according to the updated read / write instruction.

[0083] After determining the target replacement position information, the first position information in the read / write instruction can be updated according to the target replacement position information, that is, the first position information carried in the read / write instruction is updated (converted) to the target replacement position information, and the data in the target replacement position information in the storage medium is read and written according to the updated read / write instruction. In a possible implementation manner, since the attribute information of the data in the target replacement position information is the same as the attribute information of the data in the first position information, when converting the reading and writing of data in the first position information to the reading and writing of data in the target replacement position information, it is possible to reduce the read / write delay, improve the device stability, and improve the user experience while achieving the same read / write effect. At the same time, when some areas in the storage medium are aging areas, the storage medium can still be used (accessed), without wasting storage resources.

[0084] S105: Read and write the data in the storage medium according to the received read / write instruction.

[0085] In a possible implementation manner, if the first position information is not located in the pre-configured aging area, it can be considered that the first position information is the position information in the non-aging area, and then the data in the first position information in the storage medium can be directly read and written according to the received read / write instruction.

[0086] Since the present invention can receive a data read / write instruction for a storage medium, where the read / write instruction carries the first position information corresponding to the data to be read / written in the storage medium; determine whether the first position information is located in the pre-configured aging area; if so, determine the target replacement position information corresponding to the first position information according to the corresponding relationship between the position information in the pre-configured aging area and the replacement position information in the non-aging area, update the first position information in the read / write instruction according to the target replacement position information, and read and write the data in the storage medium according to the updated read / write instruction. Since the present invention can convert the reading and writing of data in the first position information to the reading and writing of data in the target replacement position information in the corresponding non-aging area when the first position information carried in the read / write instruction for the data to be read / written in the storage medium is located in the aging area, it is possible to reduce the read / write delay and improve the device stability; at the same time, when some areas in the storage medium are aging areas, the storage medium can still be used (accessed), making the most of the storage resources without wasting storage resources.

[0087] Embodiment 2:

[0088] To determine (configure) the aging area in the storage medium, based on the above embodiments, in the embodiments of the present invention, the process of pre-configuring the position information in the aging area includes:

[0089] For each statistical period, during this statistical period, when reading and writing data in any position information of the storage medium, detect the read-write delay corresponding to each position information; and perform a descending order sorting on the read-write delays corresponding to each position information, and determine the position information corresponding to the top set number of read-write delays in the descending order sorting as the position information in the aging sub-area of this statistical period;

[0090] Based on the position information in the aging sub-areas of each statistical period, determine the position information in the aging area.

[0091] In a possible implementation manner, the process of determining the aging area in the storage medium can be continuously carried out along with the entire life cycle of the storage medium. For example, the position information in the aging area can be continuously counted (configured) periodically. Among them, the present invention does not make specific limitations on the statistical period, and it can be flexibly set according to requirements. For each statistical period, during this statistical period, when reading and writing data in any position information of the storage medium, detect the read-write delay corresponding to each position information of the storage medium. Among them, the process of detecting (determining) the read-write delay corresponding to each position information can adopt the method of determining the read-write delay provided in Embodiment 5, which will not be elaborated here.

[0092] Generally, the longer the read-write delay, the more serious the aging of the position information. To flexibly and accurately determine the aging area in the storage medium, the read-write delays corresponding to each position information can be sorted in descending order, and then the position information corresponding to the top set number of read-write delays in the descending order sorting is determined as the position information in the aging sub-area of this statistical period, that is, the position information corresponding to the set number of read-write delays with longer read-write delays can be determined as the position information in the aging sub-area of this statistical period. Among them, the present invention does not make specific limitations on the set number, and it can be flexibly set according to requirements. For example, the set number can be 10, etc. Exemplarily, assume that a total of 100 pieces of position information corresponding to read-write delays are counted in a certain statistical period, and the position information corresponding to the first 10 read-write delays with longer read-write delays can be determined as the position information in the aging sub-area of this statistical period.

[0093] After determining the position information within the aging sub-region for each statistical period, the position information within the aging region of the storage medium can be determined based on the position information within the aging sub-region for each statistical period. In one possible implementation, when determining the position information within the aging region of the storage medium, the position information within the aging sub-region for each statistical period can be determined as the position information within the aging region. That is, the position information within the aging sub-region of the current statistical period and the position information within the aging sub-region of the previous statistical period can both be determined as the position information within the aging region. Exemplarily, assuming the position information within the aging sub-region of the previous statistical period is A, B, C, and the position information within the aging sub-region of the current statistical period is D, E, then A, B, C, D, and E can all be determined as the position information within the aging region of the storage medium.

[0094] In one possible implementation, when determining the position information within the aging region of the storage medium, it can also be to update the currently saved position information within the aging region according to the position information within the aging sub-region of the current statistical period. That is, only the position information within the aging sub-region of the current statistical period is determined as the position information within the aging region of the storage medium, and the position information within the aging region determined based on the previous statistical period is deleted. Exemplarily, for example, the position information within the aging region of the storage medium (currently saved) determined based on the previous statistical period is A, B, C, and the position information within the aging sub-region of the current statistical period is D, E, then only D and E can be determined as the position information within the aging region of the storage medium, that is, the position information within the aging region of the storage medium is updated from A, B, C to D, E.

[0095] In one possible implementation, before updating the currently saved position information within the aging region according to the position information within the aging sub-region of the current statistical period, it can also be determined whether the average read / write delay corresponding to the position information within the aging sub-region of the current statistical period (for convenience of description, called the first average value) is greater than the average read / write delay corresponding to the currently saved position information within the aging region (for convenience of description, called the second average value). If the first average value is greater than the second average value, it can be considered that the aging of the position information within the aging sub-region of the current statistical period is relatively serious, and the subsequent step of updating the currently saved position information within the aging region according to the position information within the aging sub-region of the current statistical period can be performed. In one possible implementation, if the first average value is not greater than (less than or equal to) the second average value, the subsequent step of updating the currently saved position information within the aging region according to the position information within the aging sub-region of the current statistical period can be skipped.

[0096] For ease of understanding, the following uses a specific embodiment to illustrate the process of determining (configuring) the location information within the aging area provided by the present invention. Figure 2 FIG. is a schematic diagram of the first process for determining the location information within the aging area provided by an embodiment of the present invention. As Figure 2 shown, this process includes the following steps:

[0097] S201: For each statistical period, detect the read / write latency corresponding to each location information when reading and writing data in any location information of the storage medium during this statistical period; and perform a descending order sorting on the read / write latency corresponding to each location information, and determine the location information corresponding to the top set number of read / write latencies in the descending order sorting as the location information within the aging sub-area of this statistical period.

[0098] S202: Determine the location information within the aging sub-area of each statistical period as the location information within the aging area of the storage medium.

[0099] For ease of understanding, the following uses a specific embodiment to illustrate the process of determining (configuring) the location information within the aging area provided by the present invention. Figure 3 FIG. is a schematic diagram of the second process for determining the location information within the aging area provided by an embodiment of the present invention. As Figure 3 shown, this process includes the following steps:

[0100] S301: For each statistical period, detect the read / write latency corresponding to each location information when reading and writing data in any location information of the storage medium during this statistical period; and perform a descending order sorting on the read / write latency corresponding to each location information, and determine the location information corresponding to the top set number of read / write latencies in the descending order sorting as the location information within the aging sub-area of this statistical period.

[0101] S302: Update the currently saved location information within the aging area according to the location information within the aging sub-area of the current statistical period.

[0102] For ease of understanding, the following uses a specific embodiment to illustrate the data read / write process of the storage medium provided by the present invention. Figure 4 FIG. is a schematic diagram of the second data read / write process of the storage medium provided by an embodiment of the present invention. As Figure 4 shown, this process includes the following steps:

[0103] S401: For each statistical period, detect the read / write latency corresponding to each location information when reading and writing data in any location information of the storage medium during the statistical period; sort the read / write latencies corresponding to each location information in descending order, and determine the location information corresponding to the top set number of read / write latencies in the descending order as the location information within the aging sub-region of the statistical period; based on the location information within the aging sub-region of each statistical period, determine the location information within the aging region of the storage medium.

[0104] Among them, when determining the location information within the aging region based on the location information within the aging sub-region of each statistical period, it may be to determine all the location information within the aging sub-region of each statistical period as the location information within the aging region of the storage medium; or it may be to update the currently saved location information within the aging region according to the location information within the aging sub-region of the current statistical period.

[0105] S402: Receive a data read / write instruction for the storage medium, where the read / write instruction carries the first location information corresponding to the data to be read / written in the storage medium.

[0106] S403: Determine whether the first location information is located within a pre-configured aging region; if so, perform S404; if not, perform S406.

[0107] S404: Determine the target replacement location information corresponding to the first location information according to the correspondence between the location information within the pre-configured aging region and the replacement location information within the non-aging region.

[0108] S405: Update the first location information in the read / write instruction according to the target replacement location information; and read and write the data in the storage medium according to the updated read / write instruction.

[0109] S406: Read and write the data in the storage medium according to the received read / write instruction.

[0110] Embodiment 3:

[0111] In order to determine (configure) the aging region in the storage medium, on the basis of the above embodiments, in the embodiments of the present invention, the process of pre-configuring the location information within the aging region includes:

[0112] Detect the read / write latency corresponding to the location information when reading and writing data in any location information of the storage medium; if the read / write latency corresponding to the location information exceeds the currently saved latency threshold, determine the location information as the location information within the aging region.

[0113] In a possible implementation, when pre-configuring the location information in the aging area, it can be when reading and writing data in any location information of the storage medium, detecting the read-write delay corresponding to the location information, and determining whether the read-write delay corresponding to the location information exceeds the pre-configured delay threshold. If the read-write delay corresponding to the location information exceeds the currently saved delay threshold, it can be considered that the read-write delay corresponding to the location information is relatively long, and the location information can be determined as the location information in the aging area. On the contrary, if the read-write delay corresponding to the location information does not exceed the pre-configured delay threshold, it can be considered that the read-write delay corresponding to the location information is relatively short, and the location information can be considered as the location information in the non-aging area, and the location information is not determined as the location information in the aging area. In a possible implementation, the delay threshold can be a fixed value, and the specific value of the delay threshold can be flexibly set according to requirements, and the present invention does not make specific limitations on this.

[0114] For ease of understanding, the following uses a specific embodiment to illustrate the process of determining (configuring) the location information in the aging area provided by the present invention. Figure 5 FIG. is a schematic diagram of the third process of determining the location information in the aging area provided by the embodiment of the present invention. As Figure 5 shown, the process includes the following steps:

[0115] S501: Detect the read-write delay corresponding to the location information when reading and writing data in any location information of the storage medium.

[0116] S502: Determine whether the read-write delay corresponding to the location information exceeds the currently saved delay threshold. If so, perform S503; if not, perform S504.

[0117] S503: Determine the location information as the location information in the aging area of the storage medium.

[0118] S504: Consider the location information as the location information in the non-aging area, and do not determine the location information as the location information in the aging area.

[0119] Embodiment 4:

[0120] In a possible implementation, in order to accurately determine the location information in the aging area, the delay threshold can be configured as a value that can be adaptively adjusted dynamically with the read-write delay of the location information detected in the current statistical period (for ease of description, called a dynamic value). In order to configure the delay threshold as a dynamic value, on the basis of the above embodiments, in the embodiment of the present invention, the process of configuring the delay threshold includes:

[0121] Detect the read / write latency corresponding to each location information when reading and writing data in any location information of the storage medium during the current statistical period; sort the read / write latencies corresponding to each location information in descending order, and determine a candidate latency threshold based on the top set number of read / write latencies in the descending order;

[0122] Determine a target latency threshold based on the candidate latency threshold and the currently saved latency threshold; update the currently saved latency threshold according to the target latency threshold.

[0123] In a possible implementation manner, when configuring the latency threshold, it is possible to detect the read / write latency corresponding to each location information when reading and writing data in any location information of the storage medium during the current statistical period. Among them, the process of detecting (determining) the read / write latency corresponding to each location information can adopt the method for determining the read / write latency provided in Embodiment 5, which will not be elaborated here.

[0124] After determining the read / write latency corresponding to each location information, the read / write latencies corresponding to each location information can be sorted in descending order. Then, based on the top set number of read / write latencies in the descending order, determine a candidate latency threshold. Among them, when determining the candidate latency threshold based on the top set number of read / write latencies in the descending order, it can be to determine the average value, the highest value, the lowest value, etc. of the set number of read / write latencies as the candidate latency threshold. In addition, the set number can be flexibly set according to requirements, and the present invention does not make specific limitations in this regard. Exemplarily, the average value of the top 10 read / write latencies in the descending order, that is, the average value of the 10 read / write latencies with longer read / write latencies, can be determined as the candidate latency threshold, etc.

[0125] After determining the candidate latency threshold for the current statistical period, a target latency threshold can be determined based on the candidate latency threshold and the currently saved latency threshold. Exemplarily, when determining the target latency threshold, it can be to determine the average value, the highest value, the lowest value, etc. of the candidate latency threshold and the currently saved latency threshold as the target latency threshold. Then, update the currently saved latency threshold according to the target latency threshold, that is, dynamically update the latency threshold to the target latency threshold.

[0126] Exemplarily, taking the average value of the candidate latency threshold and the currently saved latency threshold as the target latency threshold as an example, if the candidate latency threshold for the current statistical period is 10s and the currently saved latency threshold is 8s, then the target latency threshold can be determined to be 9s, and the currently saved latency threshold can be further updated to 9s. That is, the currently saved latency threshold is dynamically updated from 8s to 9s.

[0127] For ease of understanding, the following uses a specific embodiment to illustrate the data read / write process of the storage medium provided by the present invention.Figure 6 Schematic diagram of the data reading and writing process of the third storage medium provided by the embodiment of the present invention. As Figure 6 shown, this process includes the following steps:

[0128] S601: During the current statistical period, when reading and writing data in any location information of the storage medium, detect the read / write delay corresponding to each location information; and perform a descending sort on the read / write delays corresponding to each location information; based on the top set number of read / write delays in the descending sort, determine a candidate delay threshold; based on the candidate delay threshold and the currently saved delay threshold, determine a target delay threshold; and update the currently saved delay threshold according to the target delay threshold.

[0129] S602: When reading and writing data in any location information of the storage medium, detect the read / write delay corresponding to this location information; determine whether the read / write delay corresponding to this location information exceeds the currently saved delay threshold. If so, determine this location information as the location information within the aging area.

[0130] S603: Receive a data read / write instruction for the storage medium. Among them, the read / write instruction carries the first location information corresponding to the data to be read / written in the storage medium.

[0131] S604: Determine whether the first location information is located within a pre-configured aging area; if so, perform S605; if not, perform S607.

[0132] S605: According to the correspondence between the location information within the pre-configured aging area and the alternative location information within the non-aging area, determine the target alternative location information corresponding to the first location information.

[0133] S606: Update the first location information in the read / write instruction according to the target alternative location information; and read and write the data in the storage medium according to the updated read / write instruction.

[0134] S607: Read and write the data in the storage medium according to the received read / write instruction.

[0135] Embodiment 5:

[0136] In order to detect the read / write delay corresponding to the location information, based on the above embodiments, in the embodiment of the present invention, detecting the read / write delay corresponding to any location information of the storage medium when reading and writing data in it includes:

[0137] For any location information, record the start time information when starting to read and write the data in this location information and the end time information when finishing reading and writing the data in this location information;

[0138] Determine the read / write latency corresponding to the location information according to the start time information and the end time information.

[0139] In a possible implementation manner, for any location information in the storage medium, when detecting the read / write latency corresponding to the location information, it may be that when starting to read / write the data in the location information, record the start time information. When finishing reading / writing the data in the location information, record the end time information again. Then, determine the read / write latency corresponding to the location information according to the start time information and the end time information. Exemplarily, the time difference between the end time information and the start time information can be determined as the read / write latency corresponding to the location information.

[0140] Embodiment 6:

[0141] In a possible implementation manner, in order to improve efficiency, based on the above embodiments, in the embodiments of the present invention, the correspondence relationship between the location information in the aging area and the alternative location information in the non-aging area is pre-configured at a set position of the storage medium.

[0142] In a possible implementation manner, the correspondence relationship between the location information in the aging area of the storage medium and the alternative location information in the non-aging area can be pre-configured at a set position of the storage medium. Among them, the set position can be flexibly set according to requirements, and the present invention does not make specific limitations on this. Exemplarily, taking the storage medium as a hard disk, a space can be reserved in the hard disk, and the reserved space is used as the set position, and the correspondence relationship between the location information in the aging area of the storage medium and the alternative location information in the non-aging area is pre-configured at the set position. In a possible implementation manner, the reserved space (set position) can be shielded at the system layer so that the reserved space is not displayed to the user layer, and the user cannot view the reserved space.

[0143] In a possible implementation manner, when pre-configuring the correspondence relationship between the location information in the aging area and the alternative location information in the non-aging area at the set position of the storage medium, that is, when pre-configuring the correspondence relationship between the location information in the aging area and the alternative location information in the non-aging area inside the storage medium, no matter which electronic device the storage medium is connected to, the connected electronic device can quickly obtain the correspondence relationship between the location information in the aging area of the storage medium and the alternative location information in the non-aging area configured at the set position of the storage medium. This correspondence relationship can take effect and be used immediately, without the need to re-configure (re-build) this correspondence relationship due to different connected electronic devices, thereby improving efficiency.

[0144] In a possible implementation, the process of determining the aging area in the storage medium can be carried out throughout the entire life cycle of the storage medium. For ease of understanding, the following uses a specific embodiment to illustrate the process of determining the location information in the aging area provided by the present invention. Figure 7 FIG. 4 is a schematic diagram of the fourth process for determining the location information in the aging area provided by the embodiment of the present invention. As Figure 7 shown, this process includes the following steps:

[0145] S701: When the electronic device starts up or when the storage medium is hot-plugged during the operation of the electronic device, the electronic device identifies whether the corresponding relationship between the location information in the aging area and the alternative location information in the non-aging area of the storage medium is pre-configured (saved) at the set position of the storage medium accessed by the electronic device itself. If so, the corresponding relationship is saved in the memory of the electronic device.

[0146] S702: When reading and writing data in any location information of the storage medium, detect the read-write delay corresponding to the location information, and determine whether the read-write delay corresponding to the location information exceeds the set delay threshold. If so, determine the location information as the location information in the aging area.

[0147] S703: When the electronic device determines any location information as the location information in the aging area, an administrator or the like can configure the alternative location information in the non-aging area corresponding to the location information, and the electronic device can synchronously add (update) the corresponding relationship between the location information and the alternative location information in the non-aging area corresponding thereto to the set position of the storage medium and its own memory.

[0148] In a possible implementation, considering that if a certain location information has been determined to be the location information within the aging area, it is not necessary to repeatedly determine whether the location information is within the aging area. Therefore, after identifying that the correspondence relationship between the location information within the aging area and the alternative location information within the non-aging area of the storage medium is pre-configured (saved) at the set location of the storage medium, before detecting the read / write delay corresponding to the location information when reading and writing data in any location information of the storage medium, it is also possible to first determine whether the location information is located within the pre-configured aging area. If the location information is not located within the pre-configured aging area, subsequent steps can be carried out, including detecting the read / write delay corresponding to the location information when reading and writing data in any location information of the storage medium, and then determining whether the read / write delay corresponding to the location information exceeds the set delay threshold. If the location information is already located within the pre-configured aging area, it can be considered that the location information already belongs to the location information within the aging area, and it is not necessary to repeatedly perform the subsequent steps of detecting the read / write delay corresponding to the location information when reading and writing data in any location information of the storage medium, and then determining whether the read / write delay corresponding to the location information exceeds the set delay threshold.

[0149] For ease of understanding, the process of determining the location information within the aging area provided by the present invention will be further illustrated by a specific embodiment below. Figure 8 FIG. 5 is a schematic diagram of the process of determining the location information within the aging area provided by the embodiment of the present invention. As Figure 8 shown, the process includes the following steps:

[0150] S801: When the electronic device is started or when a storage medium is hot-plugged during the operation of the electronic device, the electronic device identifies whether the correspondence relationship between the location information within the aging area and the alternative location information within the non-aging area of the storage medium is pre-configured (saved) at the set location of the storage medium itself that the electronic device accesses. If so, the correspondence relationship is saved in the memory of the electronic device.

[0151] S802: When reading and writing data in any location information of the storage medium, determine whether the location information is located within the pre-configured aging area. If not, proceed to S803.

[0152] S803: Detect the read / write delay corresponding to the location information, and determine whether the read / write delay corresponding to the location information exceeds the set delay threshold. If so, determine the location information as the location information within the aging area.

[0153] S804: When the electronic device determines any location information as the location information within the aging area, an administrator or the like can configure the alternative location information within the non-aging area corresponding to this location information, and the electronic device can add (update) the corresponding relationship between this location information and the alternative location information within the corresponding non-aging area to the set position of the storage medium.

[0154] Embodiment 7:

[0155] Based on the same technical concept, the present invention provides a data reading and writing device for a storage medium. Figure 9 As shown in the schematic diagram of the data reading and writing device for a storage medium provided by an embodiment of the present invention, Figure 9 as shown, the device includes:

[0156] A receiving module 91, configured to receive a data reading and writing instruction for the storage medium, where the reading and writing instruction carries first location information corresponding to the data to be read and written in the storage medium.

[0157] A judging module 92, configured to judge whether the first location information is located within a pre-configured aging area.

[0158] A determining module 93, configured to, if the first location information is located within the pre-configured aging area, determine the target alternative location information corresponding to the first location information according to the corresponding relationship between the location information within the pre-configured aging area and the alternative location information within the non-aging area.

[0159] An updating module 94, configured to update the first location information in the reading and writing instruction according to the target alternative location information.

[0160] A reading and writing module 95, configured to read and write the data in the storage medium according to the updated reading and writing instruction.

[0161] In a possible implementation manner, the device further includes:

[0162] An aging area determining module, configured to, for each statistical period, detect the read and write delay corresponding to each location information when reading and writing the data at any location information of the storage medium within this statistical period; and perform a descending order sorting on the read and write delays corresponding to each location information, and determine the location information corresponding to the top set number of read and write delays in the descending order sorting as the location information within the aging sub-area of this statistical period;

[0163] Based on the location information within the aging sub-area of each statistical period, determine the location information within the aging area.

[0164] In a possible implementation manner, the aging area determination module is specifically configured to determine the location information within the aging sub-area of each statistical period as the location information within the aging area; or,

[0165] update the location information within the currently saved aging area according to the location information within the aging sub-area of the current statistical period.

[0166] In a possible implementation manner, the aging area determination module is further configured to detect the read / write delay corresponding to the location information when reading and writing data in any location information of the storage medium; determine whether the read / write delay corresponding to the location information exceeds a pre-configured delay threshold, and if so, determine the location information as the location information within the aging area.

[0167] In a possible implementation manner, the device further includes:

[0168] a delay threshold configuration module, configured to detect the read / write delay corresponding to each location information when reading and writing data in any location information of the storage medium within the current statistical period; perform a descending order sorting on the read / write delays corresponding to each location information; determine candidate delay thresholds based on the top set number of read / write delays in the descending order sorting; determine a target delay threshold based on the candidate delay thresholds and the currently saved delay threshold; and update the currently saved delay threshold according to the target delay threshold.

[0169] In a possible implementation manner, the aging area determination module is specifically configured to, for any location information, record the start time information when starting to read and write data in the location information and the end time information when finishing reading and writing data in the location information; and determine the read / write delay corresponding to the location information according to the start time information and the end time information.

[0170] In a possible implementation manner, the read / write module 95 is further configured to, if the first location information is not located within the pre-configured aging area, read and write the data in the storage medium according to the received read / write instruction.

[0171] Since in the present invention, when the first location information corresponding to the data to be read and written in the read / write instruction is located within the aging area, reading and writing data in the first location information can be converted into reading and writing data in the target alternative location information within the corresponding non-aging area, thereby reducing the read / write delay and improving the device stability; meanwhile, when some areas of the storage medium are aging areas, the storage medium can still be used (accessed), maximizing the utilization of storage resources without wasting storage resources.

[0172] Example 8:

[0173] Based on the same inventive concept, the present invention provides an electronic device. Figure 10 As shown in the schematic structural diagram of an electronic device provided by an embodiment of the present invention, Figure 10 it includes: a processor 101, a communication interface 102, a memory 103, and a communication bus 104. Among them, the processor 101, the communication interface 102, and the memory 103 complete mutual communication through the communication bus 104;

[0174] A computer program is stored in the memory 103. When the program is executed by the processor 101, the processor 101 is caused to execute the following steps:

[0175] Receive a data read / write instruction for a storage medium, where the read / write instruction carries first position information corresponding to the data to be read / written in the storage medium;

[0176] Determine whether the first position information is located within a pre-configured aging area;

[0177] If so, determine target replacement position information corresponding to the first position information according to the correspondence between the position information within the pre-configured aging area and the replacement position information within the non-aging area;

[0178] Update the first position information in the read / write instruction according to the target replacement position information; and read / write the data in the storage medium according to the updated read / write instruction.

[0179] In a possible implementation manner, the processor 101 is specifically configured to, for each statistical period, detect the read / write delay corresponding to each position information when reading / writing the data at any position information of the storage medium within the statistical period; and perform a descending order sorting on the read / write delays corresponding to each position information, and determine the position information corresponding to the top set number of read / write delays in the descending order sorting as the position information within the aging sub-area of the statistical period;

[0180] Based on the position information within the aging sub-area of each statistical period, determine the position information within the aging area.

[0181] In a possible implementation manner, the processor 101 is specifically configured to determine all the position information within the aging sub-area of each statistical period as the position information within the aging area; or,

[0182] Update the currently saved position information within the aging area according to the position information within the aging sub-area of the current statistical period.

[0183] In a possible implementation, the processor 101 is specifically configured to detect the read / write delay corresponding to a position information when reading and writing data in any position information of the storage medium; determine whether the read / write delay corresponding to the position information exceeds a pre-configured delay threshold, and if so, determine the position information as the position information within the aging area.

[0184] In a possible implementation, the processor 101 is specifically configured to detect, within the current statistical period, the read / write delay corresponding to each position information when reading and writing data in any position information of the storage medium; and perform a descending order sorting on the read / write delay corresponding to each position information.

[0185] Based on the top set number of read / write delays in the descending order sorting, determine a candidate delay threshold.

[0186] Based on the candidate delay threshold and the currently saved delay threshold, determine a target delay threshold.

[0187] Update the currently saved delay threshold according to the target delay threshold.

[0188] In a possible implementation, the processor 101 is specifically configured to, for any position information, record the start time information when starting to read and write data in the position information and the end time information when finishing reading and writing data in the position information.

[0189] Determine the read / write delay corresponding to the position information according to the start time information and the end time information.

[0190] In a possible implementation, the corresponding relationship between the position information within the aging area and the alternative position information within the non-aging area is pre-configured at a set position of the storage medium.

[0191] In a possible implementation, the processor 101 is further configured to, if the first position information is not within the pre-configured aging area, read and write data in the storage medium according to the received read / write instruction.

[0192] Since the principle of the above electronic device for solving problems is similar to the data read / write method of the storage medium, the implementation of the above electronic device can refer to the implementation of the method, and the repeated parts will not be elaborated.

[0193] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity in illustration, only a thick line is used in the figure to represent it, but it does not mean that there is only one bus or one type of bus.

[0194] The communication interface 102 is used for communication between the above electronic device and other devices.

[0195] The memory may include a Random Access Memory (RAM), and may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0196] The above processor may be a general-purpose processor, including a central processing unit, a Network Processor (NP), etc.; it may also be a Digital Signal Processing (DSP), an application-specific integrated circuit, a field-programmable gate array, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0197] Since the present invention can, when the first position information corresponding to the data to be read and written in the storage medium carried in the read and write instruction is located in the aging area, convert the reading and writing of data in the first position information into the reading and writing of data in the target alternative position information in the corresponding non-aging area, thereby reducing the read and write delay and improving the device stability; at the same time, when a part of the storage medium is an aging area, the storage medium can still be used (accessed), maximizing the utilization of storage resources and not wasting storage resources.

[0198] Embodiment 9:

[0199] Based on the same technical concept, an embodiment of the present invention provides a storage medium, in which a computer program executable by an electronic device is stored. When the program runs on the electronic device, the electronic device is caused to execute the following steps when executed:

[0200] Receive a data read and write instruction for the storage medium, where the read and write instruction carries the first position information corresponding to the data to be read and written in the storage medium;

[0201] Determine whether the first position information is located within a pre-configured aging area;

[0202] If so, determine the target alternative position information corresponding to the first position information according to the correspondence between the position information within the pre-configured aging area and the alternative position information within the non-aging area;

[0203] Update the first position information in the read / write instruction according to the target alternative position information; and read and write the data in the storage medium according to the updated read / write instruction.

[0204] In a possible implementation manner, the process of pre-configuring the position information within the aging area includes:

[0205] For each statistical period, detect the read / write delay corresponding to each position information when reading and writing the data in any position information of the storage medium during this statistical period; and perform a descending order sorting on the read / write delays corresponding to each position information, and determine the position information corresponding to the top set number of read / write delays in the descending order sorting as the position information within the aging sub-area of this statistical period;

[0206] Based on the position information within the aging sub-area of each statistical period, determine the position information within the aging area.

[0207] In a possible implementation manner, the determining the position information within the aging area based on the position information within the aging sub-area of each statistical period includes:

[0208] Determine the position information within the aging sub-area of each statistical period as the position information within the aging area; or,

[0209] Update the currently saved position information within the aging area according to the position information within the aging sub-area of the current statistical period.

[0210] In a possible implementation manner, the process of pre-configuring the position information within the aging area includes:

[0211] Detect the read / write delay corresponding to a position information when reading and writing the data in any position information of the storage medium; determine whether the read / write delay corresponding to this position information exceeds a pre-configured delay threshold, and if so, determine this position information as the position information within the aging area.

[0212] In a possible implementation manner, the process of configuring the delay threshold includes:

[0213] Detect the read / write latency corresponding to each location information when reading and writing data in any location information of the storage medium within the current statistical period; and sort the read / write latencies corresponding to each location information in descending order;

[0214] Based on the top set number of read / write latencies in the descending order, determine a candidate latency threshold;

[0215] Based on the candidate latency threshold and the currently saved latency threshold, determine a target latency threshold;

[0216] Update the currently saved latency threshold according to the target latency threshold.

[0217] In a possible implementation manner, detecting the read / write latency corresponding to a location information when reading and writing data in any location information of the storage medium includes:

[0218] For any location information, record the start time information when starting to read and write data in this location information and the end time information when finishing reading and writing data in this location information;

[0219] Determine the read / write latency corresponding to this location information according to the start time information and the end time information.

[0220] In a possible implementation manner, the corresponding relationship between the location information in the aging area and the alternative location information in the non-aging area is pre-configured at a set location of the storage medium.

[0221] In a possible implementation manner, the method further includes:

[0222] If the first location information is not located in the pre-configured aging area, read and write data in the storage medium according to the received read / write instruction.

[0223] Since the principle of the above storage medium for solving problems is similar to the data read / write method of the storage medium, the implementation of the above storage medium can refer to the implementation of the method, and the repeated parts will not be elaborated.

[0224] The above storage medium can be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memories such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical memories such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memories such as ROM, EPROM, EEPROM, non-volatile memories (NAND FLASH), solid state drives (SSD), etc.

[0225] Since the present invention can convert the data reading and writing in the first position information into the data reading and writing in the target alternative position information in the corresponding non-aging area when the first position information corresponding to the data to be read and written in the storage medium carried in the read-write instruction is located in the aging area, the reading and writing delay can be reduced and the device stability can be improved; at the same time, when some areas in the storage medium are aging areas, the storage medium can still be used (accessed), maximizing the utilization of storage resources and not wasting storage resources.

[0226] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0227] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0228] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the specified functions in Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0229] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are performed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the specified functions in Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0230] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these changes and modifications.

Claims

1. A method for reading and writing data of a storage medium, characterized in that, The method includes: Receiving a data read / write instruction for a storage medium, where first position information corresponding to data to be read / written in the storage medium is carried in the read / write instruction; Determining whether the first position information is located within a preconfigured aging area; If so, determining target alternative position information corresponding to the first position information according to the correspondence between position information within the preconfigured aging area and alternative position information within a non-aging area; Updating the first position information in the read / write instruction according to the target alternative position information; and reading and writing data in the storage medium according to the updated read / write instruction; Among them, the process of preconfiguring position information within the aging area includes: For each statistical period, detecting the read / write delay corresponding to each position information when reading and writing data at any position information in the storage medium during this statistical period; and sorting the read / write delays corresponding to each position information in descending order, and determining the position information corresponding to the top set number of read / write delays in the descending order as the position information within the aging sub-area of this statistical period; if the average value of the read / write delays corresponding to the position information within the aging sub-area of the current statistical period is greater than the average value of the read / write delays corresponding to the position information within the currently saved aging area, then updating the position information within the currently saved aging area according to the position information within the aging sub-area of the current statistical period; or Detecting the read / write delay corresponding to any position information when reading and writing data at any position information in the storage medium; determining whether the read / write delay corresponding to this position information exceeds the currently saved delay threshold, and if so, determining this position information as the position information within the aging area; Among them, the process of configuring the delay threshold includes: Detecting the read / write delay corresponding to each position information when reading and writing data at any position information in the storage medium during the current statistical period; and sorting the read / write delays corresponding to each position information in descending order; determining a candidate delay threshold based on the top set number of read / write delays in the descending order; determining a target delay threshold based on the candidate delay threshold and the currently saved delay threshold; and updating the currently saved delay threshold according to the target delay threshold.

2. The method according to claim 1, wherein Detecting the read / write delay corresponding to any position information when reading and writing data at any position information in the storage medium includes: For any position information, recording the start time information when starting to read and write data at this position information and the end time information when finishing reading and writing data at this position information; Determining the read / write delay corresponding to this position information according to the start time information and the end time information.

3. The method according to claim 1, characterized in that The correspondence between the position information within the aging area and the alternative position information within the non-aging area is preconfigured at a set position of the storage medium.

4. The method according to claim 1, wherein The method further includes: If the first position information is not located within the preconfigured aging area, reading and writing data in the storage medium according to the received read / write instruction.

5. An electronic device, characterized in that, The electronic device includes at least a processor and a memory. When the processor executes a computer program stored in the memory, it implements the steps of the data reading and writing method of the storage medium as described in any one of claims 1-4.

6. A computer-readable storage medium, characterized in that, It stores a computer program. When the computer program is executed by a processor, it implements the steps of the data reading and writing method of the storage medium as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Method for storing software to storage medium and device for storing medium classification

    CN101751267A

  • Method and apparatus for adjusting data recovery speed based on object read / write delay

    CN109117306A

  • Disk format for secondary storage system

    EP0435852A2