Method and device for improving read-write performance of hard disk, hard disk and storage medium

By changing the field value of the characteristic field when the hard drive is powered off and performing a read operation after power is restored, the number of open page errors is determined, which solves the problem of read and write performance jitter after the hard drive is powered off and improves the read and write performance of the hard drive.

CN116301631BActive Publication Date: 2026-03-27INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-21
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

When a hard drive loses power, it cannot periodically fill in empty data, making it impossible to determine when data blocks are opened, which affects read and write performance and causes performance jitter.

Method used

When the hard drive loses power, the value of the characteristic field of the open data block is changed. After power is restored, a read operation is performed based on the field value to determine the number of errors in the open page. Then, based on the relationship between the number of errors and a preset threshold, it is decided whether to perform a data refresh or write operation.

Benefits of technology

While ensuring reliability, the impact of direct garbage collection on read and write operations has been resolved, improving hard drive read and write performance and providing a better user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116301631B_ABST
    Figure CN116301631B_ABST
Patent Text Reader

Abstract

The application provides a hard disk read-write performance improvement method, an improvement device, a hard disk and a storage medium, relates to the technical field of hard disks, and comprises the following steps: changing the field value of a feature field in an open data block of a hard disk according to the power-off state of the hard disk; obtaining the field value after the hard disk is powered on; performing a read operation on an open page corresponding to the field value in the case where the field value meets a preset condition; determining the size relationship between the error number of the open page and a preset threshold according to the result of the read operation; and performing data refreshing or a data write operation on the data block where the open page is located according to the size relationship between the error number and the preset threshold. The application solves the performance jitter problem caused by the direct garbage collection affecting normal read / write operations on the basis of ensuring reliability, thereby improving the read-write performance of the hard disk and bringing a better use experience to users.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of hard disks, and in particular to a method and device for improving the read / write performance of a hard disk, a hard disk, and a computer-readable storage medium. BACKGROUND

[0002] Currently, hard disks are widely used as storage media, and with the development of technology, solid state disks have occupied a major market share.

[0003] Currently, for the scenario of occasional power failure of a hard disk, since the hard disk has been offline, it is not possible to perform a periodic empty data operation on a data block that is being written to, and the opening time of such a data block may exceed a threshold value or may not exceed the threshold value. This time length can be converted by a time stamp. However, if the hard disk experiences high-temperature storage when it is offline, the time is accelerated, and since the temperature has returned to a normal value after power-on, it is not possible to determine how much time the data block has been opened, and it is not possible to obtain the temperature when offline. Since power failure produces many such data blocks, the conventional approach is to select to directly recycle such data blocks, which affects normal read / write operations, causes performance jitter problems, reduces the read / write performance of the hard disk, and brings a poor user experience. SUMMARY

[0004] In view of the above problems, the present application provides a method and device for improving the read / write performance of a hard disk, a hard disk, and a computer-readable storage medium.

[0005] The present application provides a method for improving the read / write performance of a hard disk, which comprises:

[0006] According to the power failure state of the hard disk, the field value of the feature field in the open data block of the hard disk is changed;

[0007] After the hard disk is powered on, the field value is obtained;

[0008] In the case where the field value meets a preset condition, a read operation is performed on the open page corresponding to the field value;

[0009] According to the result of the read operation, the size relationship between the number of errors of the open page and a preset threshold value is determined;

[0010] According to the size relationship between the number of errors and the preset threshold value, data refresh or data write operation is performed on the data block in which the open page is located.

[0011] Optionally, before changing the field value of the feature field in the open data block of the hard disk, the method comprises:

[0012] A feature field is added in all data blocks of the hard disk, and the feature field is used to record the page number of the open page.

[0013] setting field values of all feature fields as the default value, the field value being a page number of the open page, the default value being different from all page numbers of open pages.

[0014] Optionally, according to the power-off state of the hard disk, changing the field value of the feature field in the open data block of the hard disk, comprising:

[0015] if the hard disk is an abnormal power-off, changing the field value of the feature field in the open data block to a page number of an open page being written data at the time of power-off;

[0016] if the hard disk is a normal power-off, performing a fill empty data operation on the open data block, filling empty data to a next page of the open page being written data at the time of power-off, and changing the field value of the feature field in the open data block to the page number of the next page.

[0017] Optionally, after the hard disk is powered on, acquiring the field value, comprising:

[0018] reconstructing a linked list pool of all data blocks in the hard disk;

[0019] performing a patrol on all data blocks according to the linked list pool;

[0020] if any data block is not an open data block, directly putting the data block into a to-be-written pool;

[0021] if any data block is an open data block, determining whether the target open data block is full;

