Hard disk read-write test method and device, equipment and storage medium

By using a loop array architecture to replace ordinary memory space in hard disk testing, the problem of too long hard disk diagnosis time is solved, and the efficiency of hard disk read and write test is improved.

CN119993253APending Publication Date: 2025-05-13INSPUR (SHANDONG) COMPUTER TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510115742.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

During the existing hard disk diagnosis process, file read and write operations take the longest time, resulting in too long hard disk diagnosis time. This is mainly due to the imbalance in the configuration ratio between the hard disk, memory and processor, resulting in insufficient memory space to support multi-threaded read and write tests.

Method used

The loop array architecture is used to replace ordinary memory space, expand the memory physical space from the software level, and read data from the target hard disk through pre-configured array writing threads and read threads, and read data from the target hard disk and write to the loop array. If the data amount reaches the threshold, read and write operations are performed to determine the read and write performance of the hard disk.

Benefits of technology

It effectively shortens the hard disk diagnosis time, improves the hard disk testing efficiency, and avoids thread performance bottlenecks caused by the difference in processor memory space and hard disk space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119993253A_ABST
    Figure CN119993253A_ABST
Patent Text Reader

Abstract

The invention discloses a hard disk read-write test method, device and equipment and a storage medium, and relates to the field of hard disk testing, and the method comprises the following steps: reading hard disk data from a target hard disk by utilizing each pre-configured array write-in thread, and determining the hard disk read performance of the corresponding target hard disk; by configuring the write-in lock state of any array write-in thread, the operation that any array write-in thread writes the hard disk data read by the array write-in thread into the preset cycle array is started or stopped if the data volume of the hard disk data stored in the current preset cycle array reaches a preset threshold value; if yes, the reading lock state of any array reading thread is configured to start or stop the operation that any array reading thread reads the hard disk data from the preset cycle array and writes the hard disk data into the target hard disk, and the hard disk writing performance of the corresponding target hard disk is determined. Therefore, the common memory space can be replaced by the cyclic array architecture, so that the physical space of the memory is expanded from the software level, and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hard disk testing, and in particular to a hard disk read and write test method, device, equipment and storage medium. Background Art

[0002] With the development of science and technology, the demand for computer computing power and storage space is increasing. The large demand for high storage has led to higher and higher configurations of large-capacity storage servers. Large-capacity storage servers are increasingly equipped with dozens of hard disks. The more storage devices a server carries, the longer it will take for the factory hard disk diagnosis to test the read and write, performance, and stress of the storage devices.

[0003] At present, the longest time-consuming part of the hard disk diagnosis process is file reading and writing, that is, the data reading and writing of all tracks of all hard disks. The realization of this function requires the longest file reading and writing operation on the computer. In the prior art, the reading and writing of files mainly depends on the hard disk, memory and processor, but the increasing number of hard disks mounted on storage servers has led to a gradual imbalance in the configuration ratio between the hard disk, memory and processor. It is often the case that the hard disk storage space is dozens or even hundreds of times that of the memory. When implementing the read and write test of the entire disk file, even if the multi-threaded mode is used to maximize the processor performance, there will be a bottleneck that the available memory space is not enough to support the consumption of cache resources in the thread pool. If multiple rounds of full disk reading and writing are performed to ensure the quality of the shipped storage device, it often requires the machine to consume too much testing time in the diagnostic test link.

[0004] It can be seen that how to optimize the read and write efficiency of the hard disk to shorten the hard disk diagnosis time is a problem that technical personnel in this field need to solve. Summary of the invention

[0005] The purpose of the embodiments of the present invention is to provide a hard disk read and write test method, device, equipment and storage medium, which can use a circular array architecture to replace ordinary memory space to expand the physical space of the memory from the software level to improve the test efficiency. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses a hard disk read and write test method, comprising:

[0007] Using pre-configured array write threads to read hard disk data from a target hard disk, and determining the hard disk read performance of the corresponding target hard disk;

[0008] By configuring the write lock state of any array writing thread, the operation of any array writing thread writing the hard disk data read by itself into a preset circular array is started or stopped; the preset circular array is a circular array created based on a preset continuous memory space;

