Method for writing data into solid state hard disk and solid state hard disk

By introducing nonvolatile memory into the solid-state drive and writing data from the write operation request to its write area, the problem of short SSD service life caused by excessive use of NAND Flash and capacitors is solved, and the effect of extending service life and improving reliability is achieved.

CN111638852BActive Publication Date: 2025-02-28HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010311530.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2014-12-31
Publication Date
2025-02-28
Estimated Expiration
2034-12-31

AI Technical Summary

Technical Problem

In existing solid-state drives (SSDs), excessive read, write and use of NAND Flash and capacitors result in a shorter service life of SSDs.

Method used

By introducing nonvolatile memory (NVM) into the SSD, pre-written data from the write operation request is written to the write area of ​​the NVM instead of directly writing to the NAND Flash, and migrating according to the access frequency of the data to reduce access to NAND Flash.

Benefits of technology

Reduces the access frequency of NAND Flash, reduces its wear, extends the service life of the SSD, and avoids the risk of data loss when power supply is interrupted due to the non-volatile nature of NVM.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111638852B_ABST
    Figure CN111638852B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method for writing data to a solid-state hard disk and a solid-state hard disk. The SSD includes a controller and a memory, the storage medium of the memory includes NAND Flash and NVM, and the NVM includes a write area. The method includes: receiving a write operation request, the write operation request includes pre-written data; determining that the pre-written data is not stored in the write area; writing the pre-written data into the write area. The embodiment of the present invention writes the pre-written data into the write area of ​​the NVM, which can reduce the access to the NAND Flash, that is, reduce the access frequency of the NAND Flash in the SSD, thereby reducing the wear on the NAND Flash; and, due to the non-volatile characteristics of the NVM, the data stored in the NVM is not lost when the power is off, so when the power is interrupted, the SSD does not need a capacitor to provide backup power. Based on the above reasons, the service life of the SSD in the embodiment of the present invention is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to storage technology, and more particularly to a method for writing data into a solid-state hard disk and a solid-state hard disk. Background Art

[0002] Solid State Drives (SSD), also known as solid disks, are widely used in servers, desktops, notebooks, mobile devices, game consoles, etc.

[0003] like Figure 1 As shown, SSD 10 mostly uses semiconductor NAND Flash 14 as the storage medium of the memory; and provides backup power through capacitor 15 to avoid data loss in memory 13 during power failure; receives read and write operation requests from host 11 through controller 12, and reads and writes memory 13 or NAND Flash 14.

[0004] In the prior art, when a read or write operation request is directed to NAND Flash 14, the memory 13 is used as an intermediary to read the data corresponding to the read operation request from NAND Flash 14 to the memory 13, and then return it to the host 11; or, the data corresponding to the write operation request is first written into the memory 13, and then transferred to NAND Flash 14. In this way, if the data corresponding to the write operation request cached in the memory 13 has not been transferred to the NAND Flash 14, the power supply is interrupted, and the capacitor 15 is required to provide backup power to write the data in the memory 13 to the NAND Flash 14.

[0005] However, based on historical data statistics, NAND Flash and capacitors are the main sources of SSD failure. Therefore, the presence of capacitors and excessive reading and writing of NAND Flash in SSDs may shorten the service life of SSDs. Summary of the invention

[0006] The embodiments of the present invention provide a method for writing data into a solid state drive and a solid state drive, so as to increase the service life of the SSD and improve the reliability of the SSD.

[0007] In a first aspect, an embodiment of the present invention provides a method for writing data into a solid state drive (SSD), wherein the SSD includes a controller and a memory, wherein a storage medium of the memory includes a NAND Flash and a non-volatile memory (NVM), and the NVM includes a write area, and the method includes:

[0008] receiving a write operation request, wherein the write operation request includes pre-written data;

[0009] determining that the pre-written data is not stored in the write area;

[0010] The pre-write data is written into the write area.

[0011] According to the first aspect, in a first possible implementation manner of the first aspect, the method further includes:

[0012] Determine whether the pre-written data has been stored in the NAND Flash;

[0013] If the pre-written data has been stored in the NAND Flash, the page storing the pre-written data in the NAND Flash is set to be invalid.

[0014] According to the first aspect or the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, after writing the pre-written data into the write area, the method further includes:

[0015] A mapping relationship is saved, where the mapping relationship includes a corresponding relationship between a logical address of the pre-written data and a position where the pre-written data is written into the writing area.

[0016] According to the first aspect, or any one of the first to second possible implementations of the first aspect, in a third possible implementation of the first aspect, the method further includes:

[0017] Determining whether the access frequency of the pre-written data reaches a preset threshold;

[0018] When the access frequency of the pre-written data reaches the preset threshold, the pre-written data is migrated to the read area.