[0022] if the target open data block is full, determining whether the target open data block is put into a to-be-recycled pool according to a recycling rule;

[0023] if the target open data block is not full, acquiring the field value of the feature field in the target open data block.

[0024] Optionally, in a case where the field value meets a preset condition, performing a read operation on an open page corresponding to the field value, comprising:

[0025] in a case where the field value is the default value, putting a data block where the open page corresponding to the field value is located into a to-be-written pool;

[0026] in a case where the field value is not the default value, putting a data block where the open page corresponding to the field value is located into a to-be-patrolled pool;

[0027] performing a read operation on an open page contained in each data block of the to-be-patrolled pool.

[0028] Optionally, based on the relationship between the number of errors and the preset threshold, the data block containing the open page is refreshed or a data write operation is performed, including:

[0029] If the number of errors exceeds the preset threshold, the data block containing the open page is refreshed.

[0030] If the number of errors is not higher than the preset threshold, the data block containing the open page is placed in the write pool, waiting for the data write operation to be performed.

[0031] Optionally, while placing the data block containing the open page into the write pool, the boosting method includes:

[0032] The field values ​​of the feature fields in the data blocks placed in the write pool are changed from the page number of their open page to the default value.

[0033] Optionally, before determining whether the target open data block is full, the boosting method includes:

[0034] Determine whether the offline duration of the target open data block exceeds a preset duration;

[0035] If the offline duration of the target open data block exceeds the preset duration, the target open data block will be placed in the recycling pool.

[0036] If the offline duration of the target open data block does not exceed the preset duration, determine whether the target open data block has been filled.

[0037] This invention provides a device for improving hard disk read / write performance, the device comprising:

[0038] The modification unit is used to modify the field value of the feature field in the open data block of the hard disk according to the power failure state of the hard disk;

[0039] The acquisition unit is used to acquire the field value after the hard disk is powered on;

[0040] The read operation inspection unit is used to perform a read operation on the open page corresponding to the field value when the field value meets the preset conditions.

[0041] The size relationship determination unit is used to determine the size relationship between the number of errors in the open page and a preset threshold based on the result of the read operation;

[0042] The refresh or execution unit is used to refresh the data block containing the open page or perform a data write operation based on the relationship between the number of errors and the preset threshold.

[0043] Optionally, the lifting device includes:

[0044] an increasing field unit, configured to increase a characteristic field in all data blocks of the hard disk, the characteristic field being used to record a page number of the open page;

[0045] a setting field value unit, configured to set a field value of all characteristic fields as the default value, the field value being the page number of the open page, and the default value being different from the page number of all open pages.

[0046] Optionally, the changing unit is specifically configured to:

[0047] if the hard disk is an abnormal power-off, change the field value of the characteristic field in the open data block to the page number of the open page being written with data at the time of power-off;

[0048] if the hard disk is a normal power-off, perform a filling empty data operation on the open data block, fill empty data to a next page of the open page being written with data at the time of power-off, and change the field value of the characteristic field in the open data block to the page number of the next page.

[0049] Optionally, the obtaining unit is specifically configured to:

[0050] reconstruct a linked list pool of all data blocks in the hard disk;

[0051] perform an inspection on all data blocks according to the linked list pool;

[0052] if any data block is not an open data block, directly put the data block into a to-be-written pool;

[0053] if any data block is an open data block, determine whether the target open data block is full;

[0054] if the target open data block is full, determine whether the target open data block is put into a to-be-recycled pool according to a recycling rule;

[0055] if the target open data block is not full, obtain a field value of a characteristic field in the target open data block.

[0056] Optionally, the read operation inspection unit comprises:

[0057] a putting into a writing pool subunit, configured to, in a case where the field value is the default value, put a data block in which the open page corresponding to the field value is located into the to-be-written pool;

[0058] a putting into an inspection pool subunit, configured to, in a case where the field value is not the default value, put a data block in which the open page corresponding to the field value is located into the to-be-inspected pool;

[0059] The read operation subunit is configured to perform a read operation on the open page contained in each data block of the to-be-inspected pool.

[0060] Optionally, the refreshing or executing unit comprises:

[0061] The refreshing subunit is configured to perform data refreshing on the data block where the open page is located when the number of errors is higher than the preset threshold.

[0062] The executing write subunit is configured to put the data block where the open page is located into the to-be-written pool and wait for performing data write operation when the number of errors is not higher than the preset threshold.

[0063] Optionally, the changing unit is further configured to:

[0064] change the field value of the feature field in the data block put into the to-be-written pool from the page number of the open page to a default value.

[0065] Optionally, the obtaining unit is further configured to:

[0066] determine whether the offline duration of the target open data block exceeds a preset duration;