[0009] If the amount of hard disk data currently stored in the preset loop array reaches a preset threshold, the read lock state of any array reading thread is configured to start or stop the operation of any array reading thread reading hard disk data from the preset loop array and writing it to the target hard disk, and determine the corresponding hard disk write performance of the target hard disk.

[0010] Optionally, before using the pre-configured array write threads to read hard disk data from the target hard disk and determining the hard disk read performance of the corresponding target hard disk, the method further includes:

[0011] Applying for a circular array space corresponding to a preset circular array in a preset continuous memory space, so as to store data in the preset circular array through the circular array space;

[0012] An array writing thread and an array reading thread corresponding to the loop array space are configured for the preset loop array.

[0013] Optionally, configuring the write lock state of any array writing thread to start or stop the operation of any array writing thread writing the hard disk data read by itself into a preset loop array includes:

[0014] Acquire the write lock corresponding to the circular array space through each array writing thread;

[0015] The array write thread that obtains the write lock among the array write threads is used as the target array write thread, and the other array write threads among the array write threads are set to a waiting state;

[0016] Extracting target write data of preset data length from the hard disk data through the target array write thread;

[0017] Calculating a first target distance between a current data write position in the loop array space and a loop array jump identification bit;

[0018] If the first target distance is not less than the preset data length, writing the target write data into the circular array space based on the current data write position;

[0019] If the first target distance is less than the preset data length, writing the first part of the target write data into the tail space of the current circular array space, and then jumping to the head space of the circular array space to perform a data write operation on the second part of the target write data starting from the head space;

[0020] The write lock is released after the target write data is written, and a new current data write position is determined based on the position of the last written data. Then, the next array write thread that obtains the write lock is used as the new target array write thread, and the process jumps to the step of extracting target write data of a preset data length from the hard disk data through the target array write thread, so that the next target array write thread can write the corresponding target write data to the circular array space.

[0021] Optionally, if the amount of hard disk data currently stored in the preset circular array reaches a preset threshold, configuring a read lock state of any array reading thread to start or stop the operation of any array reading thread reading hard disk data from the preset circular array and writing it into the target hard disk includes:

[0022] Judging the data volume corresponding to the target write data currently stored in the preset loop array space to determine whether the data volume corresponding to the target write data is greater than a preset data volume threshold;

[0023] If the data volume corresponding to the target write data is greater than a preset data volume threshold, unlocking the read lock in the circular array space so that the array read thread acquires the read lock;

[0024] An array reading thread that obtains the read lock among the array reading threads is used as a target array reading thread, and a second target distance between a current data reading position in the loop array space and a loop array jump identification bit is calculated;

[0025] If the second target distance is not less than the preset data length, reading hard disk data of the preset data length from the circular array space;

[0026] If the second target distance is less than the preset data length, hard disk data of the first data length is read from the end space of the current circular array space, and then jump to the head space of the circular array space to perform a read operation on hard disk data of the second data length starting from the head space; wherein the sum of the first data length and the second data length is the same as the preset data length;

[0027] The hard disk data read from the circular array space is rewritten into the target hard disk. After the rewriting is completed, the read lock is released, and the process jumps to the step of determining the amount of data corresponding to the target write data currently stored in the preset circular array space, so that the next target array reading thread can read the corresponding hard disk data from the circular array space.

[0028] Optionally, the hard disk read and write test method further includes:

[0029] Calculating the storage space of the target hard disk and determining a number of hard disk track lengths corresponding to the target hard disk, so as to determine a number of hard disk read and write positions of the target hard disk according to the storage space and the number of hard disk track lengths;

[0030] Saving the position pointers corresponding to the plurality of hard disk read and write positions into a random array;

[0031] Based on the random array, corresponding random read and write operations are performed on the target hard disk, so as to analyze the read and write performance of the target hard disk based on the random read and write results.

[0032] Optionally, before performing a corresponding random read and write operation on the target hard disk based on the random array, the method further includes:

[0033] Determine an array index record in the random array;

[0034] A random number range is determined based on the array index record, so as to perform corresponding random read and write operations on the target hard disk based on the random array and the random number range.

[0035] Optionally, performing corresponding random read and write operations on the target hard disk based on the random array includes:

[0036] Generate a current random number based on the random number range;

[0037] Determine a corresponding target array subscript from the random array according to the generated random number;

[0038] According to the hard disk read and write position corresponding to the target array index, a corresponding random read and write operation is performed on the target hard disk.