[0019] According to the first aspect or any one of the first to third possible implementations of the first aspect, in a fourth possible implementation of the first aspect, the method further includes:

[0020] Determine whether the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold;

[0021] When the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold, data in the page whose access frequency is greater than or equal to the preset threshold is migrated to the read area of ​​the NVM.

[0022] In a second aspect, an embodiment of the present invention provides a method for writing data into a solid state drive (SSD), wherein the SSD includes a controller and a memory, wherein a storage medium of the memory includes a NAND Flash and a non-volatile memory (NVM), wherein the NVM includes a write area and a read area, and wherein the method includes:

[0023] receiving a write operation request, wherein the write operation request includes pre-written data;

[0024] Determining that the pre-written data has been stored in the read area;

[0025] The pre-write data in the read area is migrated to the write area.

[0026] According to the second aspect, in a first possible implementation manner of the second aspect, after migrating the pre-written data in the read area to the write area, the method further includes:

[0027] Update the first mapping relationship to a second mapping relationship, wherein the first mapping relationship includes a correspondence between the logical address of the pre-written data and the position of the pre-written data in the read area, and the second mapping relationship includes a correspondence between the logical address of the pre-written data and the position of the pre-written data in the write area.

[0028] According to the second aspect or the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the method further includes:

[0029] Determining whether the access frequency of the pre-written data reaches a preset threshold;

[0030] When the access frequency of the pre-written data reaches the preset threshold, the pre-written data is migrated to the read area.

[0031] According to the second aspect, or any one of the first to second possible implementations of the second aspect, in a third possible implementation of the second aspect, the method further includes:

[0032] Determine whether the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold;

[0033] When the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold, data in the page whose access frequency is greater than or equal to the preset threshold is migrated to the read area of ​​the NVM.

[0034] According to the second aspect and any one of the first to third possible implementations of the second aspect, in a fourth possible implementation of the second aspect, the NVM further includes a spare area, and after migrating the pre-written data in the read area to the write area, the method further includes:

[0035] In the idle area, N pages are adjusted from the pages reserved for the write area to the read area, where N is the number of pages corresponding to the pre-written data.

[0036] In a third aspect, an embodiment of the present invention provides a solid state drive SSD, the SSD comprising a controller and a memory, the storage medium of the memory comprising NAND Flash and a non-volatile memory NVM, the NVM comprising a write area, wherein:

[0037] The controller is configured to receive a write operation request, the write operation request including pre-written data; determine that the pre-written data is not stored in the write area; and write the pre-written data into the write area;

[0038] The write area is used to store the pre-write data.

[0039] According to the third aspect, in a first possible implementation manner of the third aspect, the controller is further used to:

[0040] Determine whether the pre-written data has been stored in the NAND Flash;

[0041] If the pre-written data has been stored in the NAND Flash, the page storing the pre-written data in the NAND Flash is set to be invalid.

[0042] According to the third aspect or the first possible implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the controller is further used to:

[0043] A mapping relationship is saved, where the mapping relationship includes a corresponding relationship between a logical address of the pre-written data and a position where the pre-written data is written into the writing area.

[0044] According to the third aspect, or any one of the first to the second possible implementation manners of the third aspect, in a third possible implementation manner of the third aspect, the controller is further used to:

[0045] Determining whether the access frequency of the pre-written data reaches a preset threshold;

[0046] When the access frequency of the pre-written data reaches the preset threshold, the pre-written data is migrated to the read area.

[0047] According to the third aspect and any one of the first to third possible implementations of the third aspect, in a fourth possible implementation of the third aspect, the controller is further used to:

[0048] Determine whether the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold;

[0049] When the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold, data in the page whose access frequency is greater than or equal to the preset threshold is migrated to the read area of ​​the NVM.

[0050] In a fourth aspect, an embodiment of the present invention provides a solid state drive SSD, wherein the SSD includes a controller and a memory, wherein the storage medium of the memory includes NAND Flash and a non-volatile memory NVM, wherein the NVM includes a write area and a read area, wherein:

[0051] The controller is configured to receive a write operation request including pre-write data; determine that the pre-write data has been stored in the read area; and migrate the pre-write data in the read area to the write area.

[0052] According to the fourth aspect, in a first possible implementation manner of the fourth aspect, the controller is further used to:

[0053] Update the first mapping relationship to a second mapping relationship, wherein the first mapping relationship includes a correspondence between the logical address of the pre-written data and the position of the pre-written data in the read area, and the second mapping relationship includes a correspondence between the logical address of the pre-written data and the position of the pre-written data in the write area.

[0054] According to the fourth aspect or the first possible implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the controller is further used to:

[0055] Determining whether the access frequency of the pre-written data reaches a preset threshold;