[0067] put the target open data block into the to-be-recycled pool if the offline duration of the target open data block exceeds the preset duration;

[0068] determine whether the target open data block is full if the offline duration of the target open data block does not exceed the preset duration.

[0069] The embodiment of the application further provides a hard disk, which comprises a controller.

[0070] The controller is configured to execute the hard disk read-write performance improving method according to any one of the above.

[0071] The embodiment of the application further provides a computer readable storage medium, which stores a computer program, so that a processor executes the hard disk read-write performance improving method according to any one of the above.

[0072] The hard disk read-write performance improving method provided by the application changes the field value of the feature field in the open data block of the hard disk according to the power-off state of the hard disk; after the hard disk is powered on, the field value is first obtained; the read operation is performed on the open page corresponding to the field value when the field value meets the preset condition; the number of errors of the open page and the preset threshold are determined according to the result of the read operation; and finally, data refreshing or data write operation is performed on the data block where the open page is located according to the size relationship between the number of errors and the preset threshold.

[0073] The present application aims at the scene of power-off and recovery of a hard disk, and is different from the existing technology. Instead of directly recycling the data block where the open page is located, the field value of the characteristic field is changed when power-off, and the read operation is performed on the open page corresponding to the field value after power-on, so as to determine the error number of the open page. Then, according to the size relationship between the error number and the preset threshold, it is determined whether the data block where the open page is located needs to be recycled or not, and the data write operation can be performed. On the basis of ensuring reliability, the present application solves the performance jitter problem caused by the direct garbage recycling affecting the normal read / write operation, thereby improving the read / write performance of the hard disk and bringing better use experience to the user. BRIEF DESCRIPTION OF DRAWINGS

[0074] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not intended to limit the scope of the present application. Moreover, the same reference numerals are used throughout the same figures. In the drawings:

[0075] Figure 1 is a flowchart of a hard disk read / write performance improvement method according to an embodiment of the present application;

[0076] Figure 2 is a flowchart of a hard disk power-off processing according to an embodiment of the present application;

[0077] Figure 3 is a flowchart of a hard disk power-on processing according to an embodiment of the present application;

[0078] Figure 4 is a block diagram of a hard disk read / write performance improvement device according to an embodiment of the present application. DETAILED DESCRIPTION

[0079] In order to make the above-mentioned objects, features and advantages of the present application more apparent, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and only represent a part of the embodiments of the present application, but are not used to limit the present application.

[0080] The inventors found that, in order to improve the data reliability of hard disks, especially solid state drives (SSD), firmware is usually used to design the data patrol function of the hard disk, and all blocks are patrolled in unit time (such as 1 hour) in unit of die. For solid state drives, the data is usually stored in the flash memory particles inside the solid state drive, and each flash memory particle encapsulates multiple dies. Each die is a very small storage unit. For example, each die has 1980 blocks, and each block has 1152 pages.

[0081] The storage medium of the solid state drive is divided into two types, one is to use FLASH chip as storage medium, and the other is to use DRAM as storage medium. The latest is Intel's XPoint particle technology.

[0082] Solid state drive based on flash memory (IDE FLASH DISK, Serial ATA Flash Disk): uses FLASH chip as storage medium, which is also commonly known as SSD. Its appearance can be made into various shapes, such as notebook hard disk, micro hard disk, memory card, U disk, etc. The biggest advantage of this SSD solid state drive is that it can be moved, and the data protection is not controlled by the power supply, and can adapt to various environments, and is suitable for personal users.

[0083] Longer life, different flash media have different life. SLC (Single Level Cell) flash memory generally reaches tens of thousands of PE (recyclable erasing times), MLC (Multi-Level Cell) can reach more than 3000 times, TLC (Triple-Level Cell) also reaches about 1000 times, and the latest QLC (Quad-Level Cell) can also ensure 300 times of life. The total size of the annual write amount of ordinary users does not exceed 50 times of the hard disk, even the cheapest QLC flash memory can provide 6 years of write life. High reliability, high-quality home solid state drives can easily achieve one-tenth of the failure rate of ordinary home mechanical hard drives.

[0084] DRAM-based solid state drive: using DRAM as storage medium, the application range is narrow. It imitates the design of traditional hard disk, can be set and managed by file system tools of most operating systems, and provides industry standard PCI and FC interface for connecting host or server. The application mode can be divided into SSD hard disk and SSD hard disk array two kinds. It is a kind of high performance memory, theoretically can be written unlimitedly, the only drawback is that independent power supply is needed to protect data security. DRAM solid state hard disk belongs to the relatively non mainstream equipment.