[0039] In a second aspect, the present application discloses a hard disk read and write test device, comprising:

[0040] A read performance test module, used to read hard disk data from a target hard disk using pre-configured array write threads, and determine the hard disk read performance of the corresponding target hard disk;

[0041] A data writing module, configured to start or stop the operation of any array writing thread writing the hard disk data read by the array writing thread into a preset circular array by configuring the write lock state of the array writing thread; the preset circular array is a circular array created based on a preset continuous memory space;

[0042] A write performance test module is used to start or stop the operation of any array reading thread to read hard disk data from the preset cycle array and write it to the target hard disk by configuring the read lock state of any array reading thread if the amount of hard disk data currently stored in the preset cycle array reaches a preset threshold, and determine the corresponding hard disk write performance of the target hard disk.

[0043] In a third aspect, the present application discloses an electronic device, comprising:

[0044] Memory for storing computer programs;

[0045] The processor is used to execute the computer program to implement the steps of the hard disk read and write test method as described above.

[0046] In a fourth aspect, the present application discloses a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the aforementioned hard disk read and write test method are implemented.

[0047] In the present application, firstly, each pre-configured array write thread can be used to read hard disk data from the target hard disk, and determine the corresponding hard disk reading performance of the target hard disk; by configuring the write lock state of any array write thread, the operation of any array write thread to write the hard disk data read by itself to a preset loop array can be started or stopped; the preset loop array is a loop array created based on a preset continuous memory space; if the amount of hard disk data currently stored in the preset loop array reaches a preset threshold, the read lock state of any array read thread can be configured to start or stop the operation of any array read thread to read the hard disk data from the preset loop array and write it to the target hard disk, and determine the corresponding hard disk writing performance of the target hard disk.

[0048] Beneficial effect: Through the method of the present application, the hard disk data in the target hard disk can be read by using the pre-configured array write thread, and then the hard disk read performance can be determined by the hard disk data reading situation. Furthermore, the write lock state of any array write thread can be configured to start any array write thread to write the hard disk data read by itself to the preset loop array, and if the amount of data in the current loop array reaches the preset threshold, the read lock state of any array read thread can be configured to start any array read thread to read the hard disk data from the preset loop array and write it to the target hard disk. In this way, the loop array architecture can be used to replace the ordinary memory space, and the same memory space can be used to support the normal operation of multiple processor read and write threads, which is equivalent to expanding the physical space of the memory from the software level, avoiding the situation where enough threads cannot be started to work simultaneously due to the huge difference between the processor memory space and the hard disk space, and effectively improving the performance shortcomings of the hard disk test. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A flow chart of a hard disk read and write test method provided by an embodiment of the present invention;

[0051] Figure 2 A schematic diagram of a circular array structure provided by an embodiment of the present invention;

[0052] Figure 3 A read-write architecture diagram based on a circular array provided in an embodiment of the present invention;

[0053] Figure 4 A flow chart of another hard disk read and write test method provided by an embodiment of the present invention;

[0054] Figure 5 A structural schematic diagram of a hard disk read-write test device provided by an embodiment of the present invention;

[0055] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.

[0058] In the prior art, when implementing a read and write test of the entire disk file, if a multi-threaded mode is used to perform a hard disk read and write test, a bottleneck may occur in which the available memory space is insufficient to support the consumption of cache resources in the thread pool, thereby consuming too much test time.

[0059] In order to overcome the above technical problems, the present application discloses a hard disk read and write test method, device, equipment and storage medium, which can use a circular array architecture to replace ordinary memory space to expand the physical space of the memory from the software level to improve test efficiency.

[0060] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0061] See also Figure 1 As shown, the embodiment of the present application discloses a hard disk read and write test method, comprising:

[0062] Step S11 : reading hard disk data from a target hard disk using pre-configured array write threads, and determining the corresponding hard disk read performance of the target hard disk.