[0056] When the access frequency of the pre-written data reaches the preset threshold, the pre-written data is migrated to the read area.

[0057] According to the fourth aspect and any one of the first to the second possible implementation manners of the fourth aspect, in a third possible implementation manner of the fourth aspect, the controller is further used to:

[0058] Determine whether the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold;

[0059] When the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold, data in the page whose access frequency is greater than or equal to the preset threshold is migrated to the read area of ​​the NVM.

[0060] According to the fourth aspect and any one of the first to third possible implementations of the fourth aspect, in a fourth possible implementation of the fourth aspect, the NVM further includes a spare area, and the controller is further used to:

[0061] In the idle area, N pages are adjusted from the pages reserved for the write area to the read area, where N is the number of pages corresponding to the pre-written data.

[0062] The embodiment of the present invention provides a method for writing data to a solid state drive and a solid state drive, which writes pre-written data into the write area of ​​NVM, thereby reducing the access to NAND Flash, that is, reducing the access frequency of NAND Flash in the SSD, and reducing the wear on the NAND Flash; and due to the non-volatile characteristics of NVM, the data stored in the NVM is not lost when the power is off, so when the power supply is interrupted, the SSD does not need a capacitor to provide backup power. Based on the above reasons, the service life of the SSD in the embodiment of the present invention is increased. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0064] Figure 1 A schematic diagram of an application scenario of a prior art SSD;

[0065] Figure 2 A schematic diagram of data stored in a storage unit of an SLC;

[0066] Figure 3 A schematic diagram of data stored in a storage unit of an MLC;

[0067] Figure 4 It is a schematic diagram of the structure of the SSD of the present invention;

[0068] Figure 5 This is a diagram showing an example structure of NVM in the SSD of the present invention;

[0069] Figure 6 This is a flow chart of a method for writing data into an SSD according to a first embodiment of the present invention;

[0070] Figure 7 This is a flow chart of a second embodiment of a method for writing data into an SSD according to the present invention;

[0071] Figure 8 This is an example diagram of the mapping relationship in the embodiment of the present invention. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.

[0073] In the prior art, NAND Flash is the physical medium that actually stores data in SSD. Among them, NAND Flash includes single-level cell storage (English: Single Level Cell, abbreviated as: SLC), multi-level cell storage (English: MultiLevel Cell, abbreviated as: MLC), and triple-level cell storage (English: Triple Level Cell, abbreviated as: TLC). In the field of enterprise-level storage, SLC and MLC are mainly used. TLC, a medium with a low number of erase and write times, is currently mainly used in consumer-level electronic products.

[0074] The characteristic of SLC technology is that the oxide film between the floating gate and the source is thinner. When writing data, the voltage is added to the charge of the floating gate, and then the stored charge is eliminated through the source. In this way, one information unit can be stored. This technology can provide fast program programming and reading. However, this technology is limited by silicon efficiency, and more advanced process enhancement technology must be used to improve SLC processing technology.

[0075] SLC stores 1 bit of data in each storage cell. Whether the stored data is "0" or "1" is determined based on the voltage threshold. Writing to NAND Flash, i.e. programming, is to charge it so that the voltage of NAND Flash exceeds Figure 2 At the voltage judgment point A shown in the figure, the storage cell indicates "0", that is, it has been written; if there is no charge or the voltage threshold is lower than the voltage judgment point A, it indicates "1", that is, it is erased. Figure 2 The horizontal axis represents voltage.

[0076] Intel first developed MLC in September 1997. Its function is to store two units of information into a floating gate, and then use charges of different potentials to control the precise reading and writing through the voltage stored in the memory. MLC uses a large number of voltage levels to store two bits of data in each unit, and the data density is relatively high. SLC stores two values ​​0 and 1, while MLC can store more than 4 values ​​at a time. Therefore, MLC has a relatively high storage density.

[0077] like Figure 3 As shown, MLC stores 2 bits of data in each storage unit. The stored data is "00", "01", "10", or "11", which is also determined based on the voltage threshold. When the voltage is less than the voltage determination point B, it represents "11"; when the voltage is between the voltage determination point B and the voltage determination point C, it represents "10"; when the voltage is between the voltage determination point C and the voltage determination point D, it represents "01"; and when the voltage reaches or exceeds the voltage determination point D, it represents "00".

[0078] A TLC storage unit can store 3 bits, so 8 levels of potential are required for encoding and decoding. In essence, TLC belongs to MLC.

[0079] At present, the research on new storage media is in the ascendant in the industry, and various new technologies or new storage media emerge in an endless stream. New storage media include, for example, phase change random access memory (PCRAM / PCM), magnetoresistive random access memory (MRAM), resistive random access memory (RRAM / ReRAM), and spin transfer torque random access memory (STT-RAM), etc., which are not limited by the present invention.