[0085] Based on the above hard disk structure, in the process of hard disk inspection in page unit, if the BER (error number) exceeds the specified threshold, the data refresh operation (moving to other block) of the block is initiated. Since the amount of page in each block is large, each page is inspected (for example, page read operation is performed on NAND), which will affect the normal or user's read / write (the execution unit of read / write / erase is die), causing performance jitter. Taking an example of 1980 blocks on each die and 1152 pages in each block, the corresponding inspection time in 1 hour is: 3600s / 1980block / 1152page=1.57ms, that is, on a single die, an average of 1.57ms produces a patrol read.

[0086] If the whole disk has 128 dies, it means that the whole disk produces a patrol read every 1.57 / 128die=0.012ms. In order to reduce the impact on performance, in the currently adopted mode, the patrol page selects the fixed 3 weakest pages (through NAND characteristic analysis and NAND manufacturer's suggestion, different NANDs may not be the same), such as page5, page509 and page516 in a block are the weakest pages, then the single die patrol period is shortened to 3600s / 1982block / 3page=606ms, and the whole disk patrol period is shortened to 606ms / 128die=4.7ms, the impact on hard disk read / write performance is greatly reduced.

[0087] The inventor further found that, due to the principle of the NAND characteristic, after a certain block is opened (i.e., a data block is opened to prepare for writing data) or the first page is written, it needs to be filled within a specified time, for example, within 2 hours, and the higher the temperature, the lower the threshold. If the block is closed within the specified time, the aforementioned three weakest pages: page5, page509, and page516 are representative; and if the block is not filled within the specified time, page5, page509, and page516 are not representative, and the BER (bad error bit rate) of the open page will be higher and higher as the open time increases, until the subsequent page is written, and the open page (an open page in the industry refers to a page in a block where data is last written or is being written, and the open page is defined throughout the present application) will be switched constantly. The existing scheme for the open block (an open block in the industry refers to a data block that has written data but has not been filled with data, and the open block is defined throughout the present application), when there is no user data writing, will periodically (according to the upper threshold of the open time) fill the empty data, i.e., perform a dummy operation, until the block is completely written, i.e., all pages in the block are written with data.

[0088] However, for the occasional power-off scenario of the hard disk, since the hard disk has been offline, it is impossible to perform periodic filling operations, i.e., dummy operations, and the open time of such a block may exceed the threshold or may not exceed the threshold. This time length can be converted by a time stamp, but if the hard disk experiences high temperature storage when it is offline, the time is accelerated, and since the temperature has returned to the normal value after power-on, it is impossible to determine how much time the block has been opened, and it is also impossible to obtain the temperature when it is offline.

[0089] Currently, in order to solve this problem, such blocks are usually directly recycled, but for the repeated hot plug or abnormal power-off scenario, i.e., the offline time is relatively short, and there is no experience of high temperature offline, in fact, it does not need to be directly recycled (it may continue to fill data), but since power-off will generate many such blocks, if direct recycling operation is performed, it will affect normal read / write operations, cause performance jitter problems, reduce the read / write performance of the hard disk, and bring a terrible use experience to the user.

[0090] In order to solve the above problems, the inventor creatively proposes the hard disk read / write performance improvement method of the present application, which is explained and described in detail as follows.

[0091] Referring to Figure 1 , a flow chart of the hard disk read-write performance improvement method of the present application is shown, which comprises:

[0092] Step 101: according to the power-off state of the hard disk, change the field value of the feature field in the open data block of the hard disk.

[0093] Generally, in the process of writing data to any block, the data is written in the manner from the low page to the high page. For example, taking a block with 1152 pages as an example, when the block is opened, data is written from page 0 until page 1151 is written, and the block is full.

[0094] During the data writing process, if the hard disk is powered off, the field value of the feature field in the open data block of the hard disk is changed according to the power-off state of the hard disk.

[0095] Because the field value of the feature field in the open data block of the hard disk needs to be changed, unlike the current conventional block, before changing the field value of the feature field in the open data block of the hard disk, a feature field needs to be added in all blocks of the hard disk, which is used to record the page number of the open page. For example, an OPEN_PAGE field can be added in the attribute (info) of each block as a feature field, which is used to record the page number of the open page.

[0096] At the beginning, the field value of all feature fields is set to a default value, which is the page number of the open page. The default value is different from all page numbers of the open page. For example, the default value is set to 0xFFFF (hexadecimal, corresponding to decimal 65535), and the page numbers in the block are from 0 to 1151, and the corresponding hexadecimal numbers are definitely different from the default value. The field value of the feature field can be used to distinguish whether the hard disk is powered off and for further logical judgment.

[0097] In a possible embodiment, if the power-off of the hard disk is an abnormal power-off, the field value of the characteristic field in the open data block needs to be changed to the page number of the open page being written with data at the time of power-off; if the power-off of the hard disk is a non-abnormal power-off, different from the case of abnormal power-off, a dummy operation needs to be performed on the open data block, i.e. dummy operation, to fill the subsequent page of the open page being written with data at the time of power-off with dummy data, and meanwhile the field value of the characteristic field in the open data block needs to be changed to the page number of the subsequent page. For example, the hard disk is currently writing data to page 500 in a block, and suddenly a power-off occurs. If the power-off is an abnormal power-off, the field value of the characteristic field in the block needs to be changed to the page number 500 of the open page page 500 being written with data at the time of power-off; if the power-off of the hard disk is a non-abnormal power-off, a dummy operation needs to be performed on the block, i.e. dummy operation, to fill the subsequent page page 501 of the open page page 500 being written with data at the time of power-off with dummy data, and meanwhile the field value of the characteristic field in the block needs to be changed to the page number 501 of the subsequent page page 501.

[0098] The above process at the time of power-off can be summarized as shown in the flowchart of the process at the time of power-off. Figure 2 The flowchart of the process at the time of power-off is shown in the figure. It is determined whether a power-off occurs. If no power-off occurs, data continues to be written. If a power-off occurs, it is determined whether the power-off is abnormal. If the power-off is not abnormal, a dummy page is added to the open data block, i.e. the page number of the page filled with dummy data is written into the attribute of the open data block as the field value of the characteristic field. If the power-off is abnormal, the page number of the open page being written is written into the attribute of the open data block as the field value of the characteristic field. The above process ends, and the power-off is completed.

[0099] Step 102: After the hard disk is powered on, the field value is obtained.

[0100] After the power-off of the hard disk is completed, the hard disk will be powered on again. After the hard disk is powered on, the field value of the characteristic field in each block needs to be obtained. In a possible embodiment, the process can include:

[0101] First, the chain table pool of all blocks in the hard disk is reconstructed. Then, all blocks are inspected according to the reconstructed chain table pool. If any block is not an open data block, it indicates that the block has not been written with data, and the block can be directly put into the pool to be written with data, waiting for data to be written.

[0102] If any block is an open data block, it is determined whether the target open data block has been written full. Since some open data blocks can have been written full with data, and the open data blocks written full are not affected by the power-off, it is first determined whether the target open data block has been written full.

[0103] If the target open data block is full, it is determined according to a recycling rule whether the target open data block is put into a recycling pool for garbage collection. The specific recycling rule can refer to the known recycling rule, and will not be described in detail.

[0104] If the target open data block is not full, the field value of the feature field in the target open data block is obtained for subsequent operation processes.

[0105] Step 103: In the case that the field value meets a preset condition, a read operation is performed on the open page corresponding to the field value.

[0106] After the field value of the feature field in the target open data block is obtained in the foregoing step 102, in the case that the field value meets a preset condition, a read operation is performed on the open page corresponding to the field value. The preset condition refers to that the field value is not a default value set by the system. In the case that the field value is the default value, it indicates that the block is not affected by power failure, and thus the block in which the open page is located can be directly put into a pool to be written, and waits for data writing.

[0107] In the case that the field value is not the default value, it indicates that the block is affected by power failure, and thus the block in which the open page is located needs to be put into a pool to be inspected. After all the blocks are inspected according to the foregoing method, the pool to be inspected stores all the blocks in which the field value is not the default value.

[0108] Finally, a read operation is performed on the open page included in each block in the pool to be inspected.

[0109] Step 104: The size relationship between the error number of the open page and a preset threshold is determined according to the result of the read operation.

[0110] After the read operation is performed, the error number of the open page, that is, the BER of the open page, can be determined according to the result of the read operation, and the size relationship between the error number and the preset threshold is determined according to the error number.

[0111] Step 105: According to the size relationship between the error number and the preset threshold, data refresh is performed on the data block in which the open page is located, or a data write operation is performed on the data block in which the open page is located.

[0112] According to the determined size relationship between the error number and the preset threshold, it is determined whether data refresh is performed on the block in which the open page is located or a data write operation is performed on the block in which the open page is located.

[0113] In one possible embodiment, the specific method includes:

[0114] If the number of errors exceeds the preset threshold, it means that the open page has a high number of errors due to power failure, resulting in a data write error. Therefore, it is necessary to perform a data refresh operation on the block containing the open page, put the block into the garbage collection pool, and wait for the block to be garbage collected so that the block can continue to be written to after garbage collection.

[0115] If the number of errors is not higher than the preset threshold, it means that the number of errors in the open page is low due to the power outage, and the data writing is normal, so data writing can continue. Therefore, the block containing the open page is directly placed into the write pool, waiting for the data write operation to be performed.

[0116] At the same time, while placing the block containing the open page into the write pool, it is also necessary to change the field value of the feature field in the block placed into the write pool from the page number of its open page to the default value, that is, restore the field value of the feature field in the block attribute to the default value.

[0117] Furthermore, as mentioned above, after a block is opened or the first page is written, it needs to be filled within a specified time, such as two hours. Therefore, if the hard drive experiences a prolonged power outage, exceeding the specified time (e.g., two and a half hours after a power outage), upon power-up, the linked list pool of all blocks on the hard drive still needs to be rebuilt, and all blocks are checked against the linked list pool. If any block is not an open data block, it is directly placed into the write pool; if any block is an open data block, before determining whether the target open data block is full, it is first determined whether the offline time of the target open data block exceeds the preset time, and whether the offline time of the target open data block exceeds the hard drive's specified time.

[0118] If the offline time of the target open data block exceeds the preset time, the target open data block is directly placed into the garbage collection pool to wait for garbage collection, without further checking whether the target open data block is full; if the offline time of the target open data block does not exceed the preset time, then it is determined whether the target open data block is full and subsequent operation procedures are performed.

[0119] The above-mentioned process for handling hard drives after power-on can be used as follows: Figure 3 The power-on process flowchart shown is as follows: Upon power-on, the block list pool is rebuilt. It is determined whether the block has not been written to. If not, the block is directly placed into the write pool. If it has been written to, it is then determined whether the block is full. If full, the block is directly placed into the garbage collection pool, awaiting garbage collection. If not full, it is then determined whether the value of the block's characteristic field is the default value. Figure 3OPEN_PAGE is 0xFFFF.

[0120] If the field value of the characteristic field of the block is a default value, the block is directly put into a to-be-written pool and waits for data writing; if the field value of the characteristic field of the block is not a default value, the block is put into a to-be-inspected pool.

[0121] The to-be-inspected pool is inspected, and a read operation is performed on the open page corresponding to the field value of the characteristic field of each block. Figure 3 The read operation is performed on the page corresponding to the field value of the OPEN_PAGE of each block.

[0122] After the read operation is completed, it is determined whether the error number BER exceeds a preset threshold value; if the error number BER exceeds the preset threshold value, the block is put into a to-be-recycled pool and waits for garbage collection; if the error number BER does not exceed the preset threshold value, the field value of the characteristic field in the attribute of the block is restored to a default value, and the block with the field value of the characteristic field restored to the default value is put into the to-be-written pool and waits for data writing. Figure 3 The field value of the OPEN_PAGE is restored to the default value, and the block with the field value of the characteristic field restored to the default value is put into the to-be-written pool and waits for data writing. Figure 3 The field value of the OPEN_PAGE is restored to the default value, and the block with the field value of the characteristic field restored to the default value is put into the to-be-written pool and waits for data writing.

[0123] In summary, in the scenario of power failure and recovery of the hard disk, the application differs from the existing technology, and instead of directly recycling the block in which the open page is located, the field value of the characteristic field is changed when the power fails, and a read operation is performed on the open page corresponding to the field value after the power is turned on, so as to determine the error number of the open page, and then it is determined whether the block in which the open page is located needs to be recycled or not according to the size relationship between the error number and the preset threshold value. The application can perform a data writing operation. The application solves the problem of performance jitter caused by the influence of direct garbage collection on normal read / write operations on the basis of ensuring reliability, thereby improving the read / write performance of the hard disk and bringing a better use experience to users.

[0124] In the embodiment of the application, based on the method for improving the read / write performance of the hard disk, a device for improving the read / write performance of the hard disk is further provided, and a block diagram of the device for improving the read / write performance of the hard disk is shown in FIG. 4. Figure 4 The device for improving the read / write performance of the hard disk comprises:

[0125] A changing unit 410 is configured to change the field value of the characteristic field in the open data block of the hard disk according to the power failure state of the hard disk.

[0126] An obtaining unit 420 is configured to obtain the field value after the hard disk is powered on.

[0127] The read operation patrol unit 430 is configured to perform a read operation on the open page corresponding to the field value if the field value meets a preset condition.

[0128] The size relationship determination unit 440 is configured to determine a size relationship between the number of errors of the open page and a preset threshold according to a result of the read operation.

[0129] The refreshing or executing unit 450 is configured to perform data refreshing or a data write operation on the data block where the open page is located according to the size relationship between the number of errors and the preset threshold.

[0130] Optionally, the lifting device comprises:

[0131] The increasing field unit is configured to increase a characteristic field in all data blocks of the hard disk, and the characteristic field is used to record a page number of the open page.

[0132] The setting field value unit is configured to set a field value of all characteristic fields as the default value, the field value is the page number of the open page, and the default value is different from the page number of all open pages.

[0133] Optionally, the changing unit 410 is specifically configured to:

[0134] If the hard disk is an abnormal power failure, the field value of the characteristic field in the open data block is changed to the page number of the open page that is writing data at the time of the power failure.

[0135] If the hard disk is a non-abnormal power failure, a fill empty data operation is performed on the open data block, empty data is filled in a next page of the open page that is writing data at the time of the power failure, and the field value of the characteristic field in the open data block is changed to the page number of the next page.

[0136] Optionally, the obtaining unit 420 is specifically configured to:

[0137] The chain table pool of all data blocks in the hard disk is reconstructed.

[0138] All data blocks are patrolled according to the chain table pool.

[0139] If any data block is not an open data block, the data block is directly put into the to-be-written pool.

[0140] If any data block is an open data block, it is determined whether the target open data block is full.

[0141] If the target open data block is full, it is determined whether the target open data block is put into the to-be-recycled pool according to a recycling rule.

[0142] If the target open data block is not full, a field value of a characteristic field in the target open data block is obtained.

[0143] Optionally, the read operation inspection unit 430 comprises:

[0144] a putting into a write pool sub-unit, configured to put a data block where an open page corresponding to the field value is located into a write pool if the field value is the default value;

[0145] a putting into an inspection pool sub-unit, configured to put a data block where an open page corresponding to the field value is located into an inspection pool if the field value is not the default value;

[0146] a read operation sub-unit, configured to perform a read operation on an open page contained in each data block in the inspection pool.

[0147] Optionally, the refreshing or executing unit 450 comprises:

[0148] a refreshing sub-unit, configured to perform data refreshing on a data block where the open page is located if the number of errors is higher than the preset threshold;

[0149] an executing write sub-unit, configured to put the data block where the open page is located into a write pool and wait for performing a data write operation if the number of errors is not higher than the preset threshold.

[0150] Optionally, the changing unit 410 is further configured to:

[0151] change a field value of a feature field in a data block put into the write pool from a page number of an open page thereof to a default value.

[0152] Optionally, the obtaining unit 420 is further configured to:

[0153] determine whether an offline duration of the target open data block exceeds a preset duration;

[0154] put the target open data block into the recycle pool if the offline duration of the target open data block exceeds the preset duration;

[0155] determine whether the target open data block has been written full if the offline duration of the target open data block does not exceed the preset duration.

[0156] In the embodiment of the application, based on the method for improving the read-write performance of a hard disk, a hard disk is further provided, which comprises a controller.

[0157] In the embodiment of the present application, based on the above method for improving the read-write performance of a hard disk, a computer readable storage medium is further provided, which stores a computer program to enable a processor to execute the method for improving the read-write performance of a hard disk as described in any one of steps 101-105.

[0158] To sum up, the method for improving the read-write performance of a hard disk according to the present application changes the field value of the feature field in the open data block of the hard disk according to the power-off state of the hard disk; after the hard disk is powered on, the field value is first acquired; in the case that the field value meets the preset condition, a read operation is performed on the open page corresponding to the field value; the size relationship between the error number of the open page and the preset threshold is determined according to the result of the read operation; and finally, the data of the block where the open page is located is refreshed or a data write operation is performed according to the size relationship between the error number and the preset threshold.

[0159] The present application is directed to the scenario of power-off and recovery of a hard disk, and is different from the existing technology, which does not directly recycle the block where the open page is located, but changes the field value of the feature field when power-off, and performs a read operation on the open page corresponding to the field value after power-on, to determine the error number of the open page, and then determines whether to recycle the block where the open page is located or not according to the size relationship between the error number and the preset threshold, and can perform a data write operation. The present application solves the problem of performance jitter caused by the direct garbage collection affecting normal read / write operations on the basis of ensuring reliability, thereby improving the read-write performance of the hard disk and bringing a better user experience.

[0160] Although the preferred embodiments of the present application have been described, those skilled in the art can make further changes and modifications to these embodiments once they know the basic inventive concept. Therefore, the appended claims are intended to cover all changes and modifications falling within the scope of the embodiments of the present application.

[0161] Finally, it should be noted that, in this document, the terms such as first and second are merely used to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "comprise", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or terminal device. Without more limitations, the element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article or terminal device including the element.

[0162] The embodiments of the present application are described above with reference to the accompanying drawings, but the present application is not limited to the above-described specific embodiments, and the above-described specific embodiments are merely illustrative, but not restrictive, and a person of ordinary skill in the art can make many forms under the inspiration of the present application without departing from the purpose of the present application and the scope protected by the claims, and these all belong to the protection of the present application.

Claims

1. A method for improving the read-write performance of a hard disk, characterized in that, The improving method comprises: According to the power-off state of the hard disk, the field value of the feature field in the open data block of the hard disk is changed; After the hard disk is powered on, the field value is obtained; In the case that the field value meets a preset condition, a read operation is performed on the open page corresponding to the field value; According to the size relationship between the error number of the open page and a preset threshold, data refresh is performed on the data block where the open page is located or a data write operation is performed; The method comprises: If the hard disk is abnormally powered off, the field value of the feature field in the open data block is changed to the page number of the open page that is writing data at the time of power-off; If the hard disk is not abnormally powered off, a fill empty data operation is performed on the open data block, empty data is filled in the next page of the open page that is writing data at the time of power-off, and the field value of the feature field in the open data block is changed to the page number of the next page. Before changing the field value of the feature field in the open data block of the hard disk, the improving method comprises:

2. The lifting method according to claim 1, characterized in that, A feature field is added in all data blocks of the hard disk, and the feature field is used to record the page number of the open page; The field value of all feature fields is set to a default value, and the field value is the page number of the open page, and the default value is different from the page number of all open pages. After the hard disk is powered on, the field value is obtained, which comprises:

3. The method of lifting of claim 1, wherein, A linked list pool of all data blocks in the hard disk is reconstructed; All data blocks are inspected according to the linked list pool; If any data block is not an open data block, the data block is directly put into a to-be-written pool; If any data block is an open data block, the data block is taken as a target open data block, and whether the target open data block is full is determined; If the target open data block is full, whether the target open data block is put into a to-be-recycled pool is determined according to a recycling rule; If the target open data block is not full, the field value of the feature field in the target open data block is obtained. In the case that the field value meets a preset condition, a read operation is performed on the open page corresponding to the field value, which comprises:

4. The method of lifting of claim 1, wherein, In the case that the field value is a default value, the data block where the open page corresponding to the field value is located is put into a to-be-written pool; In the case that the field value is not a default value, the data block where the open page corresponding to the field value is located is put into a to-be-inspected pool; A read operation is performed on the open page contained in each data block of the to-be-inspected pool. According to the size relationship between the error number and the preset threshold, data refresh is performed on the data block where the open page is located or a data write operation is performed, which comprises:

5. The method of lifting of claim 1, wherein, In the case that the error number is higher than the preset threshold, data refresh is performed on the data block where the open page is located; In the case that the error number is not higher than the preset threshold, the data block where the open page is located is put into a to-be-written pool, and waits for a data write operation to be performed. At the same time that the data block where the open page is located is put into the to-be-written pool, the improving method comprises:

6. The method of hoisting according to claim 5, characterized in that, ​ Change the field value of the feature field in the data block to be written into the pool into a default value from the page number of its open page.

7. The method of lifting of claim 3, wherein, Before determining whether the target open data block has been written full, the promotion method comprises: Determining whether the offline duration of the target open data block exceeds a preset duration; If the offline duration of the target open data block exceeds the preset duration, putting the target open data block into the pool to be recycled; If the offline duration of the target open data block does not exceed the preset duration, determining whether the target open data block has been written full.

8. A device for improving the read-write performance of a hard disk, characterized in that, The promotion device comprises: A changing unit configured to change the field value of the feature field in the open data block of the hard disk according to the power-off state of the hard disk; An obtaining unit configured to obtain the field value after the hard disk is powered on; A read operation inspection unit configured to perform a read operation on the open page corresponding to the field value if the field value meets a preset condition; A size relationship determining unit configured to determine the size relationship between the error number of the open page and a preset threshold according to the result of the read operation; A refreshing or executing unit configured to perform data refreshing or data writing operation on the data block where the open page is located according to the size relationship between the error number and the preset threshold. The changing unit is specifically configured to: If the hard disk is abnormally powered off, change the field value of the feature field in the open data block into the page number of the open page that is writing data at the time of power-off; If the hard disk is not abnormally powered off, perform a fill empty data operation on the open data block, fill empty data on the next page of the open page that is writing data at the time of power-off, and change the field value of the feature field in the open data block into the page number of the next page.

9. A hard disk, characterized by The hard disk comprises a controller. The controller is configured to execute the hard disk read-write performance promotion method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer program stored therein causes the processor to execute the hard disk read-write performance promotion method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Power-on reconstruction method and device and solid state disk

    CN113296694A

  • Data reading method applied to solid state disk (SSD), and related apparatus

    WO2022067686A1