[0063] In this embodiment, before reading the data of the hard disk, it is necessary to configure a loop array and a write thread and a read thread for hard disk data reading and writing for the hard disk read and write test. Specifically, a loop array space corresponding to the preset loop array can be applied in the preset continuous memory space to store the data in the preset loop array through the loop array space, and an array write thread and an array read thread corresponding to the loop array space can be configured for the preset loop array. The loop array space is a continuous memory space in the processor, that is, a space in the cache, and as Figure 2As shown, the loop array is divided into a loop array control domain and a data storage domain, wherein the loop array control domain contains a read lock, a write lock, a loop array jump flag, a next read flag, a next write flag, a read warning lock, and a write warning lock; the data storage domain is used to store data. The size of the data read and written each time in the loop array is a fixed preset length, and the write data before the read data, the distance between the write data and the read data cannot exceed the set critical value of the loop array, and the data written and read each time is divided into two parts: the data header and the data content. Then it is necessary to configure the loop array for the hard disk read and write test, as well as the write thread and the read thread for the hard disk data read and write.

[0064] Furthermore, hard disk data can be read from the target hard disk through each array write thread configured, and the hard disk reading performance of the target hard disk can be determined according to the hard disk data reading speed. In this way, the memory space in the processor can be replaced by setting a circular array to solve the bottleneck disadvantages of physical configuration through software architecture and realize the reasonable use of computer resources.

[0065] Step S12: configuring the write lock state of any array write thread to start or stop the operation of any array write thread writing the hard disk data read by itself into the preset loop array.

[0066] In this embodiment, after the array write thread reads the hard disk data from the target hard disk, the read write data can be written to the circular array. It should be noted that it is necessary to configure the write lock state of the array write thread to start or stop the array write thread from writing the hard disk data it has read to the preset circular array. Specifically, it is necessary to obtain the write lock corresponding to the circular array space through each array write thread. The write lock is in an open state when it is not obtained by the array write thread, and is in a closed state after being obtained by the array write thread. Therefore, only the target array write thread that has obtained the write lock can write the hard disk data it has read into the circular array, and the non-target write thread that has not currently obtained the write lock needs to enter a waiting state, waiting for the write lock to be opened.

[0067] Furthermore, when the target array write thread needs to write hard disk data, it is necessary to calculate the first target distance between the current data write position in the circular array space and the circular array jump identification position. If the first target distance is not less than the preset data length of the data reading and writing set in the circular array space, then the distance representing the data written in the current circular array can directly store the target write data of the target array write thread. In another case, if the first target distance is less than the preset data length, it is necessary to write the first part of the target write data corresponding to the preset data length into the tail space of the current circular array space, and then jump to the head space of the circular array space, and execute the data write operation on the remaining second part of the target write data starting from the head space of the circular array.

[0068] In another step, if the target write data has been written into the circular array, it is necessary to release the write lock and update the current data write position. Specifically, the position of the last written data can be used to determine the new current data write position, that is, the next write identification position. For example, if the length of the target write data is the preset data length X, then the current data write position can be set to X at this time, and the data will be written from position X the next time the data is stored. Then the next array write thread that obtains the write lock can be used as the new target array write thread, and jump to the step of extracting the target write data of the preset data length from the hard disk data through the target array write thread, so that the next target array write thread can write the corresponding target write data to the circular array space. In this way, the orderly writing of data can be guaranteed, and the congestion of data writing caused by the large difference between the processor memory space and the hard disk space can be avoided.

[0069] Step S13: If the amount of hard disk data currently stored in the preset loop array reaches a preset threshold, the read lock state of any array reading thread is configured to start or stop the operation of any array reading thread to read the hard disk data from the preset loop array and write it to the target hard disk, and determine the corresponding hard disk write performance of the target hard disk.

[0070] In this embodiment, when a certain amount of data is stored in the circular array, the data in the circular array can be read. Specifically, the data amount corresponding to the target write data currently stored in the preset circular array space can be judged to determine whether the data amount corresponding to the target write data is greater than the preset data amount threshold. If the data amount corresponding to the target write data is greater than the preset data amount threshold, the lock state of the read lock can be released, and then the read lock is acquired by the array read thread, and the array read thread that successfully acquires the read lock is used as the target array read thread for data reading.

[0071] Furthermore, it is necessary to calculate the second target distance between the current data reading position in the circular array space and the circular array jump identification bit. If the second target distance is not less than the preset data length, the hard disk data of the preset data length is read from the current data reading position in the circular array space. If the second target distance is less than the preset data length, the hard disk data of the first data length is read from the end space of the circular array space, and then jump to the head space of the circular array space, and read the hard disk data of the second data length from the head space, wherein the sum of the first data length and the second data length is the same as the preset data length. Then, the current data reading position needs to be updated, and the position of the hard disk data of the preset data length currently read is used as the current data reading position for the next data reading, that is, the next reading identification bit.