[0080] The new storage media mentioned above are all non-volatile memory (NVM). In the foreseeable future, NAND Flash will continue to exist as the main storage medium for a long time based on the consideration of protecting existing investments and costs. At the same time, new non-volatile storage media will gradually play an important role until they gradually replace NAND Flash. In this evolution process, there may be multiple media coexisting on the same SSD.

[0081] Based on the above reasons, an embodiment of the present invention provides an SSD.

[0082] like Figure 4 As shown, the SSD 40 includes a controller 42 and a memory, and the storage medium of the memory includes a NAND Flash 44 and a NVM 43 .

[0083] Among them, NVM is different from ordinary memory in that the NVM medium itself has the characteristic of not losing data when power is off. Based on this characteristic, NVM has the following functional characteristics: cache write, assemble a complete page in NVM, and then determine whether to transfer it to NAND Flash based on the access frequency of the page and the capacity of NVM; accelerate read, migrate the data with high access frequency to NVM.

[0084] Figure 5 The NVM area division is shown. Figure 5 As shown, NVM 50 may include four logical areas: metadata area 51, read area 52, write area 53 and idle area 54, to achieve partition management of NVM. The functions of each area are as follows:

[0085] The metadata area 51 is used to store metadata of the SSD, for example, the metadata may be a mapping relationship, a first-in first-out (FIFO) bidirectional linked list corresponding to a write operation, and the like.

[0086] The read area 52 is used for read acceleration. Pages in the SSD whose access frequency (ie, the number of reads) is higher than or equal to a preset threshold will be migrated to the read area 52 .

[0087] Write area 53: All write operations to the SSD are first written to the write area 53. When the area is full, it is eliminated according to the least recently accessed policy.

[0088] The free area 54 is shared by the read area 52 and the write area 53 , and provides free pages for read operations or write operations. The read operations and the write operations share the free area in a ratio of the read area 52 to the write area 53 .

[0089] It should be noted that the ratio of the write area to the read area in NVM is adjustable. Normally, the write area is much larger than the read area. In particular, there can be only a write area and no read area in NVM. In addition, different application scenarios have different performance requirements and erase and write times for SSDs. Therefore, based on the service life of the SSD, the performance of the SSD, and cost considerations, an SSD that meets the required erase and write times can be configured according to the user's actual business needs. By adjusting the matching ratio of NVM and NAND, users can be provided with cost-effective products, avoiding additional expenses caused by over-configuration and improving resource utilization.

[0090] Specifically, the controller 42 is used to execute the technical solution protected by the following method embodiments, for example, Figure 6 The technical solution shown is used to write data into the write area of ​​NVM 43, which is used to store pre-written data. Among them, NVM has the ability to address by byte, write data in bits, and rewrite by bits.

[0091] like Figure 6 As shown, an embodiment of the present invention provides a method for writing data into an SSD, which can be executed by a controller in the SSD. The method includes:

[0092] S601: Receive a write operation request, where the write operation request includes pre-written data.

[0093] S602: Determine whether the pre-written data is not stored in the write area.

[0094] S603: Write the pre-written data into the write area.

[0095] Specifically, all write operations to the SSD 40 are first written to the write area.

[0096] For the pre-written data to be written into the SSD 40 , the pre-written data may have been stored in the write area. Therefore, S602 is executed to first determine that the pre-written data is not stored in the write area.

[0097] The embodiment of the present invention writes the pre-written data into the write area of ​​the NVM, which can reduce the access to the NAND Flash, that is, reduce the access frequency of the NAND Flash in the SSD, thereby reducing the wear on the NAND Flash; and due to the non-volatile characteristics of the NVM, the data stored in the NVM is not lost when the power is off, so when the power supply is interrupted, the SSD does not need a capacitor to provide backup power. Based on the above reasons, the service life of the SSD in the embodiment of the present invention is increased.

[0098] In the above embodiment, the method for writing data into the SSD may further include: determining whether the pre-written data has been stored in the NAND Flash; if the pre-written data has been stored in the NAND Flash, setting the page storing the pre-written data in the NAND Flash to be invalid. This embodiment can avoid storing two copies of the same data in the SSD, thereby wasting storage space.

[0099] Further, after S603, the method may further include: saving a mapping relationship, the mapping relationship including a correspondence between a logical address of the pre-written data and a position where the pre-written data is written into the writing area. Figure 4 According to the mapping relationship, the controller 42 can conveniently read and write the NVM 43 and the NAND Flash 44.

[0100] Since the read area of ​​NVM 43 is used to store data whose access frequency (i.e., the number of reads) is higher than or equal to a preset threshold, and NAND Flash 44 is used to store data whose access frequency (i.e., the number of reads) is lower than the preset threshold, the above method may further include: determining whether the access frequency of the pre-written data reaches the preset threshold; when the access frequency of the pre-written data reaches the preset threshold, migrating the pre-written data to the read area to achieve migration of the pre-written data from the write area to the read area, thereby accelerating the reading of the pre-written data.

