WO2015185002A1 - Method and device for writing data - Google Patents

Method and device for writing data Download PDF

Info

Publication number
WO2015185002A1
WO2015185002A1 PCT/CN2015/080779 CN2015080779W WO2015185002A1 WO 2015185002 A1 WO2015185002 A1 WO 2015185002A1 CN 2015080779 W CN2015080779 W CN 2015080779W WO 2015185002 A1 WO2015185002 A1 WO 2015185002A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
data
written
refresh operation
flash memory
Prior art date
Application number
PCT/CN2015/080779
Other languages
French (fr)
Chinese (zh)
Inventor
石亮
沙行勉
朱冠宇
赵俊峰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015185002A1 publication Critical patent/WO2015185002A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a data writing method and apparatus.
  • SSD Solid State Disk
  • SSDs can use flash memory as a storage medium.
  • the higher the write speed the better the performance of the SSD is usually indicated.
  • the write speed is proportional to the programming voltage at which the write operation is performed. The higher the write speed, the larger the programming voltage.
  • the programming voltage here is the charging voltage step used when programming each memory cell (ie, writing data).
  • the storage unit is divided into a single level unit (SLC) and a multi-level unit (MLC).
  • the size of each SLC is 1 bit, and the size of each MLC is 2 bits. As shown in Fig. 1(a) and Fig.
  • threshold voltages V for each MLC data (11, 10, 01, and 00, respectively) at the program voltages ⁇ Vpp1 and ⁇ Vpp2 ( ⁇ Vpp1 ⁇ ⁇ Vpp2), respectively.
  • th distribution of FIG. It can be seen from the figure that the larger the programming voltage is, the larger the distribution range of the threshold voltage corresponding to the stored data is, and the smaller the interval between the threshold voltages of different stored data is. If electrons are lost in the memory cell, the threshold voltage will change, as shown in Figure 2, which is a schematic diagram of the threshold voltage change caused by electron loss; in this case, the interval between threshold voltages of different stored data is smaller. The easier it is to cause errors in stored data.
  • the total number of Program/Erase (P/E) times that can be performed for each flash block in the flash memory can be used to measure the lifetime of the SSD flash.
  • the one-time P/E operation refers to performing an erase operation on the stored data of the entire flash block in units of flash blocks after performing at least one write operation on the flash block in units of pages. P/E operation will cause wear and tear on the flash memory of the SSD. The insulation of the bad flash memory causes electron loss. Therefore, the more P/E operations performed on a flash block, the more error-prone the data stored in the flash block is.
  • the SSD controller can use the Error Correcting Code (ECC) to correct the read stored data. However, if the degree of error in the stored data exceeds the error correction range of the ECC, the ECC cannot perform the stored data. Error correction means the end of SSD flash life.
  • ECC Error Correcting Code
  • the embodiment of the invention provides a data writing method and device, which are used to solve the problem that there is a large contradiction between the flash memory life of the SSD and the performance of the SSD.
  • a data writing method including:
  • the SSD controller corresponds to the average of the program/erase P/E times currently performed for each flash block in the flash memory of the SSD, and the preset P/E number range respectively, corresponding to the write speed and the data storage duration. Relationship, determine the write speed and data retention time;
  • the SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed
  • the refresh operation is to rewrite data in the flash memory whose storage time exceeds the data storage duration from the last written location to another location in the flash memory.
  • the SSD controller performs a write operation other than a refresh operation on the flash memory of the SSD, including:
  • the SSD controller After receiving the write request sent by the host, the SSD controller performs a write operation on the flash memory of the SSD according to the write request; or
  • the SSD controller writes valid data in the flash block containing the invalid data into the blank flash page after determining that the ratio of the number of blank flash blocks in the flash memory in the flash memory is lower than a set threshold.
  • the SSD controller performs an average of P/ performed on each flash block in the flash memory.
  • the E times, and the preset P/E number range respectively correspond to the writing speed and the data saving duration, and determine the writing speed and the data saving duration, including:
  • the SSD controller Determining, by the SSD controller, a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute.
  • the corresponding relationship table records a correspondence between a preset P/E number of times range and a writing speed and a data saving duration;
  • the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than The frequency of access to the cold data;
  • the SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, including: the SSD controller needs to write to the flash memory according to the write operation other than the refresh operation Data attribute of the data, selecting a write speed from the determined write speed corresponding to each data attribute, and performing a write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed;
  • the SSD controller performs a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed, including: the SSD controller determines from the data attribute of the data written in the flash memory Select the data to save in the data retention time corresponding to each data attribute. The duration, according to the selected data save duration and the write speed corresponding to the cold data, performs a refresh operation on the data written to the flash memory.
  • the SSD controller performs the write operation except the refresh operation on the flash memory of the SSD according to the selected write speed ,include:
  • the SSD controller writes data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information
  • the page number including the page, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the data written on the page Time;
  • the expiration time queue information After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
  • the SSD controller performs a refresh operation on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
  • the SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data or the last write data in the expiration time queue information corresponding to the data attribute.
  • the page number of the page, the OOB information of the page in which the data is written in the flash memory, and the selected data storage duration, and the page that needs to perform the refresh operation is determined;
  • the SSD controller performs a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, records the OOB information of the refreshed page, and updates the invalidation time queue information corresponding to the cold data.
  • the SSD controller performs a refresh operation on the flash memory of the SSD according to the determined write speed Write operations, including:
  • the SSD controller writes data to the flash memory in units of pages according to the determined write speed; For each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page number of the page, and the page number of the previous page adjacent to the page in the write order The page number of the next page adjacent to the page in the write order and the time at which the data was written on the page;
  • the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
  • the SSD controller performs a refresh operation on the data written in the flash memory according to the determined data storage duration and the determined write speed, including:
  • the SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data in the expiration time queue information or the page number of the page of the last write data, writing in the flash memory
  • the SSD controller performs a refresh operation on the determined page that needs to perform a refresh operation according to the determined write speed, records OOB information of the refreshed page, and updates the invalidation time queue information.
  • the SSD controller is configured according to a page number of a page of the earliest written data in the expiration time queue information.
  • the page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation including:
  • the SSD controller searches for, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
  • Refresh operation If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
  • the SSD controller is configured according to a page number of a page of the earliest written data in the expiration time queue information or The page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation, including:
  • the SSD controller searches for, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
  • the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order.
  • a refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
  • Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
  • a data writing apparatus including:
  • a determining module for respectively performing a program/erase P/E count performed on each flash block in the flash memory of the solid state hard disk SSD, and a preset P/E number range corresponding to the write speed and the data storage duration respectively Relationship, determine the write speed and data retention time;
  • An execution module configured to perform a write operation other than the refresh operation on the flash memory of the SSD according to the write speed determined by the determining module
  • the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
  • the execution module is specifically configured to:
  • the determining module is specifically configured to:
  • the execution module is specifically configured to perform the write operation according to the following steps: data attributes of data to be written into the flash memory according to the write operation except the refresh operation, from each determined data attribute In the corresponding write speed, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
  • the execution module is specifically configured to perform the refresh operation according to the following steps: according to the data attribute of the data written in the flash memory, select a data storage duration from the determined data storage duration corresponding to each data attribute, according to the selected The data storage duration and the write speed corresponding to the cold data perform a refresh operation on the data written to the flash memory.
  • the execution module is specifically configured to perform the write operation according to the following steps:
  • the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
  • the expiration time queue information After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
  • the execution module is specifically configured to perform the refresh operation according to the following steps:
  • the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute determines the page on which the refresh operation needs to be performed;
  • the execution module is specifically configured to perform the write operation according to the following steps:
  • the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
  • the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
  • the execution module is specifically configured to perform the refresh operation according to the following steps:
  • the OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
  • the execution module is specifically configured to:
  • OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data
  • Refresh operation If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
  • the currently determined page that needs to perform the refresh operation is used as the current page, and is searched in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. Find the OOB information for the next page, and
  • the executing module is specifically configured to: according to a page number of a page of the most recently written data, Searching, in the flash memory, OOB information corresponding to a page of the most recently written data;
  • the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order.
  • a refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
  • Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
  • a data writing apparatus comprising a processor, a memory and a bus, the memory storing execution instructions, and when the apparatus is in operation, the processor communicates with the memory via a bus, Executing the execution instruction by the processor causes the apparatus to perform the following method:
  • the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
  • performing a write operation other than a refresh operation on the flash memory of the SSD includes:
  • the second possible implementation manner in the method performed by the processor, according to the current flash memory in the flash memory
  • the average number of P/E times performed by the block and the corresponding P/E times range are respectively related to the write speed and the data storage duration, and the write speed and data retention duration are determined, including:
  • Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed including: data attributes of data to be written into the flash memory according to the write operation other than the refresh operation, from each determined Among the write speeds corresponding to the data attributes, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
  • Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed including: determining each type of data from the data attribute of the data written in the flash memory In the data storage duration corresponding to the sex, the data storage duration is selected, and the refresh operation is performed on the data written in the flash memory according to the selected data storage duration and the write speed corresponding to the cold data.
  • the method performed by the processor performs the performing on the flash memory of the SSD according to the selected write speed.
  • Write operations outside the refresh operation including:
  • the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
  • the expiration time queue information After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
  • the refresh operation is performed on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
  • the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute determines the page on which the refresh operation needs to be performed;
  • the method performed by the processor, according to the determined write speed, to the SSD Flash performs write operations other than refresh operations, including:
  • the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
  • Performing a refresh operation on the data written to the flash memory according to the determined data save duration and the determined write speed including:
  • the OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
  • a fifth possible implementation manner in the method performed by the processor, according to the earliest written data in the expiration time queue information The page number of one page and the page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the data storage duration determine the page on which the refresh operation needs to be performed, including:
  • OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data
  • Refresh operation If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
  • the processor in the method performed by the processor, according to the earliest written data in the expiration time queue information The page number of one page or the page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation, including:
  • the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order.
  • a refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
  • Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
  • FIG. 1(a) is a schematic diagram showing a threshold voltage distribution corresponding to each MLC data at a program voltage ⁇ Vpp1;
  • 1(b) is a schematic diagram showing a threshold voltage distribution corresponding to each MLC data at a program voltage ⁇ Vpp2;
  • 2 is a schematic diagram showing changes in threshold voltage caused by electron loss
  • FIG. 5 is a flowchart of a data writing method according to Embodiment 2 of the present invention.
  • Figure 6 (a) is a correspondence diagram at the beginning of the life of the SSD flash memory
  • Figure 6 (b) is a corresponding relationship diagram in the middle of the life of the SSD flash memory
  • Figure 6 (c) is a correspondence diagram at the end of the life of the SSD flash memory
  • FIG. 7 is a flowchart of a data writing method according to Embodiment 3 of the present invention.
  • FIG. 8 is a schematic diagram of recording OOB information of a page for each page of data written in a flash block
  • FIG. 9 is a flowchart of a data writing method according to Embodiment 4 of the present invention.
  • FIG. 10 is a schematic structural diagram of a data writing apparatus according to Embodiment 5 of the present invention.
  • FIG. 11 is a schematic structural diagram of a data writing apparatus according to Embodiment 6 of the present invention.
  • FIG. 3 it is a schematic structural diagram of an SSD.
  • the SSD is mainly composed of a host logical interface 31, an SSD controller 32, and a flash chip 33.
  • the SSD controller 32 performs data interaction with the host 34 through the host logical interface 31. After the host 34 sends a data read/write request to the SSD controller 32, the SSD controller 32 reads and writes the flash chip 33 according to the data read and write request. operating.
  • the embodiment of the invention mainly improves the write operation of the SSD controller to the SSD flash memory in the SSD.
  • the SSD controller is flat according to each flash block in the flash memory of the current SSD.
  • the P/E times that are executed, and the preset P/E times range are respectively related to the write speed and the data storage duration, and the write speed and the data storage duration are determined.
  • different write speeds and data retention durations can be used in different life stages of the SSD flash memory to meet the requirements for the performance and life of the SSD at different stages.
  • the data retention time here is the time base for the refresh operation.
  • the refresh operation is to rewrite the data stored in the flash memory for more than the data storage duration from the last written position to other locations in the flash memory, which can further reduce the error rate and error degree of the stored data, and prolong the operation. The life of the SSD flash memory.
  • a flowchart of a data writing method provided by Embodiment 1 of the present invention includes the following steps:
  • the SSD controller determines the write speed according to the average P/E times of each flash block currently executed in the flash memory of the SSD, and the preset P/E number range respectively, corresponding to the write speed and the data storage duration. Data retention time;
  • the SSD controller may perform a P/E operation on the flash memory in total or the most recent time after performing a P/E operation on each flash block in the flash memory of the SSD.
  • the average number of P/Es performed on each flash block in the flash at a time determines the average number of P/Es currently performed on each flash block in the flash.
  • the correspondence between the different P/E frequency ranges and the write speed and the data storage duration is set in advance, and the P/E number of times of the P/E times that are currently performed on each flash block in the flash memory is determined. After the change occurs, the current write speed and the data storage duration are updated according to the correspondence between the preset P/E frequency range and the write speed and the data storage duration. Since the number of P/Es that have been executed is small in the early life of the SSD flash memory, the damage of the flash insulation layer is small, the electron loss rate in the memory cell is slow, and the stored data is not prone to errors, so in the SSD flash memory At the beginning of life, a larger write speed can be used to improve the performance of the SSD.
  • a longer data storage duration can be used to reduce the number of refresh operations, thereby saving SSD system overhead and improving the performance of the SSD.
  • the number of P/Es that have been executed is high, and the flash memory
  • the insulation layer is damaged to a large extent, the electron loss rate in the memory unit is fast, and the storage data is prone to error. Therefore, a small write speed can be used later in the life of the SSD flash memory to extend the service life of the SSD flash memory;
  • the short data storage duration is used to shorten the time for performing the refresh operation, and to avoid the end of the life of the SSD flash memory due to the error of the stored data exceeding the ECC check range.
  • the SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, and performs execution on the data written in the flash memory according to the determined data save duration and the determined write speed.
  • a refresh operation the refresh operation is to rewrite data in the flash memory whose storage time exceeds the data storage duration from the last written location to another location in the flash memory.
  • the SSD controller performs a write operation other than the refresh operation according to the write speed of the current stage determined in step S401, and determines the data save duration and the write speed in conjunction with step S401 to perform a refresh operation.
  • the write operation other than the refresh operation that is, any other write operation performed on the flash memory other than the refresh operation.
  • the specific two types of write operations can be included:
  • the SSD controller After receiving the write request sent by the host, the SSD controller performs a write operation on the flash memory of the SSD according to the write request; or
  • the SSD controller writes valid data in the flash block containing invalid data to the blank flash page after determining that the amount of blank flash blocks in the flash memory is lower than the set threshold in the flash memory.
  • the first of the above two write operations is that the SSD controller performs a write operation on the flash memory according to a write request sent by the host.
  • the second is the process by which the SSD controller performs Garbage Collection (GC).
  • GC Garbage Collection
  • the amount of blank flash blocks in the SSD flash memory in the flash memory is lower than the set threshold, which will seriously affect the write performance of the SSD. Therefore, it is necessary to perform an erase operation on the flash block containing invalid data in time.
  • the data in the flash memory is modified, the data before the modification is not deleted, but the flash page including the data before the modification is marked as an invalid data page, and the modified data is written into the blank flash page.
  • different write speeds and data retention durations can be used in different life stages of the SSD flash memory.
  • a larger write speed and a longer data retention duration can be used to improve the SSD.
  • Performance a small write speed and a short data retention time can be used later in the life of the SSD flash to extend the life of the SSD flash. It can be seen that the embodiment of the present invention can better improve the contradiction between the service life of the SSD flash memory and the performance of the SSD.
  • the data stored in the flash memory of the SSD can be divided into two types, one is hot data with a relatively high frequency of access, and the other is cold data with a small frequency of access.
  • the two types of data can be treated differently, that is, different write speeds and data retention durations are used for different types of data in the same life stage of the SSD flash memory.
  • cold data can be used with relatively slow write speeds and relatively long data retention times.
  • the threshold voltage interval between the storage units of the cold data can be made larger, so that even with a longer data storage time, the cold data is not prone to error. Since cold data is not frequently accessed, slower write speeds for cold data have less impact on the overall write performance of the SSD, and do not substantially affect user experience. This embodiment will be described in detail in the following second embodiment.
  • a flowchart of a data writing method provided by Embodiment 2 of the present invention includes the following steps:
  • the SSD controller determines, according to the current P/E times that are performed on each flash block in the flash memory, and the corresponding relationship table corresponding to each data attribute, determining a write speed and a data storage duration corresponding to each data attribute.
  • the corresponding relationship table records a correspondence between a preset P/E number of times range and a writing speed and a data saving duration; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than The frequency of access to the cold data.
  • FIG. 6(a) it is a correspondence diagram at the beginning of the life of the SSD flash memory. At the beginning of the life of the SSD flash memory, since the number of P/Es that have been executed is small, a large write speed and a long data retention time can be set for both hot data and cold data to improve the performance of the SSD. As shown in FIG.
  • FIG. 6(b) it is a correspondence diagram in the middle of the life of the SSD flash memory, in which the solid line corresponds to the hot data and the broken line corresponds to the cold data.
  • different correspondences can be set for hot data and cold data. Since cold data is accessed less frequently, cold data can be used with relatively slower write speeds and relatively longer data retention times than hot data. Although the cold data corresponds to a slower write speed, the threshold voltage interval between the cold data storage units can be made larger, so that cold data is not prone to errors even with a long data retention time. Moreover, since cold data is not frequently accessed, the slower write speed corresponding to cold data has less impact on the overall write performance of the SSD.
  • the write speed and data retention time corresponding to the hot data can be reduced.
  • relatively fast write speeds and relatively short data save times can be used for hot data compared to cold data.
  • FIG. 6(c) it is a correspondence diagram at the end of the life of the SSD flash memory, in which the solid line corresponds to the hot data and the broken line corresponds to the cold data.
  • the life of SSD flash is called a key consideration.
  • the write speed corresponding to the cold data and the hot data is further reduced, and the data retention time of the hot data can be further reduced.
  • Table 1 and Table 2 below show the correspondence table between the hot data and the cold data in the second embodiment of the present invention.
  • the size of the write voltage is used to identify the size of the write speed.
  • the corresponding relationship table is only one of the specific implementation manners of the embodiment of the present invention. In a specific implementation, the corresponding relationship in the table may be changed according to actual needs.
  • the SSD controller selects a write speed according to a data attribute of data to be written into the flash memory according to the write operation except the refresh operation, and selects a write speed from the determined write speed corresponding to each data attribute.
  • the flash memory of the SSD performs the write operation.
  • the data attributes of different types of data can be set in advance.
  • the root directory of the file can be set to hot data because it needs to be accessed frequently.
  • it can be set as cold data.
  • the data attribute of the data is not fixed.
  • the SSD controller can adjust the data attribute according to the accessed frequency of the data.
  • the SSD controller selects a data storage duration from the determined data storage duration corresponding to each data attribute determined according to the data attribute of the data written in the flash memory, and saves the duration according to the selected data and the corresponding data of the cold data. Speed, performs a refresh operation on the data written to the flash memory.
  • the hot data written in the flash memory is not updated after the set data is saved for a long time, the data attribute of the hot data can be changed to cold data, and the write speed corresponding to the cold data is used. Refresh the data. Therefore, in this step, whether it is hot data or cold data, when refresh is required, it is refreshed as cold data.
  • the flash block can be used as the minimum refresh unit.
  • the time of writing each page of the flash block is inconsistent, if the data is refreshed according to the data written at the earliest time, many unnecessary data will be refreshed. If the data is refreshed according to the data that is written the latest, it may cause other data that was written earlier to be incorrectly updated due to not being refreshed in time. Therefore, in the following Embodiment 3 of the present invention, in order to improve the timeliness of performing data refreshing and avoiding refreshing operations on unnecessary data, the page is used as the minimum refresh unit.
  • a flowchart of a data writing method provided by Embodiment 3 of the present invention includes:
  • S701 The SSD controller performs an average of the P/E times performed on each flash block in the flash memory of the SSD, and the preset P/E times range respectively corresponding to the write speed and the data storage duration. System, determine the write speed and data retention time.
  • the SSD controller writes data to the flash memory in units of pages according to the determined write speed; and records out-of-band (OOB) information of the page in the page for each page of the write data,
  • OOB information includes a page number of the page, a page number of a previous page adjacent to the page in the writing order, a page number of a subsequent page adjacent to the page in the writing order, and a page number on the page The time the data was written.
  • a schematic diagram of OOB information of the page is recorded for each page in which data is written in the flash block.
  • OOB information of any page of data not only the page number of the page can be determined, but also the page number of the previous page of the page and the page number of the next page of the page, the previous page and the next page here
  • a page is a page that is adjacent to the page in the write order.
  • the SSD controller updates the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the invalidation time queue information includes the previously written data and is not updated, the earliest The page number of the page on which the data is written and the page number of the page on which the data was last written.
  • the expiration time queue information can be stored in the ROM of the SSD controller.
  • the data written by the write operation is added to the expiration time queue.
  • adding the written data to the expiration time queue is actually recording the written page as described in step S702.
  • OOB information After the written data is added to the dead time queue, the dead time queue information is updated.
  • the page of the queue header may be a page of the earliest written data, and the page at the end of the queue may be the The page on which data was last written, or the page of the queue header may be one page of the most recently written data, and the page at the end of the queue may be one page of the earliest written data.
  • the page number of the queue header or the tail of the queue, and the OOB information of each page recorded can be found in turn. Every page in the queue.
  • the SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data in the expiration time queue information and the page number of the page of the last write data, the flash memory.
  • the OOB information of the page in which the data is written and the duration of the data storage determining that a refresh needs to be performed a page of operation; performing a refresh operation on the determined page that needs to perform a refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
  • the page number of the page in which the data is first written or the page number of the page on which the data was last written and the OOB information of the page in which the data is written in the flash memory may be sequentially determined according to the failure time queue information. Find each page in the expiration time queue. In combination with the data storage duration, it is sequentially determined whether each page found needs to be refreshed, and after determining that it needs to be refreshed, it is refreshed according to the determined write speed, because the refresh actually rewrites the data of the page to other The position of the page, therefore, the OOB information of the refreshed page needs to be re-recorded, and the dead time queue information is updated.
  • a page of the earliest written data or a page of the last written data may be selected from the above-mentioned dead time queue information as a start page to start judgment, according to the selected start page.
  • the following two embodiments are specifically provided in this embodiment.
  • the first type starting with a page of the earliest written data as a starting page
  • the SSD controller searches for, in the flash memory, OOB information corresponding to one page of the earliest written data according to a page number of a page of the earliest written data;
  • Refresh operation If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
  • the expiration time queue information records the page number 2 of one page of the earliest written data and the page number 6 of the page of the most recently written data. Find the page with page number 2 based on the OOB information for each page in the flash. After finding the page with the page number 2, according to the time when the data is written on the page recorded in the OOB information of the page, the data storage duration, and the current time, the time and current time of writing the data on the page are determined. Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation needs to be performed on the page number 2, otherwise, the current refresh operation is ended.
  • a refresh operation is performed on the page number 2, and the next page of the page is recorded according to the OOB information of the page number 2 Page number 4, find the page number 4 in the flash memory. After finding the page with page number 4, according to the time when the data is written on the page recorded in the OOB information of the page, the data storage duration, and the current time, the time and current time of writing the data on the page are determined. Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation needs to be performed on the page number 4, otherwise, the current refresh operation is ended.
  • the page operation is performed on the page number 4, and the next page of the page recorded in the OOB information of the page having the page number 4 is Page number 6, find the page number 6 in the flash memory. After finding the page with page number 6, according to the time of writing data on the page recorded in the OOB information of the page, the data storage duration, and the current time, determining the time and current time of writing data on the page Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation needs to be performed on the page number 6; otherwise, the current refresh operation is ended. If it is determined that a refresh operation is required for the page number 6 of the page, the page operation is performed on the page number 6 and since page number 6 is the page number of the page of the most recent write data, Need to end the current refresh operation.
  • the second type starting with the page of the last written data as the starting page;
  • the SSD controller determines, according to the page number of the page of the earliest written data in the expiration time queue information or the page number of the page on which the data was last written, the OOB of the page in which the data is written in the flash memory.
  • the information and the length of time the data is saved determine the pages that need to perform the refresh operation, including:
  • the SSD controller searches for, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
  • the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. All unupdated pages before the page are refreshed, or until it is determined that a refresh operation is not required on the page of the earliest written data:
  • the expiration time queue information records the page number 2 of one page of the earliest written data and the page number 6 of the page of the most recently written data. Find the page number 6 based on the OOB information for each page in the flash. After finding the page with page number 6, according to the time of writing data on the page recorded in the OOB information of the page, the data storage duration, and the current time, determining the time and current time of writing data on the page Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation is required for the page numbered 6 and all unupdated pages whose write order precedes the page number.
  • the previous page of the page number 6 is the page with the page number 4 according to the OOB information of the page number 6 of the page, and the page number is determined according to the OOB information of the page whose page number is 4.
  • the previous page of the page is a page with page number 2, that is, one page of the earliest data to be written. Then, in this embodiment, it is necessary to sequentially refresh the pages of page numbers 6, 4, and 2. If it is determined that the page number is The time interval between the time when the page write data of 6 and the current time does not exceed the data storage time length, and the page number 4 of the previous page of the page recorded in the OOB information of the page whose page number is 6 is Look for pages with page number 4 in flash memory.
  • the data storage duration, and the current time are determined. Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that the page needs to be refreshed for the page numbered 4 and the previous page of the page number 4 (page number 2).
  • the page number 2 of the previous page of the page recorded in the OOB information of the page number 4 the page number 2 is found in the flash memory, and after the page number 2 is found, according to the page number
  • the time at which the data is written on the page recorded in the OOB information of the page, the length of the data being saved, and the current time determining whether the time interval between the time when the page is written with the current time and the current time exceeds the data saving
  • the duration if exceeded, determines that a refresh operation needs to be performed on the page with page number 2, otherwise, it is determined that the page with the page number 2 is not required, that is, the page of the earliest written data performs a refresh operation.
  • a flowchart of a data writing method provided by Embodiment 4 of the present invention includes:
  • the SSD controller determines to write according to the P/E times that are currently performed on each flash block in the flash memory of the SSD, and the preset P/E number range respectively, and the correspondence between the write speed and the data storage duration. Speed and data retention time.
  • the SSD controller writes data to the flash memory in units of pages according to the selected write speed; for each page of the write data, records the out-of-band OOB information of the page in the page,
  • the OOB information includes the page number of the page, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the page number written on the page The time of the data.
  • the SSD controller After writing data to any page in the flash memory, the SSD controller updates the invalidation time queue letter corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data.
  • the expiration time queue information includes a page number of a page of the earliest data to be written and a page number of a page of which data was last written, in a page that was previously written with data of the data attribute and not updated.
  • the SSD controller is based on a preset refresh period, according to the page number of the earliest written data in the expiration time queue information corresponding to the data attribute or the last write data.
  • the page number of one page, the OOB information of the page in which the data is written in the flash memory, and the selected data storage duration, determine a page that needs to perform a refresh operation; perform a refresh on the determined need according to the write speed corresponding to the cold data
  • the operated page performs a refresh operation, records the OOB information of the refreshed page, and updates the invalidation time queue information corresponding to the cold data.
  • a page of the earliest written data or a page of the last written data may be selected from the above-mentioned dead time queue information as a start page to start judgment, according to the selected start page.
  • the following two embodiments are specifically provided in this embodiment.
  • the first type starting with a page of the earliest written data as a starting page
  • the SSD controller searches for, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
  • Refresh operation If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
  • the second type starting with the page of the last written data as the starting page;
  • the SSD controller is based on a preset refresh period, according to the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, the flash memory.
  • the OOB information of the page in which the data is written and the length of time the selected data is saved, and the page that needs to perform the refresh operation including:
  • the SSD controller searches for the OOB information corresponding to the page of the most recently written data in the flash memory according to the page number of the page of the most recently written data;
  • the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order.
  • a refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
  • Whether the refresh operation of the previous page needs to be performed is determined according to the time of writing the data on the previous page, the selected data save duration, and the current time included in the found OOB information of the previous page.
  • the embodiment of the present invention further provides a data writing device corresponding to the data writing method. Since the principle of solving the problem is similar to the data writing method of the embodiment of the present invention, the implementation of the device is implemented. See the implementation of the method, and the repetition will not be repeated.
  • FIG. 10 is a schematic structural diagram of a data writing apparatus according to Embodiment 5 of the present invention, including:
  • the determining module 101 is configured to perform an average of the program/erase P/E times performed on each flash block in the flash memory of the solid state hard disk SSD, and the preset P/E number of times range respectively with the writing speed and the data saving duration Corresponding relationship, determining the writing speed and the data storage duration;
  • the executing module 102 is configured to perform a write operation other than the refresh operation on the flash memory of the SSD according to the write speed determined by the determining module 101, and
  • the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
  • the execution module 102 is specifically configured to:
  • the determining module 101 is specifically configured to:
  • the execution module 102 is specifically configured to perform the write operation according to the following steps: the data attribute of the data that needs to be written into the flash memory according to the write operation other than the refresh operation, and the corresponding write from each determined data attribute In the speed, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
  • the execution module 102 is specifically configured to perform the refresh operation according to the following steps: according to the data attribute of the data written in the flash memory, select a data storage duration from the determined data storage duration corresponding to each data attribute, according to the selection Data save duration and write speed corresponding to cold data, write to Perform a refresh operation on the data in the flash memory.
  • the execution module 102 is specifically configured to perform the write operation according to the following steps:
  • the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
  • the expiration time queue information After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
  • the execution module 102 is specifically configured to perform the refresh operation according to the following steps:
  • the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute determines the page on which the refresh operation needs to be performed;
  • the execution module 102 is specifically configured to perform the write operation according to the following steps:
  • the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
  • the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
  • the execution module 102 is specifically configured to perform the refresh operation according to the following steps:
  • the OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
  • the execution module 102 is specifically configured to:
  • OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data
  • Refresh operation If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
  • the executing module 102 is specifically configured to: in the flash memory, search for OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
  • the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order.
  • a refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
  • Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
  • FIG. 11 is a schematic structural diagram of a data writing apparatus 110 according to Embodiment 6 of the present invention.
  • the apparatus includes a processor 111, a memory 112, and a bus 113.
  • the memory 112 stores execution instructions.
  • the processor 111 communicates with the memory 112 via a bus 113, and the processor 111 executes the execution instructions such that the apparatus performs the following method:
  • the write speed is determined according to the current program/erase P/E times performed on each flash block in the flash memory of the solid state drive SSD, and the preset P/E number range respectively corresponding to the write speed and the data save duration. And the length of time the data is saved;
  • the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
  • performing a write operation other than the refresh operation on the flash memory of the SSD includes:
  • the processor 111 according to the current P/E times performed on each flash block in the flash memory, and the preset P/E times range and the write speed respectively The correspondence between data retention durations, determining the write speed and data retention duration, including:
  • Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed including: data attributes of data to be written into the flash memory according to the write operation other than the refresh operation, from each determined Among the write speeds corresponding to the data attributes, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
  • Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed including: saving the data duration corresponding to each of the determined data attributes according to the data attribute of the data written in the flash memory In the middle, the data storage duration is selected, and a refresh operation is performed on the data written in the flash memory according to the selected data storage duration and the write speed corresponding to the cold data.
  • performing a write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed including:
  • the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
  • the expiration time queue information corresponding to the data attribute maintained by the SSD controller; the failure time queue information includes a page number of the page of the first written data and the most recent page that was previously written to the data having the data attribute and not updated.
  • the refresh operation is performed on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
  • the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute determines the page on which the refresh operation needs to be performed;
  • performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed including:
  • the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
  • the dead time queue information After writing data to any page in the flash memory, updating the expiration time queue information maintained by the SSD controller; the dead time queue information includes one of the pages that were previously written and not updated, and the first one of which is written The page number of the page and the page number of the page on which the data was last written;
  • Performing a refresh operation on the data written to the flash memory according to the determined data save duration and the determined write speed including:
  • the OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
  • the flash memory The OOB information of the page in which the data is written and the length of time the data is saved, and the page that needs to perform the refresh operation, including:
  • OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data
  • Refresh operation If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
  • the flash memory The OOB information of the page in which the data is written and the length of time the data is saved, and the page that needs to perform the refresh operation, including:
  • the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order.
  • a refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
  • Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