[0072] Another step, such as Figure 3 As shown, it is necessary to write the read hard disk data to the target hard disk, release the read lock, and jump to the step of judging the data amount corresponding to the target write data currently stored in the preset circular array space, so that the next target array reading thread reads the corresponding hard disk data from the circular array space, and finally the hard disk write performance of the target hard disk can be determined according to the efficiency of hard disk writing data. It should be noted that the circular array in this embodiment can be applied to all situations where cache resources are insufficient. As long as the processor performance is available, the cache resources can be converted through the read and write method of the circular array, thereby improving the utilization of resources. In this way, the continuous writing and reading of data can be guaranteed, avoiding the problem of insufficient thread performance due to the large difference between the processor memory space and the hard disk space, thereby improving the efficiency of hard disk read and write tests.

[0073] It can be seen that in this embodiment, the pre-configured array write thread can be used to read the hard disk data in the target hard disk, and then the hard disk read performance can be determined by the hard disk data reading situation. Furthermore, the write lock state of any array write thread can be configured to start any array write thread to write the hard disk data read by itself to the preset loop array, and if the amount of data in the current loop array reaches the preset threshold, the read lock state of any array read thread can be configured to start any array read thread to read the hard disk data from the preset loop array and write it to the target hard disk. In this way, the loop array architecture can be used to replace the ordinary memory space, and the same memory space can be used to support the normal operation of multiple processor read and write threads, which is equivalent to expanding the physical space of the memory from the software level, avoiding the situation where enough threads cannot be started to work simultaneously due to the huge difference between the processor memory space and the hard disk space, and effectively improving the performance shortcomings of the hard disk test.

[0074] See also Figure 4 As shown, the embodiment of the present application discloses a hard disk read and write test method, comprising:

[0075] Step S21, calculating the storage space of the target hard disk, and determining a number of hard disk track lengths corresponding to the target hard disk, so as to determine a number of hard disk read and write positions of the target hard disk according to the storage space and the number of hard disk track lengths.

[0076] In this embodiment, the hard disk read and write test can be performed by random addressing. Specifically, the entire hard disk storage space of the target hard disk can be calculated, and then the number of hard disk tracks corresponding to the target hard disk and the lengths of the hard disk tracks corresponding to the number of hard disk tracks can be determined. Furthermore, a number of hard disk read positions can be selected according to the size of the storage space, and it is ensured that the selected hard disk read positions can cover each hard disk track, and it is ensured that there are one or two read positions in each hard disk track. In this way, it can be ensured that each hard disk track is tested when performing the hard disk read and write test, thereby ensuring the effectiveness of the hard disk read and write test.

[0077] Step S22: Save the position pointers corresponding to the plurality of hard disk read and write positions into a random array.

[0078] In this embodiment, it is necessary to determine the position pointer corresponding to the hard disk read and write position and save the position pointer. It should be noted that a random array can be generated and the array subscript record in the random array can be recorded. Then, the random number range needs to be determined based on the array subscript record, and the relationship between the position pointer and the subscript record is established. Then, based on the random array and the random number range, the target hard disk is subjected to corresponding random read and write operations.

[0079] Step S23: performing corresponding random read and write operations on the target hard disk based on the random array, so as to analyze the read and write performance of the target hard disk based on the random read and write results.

[0080] In this embodiment, it is necessary to generate the current random number in the random array according to the random array range, and determine the target array subscript corresponding to the random number in the random number, and then determine the target position pointer corresponding to the target array subscript according to the relationship between the array subscript and the position pointer, and then read and write data according to the hard disk read and write position corresponding to the target position pointer. It should be noted that after the reading and writing are completed, the pointer needs to be deleted from the random array, and the subscript of the random array is reduced by one bit, and then jump to the step of performing corresponding random read and write operations on the target hard disk based on the random array, so as to analyze the read and write performance of the target hard disk based on the random read and write results, until all the position pointers of the random array are read and written, and finally the read and write performance of the target hard disk is determined according to the read and write efficiency of each position.