[0101] Similarly, the method may also include: determining whether the access frequency of a page in the NAND Flash is greater than or equal to a preset threshold; when the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold, migrating data in the page whose access frequency is greater than or equal to the preset threshold to a read area of ​​the NVM, so as to achieve data migration from the NAND Flash to the read area, accelerate the reading of the data, utilize the temporal locality and spatial locality of the data, store frequently modified data and other hot spot data in the NVM, and reduce wear on the NAND Flash.

[0102] In addition, the controller 42 can also be used to perform the following operations: Figure 7 The steps shown are as follows. Figure 7 As shown, an embodiment of the present invention provides a method for writing data into an SSD, the method comprising:

[0103] S701: Receive a write operation request, where the write operation request includes pre-written data.

[0104] S702: Determine whether the pre-written data has been stored in the read area.

[0105] S703: Migrate the pre-written data in the read area to the write area.

[0106] Specifically, the node corresponding to the pre-written data in the second bidirectional linked list can be updated to the tail of the first bidirectional linked list. Each node in the first bidirectional linked list is used to store the logical address of each page in the write area; each node in the second bidirectional linked list is used to store the logical address of each page in the read area. This is to achieve the mutual migration of data stored in the read area and the write area in the NVM.

[0107] If the pre-written data has been stored in the read area of ​​the NVM, it will be migrated to the write area. In the specific implementation, only the nodes in the read area need to be migrated to the write area.

[0108] The embodiment of the present invention migrates the pre-written data stored in the read area to the write area. This migration only involves two different areas in the NVM and has nothing to do with the NAND Flash. Therefore, it can reduce the access to the NAND Flash, that is, reduce the access frequency of the NAND Flash in the SSD, thereby reducing the wear on the NAND Flash. Moreover, due to the non-volatile characteristics of the NVM, the data stored in the NVM will not be lost when the power is off. Therefore, when the power supply is interrupted, the SSD does not need a capacitor to provide backup power. Based on the above reasons, the service life of the SSD in the embodiment of the present invention is increased.

[0109] In the above embodiment, after S703, the method may further include: updating the first mapping relationship to a second mapping relationship. The first mapping relationship includes a correspondence between the logical address of the pre-written data and the position of the pre-written data in the read area; the second mapping relationship includes a correspondence between the logical address of the pre-written data and the position of the pre-written data in the write area. Figure 4 According to the mapping relationship, the controller 42 can conveniently read and write the NVM 43 and the NAND Flash 44.

[0110] Since the read area of ​​NVM 43 is used to store data whose access frequency (i.e., the number of reads) is higher than or equal to a preset threshold, and NAND Flash 44 is used to store data whose access frequency (i.e., the number of reads) is lower than the preset threshold, the above method may further include: determining whether the access frequency of the pre-written data reaches the preset threshold; when the access frequency of the pre-written data reaches the preset threshold, migrating the pre-written data to the read area to achieve migration of the pre-written data from the write area to the read area, thereby accelerating the reading of the pre-written data.

[0111] Similarly, the method may also include: determining whether the access frequency of a page in the NAND Flash is greater than or equal to a preset threshold; when the access frequency of a page in the NAND Flash is greater than or equal to the preset threshold, migrating data in the page whose access frequency is greater than or equal to the preset threshold to a read area of ​​the NVM, so as to achieve data migration from the NAND Flash to the read area, accelerate the reading of the data, utilize the temporal locality and spatial locality of the data, store frequently modified data and other hot spot data in the NVM, and reduce wear on the NAND Flash.

[0112] Furthermore, the NVM 43 may also include a spare area. After S703, the method may further include: in the spare area, adjusting N pages from the pages reserved for the write area to the read area, wherein N is the number of pages corresponding to the pre-written data.

[0113] In the case where the above pre-written data has been stored in the SSD, the controller 42 needs to obtain the storage location to determine the subsequent operation. Specifically, the following application scenarios are respectively described.

[0114] In the first application scenario, the pre-written data is stored in the NAND Flash of the SSD. This application scenario includes at least two implementation methods.

[0115] In the first implementation, the pre-written data occupies a complete page in the NAND Flash. At this time, the mapping relationship is updated, that is, the logical address of the pre-written data points to the location where the pre-written data is written to the write area. The mapping relationship includes the correspondence between the logical address and the physical address of all pages in the SSD.