A method and device for writing data, for use in solving the problem that a major conflict is found between the flash memory lifespan of an SSD and use performance of the SSD. The method for writing data comprises: an SSD controller determines a write speed and a data retention duration on the basis of a current average of programming/erasing (P/E) cycles executed with respect to each flash memory chip of the flash memory of an SSD and of correlations of a predetermined range of P/E cycles respectively to write speeds and data retention durations (S401); the SSD controller executes write operations other than refresh operations with respect to the flash memory of the SSD on the basis of the determined write speed, and executes the refresh operations with respect to written data in the flash memory on the basis of the determined data retention duration and of the determined write speed, where the refresh operations are rewriting of data that have been stored in the flash memory for a duration exceeding the data retention duration from the location last written to another location in the flash memory (S402).

Description

一种数据写入方法及装置Data writing method and device 技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种数据写入方法及装置。The present invention relates to the field of computer technologies, and in particular, to a data writing method and apparatus.
背景技术Background technique
固态硬盘(Solid State Disk,SSD)是存储领域常用的数据载体。由于它具有高性能、低延迟、低功耗、环境适应性强等优点,同时成本也在不断降低,因此目前应用的越来越普遍。Solid State Disk (SSD) is a commonly used data carrier in the storage field. Due to its high performance, low latency, low power consumption, and strong environmental adaptability, the cost is also decreasing, so the application is becoming more and more popular.
SSD可以采用闪存作为存储介质。一般情况下,人们常采用对SSD闪存执行写操作的速度(也即写速度)来衡量SSD的使用性能。写速度越大,通常表示该SSD的使用性能越好。写速度的大小与执行写操作时的编程电压成正比,写速度越大,编程电压越大。这里的编程电压是在对每个存储单元进行编程(也即写入数据)时采用的充电电压步幅。存储单元分为单层单元(Single Level Cell,SLC)和多层单元(Multi-Level Cell,MLC)两种。每个SLC的大小为1比特(bit),每个MLC的大小为2比特(bit)。如图1(a)和图1(b)所示,分别为在编程电压ΔVpp1和ΔVpp2(ΔVpp1<ΔVpp2)下每个MLC数据(分别为11、10、01和00)对应的阈值电压(Vth)分布示意图。从图中可见,编程电压越大,存储数据对应的阈值电压的分布范围越大,不同存储数据的阈值电压之间的间隔越小。若存储单元中出现电子流失,阈值电压就会发生变化,如图2所示,为电子流失导致阈值电压发生变化的示意图;在这种情况下,不同存储数据的阈值电压之间的间隔越小,就越容易导致存储数据出错。SSDs can use flash memory as a storage medium. In general, people often use the speed of writing to SSD flash (that is, write speed) to measure the performance of SSD. The higher the write speed, the better the performance of the SSD is usually indicated. The write speed is proportional to the programming voltage at which the write operation is performed. The higher the write speed, the larger the programming voltage. The programming voltage here is the charging voltage step used when programming each memory cell (ie, writing data). The storage unit is divided into a single level unit (SLC) and a multi-level unit (MLC). The size of each SLC is 1 bit, and the size of each MLC is 2 bits. As shown in Fig. 1(a) and Fig. 1(b), threshold voltages (V for each MLC data (11, 10, 01, and 00, respectively) at the program voltages ΔVpp1 and ΔVpp2 (ΔVpp1 < ΔVpp2), respectively. th) distribution of FIG. It can be seen from the figure that the larger the programming voltage is, the larger the distribution range of the threshold voltage corresponding to the stored data is, and the smaller the interval between the threshold voltages of different stored data is. If electrons are lost in the memory cell, the threshold voltage will change, as shown in Figure 2, which is a schematic diagram of the threshold voltage change caused by electron loss; in this case, the interval between threshold voltages of different stored data is smaller. The easier it is to cause errors in stored data.
对于SSD,可以采用对闪存中的每个闪存块总共可执行的编程/擦除(Program/Erase,P/E)次数来衡量该SSD闪存的寿命大小。一次P/E操作是指对闪存块以页为单位执行至少一次写入动作后,又以闪存块为单位对整个闪存块的存储数据执行了一次擦除动作。P/E操作会对SSD的闪存造成磨损,破 坏闪存的绝缘层,导致电子流失。因此,对一个闪存块执行的P/E操作次数越多,该闪存块存储的数据就越容易出错。SSD控制器可以采用纠错码(Error Correcting Code,ECC)来对读取的存储数据进行纠错,但是,若存储数据出错的程度超出了ECC的纠错范围,ECC便无法对该存储数据进行纠错,也就意味着SSD闪存寿命的终结。For an SSD, the total number of Program/Erase (P/E) times that can be performed for each flash block in the flash memory can be used to measure the lifetime of the SSD flash. The one-time P/E operation refers to performing an erase operation on the stored data of the entire flash block in units of flash blocks after performing at least one write operation on the flash block in units of pages. P/E operation will cause wear and tear on the flash memory of the SSD. The insulation of the bad flash memory causes electron loss. Therefore, the more P/E operations performed on a flash block, the more error-prone the data stored in the flash block is. The SSD controller can use the Error Correcting Code (ECC) to correct the read stored data. However, if the degree of error in the stored data exceeds the error correction range of the ECC, the ECC cannot perform the stored data. Error correction means the end of SSD flash life.
为了提高SSD的使用性能,人们一般将写速度设置的较大。从上述分析可知,写速度越大,不同存储单元的阈值电压之间的间隔越小,存储数据出错的几率及出错程度就越大。尤其在SSD闪存的寿命后期,由于已执行了较多次的P/E操作,电子流失速度变得很快,如果这时仍采用较大的写速度,很容易造成存储数据出错,而存储数据出错程度一旦超出ECC的纠错范围,也就导致了SSD闪存寿命的终结。In order to improve the performance of SSD, people generally set the write speed to be large. It can be seen from the above analysis that the larger the write speed, the smaller the interval between threshold voltages of different memory cells, and the greater the probability and error degree of storing data errors. Especially in the later life of SSD flash memory, since more than one P/E operation has been performed, the electron loss rate becomes very fast. If a large write speed is still used at this time, it is easy to cause storage data errors and store data. Once the error level exceeds the ECC's error correction range, it will lead to the end of SSD flash life.
综上,SSD的闪存寿命与SSD的使用性能之间存在较大矛盾:若为了提高SSD使用性能而采用较大的写速度,在SSD闪存的寿命后期很容易导致存储数据出错程度较大而终结SSD闪存的寿命;若为了延长SSD闪存寿命而采用较小的写速度,又降低了SSD的使用性能。In summary, there is a big contradiction between the flash memory life of SSD and the performance of SSD: if a large write speed is used in order to improve the performance of SSD, it is easy to cause a large degree of error in the storage data at the end of the life of the SSD flash memory. The life of SSD flash memory; if you use a small write speed to extend the life of SSD flash, it reduces the performance of SSD.
发明内容Summary of the invention
本发明实施例提供一种数据写入方法及装置,用以解决SSD的闪存寿命与SSD的使用性能之间存在较大矛盾的问题。The embodiment of the invention provides a data writing method and device, which are used to solve the problem that there is a large contradiction between the flash memory life of the SSD and the performance of the SSD.
第一方面,提供一种数据写入方法,包括:In a first aspect, a data writing method is provided, including:
固态硬盘SSD控制器根据当前对所述SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;The SSD controller corresponds to the average of the program/erase P/E times currently performed for each flash block in the flash memory of the SSD, and the preset P/E number range respectively, corresponding to the write speed and the data storage duration. Relationship, determine the write speed and data retention time;
所述SSD控制器根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并The SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, and
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行 刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing on the data written to the flash memory according to the determined data save duration and the determined write speed a refresh operation; the refresh operation is to rewrite data in the flash memory whose storage time exceeds the data storage duration from the last written location to another location in the flash memory.
结合第一方面,在第一种可能的实现方式中,所述SSD控制器对所述SSD的闪存执行除刷新操作外的写操作,包括:With reference to the first aspect, in a first possible implementation manner, the SSD controller performs a write operation other than a refresh operation on the flash memory of the SSD, including:
所述SSD控制器在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执行写操作;或,After receiving the write request sent by the host, the SSD controller performs a write operation on the flash memory of the SSD according to the write request; or
所述SSD控制器在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。The SSD controller writes valid data in the flash block containing the invalid data into the blank flash page after determining that the ratio of the number of blank flash blocks in the flash memory in the flash memory is lower than a set threshold.
结合第一方面,或第一方面的第一种可能的实现方式,在第二种可能的实现方式中,所述SSD控制器根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长,包括:With reference to the first aspect, or the first possible implementation manner of the first aspect, in a second possible implementation manner, the SSD controller performs an average of P/ performed on each flash block in the flash memory. The E times, and the preset P/E number range respectively correspond to the writing speed and the data saving duration, and determine the writing speed and the data saving duration, including:
所述SSD控制器根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率;Determining, by the SSD controller, a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute. Wherein, the corresponding relationship table records a correspondence between a preset P/E number of times range and a writing speed and a data saving duration; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than The frequency of access to the cold data;
所述SSD控制器根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:所述SSD控制器根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;The SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, including: the SSD controller needs to write to the flash memory according to the write operation other than the refresh operation Data attribute of the data, selecting a write speed from the determined write speed corresponding to each data attribute, and performing a write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed;
所述SSD控制器根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:所述SSD控制器根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存 时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。The SSD controller performs a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed, including: the SSD controller determines from the data attribute of the data written in the flash memory Select the data to save in the data retention time corresponding to each data attribute. The duration, according to the selected data save duration and the write speed corresponding to the cold data, performs a refresh operation on the data written to the flash memory.
结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中,所述SSD控制器根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作,包括:With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner, the SSD controller performs the write operation except the refresh operation on the flash memory of the SSD according to the selected write speed ,include:
所述SSD控制器根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并The SSD controller writes data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information The page number including the page, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the data written on the page Time; and
在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
所述SSD控制器根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作,包括:The SSD controller performs a refresh operation on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
针对任一种数据属性,所述SSD控制器基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页;For any data attribute, the SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data or the last write data in the expiration time queue information corresponding to the data attribute. The page number of the page, the OOB information of the page in which the data is written in the flash memory, and the selected data storage duration, and the page that needs to perform the refresh operation is determined;
所述SSD控制器根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。The SSD controller performs a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, records the OOB information of the refreshed page, and updates the invalidation time queue information corresponding to the cold data.
结合第一方面,或第一方面的第一种可能的实现方式,在第四种可能的实现方式中,所述SSD控制器根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:With reference to the first aspect, or the first possible implementation manner of the first aspect, in a fourth possible implementation, the SSD controller performs a refresh operation on the flash memory of the SSD according to the determined write speed Write operations, including:
所述SSD控制器根据确定的写速度,以页为单位向所述闪存中写入数据; 针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并The SSD controller writes data to the flash memory in units of pages according to the determined write speed; For each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page number of the page, and the page number of the previous page adjacent to the page in the write order The page number of the next page adjacent to the page in the write order and the time at which the data was written on the page;
在向所述闪存中的任一页写入数据后,更新所述SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;Updating the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
所述SSD控制器根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:The SSD controller performs a refresh operation on the data written in the flash memory according to the determined data storage duration and the determined write speed, including:
所述SSD控制器基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页;The SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data in the expiration time queue information or the page number of the page of the last write data, writing in the flash memory The OOB information of the page into which the data is entered and the determined duration of the data retention, and the page that needs to perform the refresh operation;
所述SSD控制器根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。The SSD controller performs a refresh operation on the determined page that needs to perform a refresh operation according to the determined write speed, records OOB information of the refreshed page, and updates the invalidation time queue information.
结合第一方面的第三或第四种可能的实现方式,在第五种可能的实现方式中,所述SSD控制器根据失效时间队列信息中所述最早写入数据的一页的页号和最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:With reference to the third or fourth possible implementation manner of the first aspect, in a fifth possible implementation manner, the SSD controller is configured according to a page number of a page of the earliest written data in the expiration time queue information. The page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation, including:
所述SSD控制器根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;The SSD controller searches for, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the earliest written data according to a time, a data saving duration, and a current time of the data written in the page included in the found OOB information;
若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作; If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. OOB information on the next page, and
根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
结合第一方面的第三或第四种可能的实现方式,在第六种可能的实现方式中,所述SSD控制器根据失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:With reference to the third or fourth possible implementation manner of the first aspect, in a sixth possible implementation manner, the SSD controller is configured according to a page number of a page of the earliest written data in the expiration time queue information or The page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation, including:
所述SSD控制器根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;The SSD controller searches for, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the most recently written data according to a time, a data storage duration, and a current time of the data written in the page included in the found OOB information;
若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查 找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, according to the page number of the previous page included in the OOB information of the current page and adjacent to the current page in the writing order, check in the flash memory Find the OOB information for the previous page, and
根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
第二方面,提供一种数据写入装置,包括:In a second aspect, a data writing apparatus is provided, including:
确定模块,用于根据当前对固态硬盘SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;a determining module for respectively performing a program/erase P/E count performed on each flash block in the flash memory of the solid state hard disk SSD, and a preset P/E number range corresponding to the write speed and the data storage duration respectively Relationship, determine the write speed and data retention time;
执行模块,用于根据所述确定模块确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并An execution module, configured to perform a write operation other than the refresh operation on the flash memory of the SSD according to the write speed determined by the determining module, and
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed; the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
结合第二方面,在第一种可能的实现方式中,所述执行模块具体用于:In conjunction with the second aspect, in a first possible implementation, the execution module is specifically configured to:
在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执行写操作;或,After receiving the write request sent by the host, performing a write operation on the flash memory of the SSD according to the write request; or
在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。After determining that the amount of blank flash blocks in the flash memory is below the set threshold in the flash memory, valid data in the flash block containing the invalid data is written into the blank flash page.
结合第二方面,或第二方面的第一种可能的实现方式,在第二种可能的实现方式中,所述确定模块具体用于:With reference to the second aspect, or the first possible implementation manner of the second aspect, in a second possible implementation manner, the determining module is specifically configured to:
根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率;Determining a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute; wherein Corresponding relationship between the preset P/E number range and the writing speed and the data saving duration is recorded in the correspondence table; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than the access of the cold data. frequency;
所述执行模块具体用于根据以下步骤执行所述写操作:根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性 对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;The execution module is specifically configured to perform the write operation according to the following steps: data attributes of data to be written into the flash memory according to the write operation except the refresh operation, from each determined data attribute In the corresponding write speed, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
所述执行模块具体用于根据以下步骤执行所述刷新操作:根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。The execution module is specifically configured to perform the refresh operation according to the following steps: according to the data attribute of the data written in the flash memory, select a data storage duration from the determined data storage duration corresponding to each data attribute, according to the selected The data storage duration and the write speed corresponding to the cold data perform a refresh operation on the data written to the flash memory.
结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中,所述执行模块具体用于根据以下步骤执行所述写操作:With reference to the second possible implementation of the second aspect, in a third possible implementation, the execution module is specifically configured to perform the write operation according to the following steps:
根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
所述执行模块具体用于根据以下步骤执行所述刷新操作:The execution module is specifically configured to perform the refresh operation according to the following steps:
针对任一种数据属性,基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页;For any data attribute, based on the preset refresh period, the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, The OOB information of the page in which the data is written in the flash memory and the selected data storage duration determine the page on which the refresh operation needs to be performed;
根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, recording the OOB information of the refreshed page, and updating the invalidation time queue information corresponding to the cold data.
结合第二方面,或第二方面的第一种可能的实现方式,在第四种可能的实现方式中,所述执行模块具体用于根据以下步骤执行所述写操作: In conjunction with the second aspect, or the first possible implementation of the second aspect, in a fourth possible implementation, the execution module is specifically configured to perform the write operation according to the following steps:
根据确定的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the determined write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,更新所述SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;Updating the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
所述执行模块具体用于根据以下步骤执行所述刷新操作:The execution module is specifically configured to perform the refresh operation according to the following steps:
基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页;Determining, according to the preset refresh period, a page number of a page of the earliest written data in the expiration time queue information or a page number of a page of the last write data, a page of the data written in the flash memory The OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
结合第二方面的第三或第四种可能的实现方式,在第五种可能的实现方式中,所述执行模块具体用于:In conjunction with the third or fourth possible implementation of the second aspect, in a fifth possible implementation, the execution module is specifically configured to:
根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the earliest written data according to the time when the data is written on the page, the data saving duration, and the current time included in the found OOB information;
若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查 找该后一页的OOB信息,并The currently determined page that needs to perform the refresh operation is used as the current page, and is searched in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. Find the OOB information for the next page, and
根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
结合第二方面的第三或第四种可能的实现方式,在第六种可能的实现方式中,所述执行模块具体用于:根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;In conjunction with the third or fourth possible implementation of the second aspect, in a sixth possible implementation, the executing module is specifically configured to: according to a page number of a page of the most recently written data, Searching, in the flash memory, OOB information corresponding to a page of the most recently written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the most recently written data according to the time when the data is written on the page, the data storage duration, and the current time included in the found OOB information;
若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and
根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
第三方面,提供一种数据写入装置,该装置包括处理器、存储器和总线,所述存储器存储执行指令,当所述装置运行时,所述处理器与所述存储器之间通过总线通信,所述处理器执行所述执行指令使得所述装置执行如下方法:In a third aspect, a data writing apparatus is provided, the apparatus comprising a processor, a memory and a bus, the memory storing execution instructions, and when the apparatus is in operation, the processor communicates with the memory via a bus, Executing the execution instruction by the processor causes the apparatus to perform the following method:
根据当前对固态硬盘SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系, 确定写速度和数据保存时长;According to the current program/erase P/E times performed on each flash block in the flash memory of the solid state drive SSD, and the preset P/E number range respectively corresponding to the write speed and the data storage duration, Determine the write speed and data retention time;
根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, and
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed; the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
结合第三方面,在第一种可能的实现方式中,所述处理器执行的所述方法中,对所述SSD的闪存执行除刷新操作外的写操作,包括:With reference to the third aspect, in a first possible implementation manner, in the method performed by the processor, performing a write operation other than a refresh operation on the flash memory of the SSD includes:
在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执行写操作;或,After receiving the write request sent by the host, performing a write operation on the flash memory of the SSD according to the write request; or
在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。After determining that the amount of blank flash blocks in the flash memory is below the set threshold in the flash memory, valid data in the flash block containing the invalid data is written into the blank flash page.
结合第一方面,或第一方面的第一种可能的实现方式,在第二种可能的实现方式中,所述处理器执行的所述方法中,根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长,包括:With reference to the first aspect, or the first possible implementation manner of the first aspect, in the second possible implementation manner, in the method performed by the processor, according to the current flash memory in the flash memory The average number of P/E times performed by the block and the corresponding P/E times range are respectively related to the write speed and the data storage duration, and the write speed and data retention duration are determined, including:
根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率;Determining a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute; wherein Corresponding relationship between the preset P/E number range and the writing speed and the data saving duration is recorded in the correspondence table; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than the access of the cold data. frequency;
根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, including: data attributes of data to be written into the flash memory according to the write operation other than the refresh operation, from each determined Among the write speeds corresponding to the data attributes, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:根据写入到闪存中的数据的数据属性,从确定的每种数据属 性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed, including: determining each type of data from the data attribute of the data written in the flash memory In the data storage duration corresponding to the sex, the data storage duration is selected, and the refresh operation is performed on the data written in the flash memory according to the selected data storage duration and the write speed corresponding to the cold data.
结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中,所述处理器执行的所述方法中,根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作,包括:With reference to the second possible implementation of the first aspect, in a third possible implementation, the method performed by the processor performs the performing on the flash memory of the SSD according to the selected write speed. Write operations outside the refresh operation, including:
根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作,包括:The refresh operation is performed on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
针对任一种数据属性,基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页;For any data attribute, based on the preset refresh period, the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, The OOB information of the page in which the data is written in the flash memory and the selected data storage duration determine the page on which the refresh operation needs to be performed;
根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, recording the OOB information of the refreshed page, and updating the invalidation time queue information corresponding to the cold data.
结合第一方面,或第一方面的第一种可能的实现方式,在第四种可能的实现方式中,所述处理器执行的所述方法中,根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:With reference to the first aspect, or the first possible implementation manner of the first aspect, in a fourth possible implementation, the method performed by the processor, according to the determined write speed, to the SSD Flash performs write operations other than refresh operations, including:
根据确定的写速度,以页为单位向所述闪存中写入数据;针对写入数据的 每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the determined write speed; for writing data Each page, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page number of the page, the page number of the previous page adjacent to the page in the writing order, and the page The page number of the next page adjacent in the write order and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,更新所述SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;Updating the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:Performing a refresh operation on the data written to the flash memory according to the determined data save duration and the determined write speed, including:
基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页;Determining, according to the preset refresh period, a page number of a page of the earliest written data in the expiration time queue information or a page number of a page of the last write data, a page of the data written in the flash memory The OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
结合第一方面的第三或第四种可能的实现方式,在第五种可能的实现方式中,所述处理器执行的所述方法中,根据失效时间队列信息中所述最早写入数据的一页的页号和最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:With reference to the third or fourth possible implementation manner of the first aspect, in a fifth possible implementation manner, in the method performed by the processor, according to the earliest written data in the expiration time queue information The page number of one page and the page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the data storage duration determine the page on which the refresh operation needs to be performed, including:
根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the earliest written data according to the time when the data is written on the page, the data saving duration, and the current time included in the found OOB information;
若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作: If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. OOB information on the next page, and
根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
结合第三方面的第三或第四种可能的实现方式,在第六种可能的实现方式中,所述处理器执行的所述方法中,根据失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:With reference to the third or fourth possible implementation manner of the third aspect, in the sixth possible implementation manner, in the method performed by the processor, according to the earliest written data in the expiration time queue information The page number of one page or the page number of the page on which the data was last written, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation, including:
根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the most recently written data according to the time when the data is written on the page, the data storage duration, and the current time included in the found OOB information;
若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and
根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。 Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
附图说明DRAWINGS
图1(a)为在编程电压ΔVpp1下每个MLC数据对应的阈值电压分布示意图;FIG. 1(a) is a schematic diagram showing a threshold voltage distribution corresponding to each MLC data at a program voltage ΔVpp1;
图1(b)为在编程电压ΔVpp2下每个MLC数据对应的阈值电压分布示意图;1(b) is a schematic diagram showing a threshold voltage distribution corresponding to each MLC data at a program voltage ΔVpp2;
图2为电子流失导致阈值电压发生变化的示意图;2 is a schematic diagram showing changes in threshold voltage caused by electron loss;
图3为SSD的结构示意图;3 is a schematic structural view of an SSD;
图4为本发明实施例一提供的数据写入方法流程图;4 is a flowchart of a data writing method according to Embodiment 1 of the present invention;
图5为本发明实施例二提供的数据写入方法流程图;FIG. 5 is a flowchart of a data writing method according to Embodiment 2 of the present invention;
图6(a)为在SSD闪存的寿命初期的对应关系图;Figure 6 (a) is a correspondence diagram at the beginning of the life of the SSD flash memory;
图6(b)为在SSD闪存的寿命中期的对应关系图;Figure 6 (b) is a corresponding relationship diagram in the middle of the life of the SSD flash memory;
图6(c)为在SSD闪存的寿命后期的对应关系图;Figure 6 (c) is a correspondence diagram at the end of the life of the SSD flash memory;
图7为本发明实施例三提供的数据写入方法流程图;FIG. 7 is a flowchart of a data writing method according to Embodiment 3 of the present invention;
图8为针对闪存块中写入数据的每一页,记录该页的OOB信息的示意图;8 is a schematic diagram of recording OOB information of a page for each page of data written in a flash block;
图9为本发明实施例四提供的数据写入方法流程图;9 is a flowchart of a data writing method according to Embodiment 4 of the present invention;
图10为本发明实施例五提供的数据写入装置结构示意图;10 is a schematic structural diagram of a data writing apparatus according to Embodiment 5 of the present invention;
图11为本发明实施例六提供的数据写入装置结构示意图。FIG. 11 is a schematic structural diagram of a data writing apparatus according to Embodiment 6 of the present invention.
具体实施方式detailed description
如图3所示,为SSD的结构示意图。SSD主要由主机逻辑接口31、SSD控制器32和闪存芯片33组成。SSD控制器32通过主机逻辑接口31与主机34之间进行数据交互,主机34向SSD控制器32发送数据读写请求后,SSD控制器32根据该数据读写请求,对闪存芯片33进行读写操作。本发明实施例主要对SSD中SSD控制器对SSD闪存的写入操作进行了改进。As shown in FIG. 3, it is a schematic structural diagram of an SSD. The SSD is mainly composed of a host logical interface 31, an SSD controller 32, and a flash chip 33. The SSD controller 32 performs data interaction with the host 34 through the host logical interface 31. After the host 34 sends a data read/write request to the SSD controller 32, the SSD controller 32 reads and writes the flash chip 33 according to the data read and write request. operating. The embodiment of the invention mainly improves the write operation of the SSD controller to the SSD flash memory in the SSD.
本发明实施例中,SSD控制器根据当前对SSD的闪存中的每个闪存块平 均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长。采用本发明实施例,可以在SSD闪存的不同寿命阶段采用不同的写速度和数据保存时长,以满足在不同阶段对SSD的使用性能和寿命的要求。这里的数据保存时长是进行刷新操作的时间依据。刷新操作是将闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置,该操作可以进一步减少存储数据的出错率和出错程度,延长SSD闪存的使用寿命。In the embodiment of the present invention, the SSD controller is flat according to each flash block in the flash memory of the current SSD. The P/E times that are executed, and the preset P/E times range are respectively related to the write speed and the data storage duration, and the write speed and the data storage duration are determined. With the embodiment of the present invention, different write speeds and data retention durations can be used in different life stages of the SSD flash memory to meet the requirements for the performance and life of the SSD at different stages. The data retention time here is the time base for the refresh operation. The refresh operation is to rewrite the data stored in the flash memory for more than the data storage duration from the last written position to other locations in the flash memory, which can further reduce the error rate and error degree of the stored data, and prolong the operation. The life of the SSD flash memory.
下面结合说明书附图对本发明实施例作进一步详细描述。The embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
如图4所示,为本发明实施例一提供的数据写入方法流程图,包括以下步骤:As shown in FIG. 4, a flowchart of a data writing method provided by Embodiment 1 of the present invention includes the following steps:
S401:SSD控制器根据当前对SSD的闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;S401: The SSD controller determines the write speed according to the average P/E times of each flash block currently executed in the flash memory of the SSD, and the preset P/E number range respectively, corresponding to the write speed and the data storage duration. Data retention time;
在该步骤中,SSD控制器可以在对SSD的闪存中的每个闪存块执行完一次P/E操作后,根据之前最近一次记录的对所述闪存总共执行P/E操作的次数或之前最近一次记录的对闪存中的每个闪存块平均执行的P/E次数,确定当前对闪存中的每个闪存块平均执行的P/E次数。In this step, the SSD controller may perform a P/E operation on the flash memory in total or the most recent time after performing a P/E operation on each flash block in the flash memory of the SSD. The average number of P/Es performed on each flash block in the flash at a time determines the average number of P/Es currently performed on each flash block in the flash.
在具体实施时,预先设置不同的P/E次数范围分别与写速度和数据保存时长的对应关系,在确定当前对闪存中的每个闪存块平均执行的P/E次数所属P/E次数范围发生变化后,根据预设的P/E次数范围分别与写速度和数据保存时长的对应关系,更新当前的写速度和数据保存时长。由于在SSD闪存的寿命初期,已执行的P/E次数较少,这时,闪存绝缘层损坏程度较小,存储单元内电子流失速度较慢,存储数据不容易出错,因此,在SSD闪存的寿命初期可以采用较大的写速度,以提高SSD的使用性能;同时,可以采用较长的数据保存时长,以减少进行刷新操作的次数,从而节省SSD的系统开销,提高SSD的使用性能。相应地,在SSD闪存的寿命后期,已执行的P/E次数较多,闪存 绝缘层损坏程度较大,存储单元内电子流失速度较快,存储数据容易出错,因此,在SSD闪存的寿命后期可以采用较小的写速度,以延长SSD闪存的使用寿命;同时,可以采用较短的数据保存时长,以缩短进行刷新操作的时间,避免存储数据出错程度超出ECC校验范围而导致SSD闪存的寿命终结。In a specific implementation, the correspondence between the different P/E frequency ranges and the write speed and the data storage duration is set in advance, and the P/E number of times of the P/E times that are currently performed on each flash block in the flash memory is determined. After the change occurs, the current write speed and the data storage duration are updated according to the correspondence between the preset P/E frequency range and the write speed and the data storage duration. Since the number of P/Es that have been executed is small in the early life of the SSD flash memory, the damage of the flash insulation layer is small, the electron loss rate in the memory cell is slow, and the stored data is not prone to errors, so in the SSD flash memory At the beginning of life, a larger write speed can be used to improve the performance of the SSD. At the same time, a longer data storage duration can be used to reduce the number of refresh operations, thereby saving SSD system overhead and improving the performance of the SSD. Correspondingly, at the end of the life of the SSD flash, the number of P/Es that have been executed is high, and the flash memory The insulation layer is damaged to a large extent, the electron loss rate in the memory unit is fast, and the storage data is prone to error. Therefore, a small write speed can be used later in the life of the SSD flash memory to extend the service life of the SSD flash memory; The short data storage duration is used to shorten the time for performing the refresh operation, and to avoid the end of the life of the SSD flash memory due to the error of the stored data exceeding the ECC check range.
S402:所述SSD控制器根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。S402: The SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, and performs execution on the data written in the flash memory according to the determined data save duration and the determined write speed. a refresh operation; the refresh operation is to rewrite data in the flash memory whose storage time exceeds the data storage duration from the last written location to another location in the flash memory.
在该步骤中,SSD控制器根据步骤S401确定出的当前阶段的写速度,执行除刷新操作外的写操作,并结合步骤S401确定出数据保存时长和写速度,执行刷新操作。这里,除刷新操作外的写操作,也就是除刷新操作外的对闪存执行的其它任何写操作。比如,具体可以包括以下两种写操作:In this step, the SSD controller performs a write operation other than the refresh operation according to the write speed of the current stage determined in step S401, and determines the data save duration and the write speed in conjunction with step S401 to perform a refresh operation. Here, the write operation other than the refresh operation, that is, any other write operation performed on the flash memory other than the refresh operation. For example, the specific two types of write operations can be included:
SSD控制器在接收到主机发送的写请求后,根据所述写请求,对SSD的闪存执行写操作;或,After receiving the write request sent by the host, the SSD controller performs a write operation on the flash memory of the SSD according to the write request; or
SSD控制器在确定闪存中空白的闪存块数量在闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。The SSD controller writes valid data in the flash block containing invalid data to the blank flash page after determining that the amount of blank flash blocks in the flash memory is lower than the set threshold in the flash memory.
上述两种写操作中,第一种是SSD控制器根据主机发送的写请求,对闪存执行写操作。第二种是SSD控制器执行垃圾回收(Garbage Collection,GC)的过程。SSD闪存中空白的闪存块数量在闪存中所占比率低于设定阈值后,将会严重影响SSD的写入性能,因此,需要及时对包含无效数据的闪存块执行擦除操作。这里,对闪存中的数据进行修改时,并不删除修改前的数据,而是将包含修改前的数据的闪存页标记为无效数据页,将修改后的数据写入空白的闪存页中。为了及时对包含无效数据的闪存块执行擦除操作,首先需要将该闪存块中的有效数据移动到其它位置,然后再对只包含无效数据的闪存块执行擦除操作,这就是执行GC的过程。 The first of the above two write operations is that the SSD controller performs a write operation on the flash memory according to a write request sent by the host. The second is the process by which the SSD controller performs Garbage Collection (GC). The amount of blank flash blocks in the SSD flash memory in the flash memory is lower than the set threshold, which will seriously affect the write performance of the SSD. Therefore, it is necessary to perform an erase operation on the flash block containing invalid data in time. Here, when the data in the flash memory is modified, the data before the modification is not deleted, but the flash page including the data before the modification is marked as an invalid data page, and the modified data is written into the blank flash page. In order to perform an erase operation on a flash block containing invalid data in time, it is first necessary to move the valid data in the flash block to another location, and then perform an erase operation on the flash block containing only invalid data, which is the process of executing the GC. .
采用上述实施例,可以在SSD闪存的不同寿命阶段采用不同的写速度和数据保存时长,比如,在SSD闪存的寿命初期可以采用较大的写速度和较长的数据保存时长,以提高SSD的使用性能;在SSD闪存的寿命后期可以采用较小的写速度和较短的数据保存时长,以延长SSD闪存的使用寿命。可见,本发明实施例可以较好地改善SSD闪存的使用寿命与SSD的使用性能之间存在的矛盾。With the above embodiment, different write speeds and data retention durations can be used in different life stages of the SSD flash memory. For example, in the early life of the SSD flash memory, a larger write speed and a longer data retention duration can be used to improve the SSD. Performance; a small write speed and a short data retention time can be used later in the life of the SSD flash to extend the life of the SSD flash. It can be seen that the embodiment of the present invention can better improve the contradiction between the service life of the SSD flash memory and the performance of the SSD.
在SSD的闪存中存储的数据可以分成两种类型,一种是被访问频率较大的热数据,一种是被访问频率较小的冷数据。在具体实施中,可以对这两种类型的数据进行区别对待,即在SSD闪存的同一寿命阶段,针对不同类型的数据,采用不同的写速度和数据保存时长。比如,由于冷数据不常被访问,在SSD闪存的寿命后期,相比热数据,可以对冷数据采用相对较慢的写速度,以及相对较长的数据保存时长。这样,虽然针对冷数据的写速度较慢,但却可以使冷数据的存储单元之间的阈值电压间隔大些,这样,即使采用较长的数据保存时长,冷数据也不容易出错。由于冷数据不常被访问,针对冷数据的写速度慢些对SSD的整体写入性能影响较少,基本不会影响用户体验度。以下实施例二中将对该实施方式作详细介绍。The data stored in the flash memory of the SSD can be divided into two types, one is hot data with a relatively high frequency of access, and the other is cold data with a small frequency of access. In a specific implementation, the two types of data can be treated differently, that is, different write speeds and data retention durations are used for different types of data in the same life stage of the SSD flash memory. For example, because cold data is not frequently accessed, at the end of the life of the SSD flash, compared to hot data, cold data can be used with relatively slow write speeds and relatively long data retention times. Thus, although the writing speed for cold data is slow, the threshold voltage interval between the storage units of the cold data can be made larger, so that even with a longer data storage time, the cold data is not prone to error. Since cold data is not frequently accessed, slower write speeds for cold data have less impact on the overall write performance of the SSD, and do not substantially affect user experience. This embodiment will be described in detail in the following second embodiment.
如图5所示,为本发明实施例二提供的数据写入方法流程图,包括以下步骤:As shown in FIG. 5, a flowchart of a data writing method provided by Embodiment 2 of the present invention includes the following steps:
S501:SSD控制器根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率。S501: The SSD controller determines, according to the current P/E times that are performed on each flash block in the flash memory, and the corresponding relationship table corresponding to each data attribute, determining a write speed and a data storage duration corresponding to each data attribute. Wherein, the corresponding relationship table records a correspondence between a preset P/E number of times range and a writing speed and a data saving duration; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than The frequency of access to the cold data.
该步骤中,分别为热数据和冷数据设置不同的对应关系表,可以将该对应关系表存储在SSD控制器的只读存储器(Read-Only Memory,ROM)中。在具体实施时,随P/E次数的增加,可以逐渐减小针对冷数据和热数据的写速度。 如图6(a)所示,为在SSD闪存的寿命初期的对应关系图。在SSD闪存的寿命初期,由于已执行的P/E次数较少,可以为热数据和冷数据都设置较大的写速度和较长的数据保存时长,以提高SSD的使用性能。如图6(b)所示,为在SSD闪存的寿命中期的对应关系图,其中实线对应热数据,虚线对应冷数据。在SSD闪存的寿命中期,可以为热数据和冷数据设置不同的对应关系。由于冷数据的被访问频率较低,相比热数据,可以对冷数据采用相对较慢的写速度,以及相对较长的数据保存时长。虽然冷数据对应的写速度较慢,但却可以使冷数据的存储单元之间的阈值电压间隔大些,这样,即使采用较长的数据保存时长,冷数据也不容易出错。并且,由于冷数据不常被访问,冷数据对应的写速度慢些对SSD的整体写入性能影响较少。相对SSD闪存的寿命初期,可以减小热数据对应的写速度和数据保存时长。但是,由于热数据的被访问频率较高,相比冷数据,可以对热数据采用相对较快的写速度,以及相对较短的数据保存时长。如图6(c)所示,为在SSD闪存的寿命后期的对应关系图,其中实线对应热数据,虚线对应冷数据。在SSD闪存的寿命后期,SSD闪存的寿命称为重点考虑的方面。相对SSD闪存的寿命中期,冷数据和热数据对应的写速度都进一步减小,同时,还可以进一步减小热数据的数据保存时长。如下表一和表二所示,分别为本发明实施例二中热数据和冷数据的对应关系表。该表中,以编程电压的大小来标识写速度的大小。需要说明的是,该对应关系表仅是本发明实施例具体的实施方式之一,在具体实施时可根据实际需要改变表中的对应关系。In this step, different correspondence tables are set for the hot data and the cold data, respectively, and the correspondence table may be stored in a read-only memory (ROM) of the SSD controller. In the specific implementation, as the number of P/E times increases, the writing speed for cold data and hot data can be gradually reduced. As shown in FIG. 6(a), it is a correspondence diagram at the beginning of the life of the SSD flash memory. At the beginning of the life of the SSD flash memory, since the number of P/Es that have been executed is small, a large write speed and a long data retention time can be set for both hot data and cold data to improve the performance of the SSD. As shown in FIG. 6(b), it is a correspondence diagram in the middle of the life of the SSD flash memory, in which the solid line corresponds to the hot data and the broken line corresponds to the cold data. In the middle of the life of SSD flash, different correspondences can be set for hot data and cold data. Since cold data is accessed less frequently, cold data can be used with relatively slower write speeds and relatively longer data retention times than hot data. Although the cold data corresponds to a slower write speed, the threshold voltage interval between the cold data storage units can be made larger, so that cold data is not prone to errors even with a long data retention time. Moreover, since cold data is not frequently accessed, the slower write speed corresponding to cold data has less impact on the overall write performance of the SSD. At the beginning of the life of the SSD flash memory, the write speed and data retention time corresponding to the hot data can be reduced. However, due to the high frequency of access to the hot data, relatively fast write speeds and relatively short data save times can be used for hot data compared to cold data. As shown in FIG. 6(c), it is a correspondence diagram at the end of the life of the SSD flash memory, in which the solid line corresponds to the hot data and the broken line corresponds to the cold data. At the end of the life of SSD flash, the life of SSD flash is called a key consideration. In the middle of the life of the SSD flash memory, the write speed corresponding to the cold data and the hot data is further reduced, and the data retention time of the hot data can be further reduced. Table 1 and Table 2 below show the correspondence table between the hot data and the cold data in the second embodiment of the present invention. In this table, the size of the write voltage is used to identify the size of the write speed. It should be noted that the corresponding relationship table is only one of the specific implementation manners of the embodiment of the present invention. In a specific implementation, the corresponding relationship in the table may be changed according to actual needs.
Figure PCTCN2015080779-appb-000001
Figure PCTCN2015080779-appb-000001
表一Table I
Figure PCTCN2015080779-appb-000002
Figure PCTCN2015080779-appb-000002
Figure PCTCN2015080779-appb-000003
Figure PCTCN2015080779-appb-000003
表二Table II
S502:所述SSD控制器根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,对所述SSD的闪存执行所述写操作。S502: the SSD controller selects a write speed according to a data attribute of data to be written into the flash memory according to the write operation except the refresh operation, and selects a write speed from the determined write speed corresponding to each data attribute. The flash memory of the SSD performs the write operation.
该步骤中,可以预先设置不同类型数据的数据属性,比如,文件的根目录由于需要被经常访问,可以将其设置为热数据,对于一些影视文件,可以将其设置为冷数据。这里,数据的数据属性并不是固定的,SSD控制器在将数据写入闪存后,可以根据该数据的被访问频率对其数据属性进行调整。In this step, the data attributes of different types of data can be set in advance. For example, the root directory of the file can be set to hot data because it needs to be accessed frequently. For some video files, it can be set as cold data. Here, the data attribute of the data is not fixed. After the data is written to the flash memory, the SSD controller can adjust the data attribute according to the accessed frequency of the data.
S503:所述SSD控制器根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。S503: The SSD controller selects a data storage duration from the determined data storage duration corresponding to each data attribute determined according to the data attribute of the data written in the flash memory, and saves the duration according to the selected data and the corresponding data of the cold data. Speed, performs a refresh operation on the data written to the flash memory.
该步骤中,如果写入到闪存中的热数据在经过设置的数据保存时长后,仍没有被更新,则可以将该热数据的数据属性变更为冷数据,并采用冷数据对应的写速度,对该数据进行刷新操作。因此,该步骤中,不管是热数据还是冷数据,在需要进行刷新时,都是作为冷数据被刷新。In this step, if the hot data written in the flash memory is not updated after the set data is saved for a long time, the data attribute of the hot data can be changed to cold data, and the write speed corresponding to the cold data is used. Refresh the data. Therefore, in this step, whether it is hot data or cold data, when refresh is required, it is refreshed as cold data.
在执行刷新操作时,可以以闪存块为最小刷新单位,但是,由于闪存块中每页数据被写入的时间不一致,若按照被写入时间最早的数据进行刷新,会刷新很多不必要的数据,若按照被写入时间最晚的数据进行刷新,又有可能导致其它被写入时间较早的数据因没有得到及时刷新而出错。因此,本发明以下实施例三中为了提高进行数据刷新的及时性和避免对不必要的数据进行刷新操作,以页作为最小的刷新单位。When the refresh operation is performed, the flash block can be used as the minimum refresh unit. However, since the time of writing each page of the flash block is inconsistent, if the data is refreshed according to the data written at the earliest time, many unnecessary data will be refreshed. If the data is refreshed according to the data that is written the latest, it may cause other data that was written earlier to be incorrectly updated due to not being refreshed in time. Therefore, in the following Embodiment 3 of the present invention, in order to improve the timeliness of performing data refreshing and avoiding refreshing operations on unnecessary data, the page is used as the minimum refresh unit.
如图7所示,为本发明实施例三提供的数据写入方法流程图,包括:As shown in FIG. 7, a flowchart of a data writing method provided by Embodiment 3 of the present invention includes:
S701:SSD控制器根据当前对所述SSD的闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关 系,确定写速度和数据保存时长。S701: The SSD controller performs an average of the P/E times performed on each flash block in the flash memory of the SSD, and the preset P/E times range respectively corresponding to the write speed and the data storage duration. System, determine the write speed and data retention time.
该步骤的实施可参见实施例一的描述,重复之处,不再赘述。For the implementation of this step, refer to the description of Embodiment 1, and where it is repeated, it will not be described again.
S702:SSD控制器根据确定的写速度,以页为单位向闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外(Out of Band,OOB)信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间。S702: the SSD controller writes data to the flash memory in units of pages according to the determined write speed; and records out-of-band (OOB) information of the page in the page for each page of the write data, The OOB information includes a page number of the page, a page number of a previous page adjacent to the page in the writing order, a page number of a subsequent page adjacent to the page in the writing order, and a page number on the page The time the data was written.
如图8所示,为针对闪存块中写入数据的每一页,记录该页的OOB信息的示意图。通过任一页数据的OOB信息,不仅可以确定该页的页号,还可以确定该页的前一页的页号和在该页的后一页的页号,这里的前一页和后一页是与该页在写入顺序上相邻的页。As shown in FIG. 8, a schematic diagram of OOB information of the page is recorded for each page in which data is written in the flash block. Through the OOB information of any page of data, not only the page number of the page can be determined, but also the page number of the previous page of the page and the page number of the next page of the page, the previous page and the next page here A page is a page that is adjacent to the page in the write order.
S703:SSD控制器在向闪存中的任一页写入数据后,更新所述SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号。S703: The SSD controller updates the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the invalidation time queue information includes the previously written data and is not updated, the earliest The page number of the page on which the data is written and the page number of the page on which the data was last written.
该步骤中,可以将失效时间队列信息存储在SSD控制器的ROM中。SSD控制器每执行一次写操作,就将该写操作写入的数据加入失效时间队列中,这里,将写入的数据加入失效时间队列实际上就是如步骤S702所述,记录写入的页的OOB信息。在将写入的数据加入失效时间队列后,更新失效时间队列信息。在该失效时间队列信息中只记录失效时间队列的队列头和队列尾的页的页号,其中,队列头的页可以是所述最早写入数据的一页,队列尾的页可以是所述最近一次写入数据的一页,或者,队列头的页可以是所述最近一次写入数据的一页,队列尾的页可以是所述最早写入数据的一页。结合该队列头或队列尾的页号,以及记录的每一页的OOB信息(包括该页的页号、该页的前一页和后一页的页号),可以依次寻找到该失效时间队列中的每一页。In this step, the expiration time queue information can be stored in the ROM of the SSD controller. Each time the SSD controller performs a write operation, the data written by the write operation is added to the expiration time queue. Here, adding the written data to the expiration time queue is actually recording the written page as described in step S702. OOB information. After the written data is added to the dead time queue, the dead time queue information is updated. In the expiration time queue information, only the page header of the queue head of the expiration time queue and the page number of the tail of the queue are recorded, wherein the page of the queue header may be a page of the earliest written data, and the page at the end of the queue may be the The page on which data was last written, or the page of the queue header may be one page of the most recently written data, and the page at the end of the queue may be one page of the earliest written data. Combining the page number of the queue header or the tail of the queue, and the OOB information of each page recorded (including the page number of the page, the page number of the previous page and the next page of the page), the expiration time can be found in turn. Every page in the queue.
S704:所述SSD控制器基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号和最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新 操作的页;根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。S704: The SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data in the expiration time queue information and the page number of the page of the last write data, the flash memory. The OOB information of the page in which the data is written and the duration of the data storage, determining that a refresh needs to be performed a page of operation; performing a refresh operation on the determined page that needs to perform a refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
根据对上述步骤的描述可知,根据失效时间队列信息中最早写入数据的一页的页号或最近一次写入数据的一页的页号以及闪存中写入数据的页的OOB信息,可以依次寻找到失效时间队列中的每一页。结合数据保存时长,依次判断寻找到的每一页是否需要进行刷新,在确定需要进行刷新后,根据确定的写速度对其进行刷新,因为刷新实际上就将该页的数据重新写入到其它页的位置,因此,需要重新记录刷新后的页的OOB信息,并更新失效时间队列信息。According to the description of the above steps, the page number of the page in which the data is first written or the page number of the page on which the data was last written and the OOB information of the page in which the data is written in the flash memory may be sequentially determined according to the failure time queue information. Find each page in the expiration time queue. In combination with the data storage duration, it is sequentially determined whether each page found needs to be refreshed, and after determining that it needs to be refreshed, it is refreshed according to the determined write speed, because the refresh actually rewrites the data of the page to other The position of the page, therefore, the OOB information of the refreshed page needs to be re-recorded, and the dead time queue information is updated.
在确定需要执行刷新操作的页时,可以从上述失效时间队列信息中选择所述最早写入数据的一页或最近一次写入数据的一页作为起始页开始判断,根据选择的起始页不同,本实施例中具体提供以下两种实施方式。When determining a page that needs to perform a refresh operation, a page of the earliest written data or a page of the last written data may be selected from the above-mentioned dead time queue information as a start page to start judgment, according to the selected start page. Differently, the following two embodiments are specifically provided in this embodiment.
第一种:以所述最早写入数据的一页作为起始页开始判断;The first type: starting with a page of the earliest written data as a starting page;
具体地,所述SSD控制器根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Specifically, the SSD controller searches for, in the flash memory, OOB information corresponding to one page of the earliest written data according to a page number of a page of the earliest written data;
所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the earliest written data according to a time, a data saving duration, and a current time of the data written in the page included in the found OOB information;
若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后 一页执行刷新操作。Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. The OOB information of the next page, and according to the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, whether it is necessary to One page performs a refresh operation.
比如,所述失效时间队列信息中记录有最早写入数据的一页的页号2和所述最近一次写入数据的一页的页号6。根据闪存中每一页的OOB信息,查找页号为2的页。在查找到页号为2的页后,根据该页的OOB信息中记录的在该页写入数据的时间,所述数据保存时长,以及当前时间,判断在该页写入数据的时间与当前时间之间的时间间隔是否超出了所述数据保存时长。如果超出,则确定需要对该页号为2的页执行刷新操作,否则,结束当前的刷新操作。若确定需要对该页号为2的页执行刷新操作,则对该页号为2的页执行刷新操作,并根据该页号为2的页的OOB信息中记录的该页的后一页的页号4,在闪存中查找页号为4的页。在查找到页号为4的页后,根据该页的OOB信息中记录的在该页写入数据的时间,所述数据保存时长,以及当前时间,判断在该页写入数据的时间与当前时间之间的时间间隔是否超出了所述数据保存时长。如果超出,则确定需要对该页号为4的页执行刷新操作,否则,结束当前的刷新操作。若确定需要对该页号为4的页执行刷新操作,则对该页号为4的页执行刷新操作,并根据该页号为4的页的OOB信息中记录的该页的后一页的页号6,在闪存中查找页号为6的页。在查找到页号为6的页后,根据该页的OOB信息中记录的在该页写入数据的时间,所述数据保存时长,以及当前时间,判断在该页写入数据的时间与当前时间之间的时间间隔是否超出了所述数据保存时长。如果超出,则确定需要对该页号为6的页执行刷新操作,否则,结束当前的刷新操作。若确定需要对该页号为6的页执行刷新操作,则对该页号为6的页执行刷新操作,并且,由于页号6为所述最近一次写入数据的一页的页号,所以需要结束当前的刷新操作。For example, the expiration time queue information records the page number 2 of one page of the earliest written data and the page number 6 of the page of the most recently written data. Find the page with page number 2 based on the OOB information for each page in the flash. After finding the page with the page number 2, according to the time when the data is written on the page recorded in the OOB information of the page, the data storage duration, and the current time, the time and current time of writing the data on the page are determined. Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation needs to be performed on the page number 2, otherwise, the current refresh operation is ended. If it is determined that a refresh operation is required for the page number 2, a refresh operation is performed on the page number 2, and the next page of the page is recorded according to the OOB information of the page number 2 Page number 4, find the page number 4 in the flash memory. After finding the page with page number 4, according to the time when the data is written on the page recorded in the OOB information of the page, the data storage duration, and the current time, the time and current time of writing the data on the page are determined. Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation needs to be performed on the page number 4, otherwise, the current refresh operation is ended. If it is determined that a refresh operation is required on the page number 4, the page operation is performed on the page number 4, and the next page of the page recorded in the OOB information of the page having the page number 4 is Page number 6, find the page number 6 in the flash memory. After finding the page with page number 6, according to the time of writing data on the page recorded in the OOB information of the page, the data storage duration, and the current time, determining the time and current time of writing data on the page Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation needs to be performed on the page number 6; otherwise, the current refresh operation is ended. If it is determined that a refresh operation is required for the page number 6 of the page, the page operation is performed on the page number 6 and since page number 6 is the page number of the page of the most recent write data, Need to end the current refresh operation.
第二种:以所述最近一次写入数据的一页作为起始页开始判断;The second type: starting with the page of the last written data as the starting page;
具体地,所述SSD控制器根据失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括: Specifically, the SSD controller determines, according to the page number of the page of the earliest written data in the expiration time queue information or the page number of the page on which the data was last written, the OOB of the page in which the data is written in the flash memory. The information and the length of time the data is saved determine the pages that need to perform the refresh operation, including:
所述SSD控制器根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;The SSD controller searches for, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the most recently written data according to a time, a data storage duration, and a current time of the data written in the page included in the found OOB information;
若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation is required to be performed on all pages before the page of the most recent write data in the write order;
若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有未更新的页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. All unupdated pages before the page are refreshed, or until it is determined that a refresh operation is not required on the page of the earliest written data:
以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration and the current time, it is determined whether the previous one needs to be The page performs a refresh operation.
比如,所述失效时间队列信息中记录有最早写入数据的一页的页号2和所述最近一次写入数据的一页的页号6。根据闪存中每一页的OOB信息,查找页号为6的页。在查找到页号为6的页后,根据该页的OOB信息中记录的在该页写入数据的时间,所述数据保存时长,以及当前时间,判断在该页写入数据的时间与当前时间之间的时间间隔是否超出了所述数据保存时长。如果超出,则确定需要对该页号为6的页以及写入顺序在该页号之前的所有未更新的页都执行刷新操作。这里,根据该页号为6的页的OOB信息确定该页号为6的页的前一页为页号为4的页,根据该页号为4的页的OOB信息确定该页号为4的页的前一页为页号为2的页,也就是所述最早写入数据的一页。那么,该实施方式中就需要将页号为6、4、2的页依次进行刷新。如果确定在页号为 6的页写入数据的时间与当前时间之间的时间间隔没有超出所述数据保存时长,则根据该页号为6的页的OOB信息中记录的该页的前一页的页号4,在闪存中查找页号为4的页。在查找到页号为4的页后,根据该页的OOB信息中记录的在该页写入数据的时间,所述数据保存时长,以及当前时间,判断在该页写入数据的时间与当前时间之间的时间间隔是否超出了所述数据保存时长。如果超出,则确定需要对该页号为4的页,以及该页号为4的页的前一页(页号为2的页)都执行刷新操作。否则,根据该页号为4页的OOB信息中记录的该页的前一页的页号2,在闪存中查找页号为2的页,在查找到页号为2的页后,根据该页的OOB信息中记录的在该页写入数据的时间,所述数据保存时长,以及当前时间,判断在该页写入数据的时间与当前时间之间的时间间隔是否超出了所述数据保存时长,如果超出,则确定需要对该页号为2的页执行刷新操作,否则,确定不需要对该页号为2的页,也就是所述最早写入数据的一页执行刷新操作。For example, the expiration time queue information records the page number 2 of one page of the earliest written data and the page number 6 of the page of the most recently written data. Find the page number 6 based on the OOB information for each page in the flash. After finding the page with page number 6, according to the time of writing data on the page recorded in the OOB information of the page, the data storage duration, and the current time, determining the time and current time of writing data on the page Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that a refresh operation is required for the page numbered 6 and all unupdated pages whose write order precedes the page number. Here, it is determined that the previous page of the page number 6 is the page with the page number 4 according to the OOB information of the page number 6 of the page, and the page number is determined according to the OOB information of the page whose page number is 4. The previous page of the page is a page with page number 2, that is, one page of the earliest data to be written. Then, in this embodiment, it is necessary to sequentially refresh the pages of page numbers 6, 4, and 2. If it is determined that the page number is The time interval between the time when the page write data of 6 and the current time does not exceed the data storage time length, and the page number 4 of the previous page of the page recorded in the OOB information of the page whose page number is 6 is Look for pages with page number 4 in flash memory. After finding the page with page number 4, according to the time when the data is written on the page recorded in the OOB information of the page, the data storage duration, and the current time, the time and current time of writing the data on the page are determined. Whether the time interval between times exceeds the data retention time. If it is exceeded, it is determined that the page needs to be refreshed for the page numbered 4 and the previous page of the page number 4 (page number 2). Otherwise, according to the page number 2 of the previous page of the page recorded in the OOB information of the page number 4, the page number 2 is found in the flash memory, and after the page number 2 is found, according to the page number The time at which the data is written on the page recorded in the OOB information of the page, the length of the data being saved, and the current time, determining whether the time interval between the time when the page is written with the current time and the current time exceeds the data saving The duration, if exceeded, determines that a refresh operation needs to be performed on the page with page number 2, otherwise, it is determined that the page with the page number 2 is not required, that is, the page of the earliest written data performs a refresh operation.
结合上述实施例二和实施例三,提出了以下实施例四。该实施例四中,不同数据属性对应不同的对应关系表,且在进行数据刷新时,以页作为最小的刷新单位。具体实施与上述实施例重复之处不再赘述。With the second embodiment and the third embodiment described above, the following fourth embodiment is proposed. In the fourth embodiment, different data attributes correspond to different correspondence tables, and when data refresh is performed, the page is used as the minimum refresh unit. The details of the specific implementations of the above embodiments are not described again.
如图9所示,为本发明实施例四提供的数据写入方法流程图,包括:As shown in FIG. 9, a flowchart of a data writing method provided by Embodiment 4 of the present invention includes:
S901:SSD控制器根据当前对所述SSD的闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长。S901: The SSD controller determines to write according to the P/E times that are currently performed on each flash block in the flash memory of the SSD, and the preset P/E number range respectively, and the correspondence between the write speed and the data storage duration. Speed and data retention time.
S902:所述SSD控制器根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间。S902: the SSD controller writes data to the flash memory in units of pages according to the selected write speed; for each page of the write data, records the out-of-band OOB information of the page in the page, The OOB information includes the page number of the page, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the page number written on the page The time of the data.
S903:SSD控制器在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信 息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号。S903: After writing data to any page in the flash memory, the SSD controller updates the invalidation time queue letter corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data. The expiration time queue information includes a page number of a page of the earliest data to be written and a page number of a page of which data was last written, in a page that was previously written with data of the data attribute and not updated.
S904:针对任一种数据属性,所述SSD控制器基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页;根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。S904: For any data attribute, the SSD controller is based on a preset refresh period, according to the page number of the earliest written data in the expiration time queue information corresponding to the data attribute or the last write data. The page number of one page, the OOB information of the page in which the data is written in the flash memory, and the selected data storage duration, determine a page that needs to perform a refresh operation; perform a refresh on the determined need according to the write speed corresponding to the cold data The operated page performs a refresh operation, records the OOB information of the refreshed page, and updates the invalidation time queue information corresponding to the cold data.
在确定需要执行刷新操作的页时,可以从上述失效时间队列信息中选择所述最早写入数据的一页或最近一次写入数据的一页作为起始页开始判断,根据选择的起始页不同,本实施例中具体提供以下两种实施方式。When determining a page that needs to perform a refresh operation, a page of the earliest written data or a page of the last written data may be selected from the above-mentioned dead time queue information as a start page to start judgment, according to the selected start page. Differently, the following two embodiments are specifically provided in this embodiment.
第一种:以所述最早写入数据的一页作为起始页开始判断;The first type: starting with a page of the earliest written data as a starting page;
具体地,针对任一种数据属性,所述SSD控制器根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Specifically, for any data attribute, the SSD controller searches for, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、选择的数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the earliest written data according to the time of writing data on the page included in the found OOB information, the selected data saving duration, and the current time;
若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、选择的数据保存时长和当前时间,判断是否需要对该 后一页执行刷新操作。Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. The OOB information of the next page, and according to the found time of the data written in the next page included in the OOB information of the next page, the selected data storage duration and the current time, whether it is necessary to The next page performs a refresh operation.
第二种:以所述最近一次写入数据的一页作为起始页开始判断;The second type: starting with the page of the last written data as the starting page;
具体地,针对任一种数据属性,所述SSD控制器基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页,包括:Specifically, for any one of the data attributes, the SSD controller is based on a preset refresh period, according to the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, the flash memory. The OOB information of the page in which the data is written and the length of time the selected data is saved, and the page that needs to perform the refresh operation, including:
针对任一种数据属性,所述SSD控制器根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;For any data attribute, the SSD controller searches for the OOB information corresponding to the page of the most recently written data in the flash memory according to the page number of the page of the most recently written data;
所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、选择的数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the most recently written data according to the time of writing data on the page, the selected data storage duration, and the current time included in the found OOB information;
若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation is required to be performed on all pages before the page of the most recent write data in the write order;
若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and
根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、选择的数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。Whether the refresh operation of the previous page needs to be performed is determined according to the time of writing the data on the previous page, the selected data save duration, and the current time included in the found OOB information of the previous page.
基于同一发明构思,本发明实施例中还提供了一种与数据写入方法对应的数据写入装置,由于该装置解决问题的原理与本发明实施例数据写入方法相似,因此该装置的实施可以参见方法的实施,重复之处不再赘述。Based on the same inventive concept, the embodiment of the present invention further provides a data writing device corresponding to the data writing method. Since the principle of solving the problem is similar to the data writing method of the embodiment of the present invention, the implementation of the device is implemented. See the implementation of the method, and the repetition will not be repeated.
如图10所示,为本发明实施例五提供的数据写入装置结构示意图,包括: FIG. 10 is a schematic structural diagram of a data writing apparatus according to Embodiment 5 of the present invention, including:
确定模块101,用于根据当前对固态硬盘SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;The determining module 101 is configured to perform an average of the program/erase P/E times performed on each flash block in the flash memory of the solid state hard disk SSD, and the preset P/E number of times range respectively with the writing speed and the data saving duration Corresponding relationship, determining the writing speed and the data storage duration;
执行模块102,用于根据所述确定模块101确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并The executing module 102 is configured to perform a write operation other than the refresh operation on the flash memory of the SSD according to the write speed determined by the determining module 101, and
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed; the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
可选地,所述执行模块102具体用于:Optionally, the execution module 102 is specifically configured to:
在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执行写操作;或,After receiving the write request sent by the host, performing a write operation on the flash memory of the SSD according to the write request; or
在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。After determining that the amount of blank flash blocks in the flash memory is below the set threshold in the flash memory, valid data in the flash block containing the invalid data is written into the blank flash page.
可选地,所述确定模块101具体用于:Optionally, the determining module 101 is specifically configured to:
根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率;Determining a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute; wherein Corresponding relationship between the preset P/E number range and the writing speed and the data saving duration is recorded in the correspondence table; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than the access of the cold data. frequency;
所述执行模块102具体用于根据以下步骤执行所述写操作:根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;The execution module 102 is specifically configured to perform the write operation according to the following steps: the data attribute of the data that needs to be written into the flash memory according to the write operation other than the refresh operation, and the corresponding write from each determined data attribute In the speed, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
所述执行模块102具体用于根据以下步骤执行所述刷新操作:根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入 到闪存中的数据执行刷新操作。The execution module 102 is specifically configured to perform the refresh operation according to the following steps: according to the data attribute of the data written in the flash memory, select a data storage duration from the determined data storage duration corresponding to each data attribute, according to the selection Data save duration and write speed corresponding to cold data, write to Perform a refresh operation on the data in the flash memory.
可选地,所述执行模块102具体用于根据以下步骤执行所述写操作:Optionally, the execution module 102 is specifically configured to perform the write operation according to the following steps:
根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
所述执行模块102具体用于根据以下步骤执行所述刷新操作:The execution module 102 is specifically configured to perform the refresh operation according to the following steps:
针对任一种数据属性,基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页;For any data attribute, based on the preset refresh period, the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, The OOB information of the page in which the data is written in the flash memory and the selected data storage duration determine the page on which the refresh operation needs to be performed;
根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, recording the OOB information of the refreshed page, and updating the invalidation time queue information corresponding to the cold data.
可选地,所述执行模块102具体用于根据以下步骤执行所述写操作:Optionally, the execution module 102 is specifically configured to perform the write operation according to the following steps:
根据确定的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the determined write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,更新所述SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号; Updating the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
所述执行模块102具体用于根据以下步骤执行所述刷新操作:The execution module 102 is specifically configured to perform the refresh operation according to the following steps:
基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页;Determining, according to the preset refresh period, a page number of a page of the earliest written data in the expiration time queue information or a page number of a page of the last write data, a page of the data written in the flash memory The OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
可选地,所述执行模块102具体用于:Optionally, the execution module 102 is specifically configured to:
根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the earliest written data according to the time when the data is written on the page, the data saving duration, and the current time included in the found OOB information;
若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. OOB information on the next page, and
根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
可选地,所述执行模块102具体用于:根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;Optionally, the executing module 102 is specifically configured to: in the flash memory, search for OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作; Determining whether it is necessary to perform a refresh operation on a page of the most recently written data according to the time when the data is written on the page, the data storage duration, and the current time included in the found OOB information;
若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and
根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
如图11所示,为本发明实施例六提供的数据写入装置110结构示意图,该装置包括处理器111、存储器112和总线113,所述存储器112存储执行指令,当所述装置运行时,所述处理器111与所述存储器112之间通过总线113通信,所述处理器111执行所述执行指令使得所述装置执行如下方法:FIG. 11 is a schematic structural diagram of a data writing apparatus 110 according to Embodiment 6 of the present invention. The apparatus includes a processor 111, a memory 112, and a bus 113. The memory 112 stores execution instructions. When the apparatus is running, The processor 111 communicates with the memory 112 via a bus 113, and the processor 111 executes the execution instructions such that the apparatus performs the following method:
根据当前对固态硬盘SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;The write speed is determined according to the current program/erase P/E times performed on each flash block in the flash memory of the solid state drive SSD, and the preset P/E number range respectively corresponding to the write speed and the data save duration. And the length of time the data is saved;
根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, and
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed; the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
可选地,所述处理器111执行的所述方法中,对所述SSD的闪存执行除刷新操作外的写操作,包括:Optionally, in the method performed by the processor 111, performing a write operation other than the refresh operation on the flash memory of the SSD includes:
在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执 行写操作;或,After receiving the write request sent by the host, executing the flash memory of the SSD according to the write request Write operation; or,
在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。After determining that the amount of blank flash blocks in the flash memory is below the set threshold in the flash memory, valid data in the flash block containing the invalid data is written into the blank flash page.
可选地,所述处理器111执行的所述方法中,根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长,包括:Optionally, in the method performed by the processor 111, according to the current P/E times performed on each flash block in the flash memory, and the preset P/E times range and the write speed respectively The correspondence between data retention durations, determining the write speed and data retention duration, including:
根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率;Determining a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute; wherein Corresponding relationship between the preset P/E number range and the writing speed and the data saving duration is recorded in the correspondence table; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than the access of the cold data. frequency;
根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, including: data attributes of data to be written into the flash memory according to the write operation other than the refresh operation, from each determined Among the write speeds corresponding to the data attributes, the write speed is selected, and the write operation other than the refresh operation is performed on the flash memory of the SSD according to the selected write speed;
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed, including: saving the data duration corresponding to each of the determined data attributes according to the data attribute of the data written in the flash memory In the middle, the data storage duration is selected, and a refresh operation is performed on the data written in the flash memory according to the selected data storage duration and the write speed corresponding to the cold data.
可选地,所述处理器111执行的所述方法中,根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作,包括:Optionally, in the method performed by the processor 111, performing a write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed, including:
根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新 SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating according to the data attribute of the written data The expiration time queue information corresponding to the data attribute maintained by the SSD controller; the failure time queue information includes a page number of the page of the first written data and the most recent page that was previously written to the data having the data attribute and not updated. The page number of a page at which data is written at a time;
根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作,包括:The refresh operation is performed on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
针对任一种数据属性,基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页;For any data attribute, based on the preset refresh period, the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, The OOB information of the page in which the data is written in the flash memory and the selected data storage duration determine the page on which the refresh operation needs to be performed;
根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, recording the OOB information of the refreshed page, and updating the invalidation time queue information corresponding to the cold data.
可选地,所述处理器111执行的所述方法中,根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:Optionally, in the method performed by the processor 111, performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, including:
根据确定的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the determined write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
在向所述闪存中的任一页写入数据后,更新SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information maintained by the SSD controller; the dead time queue information includes one of the pages that were previously written and not updated, and the first one of which is written The page number of the page and the page number of the page on which the data was last written;
根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:Performing a refresh operation on the data written to the flash memory according to the determined data save duration and the determined write speed, including:
基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页; Determining, according to the preset refresh period, a page number of a page of the earliest written data in the expiration time queue information or a page number of a page of the last write data, a page of the data written in the flash memory The OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
可选地,所述处理器111执行的所述方法中,根据失效时间队列信息中所述最早写入数据的一页的页号和最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:Optionally, in the method performed by the processor 111, according to the page number of the page of the earliest written data in the expiration time queue information and the page number of the page of the last written data, the flash memory The OOB information of the page in which the data is written and the length of time the data is saved, and the page that needs to perform the refresh operation, including:
根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the earliest written data according to the time when the data is written on the page, the data saving duration, and the current time included in the found OOB information;
若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. OOB information on the next page, and
根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
可选地,所述处理器111执行的所述方法中,根据失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:Optionally, in the method performed by the processor 111, according to a page number of a page of the earliest written data in the expiration time queue information or a page number of a page of the last write data, the flash memory The OOB information of the page in which the data is written and the length of time the data is saved, and the page that needs to perform the refresh operation, including:
根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息; Searching, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the most recently written data according to the time when the data is written on the page, the data storage duration, and the current time included in the found OOB information;
若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and
根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、装置(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一 个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of a method, apparatus (system), and computer program product according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Implemented in flowchart one Means of a process or a plurality of processes and/or block diagrams of a function specified in a block or blocks.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While the preferred embodiment of the invention has been described, it will be understood that Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and
显然,本领域的技术人员可以对本发明执行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。 It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims (21)

  1. 一种数据写入方法,其特征在于,包括:A data writing method, comprising:
    固态硬盘SSD控制器根据当前对所述SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;The SSD controller corresponds to the average of the program/erase P/E times currently performed for each flash block in the flash memory of the SSD, and the preset P/E number range respectively, corresponding to the write speed and the data storage duration. Relationship, determine the write speed and data retention time;
    所述SSD控制器根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并The SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, and
    根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed; the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
  2. 如权利要求1所述的方法,其特征在于,所述SSD控制器对所述SSD的闪存执行除刷新操作外的写操作,包括:The method of claim 1, wherein the SSD controller performs a write operation other than a refresh operation on the flash memory of the SSD, including:
    所述SSD控制器在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执行写操作;或,After receiving the write request sent by the host, the SSD controller performs a write operation on the flash memory of the SSD according to the write request; or
    所述SSD控制器在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。The SSD controller writes valid data in the flash block containing the invalid data into the blank flash page after determining that the ratio of the number of blank flash blocks in the flash memory in the flash memory is lower than a set threshold.
  3. 如权利要求1或2所述的方法,其特征在于,所述SSD控制器根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长,包括:The method according to claim 1 or 2, wherein the SSD controller separately performs an average of P/E times performed on each of the flash blocks in the flash memory, and a preset P/E number of times respectively Determine the write speed and data retention duration, as well as the write speed and data retention duration, including:
    所述SSD控制器根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率; Determining, by the SSD controller, a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute. Wherein, the corresponding relationship table records a correspondence between a preset P/E number of times range and a writing speed and a data saving duration; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than The frequency of access to the cold data;
    所述SSD控制器根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:所述SSD控制器根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;The SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, including: the SSD controller needs to write to the flash memory according to the write operation other than the refresh operation Data attribute of the data, selecting a write speed from the determined write speed corresponding to each data attribute, and performing a write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed;
    所述SSD控制器根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:所述SSD控制器根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。The SSD controller performs a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed, including: the SSD controller determines from the data attribute of the data written in the flash memory In the data storage duration corresponding to each data attribute, the data storage duration is selected, and the refresh operation is performed on the data written in the flash memory according to the selected data storage duration and the write speed corresponding to the cold data.
  4. 如权利要求3所述的方法,其特征在于,所述SSD控制器根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作,包括:The method of claim 3, wherein the SSD controller performs the write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed, including:
    所述SSD控制器根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并The SSD controller writes data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information The page number including the page, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the data written on the page Time; and
    在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
    所述SSD控制器根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作,包括:The SSD controller performs a refresh operation on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
    针对任一种数据属性,所述SSD控制器基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页; For any data attribute, the SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data or the last write data in the expiration time queue information corresponding to the data attribute. The page number of the page, the OOB information of the page in which the data is written in the flash memory, and the selected data storage duration, and the page that needs to perform the refresh operation is determined;
    所述SSD控制器根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。The SSD controller performs a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, records the OOB information of the refreshed page, and updates the invalidation time queue information corresponding to the cold data.
  5. 如权利要求1或2所述的方法,其特征在于,所述SSD控制器根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:The method according to claim 1 or 2, wherein the SSD controller performs a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, including:
    所述SSD控制器根据确定的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并The SSD controller writes data to the flash memory in units of pages according to the determined write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information The page number including the page, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the data written on the page Time; and
    在向所述闪存中的任一页写入数据后,更新所述SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;Updating the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
    所述SSD控制器根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:The SSD controller performs a refresh operation on the data written in the flash memory according to the determined data storage duration and the determined write speed, including:
    所述SSD控制器基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页;The SSD controller is based on a preset refresh period, according to the page number of the page of the earliest written data in the expiration time queue information or the page number of the page of the last write data, writing in the flash memory The OOB information of the page into which the data is entered and the determined duration of the data retention, and the page that needs to perform the refresh operation;
    所述SSD控制器根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。The SSD controller performs a refresh operation on the determined page that needs to perform a refresh operation according to the determined write speed, records OOB information of the refreshed page, and updates the invalidation time queue information.
  6. 如权利要求4或5所述的方法,其特征在于,所述SSD控制器根据失效时间队列信息中所述最早写入数据的一页的页号和最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:The method according to claim 4 or 5, wherein said SSD controller determines a page number of a page of said earliest written data and a page number of a page of which data was last written based on the expiration time queue information The OOB information of the page in which the data is written in the flash memory and the length of the data storage period, and the page that needs to perform the refresh operation, including:
    所述SSD控制器根据所述最早写入数据的一页的页号,在所述闪存中查 找对应所述最早写入数据的一页的OOB信息;The SSD controller checks in the flash memory according to a page number of a page of the earliest written data Finding OOB information corresponding to a page of the earliest written data;
    所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the earliest written data according to a time, a data saving duration, and a current time of the data written in the page included in the found OOB information;
    若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
    若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
    以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. OOB information on the next page, and
    根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
  7. 如权利要求4或5所述的方法,其特征在于,所述SSD控制器根据失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:The method according to claim 4 or 5, wherein said SSD controller determines a page number of a page of said earliest written data or a page number of a page of which data was last written based on the expiration time queue information The OOB information of the page in which the data is written in the flash memory and the length of the data storage period, and the page that needs to perform the refresh operation, including:
    所述SSD控制器根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;The SSD controller searches for, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
    所述SSD控制器根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining, by the SSD controller, whether to perform a refresh operation on a page of the most recently written data according to a time, a data storage duration, and a current time of the data written in the page included in the found OOB information;
    若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作; If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
    若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
    以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and
    根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
  8. 一种数据写入装置,其特征在于,包括:A data writing device, comprising:
    确定模块,用于根据当前对固态硬盘SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;a determining module for respectively performing a program/erase P/E count performed on each flash block in the flash memory of the solid state hard disk SSD, and a preset P/E number range corresponding to the write speed and the data storage duration respectively Relationship, determine the write speed and data retention time;
    执行模块,用于根据所述确定模块确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并An execution module, configured to perform a write operation other than the refresh operation on the flash memory of the SSD according to the write speed determined by the determining module, and
    根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed; the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
  9. 如权利要求8所述的装置,其特征在于,所述执行模块具体用于:The apparatus according to claim 8, wherein the execution module is specifically configured to:
    在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执行写操作;或,After receiving the write request sent by the host, performing a write operation on the flash memory of the SSD according to the write request; or
    在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。After determining that the amount of blank flash blocks in the flash memory is below the set threshold in the flash memory, valid data in the flash block containing the invalid data is written into the blank flash page.
  10. 如权利要求8或9所述的装置,其特征在于,所述确定模块具体用于:The device according to claim 8 or 9, wherein the determining module is specifically configured to:
    根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长; 其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率;Determining a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute; The corresponding relationship table records a correspondence between a preset P/E number range and a write speed and a data storage duration; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than the The frequency of access to cold data;
    所述执行模块具体用于根据以下步骤执行所述写操作:根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;The execution module is specifically configured to perform the write operation according to the following steps: a data attribute of data to be written into the flash memory according to the write operation except the refresh operation, and a write speed corresponding to each determined data attribute Selecting a write speed and performing a write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed;
    所述执行模块具体用于根据以下步骤执行所述刷新操作:根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。The execution module is specifically configured to perform the refresh operation according to the following steps: according to the data attribute of the data written in the flash memory, select a data storage duration from the determined data storage duration corresponding to each data attribute, according to the selected The data storage duration and the write speed corresponding to the cold data perform a refresh operation on the data written to the flash memory.
  11. 如权利要求10所述的装置,其特征在于,所述执行模块具体用于根据以下步骤执行所述写操作:The apparatus according to claim 10, wherein the execution module is specifically configured to perform the write operation according to the following steps:
    根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
    在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
    所述执行模块具体用于根据以下步骤执行所述刷新操作:The execution module is specifically configured to perform the refresh operation according to the following steps:
    针对任一种数据属性,基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页; For any data attribute, based on the preset refresh period, the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, The OOB information of the page in which the data is written in the flash memory and the selected data storage duration determine the page on which the refresh operation needs to be performed;
    根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, recording the OOB information of the refreshed page, and updating the invalidation time queue information corresponding to the cold data.
  12. 如权利要求8或9所述的装置,其特征在于,所述执行模块具体用于根据以下步骤执行所述写操作:The apparatus according to claim 8 or 9, wherein the execution module is specifically configured to perform the write operation according to the following steps:
    根据确定的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the determined write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
    在向所述闪存中的任一页写入数据后,更新所述SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;Updating the expiration time queue information maintained by the SSD controller after writing data to any page in the flash memory; the expiration time queue information includes a page that was previously written and not updated, and the oldest data is written The page number of one page and the page number of the page on which the data was last written;
    所述执行模块具体用于根据以下步骤执行所述刷新操作:The execution module is specifically configured to perform the refresh operation according to the following steps:
    基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页;Determining, according to the preset refresh period, a page number of a page of the earliest written data in the expiration time queue information or a page number of a page of the last write data, a page of the data written in the flash memory The OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
    根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
  13. 如权利要求11或12所述的装置,其特征在于,所述执行模块具体用于:The device according to claim 11 or 12, wherein the execution module is specifically configured to:
    根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
    根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the earliest written data according to the time when the data is written on the page, the data saving duration, and the current time included in the found OOB information;
    若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作; If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
    若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
    以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. OOB information on the next page, and
    根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
  14. 如权利要求11或12所述的装置,其特征在于,所述执行模块具体用于:根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;The apparatus according to claim 11 or 12, wherein the execution module is configured to: search for the most recent write in the flash memory according to a page number of a page of the most recently written data OOB information of a page into the data;
    根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the most recently written data according to the time when the data is written on the page, the data storage duration, and the current time included in the found OOB information;
    若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
    若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作:If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
    以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and
    根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。 Whether the refresh operation of the previous page needs to be performed is determined according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration, and the current time.
  15. 一种数据写入装置,其特征在于,该装置包括处理器、存储器和总线,所述存储器存储执行指令,当所述装置运行时,所述处理器与所述存储器之间通过总线通信,所述处理器执行所述执行指令使得所述装置执行如下方法:A data writing device, comprising: a processor, a memory and a bus, wherein the memory stores execution instructions, and when the device is running, the processor communicates with the memory through a bus, Executing the execution instruction by the processor causes the apparatus to perform the following method:
    根据当前对固态硬盘SSD的闪存中的每个闪存块平均执行的编程/擦除P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长;The write speed is determined according to the current program/erase P/E times performed on each flash block in the flash memory of the solid state drive SSD, and the preset P/E number range respectively corresponding to the write speed and the data save duration. And the length of time the data is saved;
    根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,并Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, and
    根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作;所述刷新操作是将所述闪存中存储时间超过所述数据保存时长的数据从最近一次写入的位置重新写入到所述闪存中的其它位置。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed; the refresh operation is to write the data stored in the flash memory longer than the data save duration from the last write The location is rewritten to other locations in the flash memory.
  16. 如权利要求15所述的装置,其特征在于,所述处理器执行的所述方法中,对所述SSD的闪存执行除刷新操作外的写操作,包括:The device according to claim 15, wherein in the method executed by the processor, performing a write operation other than a refresh operation on the flash memory of the SSD includes:
    在接收到主机发送的写请求后,根据所述写请求,对所述SSD的闪存执行写操作;或,After receiving the write request sent by the host, performing a write operation on the flash memory of the SSD according to the write request; or
    在确定闪存中空白的闪存块数量在所述闪存中所占比率低于设定阈值后,将包含无效数据的闪存块中的有效数据写入到空白的闪存页中。After determining that the amount of blank flash blocks in the flash memory is below the set threshold in the flash memory, valid data in the flash block containing the invalid data is written into the blank flash page.
  17. 如权利要求15或16所述的装置,其特征在于,所述处理器执行的所述方法中,根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及预设的P/E次数范围分别与写速度和数据保存时长的对应关系,确定写速度和数据保存时长,包括:The apparatus according to claim 15 or 16, wherein said method executed by said processor is based on a current average of P/E times performed on each of said flash blocks in said flash memory, and a preset The correspondence between the P/E frequency range and the writing speed and the data saving duration respectively determines the writing speed and the data saving duration, including:
    根据当前对所述闪存中的每个闪存块平均执行的P/E次数,以及每种数据属性所对应的对应关系表,确定每种数据属性对应的写速度和数据保存时长;其中,所述对应关系表中记录有预设的P/E次数范围与写速度和数据保存时长的对应关系;所述数据属性包括热数据和冷数据,所述热数据的访问频率大于所述冷数据的访问频率;Determining a write speed and a data retention duration corresponding to each data attribute according to a current P/E number of times performed on each flash block in the flash memory and a correspondence table corresponding to each data attribute; wherein Corresponding relationship between the preset P/E number range and the writing speed and the data saving duration is recorded in the correspondence table; the data attribute includes hot data and cold data, and the access frequency of the hot data is greater than the access of the cold data. frequency;
    根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包 括:根据所述除刷新操作外的写操作所需要写入到闪存中的数据的数据属性,从确定的每种数据属性对应的写速度中,选择写速度,并根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作;Performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed, the package Including: according to the data attribute of the data that needs to be written into the flash memory by the write operation other than the refresh operation, selecting the write speed from the determined write speed corresponding to each data attribute, and according to the selected write speed, The flash memory of the SSD performs the write operation except the refresh operation;
    根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:根据写入到闪存中的数据的数据属性,从确定的每种数据属性对应的数据保存时长中,选择数据保存时长,根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作。Performing a refresh operation on the data written in the flash memory according to the determined data save duration and the determined write speed, including: saving the data duration corresponding to each of the determined data attributes according to the data attribute of the data written in the flash memory In the middle, the data storage duration is selected, and a refresh operation is performed on the data written in the flash memory according to the selected data storage duration and the write speed corresponding to the cold data.
  18. 如权利要求17所述的装置,其特征在于,所述处理器执行的所述方法中,根据选择的写速度,对所述SSD的闪存执行所述除刷新操作外的写操作,包括:The device according to claim 17, wherein in the method executed by the processor, performing a write operation other than the refresh operation on the flash memory of the SSD according to the selected write speed comprises:
    根据选择的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the selected write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
    在向所述闪存中的任一页写入数据后,根据写入的数据的数据属性,更新所述SSD控制器维护的该数据属性对应的失效时间队列信息;所述失效时间队列信息包括之前写入具有该数据属性的数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information corresponding to the data attribute maintained by the SSD controller according to the data attribute of the written data; the expiration time queue information includes The page number of the page in which the data with the data attribute is written and not updated, the page number of the page on which the data was first written, and the page number of the page on which the data was last written;
    根据选择的数据保存时长以及冷数据对应的写速度,对写入到闪存中的数据执行刷新操作,包括:The refresh operation is performed on the data written in the flash memory according to the selected data save duration and the write speed corresponding to the cold data, including:
    针对任一种数据属性,基于预设的刷新周期,根据该数据属性对应的失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及选择的数据保存时长,确定需要执行刷新操作的页;For any data attribute, based on the preset refresh period, the page number of the page of the earliest written data or the page number of the page of the most recent write data in the expiration time queue information corresponding to the data attribute, The OOB information of the page in which the data is written in the flash memory and the selected data storage duration determine the page on which the refresh operation needs to be performed;
    根据冷数据对应的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述冷数据对应的失效时间队列 信息。Performing a refresh operation on the determined page that needs to perform the refresh operation according to the write speed corresponding to the cold data, recording the OOB information of the refreshed page, and updating the invalidation time queue corresponding to the cold data. information.
  19. 如权利要求15或16所述的装置,其特征在于,所述处理器执行的所述方法中,根据确定的写速度,对所述SSD的闪存执行除刷新操作外的写操作,包括:The device according to claim 15 or 16, wherein in the method executed by the processor, performing a write operation other than the refresh operation on the flash memory of the SSD according to the determined write speed comprises:
    根据确定的写速度,以页为单位向所述闪存中写入数据;针对写入数据的每一页,在该页中记录该页的带外OOB信息,所述OOB信息包括该页的页号、与该页在写入顺序上相邻的前一页的页号、与该页在写入顺序上相邻的后一页的页号和在该页写入数据的时间;并Writing data to the flash memory in units of pages according to the determined write speed; for each page of the write data, the out-of-band OOB information of the page is recorded in the page, the OOB information including the page of the page Number, the page number of the previous page adjacent to the page in the write order, the page number of the next page adjacent to the page in the write order, and the time at which the data is written on the page;
    在向所述闪存中的任一页写入数据后,更新SSD控制器维护的失效时间队列信息;所述失效时间队列信息包括之前写入数据且未更新的页中,最早写入数据的一页的页号和最近一次写入数据的一页的页号;After writing data to any page in the flash memory, updating the expiration time queue information maintained by the SSD controller; the dead time queue information includes one of the pages that were previously written and not updated, and the first one of which is written The page number of the page and the page number of the page on which the data was last written;
    根据确定的数据保存时长以及确定的写速度,对写入到闪存中的数据执行刷新操作,包括:Performing a refresh operation on the data written to the flash memory according to the determined data save duration and the determined write speed, including:
    基于预设的刷新周期,根据所述失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及确定的数据保存时长,确定需要执行刷新操作的页;Determining, according to the preset refresh period, a page number of a page of the earliest written data in the expiration time queue information or a page number of a page of the last write data, a page of the data written in the flash memory The OOB information and the determined data storage duration determine the page on which the refresh operation needs to be performed;
    根据确定的写速度,对确定的所述需要执行刷新操作的页执行刷新操作,记录刷新后的页的OOB信息,并更新所述失效时间队列信息。And performing a refresh operation on the determined page that needs to perform the refresh operation according to the determined write speed, recording the OOB information of the refreshed page, and updating the invalidation time queue information.
  20. 如权利要求18或19所述的装置,其特征在于,所述处理器执行的所述方法中,根据失效时间队列信息中所述最早写入数据的一页的页号和最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:The apparatus according to claim 18 or 19, wherein in said method executed by said processor, the page number of the page of the earliest written data and the most recent write data are based on the expiration time queue information. The page number of one page, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation, including:
    根据所述最早写入数据的一页的页号,在所述闪存中查找对应所述最早写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the earliest written data according to a page number of a page of the earliest written data;
    根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最早写入数据的一页执行刷新操作; Determining whether it is necessary to perform a refresh operation on a page of the earliest written data according to the time when the data is written on the page, the data storage duration, and the current time included in the found OOB information;
    若确定不需要对所述最早写入数据的一页执行刷新操作,则结束当前周期的刷新操作;If it is determined that it is not necessary to perform a refresh operation on the page of the earliest written data, the refresh operation of the current cycle is ended;
    若确定需要对所述最早写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出不需要执行刷新操作的页或直到确定出需要对所述最近一次写入数据的一页执行刷新操作:If it is determined that a refresh operation needs to be performed on one page of the earliest written data, the following steps are repeatedly performed until it is determined that a page that does not need to perform a refresh operation is determined or until it is determined that a page of the most recently written data needs to be executed Refresh operation:
    以当前确定出的需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的后一页的页号,在所述闪存中查找该后一页的OOB信息,并Taking the currently determined page that needs to perform the refresh operation as the current page, and searching for the page in the flash memory according to the page number of the next page adjacent to the current page in the write order included in the OOB information of the current page. OOB information on the next page, and
    根据查找到的该后一页的OOB信息中包括的在该后一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该后一页执行刷新操作。Based on the found time of the data written in the next page included in the OOB information of the next page, the data storage duration and the current time, it is determined whether a refresh operation needs to be performed on the subsequent page.
  21. 如权利要求18或19所述的装置,其特征在于,所述处理器执行的所述方法中,根据失效时间队列信息中所述最早写入数据的一页的页号或最近一次写入数据的一页的页号、所述闪存中写入数据的页的OOB信息以及所述数据保存时长,确定需要执行刷新操作的页,包括:The apparatus according to claim 18 or 19, wherein in said method executed by said processor, the page number of the page of the earliest written data in the expired time queue information or the most recent write data is used. The page number of one page, the OOB information of the page in which the data is written in the flash memory, and the length of the data storage period, and the page that needs to perform the refresh operation, including:
    根据所述最近一次写入数据的一页的页号,在所述闪存中查找对应所述最近一次写入数据的一页的OOB信息;Searching, in the flash memory, OOB information corresponding to a page of the most recently written data according to a page number of a page of the most recently written data;
    根据查找到的OOB信息中包括的在该页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对所述最近一次写入数据的一页执行刷新操作;Determining whether it is necessary to perform a refresh operation on a page of the most recently written data according to the time when the data is written on the page, the data storage duration, and the current time included in the found OOB information;
    若确定需要对所述最近一次写入数据的一页执行刷新操作,则确定需要对写入顺序在所述最近一次写入数据的一页之前的所有未更新的页都执行刷新操作;If it is determined that a refresh operation needs to be performed on a page of the most recently written data, it is determined that a refresh operation needs to be performed on all unupdated pages before the one page of the most recent write data in the write order;
    若确定不需要对所述最近一次写入数据的一页执行刷新操作,则重复执行以下步骤,直到确定出需要执行刷新操作的页,则确定需要对写入顺序在确定出的需要执行刷新操作的页之前的所有页都执行刷新操作,或直到确定不需要对所述最早写入数据的一页执行刷新操作: If it is determined that it is not necessary to perform a refresh operation on the page of the most recently written data, the following steps are repeatedly performed until it is determined that the page requiring the refresh operation needs to be performed, and it is determined that the refresh operation needs to be performed in the determined write order. A refresh operation is performed on all pages before the page, or until it is determined that a refresh operation is not required on the page of the earliest written data:
    以当前确定出的不需要执行刷新操作的页作为当前页,根据当前页的OOB信息中包括的与该当前页在写入顺序上相邻的前一页的页号,在所述闪存中查找该前一页的OOB信息,并根据查找到的该前一页的OOB信息中包括的在该前一页写入数据的时间、所述数据保存时长和当前时间,判断是否需要对该前一页执行刷新操作。 Taking the currently determined page that does not need to perform the refresh operation as the current page, searching in the flash memory according to the page number of the previous page adjacent to the current page in the writing order included in the OOB information of the current page. The OOB information of the previous page, and according to the found time of the data written in the previous page included in the OOB information of the previous page, the data storage duration and the current time, it is determined whether the previous one needs to be The page performs a refresh operation.
PCT/CN2015/080779 2014-06-06 2015-06-04 Method and device for writing data WO2015185002A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410251232.4A CN105242871B (en) 2014-06-06 2014-06-06 A kind of method for writing data and device
CN201410251232.4 2014-06-06

Publications (1)

Publication Number Publication Date
WO2015185002A1 true WO2015185002A1 (en) 2015-12-10

Family

ID=54766176

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/080779 WO2015185002A1 (en) 2014-06-06 2015-06-04 Method and device for writing data

Country Status (2)

Country Link
CN (1) CN105242871B (en)
WO (1) WO2015185002A1 (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017215137A1 (en) * 2016-06-14 2017-12-21 杭州海康威视数字技术股份有限公司 Data processing method, device, and system
CN110858121A (en) * 2018-08-23 2020-03-03 阿里巴巴集团控股有限公司 Scheduling method and device for background operation
WO2020149948A1 (en) * 2019-01-16 2020-07-23 Western Digital Technologies, Inc. System and method for storage system property deviation
CN112506445A (en) * 2020-12-29 2021-03-16 杭州电子科技大学 Partition proportion self-adaptive adjusting method of homogeneous hybrid solid state disk
CN114510198A (en) * 2022-02-16 2022-05-17 北京中电华大电子设计有限责任公司 Method for improving erasing and writing efficiency of NVM
CN116302633A (en) * 2023-01-18 2023-06-23 北京得瑞领新科技有限公司 Logical unit failure management method, device, medium and equipment of flash memory
TWI842248B (en) * 2021-12-02 2024-05-11 大陸商長江存儲科技有限責任公司 Memory device, memory system, and program operating method thereof
US12093535B2 (en) 2021-12-02 2024-09-17 Yangtze Memory Technologies Co., Ltd. Memory device, memory system, and program operation method thereof

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
SG11201806099WA (en) * 2016-02-19 2018-08-30 Huawei Tech Co Ltd Method and apparatus for accessing flash memory device
WO2017152392A1 (en) * 2016-03-09 2017-09-14 华为技术有限公司 Flash memory device refreshing method and apparatus
TWI576699B (en) * 2016-03-31 2017-04-01 慧榮科技股份有限公司 A method for recording an using time of a data block and device thereof
CN107436726B (en) * 2016-05-26 2020-09-08 华为技术有限公司 Data writing method, storage controller, computing device and storage device
CN107783725A (en) * 2016-08-30 2018-03-09 南京中兴新软件有限责任公司 The method, apparatus and nonvolatile memory of data storage
CN106558346B (en) * 2016-11-16 2020-04-07 杭州华澜微电子股份有限公司 Method and device for calculating service life of solid state disk based on RAIM framework
WO2018214013A1 (en) * 2017-05-23 2018-11-29 深圳大学 Data writing method and device based on three-dimensional flash memory
CN107229419B (en) * 2017-05-23 2020-05-12 深圳大学 Data writing method and device based on three-dimensional flash memory
CN107273056A (en) * 2017-06-30 2017-10-20 郑州云海信息技术有限公司 A kind of date storage method and device of Ceph file system
CN107678692B (en) * 2017-10-09 2020-09-22 苏州浪潮智能科技有限公司 IO flow rate control method and system
CN107832008A (en) * 2017-10-25 2018-03-23 记忆科技(深圳)有限公司 A kind of method of raising SSD write performance uniformity
CN107832012A (en) * 2017-11-03 2018-03-23 重庆大学 A kind of method that online mining flash memory system journey difference phenomenon optimization refreshes
CN108804025B (en) * 2018-03-07 2021-10-01 深圳忆联信息系统有限公司 Method for reducing retention errors of flash memory and solid state disk
CN109032503B (en) * 2018-06-14 2021-04-16 浙江大华存储科技有限公司 Flow control method and device for data migration bandwidth of solid state disk
CN109032505A (en) * 2018-06-26 2018-12-18 深圳忆联信息系统有限公司 Data read-write method, device, computer equipment and storage medium with timeliness
CN109119108A (en) * 2018-08-15 2019-01-01 杭州阿姆科技有限公司 A method of improving the Nand service life
CN109582224A (en) * 2018-11-12 2019-04-05 哈尔滨工业大学 A kind of NAND Flash memory reliability optimization method based on self- recoverage effect
CN109582240B (en) * 2018-12-03 2022-02-18 郑州云海信息技术有限公司 Data moving method and related equipment thereof
CN114303123A (en) * 2019-08-27 2022-04-08 华为技术有限公司 Data storage method and device of solid state disk and Solid State Disk (SSD)
CN113467703B (en) * 2020-03-31 2024-06-14 杭州海康存储科技有限公司 Storage medium management method, device and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110037821A1 (en) * 2009-08-17 2011-02-17 Xerox Corporation Erase decoupled from writing for erasable paper
CN102937935A (en) * 2012-09-04 2013-02-20 邹粤林 Solid state storage system, controller and method for prolonging service life of flash memory chips
CN103019615A (en) * 2012-07-19 2013-04-03 中国人民解放军国防科学技术大学 Method for increasing durability of flash memory solid state disk on basis of load control
CN103677653A (en) * 2012-09-21 2014-03-26 联想(北京)有限公司 Data processing method and electronic device based on solid state disk (SSD)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7154153B1 (en) * 1997-07-29 2006-12-26 Micron Technology, Inc. Memory device
US8737141B2 (en) * 2010-07-07 2014-05-27 Stec, Inc. Apparatus and method for determining an operating condition of a memory cell based on cycle information
JP2013143155A (en) * 2012-01-06 2013-07-22 Powerchip Technology Corp Nonvolatile semiconductor memory device and write-in method thereof
CN103337257B (en) * 2013-06-20 2017-05-24 深圳市瑞耐斯技术有限公司 NAND flash memory equipment and operation method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110037821A1 (en) * 2009-08-17 2011-02-17 Xerox Corporation Erase decoupled from writing for erasable paper
CN103019615A (en) * 2012-07-19 2013-04-03 中国人民解放军国防科学技术大学 Method for increasing durability of flash memory solid state disk on basis of load control
CN102937935A (en) * 2012-09-04 2013-02-20 邹粤林 Solid state storage system, controller and method for prolonging service life of flash memory chips
CN103677653A (en) * 2012-09-21 2014-03-26 联想(北京)有限公司 Data processing method and electronic device based on solid state disk (SSD)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10545808B2 (en) 2016-06-14 2020-01-28 Hangzhou Hikvision Digital Technology Co., Ltd. Method, apparatus and system for processing data
WO2017215137A1 (en) * 2016-06-14 2017-12-21 杭州海康威视数字技术股份有限公司 Data processing method, device, and system
CN110858121B (en) * 2018-08-23 2023-07-11 阿里巴巴集团控股有限公司 Background operation scheduling method and device
CN110858121A (en) * 2018-08-23 2020-03-03 阿里巴巴集团控股有限公司 Scheduling method and device for background operation
WO2020149948A1 (en) * 2019-01-16 2020-07-23 Western Digital Technologies, Inc. System and method for storage system property deviation
US10725705B1 (en) 2019-01-16 2020-07-28 Western Digital Technologies, Inc. System and method for storage system property deviation
CN112506445A (en) * 2020-12-29 2021-03-16 杭州电子科技大学 Partition proportion self-adaptive adjusting method of homogeneous hybrid solid state disk
CN112506445B (en) * 2020-12-29 2022-05-20 杭州电子科技大学 Partition proportion self-adaptive adjustment method for homogeneous hybrid solid state disk
US12093535B2 (en) 2021-12-02 2024-09-17 Yangtze Memory Technologies Co., Ltd. Memory device, memory system, and program operation method thereof
TWI842248B (en) * 2021-12-02 2024-05-11 大陸商長江存儲科技有限責任公司 Memory device, memory system, and program operating method thereof
CN114510198A (en) * 2022-02-16 2022-05-17 北京中电华大电子设计有限责任公司 Method for improving erasing and writing efficiency of NVM
CN114510198B (en) * 2022-02-16 2023-06-30 北京中电华大电子设计有限责任公司 Method for improving erasing and writing efficiency of NVM (non-volatile memory)
CN116302633B (en) * 2023-01-18 2024-04-09 北京得瑞领新科技有限公司 Logical unit failure management method, device, medium and equipment of flash memory
CN116302633A (en) * 2023-01-18 2023-06-23 北京得瑞领新科技有限公司 Logical unit failure management method, device, medium and equipment of flash memory

Also Published As

Publication number Publication date
CN105242871A (en) 2016-01-13
CN105242871B (en) 2018-06-05

Similar Documents

Publication Publication Date Title
WO2015185002A1 (en) Method and device for writing data
US11704239B2 (en) Garbage collection method for storage medium, storage medium, and program product
TWI398770B (en) Data accessing method for flash memory and storage system and controller using the same
JP6817318B2 (en) Methods and equipment for accessing flash memory devices
TWI425357B (en) Method for performing block management, and associated memory device and controller thereof
US9747202B1 (en) Storage module and method for identifying hot and cold data
US9235502B2 (en) Systems and methods for configuring non-volatile memory
US9298578B2 (en) Method and apparatus for power loss recovery in a flash memory-based SSD
US10936203B2 (en) Memory storage device and system employing nonvolatile read/write buffers
US20130060991A1 (en) Solid state drive and garbage collection control method thereof
CN106909323B (en) Page caching method suitable for DRAM/PRAM mixed main memory architecture and mixed main memory architecture system
JP5874525B2 (en) Control device, storage device, and storage control method
CN111880723A (en) Data storage device and data processing method
TWI450271B (en) Method for managing a plurality of blocks of a flash memory, and associated memory device and controller thereof
TW202101230A (en) A data storage device and a data processing method
US20150205538A1 (en) Storage apparatus and method for selecting storage area where data is written
US8671257B2 (en) Memory system having multiple channels and method of generating read commands for compaction in memory system
US10776265B2 (en) Data storage devices and data processing methods
KR20220052353A (en) Garbage collection of memory components with tuned parameters
CN111758086B (en) Method for refreshing mapping table of SSD
WO2019136969A1 (en) High-efficiency method for mapping physical position to logical mapping position
CN113918485B (en) Method, device, equipment and storage medium for preventing flash memory data from being lost
KR101353967B1 (en) Data process method for reading/writing data in non-volatile memory cache having ring structure
KR20100099888A (en) A method for log management in flash memory-based database systems
US12130743B2 (en) Method and apparatus for performing data access management of memory device in predetermined communications architecture with aid of unbalanced table search

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15803163

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15803163

Country of ref document: EP

Kind code of ref document: A1