[0081] It should be noted that, in this embodiment, since the hard disk track is designed as a cylindrical design, the test method in this embodiment can be applied to all storage devices with cylindrical designs, and then the method in this embodiment can be used to perform read and write detection on all storage devices with cylindrical designs.

[0082] It can be seen that in this embodiment, after calculating the storage space of the target hard disk and the track length of several tracks corresponding to the target hard disk, the hard disk reading position can be determined according to the storage space and the track length, and then the connection between the target position pointer corresponding to the reading position and the random array index can be established, and then the random reading and writing of the hard disk can be performed by random reading, and the position pointer corresponding to the position can be deleted from the random array after the reading and writing of a position is completed. In this way, the test method of local testing can be used to cover all physical disk track tests while reducing the test workload, thereby improving work efficiency under the premise of balancing efficiency and quality.

[0083] See also Figure 5 As shown, the embodiment of the present application discloses a hard disk read and write test device, comprising:

[0084] The read performance test module 11 is used to read hard disk data from a target hard disk using pre-configured array write threads, and determine the hard disk read performance of the corresponding target hard disk;

[0085] The data writing module 12 is used to start or stop the operation of any array writing thread writing the hard disk data read by itself into a preset circular array by configuring the write lock state of any array writing thread; the preset circular array is a circular array created based on a preset continuous memory space;

[0086] The write performance test module 13 is used to start or stop the operation of any array reading thread to read the hard disk data from the preset loop array and write it to the target hard disk by configuring the read lock state of any array reading thread if the amount of hard disk data currently stored in the preset loop array reaches a preset threshold, and determine the corresponding hard disk write performance of the target hard disk.

[0087] It can be seen that in this embodiment, the pre-configured array write thread can be used to read the hard disk data in the target hard disk, and then the hard disk read performance can be determined by the hard disk data reading situation. Furthermore, the write lock state of any array write thread can be configured to start any array write thread to write the hard disk data read by itself to the preset loop array, and if the amount of data in the current loop array reaches the preset threshold, the read lock state of any array read thread can be configured to start any array read thread to read the hard disk data from the preset loop array and write it to the target hard disk. In this way, the loop array architecture can be used to replace the ordinary memory space, and the same memory space can be used to support the normal operation of multiple processor read and write threads, which is equivalent to expanding the physical space of the memory from the software level, avoiding the situation where enough threads cannot be started to work simultaneously due to the huge difference between the processor memory space and the hard disk space, and effectively improving the performance shortcomings of the hard disk test.

[0088] In some embodiments, the hard disk read and write test device may further include:

[0089] A first configuration unit, configured to apply for a circular array space corresponding to a preset circular array in a preset continuous memory space, so as to store data in the preset circular array through the circular array space;

[0090] The second configuration unit is used to configure an array writing thread and an array reading thread corresponding to the circular array space for the preset circular array.

[0091] In some embodiments, the data writing module 12 may specifically include:

[0092] A write lock acquisition unit, configured to acquire the write lock corresponding to the circular array space through each array write thread;

[0093] a state setting unit, configured to use the array writing thread that obtains the write lock among the array writing threads as a target array writing thread, and to set other array writing threads among the array writing threads to a waiting state;

[0094] A data extraction unit, used for extracting target write data of a preset data length from the hard disk data through the target array write thread;

[0095] A first distance calculation unit, used for calculating a first target distance between a current data writing position in the circular array space and a circular array jump identification bit;

[0096] A first data writing unit, configured to write the target write data into the circular array space based on a current data writing position if the first target distance is not less than the preset data length;

[0097] a second data writing unit, configured to write a first portion of the target write data into a tail space of the current circular array space if the first target distance is less than the preset data length, and then jump to a head space of the circular array space to perform a data writing operation on a second portion of the target write data starting from the head space;

[0098] The first loop unit is used to release the write lock after the target write data is written, and determine the new current data write position based on the position of the last written data, and then use the next array write thread that obtains the write lock as the new target array write thread, and jump to the step of extracting the target write data of the preset data length from the hard disk data through the target array write thread, so that the next target array write thread can write the corresponding target write data to the loop array space.

[0099] In some embodiments, the write performance test module 13 may specifically include:

[0100] A data volume determination unit, configured to determine the data volume corresponding to the target write data currently stored in the preset loop array space, so as to determine whether the data volume corresponding to the target write data is greater than a preset data volume threshold;