[0116] In the second implementation, the pre-written data occupies an incomplete page in the NAND Flash. At this time, the data in the page corresponding to the pre-written data in the NAND Flash, except for the part with the same range as the logical address of the pre-written data, is migrated to the write area of ​​the NVM; in the write area, the written pre-written data and the data migrated to the write area are combined to form a new page; then, the logical address of the pre-written data in the mapping relationship is updated to point to the address of the above new page.

[0117] Among them, the difference between the above two implementation methods is: the first implementation method is used to illustrate that the size of the pre-written data is exactly an integer multiple of the page in the NAND Flash. At this time, it is only necessary to update the correspondence between the logical address and the physical address in the mapping relationship. In the mapping relationship, the correspondence between the logical address of the pre-written data and its physical address in the NVM is added; the second implementation method is used to illustrate the processing when the size of the pre-written data is not an integer multiple of the page in the NAND Flash.

[0118] For example, the size of the pre-written data is 4KB, and the pre-written data has been stored in the first page of NAND Flash. The size of the page in NAND Flash is 8KB, and the first page corresponds to a logical address and a physical address in the mapping relationship. When writing the pre-written data, the data in the first page except for the part with the same range as the logical address of the pre-written data is migrated to the write area; in the write area, the pre-written data and the data migrated to the write area are combined to form a new page; then, the mapping relationship is updated to point to the logical address of the pre-written data in the preset mapping relationship, so that it points to the address of the combined new page.

[0119] Optionally, the address of the new page is saved to the tail of a first bidirectional linked list, and each node in the first bidirectional linked list is used to store the logical address of each page in the write area.

[0120] Specifically, each node in the first bidirectional linked list is used to represent a page in the write area. The node has a predecessor pointer and a successor pointer, the predecessor pointer points to the predecessor node of the first bidirectional linked list, and the successor pointer points to the successor node of the first bidirectional linked list; in addition, the node also includes the logical address of the page. The size of the write area determines the number of nodes included in the first bidirectional linked list. The first bidirectional linked list is used to record the order of each page in the write area, so as to facilitate the management of the write area. For example, when writing data, the information of the corresponding page will be inserted into the tail of the first bidirectional linked list; when eliminating, the page will be selected from the head of the first bidirectional linked list.

[0121] In the second application scenario, the pre-written data is stored in the write area of ​​the NVM in the SSD. In this application scenario, at least the following implementation methods are included: receiving a write operation request sent by a requester, the write operation request including the pre-written data; determining that the pre-written data is stored in the write area; and re-writing the pre-written data in the location where the pre-written data is stored in the write area.

[0122] The node corresponding to the pre-written data in the first bidirectional linked list is adjusted to the tail of the first bidirectional linked list. In this application scenario, the internal migration of the data stored in the write area is realized. If the pre-written data has been stored in the write area, the corresponding node in the first bidirectional linked list is migrated to the tail of the first bidirectional linked list.

[0123] Optionally, after S603, the method may further include: saving the address of the page corresponding to the pre-written data to the end of the first bidirectional linked list.

[0124] And, according to the number of pages corresponding to the pre-written data, the count of the written pages in the NVM is updated; if it is determined that the count is greater than or equal to a first threshold, the pages of the first threshold number are migrated from the NVM to the NAND Flash, so that the NVM has enough space for the writing of new data and / or the migration of data stored in other areas of the SSD, thereby realizing dynamic adjustment of the data stored in the SSD.

[0125] In particular, before the pre-written data is written into the write area, if the write area is judged to be full, starting from the head of the first bidirectional linked list, it is judged that the number of reads of the page corresponding to the node in the first bidirectional linked list is greater than or equal to the second threshold, then the data in the page number corresponding to the pre-written data is migrated to the read area; the address of the page corresponding to the data in the page in the read area is saved to the second bidirectional linked list, and each node in the second bidirectional linked list is used to store the logical address of each page in the read area. Similar to the write area, the read area corresponds to the second bidirectional linked list, and the structure of the second bidirectional linked list is the same as that of the first bidirectional linked list, which will not be repeated here.

[0126] Before migrating the data in the pages corresponding to the pre-written data to the read area, if it is determined that the read area is full, or if it is determined that the write area is full, starting from the head of the first bidirectional linked list, it is determined that the number of reads of the page corresponding to the node in the first bidirectional linked list is less than the second threshold, then starting from the head of the second bidirectional linked list, the data in the pages corresponding to the pre-written data are migrated to NAND Flash to update the data in the read area in real time. When the storage space is insufficient, the data with low access frequency is migrated to NAND Flash in time to further ensure the performance of the SSD.

[0127] At the same time, the number of migrations corresponding to the NAND Flash is accumulated; if it is determined that the number of migrations is greater than or equal to a third threshold, the pages of the third threshold number are selected from the NVM to migrate to the NAND Flash, and the selected pages are the pages of the third threshold number starting from the head of the first bidirectional linked list corresponding to the write area, wherein the third threshold is determined by the ratio of the NVM to the NAND Flash in the SSD. This embodiment can balance the data stored in the NAND Flash and the NVM in the SSD, and avoid storing all the data in the NVM, resulting in a waste of the storage space of the NAND Flash.

[0128] In the second application scenario, the pre-written data has been stored in the write area. At this time, while overwriting, consider whether the storage space in each area of ​​​​the NVM and the NAND Flash is sufficient, and adjust the data stored therein according to the above instructions to ensure that each storage medium in the SSD has enough space to meet the above requirements.

[0129] In summary, the data stored in the SSD is actually stored in NVM or NAND Flash. Specifically, NVM stores data with high access frequency, and NAND Flash stores data with low access frequency. The access frequency can be determined in a variety of ways. For example, a preset threshold is set, and the storage location of the data is obtained based on the comparison between the data access frequency within a fixed time and the preset threshold. At this time, the access frequency of the page where the data is located is saved in the above mapping relationship; or, the position of the page where the data is located in the above mapping relationship reflects the access frequency of the data, and so on. The present invention is not limited to this. The following are several specific embodiments of the reading of the stored data in the SSD of the present invention.

[0130] Based on the above embodiment, the method may further include: accumulating the number of reads of the page where the pre-read data is located, wherein the above mapping relationship includes the number of reads of all pages in the SSD. In this embodiment, the access frequency of the data can be reflected by the number of reads, and the number of reads is included in the preset mapping relationship. Optionally, the access frequency of the data can also be implemented in other forms, which will not be repeated here.

[0131] The mapping relationship can be expressed as Figure 8 The mapping table is shown in the form of Figure 8 In the figure, each box represents a basic mapping unit, and its size is, for example, 4KB or 8KB. Correspondingly, a structure can also be used to represent the fields corresponding to the preset mapping relationship. Among them, the fields corresponding to a single mapping relationship include the physical address of NVM or NAND; an indicator bit used to indicate that the page corresponding to the box is located in NVM or NAND, for example, the indicator bit can be represented by a bit; and the read count of the page corresponding to the box. It should be noted that the size of the page varies with the size of the page in NAND. In the prior art, the size of a page is usually 4KB / 8KB, but the present invention is not limited to this.

[0132] In one embodiment, the physical address of the pre-read data is located in NAND Flash. After accumulating the number of reads of the page where the pre-read data is located, the method may also include: for each page where the pre-read data is located, if it is determined that the number of reads of the page where the pre-read data is located is greater than or equal to the second threshold, and there is an idle page in the NVM, then the data in the page where the number of reads is greater than or equal to the second threshold is migrated to the idle page in the NVM. The embodiment of the present invention migrates the data originally stored in the NAND Flash and accessed more frequently than the second threshold to the NVM, so as to achieve dynamic adjustment of the data stored in the SSD and avoid excessive access to the NAND Flash. Saving the data with a number of reads greater than or equal to the second threshold to the NVM can improve the speed of data reading compared to storing it in the NAND Flash, and utilize the temporal locality and spatial locality of the data to store frequently modified data and other hot spot data in the NVM, thereby reducing the wear on the NAND Flash.

[0133] Optionally, after migrating data from NAND Flash to NVM, the number of migrations corresponding to NAND Flash can be accumulated. In this way, the number of pages migrated from NAND Flash to NVM can be obtained, thereby reasonably adjusting the ratio of space occupied by NAND Flash and NVM in the SSD, or migrating the same number of pages of data in NVM to NAND Flash.

[0134] Further, when the NVM includes a read area, if it is determined that the number of reads of the page where the pre-read data is located is greater than or equal to a second threshold, and there is a free page in the NVM, then the data in the page whose number of reads is greater than or equal to the second threshold is migrated to the NVM, which may include: if it is determined that the number of reads of the page where the pre-read data is located is greater than or equal to the second threshold, and the read area includes a free page, then the data in the page whose number of reads is greater than or equal to the second threshold is migrated to the free page of the read area.

[0135] On the basis of the above, if it is determined that the number of migrations is greater than or equal to the third threshold, the third threshold number of pages are selected from the NVM to migrate to the NAND Flash, wherein the third threshold is determined by the ratio of the NVM to the NAND Flash in the SSD. In the SSD, if the space occupied by the NVM is larger than the space occupied by the NAND Flash, the third threshold is smaller; correspondingly, if the space occupied by the NVM is smaller than the space occupied by the NAND Flash, the third threshold is larger.

[0136] In another embodiment, the NVM includes a write area. If the physical address of the pre-read data is located in the write area of ​​the NVM, after the above-mentioned accumulation of the number of reads of the page where the pre-read data is located, the method may further include: updating the address of the page where the pre-read data is located to the end of the first bidirectional linked list, wherein each node in the first bidirectional linked list is used to store the logical address of each page in the write area.