[0101] a read lock acquisition unit, configured to unlock the read lock in the circular array space if the data volume corresponding to the target write data is greater than a preset data volume threshold, so that the array read thread acquires the read lock;

[0102] A second distance calculation unit, configured to take the array reading thread that obtains the read lock among the array reading threads as a target array reading thread, and calculate a second target distance between a current data reading position in the loop array space and a loop array jump identification bit;

[0103] A first data reading unit, configured to read hard disk data of the preset data length from the circular array space if the second target distance is not less than the preset data length;

[0104] A second data reading unit is used for reading hard disk data of a first data length from the end space of the current circular array space if the second target distance is less than the preset data length, and then jumping to the head space of the circular array space to perform a reading operation on hard disk data of a second data length starting from the head space; wherein the sum of the first data length and the second data length is the same as the preset data length;

[0105] The second loop unit is used to rewrite the hard disk data read from the loop array space into the target hard disk, release the read lock after the rewriting is completed, and jump to the step of judging the data amount corresponding to the target write data currently saved in the preset loop array space, so that the next target array reading thread can read the corresponding hard disk data from the loop array space.

[0106] In some embodiments, the hard disk read and write test device may further include:

[0107] a read / write position calculation unit, configured to calculate the storage space of the target hard disk and determine a number of hard disk track lengths corresponding to the target hard disk, so as to determine a number of hard disk read / write positions of the target hard disk according to the storage space and the number of hard disk track lengths;

[0108] A pointer storage unit, used for storing position pointers corresponding to the plurality of hard disk read and write positions in a random array;

[0109] The random read / write submodule is used to perform corresponding random read / write operations on the target hard disk based on the random array, so as to analyze the read / write performance of the target hard disk based on the random read / write results.

[0110] In some embodiments, the hard disk read and write test device may further include:

[0111] A subscript record determining unit, used to determine an array subscript record in the random array;

[0112] The random number range determination unit is used to determine the random number range based on the array index record, so as to perform corresponding random read and write operations on the target hard disk based on the random array and the random number range.

[0113] In some embodiments, the random read / write submodule may specifically include:

[0114] A random number generating unit, configured to generate a current random number based on the random number range;

[0115] A subscript determination unit, used to determine a corresponding target array subscript from the random array according to the generated random number;

[0116] The random read / write unit is used to perform corresponding random read / write operations on the target hard disk according to the hard disk read / write position corresponding to the target array index.

[0117] Furthermore, the present application also discloses an electronic device. Figure 6This is a structural diagram of an electronic device according to an exemplary embodiment, and the content in the diagram cannot be regarded as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the hard disk read / write test method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.

[0118] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0119] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0120] The operating system 221 is used to manage and control various hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the hard disk read and write test method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0121] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the hard disk read and write test method disclosed above. The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, and will not be repeated here.

[0122] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0123] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0124] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0125] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0126] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A hard disk read and write test method, characterized in that: include: Using pre-configured array write threads to read hard disk data from a target hard disk, and determining the hard disk read performance of the corresponding target hard disk; By configuring the write lock state of any array writing thread, the operation of any array writing thread writing the hard disk data read by itself into the preset loop array is started or stopped; The preset circular array is a circular array created based on a preset continuous memory space; If the amount of hard disk data currently stored in the preset loop array reaches a preset threshold, the read lock state of any array reading thread is configured to start or stop the operation of any array reading thread reading hard disk data from the preset loop array and writing it to the target hard disk, and determine the corresponding hard disk write performance of the target hard disk.

2. The hard disk read and write test method according to claim 1, characterized in that: Before using the pre-configured array write threads to read hard disk data from the target hard disk and determine the hard disk read performance of the corresponding target hard disk, the method further includes: Applying for a circular array space corresponding to a preset circular array in a preset continuous memory space, so as to store data in the preset circular array through the circular array space; An array writing thread and an array reading thread corresponding to the circular array space are configured for the preset circular array.