[0137] It can be seen from the above embodiments that the metadata area can store the above-mentioned first bidirectional linked list, the second bidirectional linked list and the preset mapping relationship, etc.

[0138] In summary, the embodiments of the present invention store frequently accessed data in NVM, thereby reducing the access to NAND Flash, that is, reducing the access frequency of NAND Flash in SSD and reducing the wear on NAND Flash; and, due to the non-volatile nature of NVM, the data stored in NVM is not lost when power is off, so when the power supply is interrupted, the SSD does not need a capacitor to provide backup power. Based on the above reasons, the service life of the SSD in the embodiments of the present invention is increased.

[0139] In practical applications, the embodiments of the present invention do not impose any restrictions on the size of reads and writes, and can be read or written in any size. However, the preset mapping relationship of the SSD, such as the mapping table, has a basic management granularity, such as 4KB, 8KB, or even 16KB. This management granularity is generally the same as the size of the NAND Flash page, but it can also be different. In addition, the basic management unit of SDD reading and writing is the page.

[0140] The size of the read and write operation request sent by the host to the SSD may be arbitrary. Take the page size of 8KB as an example: if the data to be read is relatively large, 32KB, then 4 pages need to be read and the relevant data is gathered together and fed back to the host; if the data to be read is relatively small, 2KB, then only the corresponding 2KB of data is returned to the host.

[0141] In the embodiment of the present invention, the SSD uses NAND Flash and NVM to store data in a hierarchical manner, that is, the data is stored in NAND Flash or NVM. Due to the non-volatile characteristics of NVM, even if the SSD does not include capacitors, the problem of data loss due to power failure will not occur. In addition, the absence of capacitors in the SSD will increase the service life of the SSD, greatly improving the reliability of the SSD.

[0142] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units or modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0143] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0144] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data writing method, executed by a controller of a solid state drive (SSD), wherein the SSD includes a NAND Flash and a non-volatile memory (NVM), and the method comprises: receiving a write operation request, wherein the write operation request includes pre-written data; Writing the pre-written data into the NVM; Determine whether the pre-written data has been stored in the NAND Flash; If the pre-written data has been stored in the NAND Flash, invalidate the page storing the pre-written data in the NAND Flash; The NVM includes a read area and a write area; Writing the pre-written data into the NVM includes: Writing the pre-written data into a write area of ​​the NVM; Determining whether the access frequency of the logical address of the pre-written data reaches a first preset threshold; When the access frequency of the logical address of the pre-written data reaches the first preset threshold, the pre-written data is migrated to the read area.

2. The method according to claim 1, characterized in that After writing the pre-written data into the NVM, the method further includes: A mapping relationship is saved, where the mapping relationship includes a corresponding relationship between a logical address of the pre-written data and a position where the pre-written data is written into the NVM.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: Determine whether the access frequency of a page in the NAND Flash is greater than or equal to a second preset threshold; When the access frequency of a page in the NAND Flash is greater than or equal to the second preset threshold, data in the page whose access frequency is greater than or equal to the second preset threshold is migrated to the read area of ​​the NVM.

4. A solid state drive SSD, comprising a controller, a NAND Flash, and a non-volatile memory NVM, wherein the NVM comprises a read area and a write area, and the controller is used for: receiving a write operation request, wherein the write operation request includes pre-written data; Writing the pre-written data into the NVM; Determine whether the pre-written data has been stored in the NAND Flash; If the pre-written data has been stored in the NAND Flash, invalidate the page storing the pre-written data in the NAND Flash; When writing the pre-written data into the NVM, the controller is used to write the pre-written data into a write area of ​​the NVM; The controller is also used for: Determining whether the access frequency of the logical address of the pre-written data reaches a first preset threshold; When the access frequency of the logical address of the pre-written data reaches the first preset threshold, the pre-written data is migrated to the read area.

5. The SSD according to claim 4, characterized in that: After writing the pre-written data into the NVM, the controller is further configured to: A mapping relationship is saved, where the mapping relationship includes a corresponding relationship between a logical address of the pre-written data and a position where the pre-written data is written into the NVM.

6. The SSD according to claim 4 or 5, characterized in that: The controller is also used for: Determine whether the access frequency of a page in the NAND Flash is greater than or equal to a second preset threshold; When the access frequency of a page in the NAND Flash is greater than or equal to the second preset threshold, data in the page whose access frequency is greater than or equal to the second preset threshold is migrated to the read area of ​​the NVM.

Citation Information

Patent Citations

  • Method for prolonging service life of solid-state disk

    CN102646069A

  • Write operation control method and write operation device for solid state disk

    CN103377152A