3. The hard disk read and write test method according to claim 2, characterized in that: The step of configuring the write lock state of any array write thread to start or stop the operation of any array write thread writing the hard disk data read by itself into the preset loop array includes: Acquire the write lock corresponding to the circular array space through each array writing thread; The array write thread that obtains the write lock among the array write threads is used as the target array write thread, and the other array write threads among the array write threads are set to a waiting state; Extracting target write data of preset data length from the hard disk data through the target array write thread; Calculating a first target distance between a current data write position in the loop array space and a loop array jump identification bit; If the first target distance is not less than the preset data length, writing the target write data into the circular array space based on the current data write position; If the first target distance is less than the preset data length, writing the first part of the target write data into the tail space of the current circular array space, and then jumping to the head space of the circular array space to perform a data write operation on the second part of the target write data starting from the head space; The write lock is released after the target write data is written, and a new current data write position is determined based on the position of the last written data. Then, the next array write thread that obtains the write lock is used as the new target array write thread, and the process jumps to the step of extracting target write data of a preset data length from the hard disk data through the target array write thread, so that the next target array write thread can write the corresponding target write data to the circular array space.

4. The hard disk read and write test method according to claim 3, characterized in that: If the amount of hard disk data currently stored in the preset circular array reaches a preset threshold, the read lock state of any array reading thread is configured to start or stop the operation of any array reading thread reading hard disk data from the preset circular array and writing it into the target hard disk, including: Judging the data volume corresponding to the target write data currently stored in the preset loop array space to determine whether the data volume corresponding to the target write data is greater than a preset data volume threshold; If the data volume corresponding to the target write data is greater than a preset data volume threshold, unlocking the read lock in the circular array space so that the array read thread acquires the read lock; An array reading thread that obtains the read lock among the array reading threads is used as a target array reading thread, and a second target distance between a current data reading position in the loop array space and a loop array jump identification bit is calculated; If the second target distance is not less than the preset data length, reading hard disk data of the preset data length from the circular array space; If the second target distance is less than the preset data length, hard disk data of the first data length is read from the end space of the current circular array space, and then jump to the head space of the circular array space to perform a read operation on hard disk data of the second data length starting from the head space; wherein the sum of the first data length and the second data length is the same as the preset data length; The hard disk data read from the circular array space is rewritten into the target hard disk. After the rewriting is completed, the read lock is released, and the process jumps to the step of determining the amount of data corresponding to the target write data currently stored in the preset circular array space, so that the next target array reading thread can read the corresponding hard disk data from the circular array space.

5. The hard disk read and write test method according to any one of claims 1 to 4, characterized in that: Also includes: Calculating the storage space of the target hard disk and determining a number of hard disk track lengths corresponding to the target hard disk, so as to determine a number of hard disk read and write positions of the target hard disk according to the storage space and the number of hard disk track lengths; Saving the position pointers corresponding to the plurality of hard disk read and write positions into a random array; Based on the random array, corresponding random read and write operations are performed on the target hard disk, so as to analyze the read and write performance of the target hard disk based on the random read and write results.

6. The hard disk read and write test method according to claim 5, characterized in that: Before performing the corresponding random read and write operations on the target hard disk based on the random array, the method further includes: Determine an array index record in the random array; A random number range is determined based on the array index record, so as to perform corresponding random read and write operations on the target hard disk based on the random array and the random number range.

7. The hard disk read and write test method according to claim 6, characterized in that: The performing corresponding random read and write operations on the target hard disk based on the random array includes: Generate a current random number based on the random number range; Determine a corresponding target array subscript from the random array according to the generated random number; According to the hard disk read and write position corresponding to the target array index, a corresponding random read and write operation is performed on the target hard disk.

8. A hard disk read and write test device, characterized in that: include: A read performance test module, used to read hard disk data from a target hard disk using pre-configured array write threads, and determine the hard disk read performance of the corresponding target hard disk; A data writing module, used to start or stop the operation of any array writing thread writing the hard disk data read by itself into a preset loop array by configuring the write lock state of any array writing thread; The preset circular array is a circular array created based on a preset continuous memory space; A write performance test module is used to start or stop the operation of any array reading thread to read hard disk data from the preset cycle array and write it to the target hard disk by configuring the read lock state of any array reading thread if the amount of hard disk data currently stored in the preset cycle array reaches a preset threshold, and determine the corresponding hard disk write performance of the target hard disk.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, used to execute the computer program to implement the steps of the hard disk read and write test method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the hard disk read and write test method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Storage pool testing method, electronic equipment and storage medium

    CN120743714A