Data storage device

CN115469802BActive Publication Date: 2026-09-25BEIJING ESWIN COMPUTING TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202211054673.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-31
Publication Date
2026-09-25
Estimated Expiration
2042-08-31

AI Technical Summary

Technical Problem

但在实际应用中,为了提高读写效率,常规的flash存储器一般会借助于与之匹配的静态随机存取存储器进行数据的快速写入,这就使得当出现掉电的情况时,待写入数据在刚写入到静态随机存取存储器后,会因静态随机存取存储器掉电失效丢失掉这部分刚写入的数据,从而导致数据存储过程中存在掉电丢失的问题

Benefits of technology

[0026]本申请提供一种数据存储设备,本设备包括第一存储区、第二存储区以及控制器;其中,所述第一存储区为基于静态随机存取存储器SRAM,所述第二存储区为基于flash构建的存储区;所述第二存储区中包含至少一个存储块,每个所述存储块是按照预设规则以字节为单位设置的存储单元;所述控制器用于当检测到待写入的第一数据时,若确定所述第一存储区中未存在与所述第一数据相同的数据,则将所述第一数据写入至所述第二存储区的目标存储块中。这样在通过本申请的设备进行数据存储的过程中,可以基于控制器确定存在待写入的第一数据时,且该第一数据在第一存储区中并未存在,将该第一数据写入到第二存储区中,可以确保在遇到掉电的情况下,第一数据仍然会在第二存储区中保持存在,而不会如第一存储区中的数据在掉电时丢失,这就避免了在写入数据的过程中,一旦出现掉电情况将第一数据写入到第一存储区而导致出现数据丢失的问题,避免了现有技术第一数据写入到第一存储区后因掉电而使刚写入的第一数据丢失的问题。解决了flash存储器因与之匹配的静态随机存取存储器SRAM中的数据因掉电而丢失,从而影响数据存储的问题。同时,由于本申请中的第二存储区中设置存储块的方式是以目标字节数设置的存储块,这不同于以往的以千字节为单位的原存储块,这样就能够在原存储块大小的存储空间内实现对多个不同数据的分别管理的效果,避免当常规方式一旦将不同数据存储在一个原存储块时,一旦进行擦除操作,很可能将整个原存储块对应的数据同时清除的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115469802B_ABST
    Figure CN115469802B_ABST
Patent Text Reader

Abstract

The application discloses a data storage device, and relates to the technical field of storage.The device comprises a first storage area, a second storage area and a controller, wherein the first storage area is based on static random access memory (SRAM), and the second storage area is a storage area based on flash; the second storage area comprises at least one storage block, and each storage block is a storage unit set in byte units according to a preset rule; and the controller is used for, when detecting first data to be written, writing the first data into a target storage block of the second storage area if it is determined that the same data as the first data does not exist in the first storage area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and more particularly to a data storage device. Background Technology

[0002] With technological advancements, storage technology has also progressed. Currently, to ensure good random access performance while remaining economical, conventional technologies typically utilize flash memory (Flash EEPROM Memory, or simply flash memory) to meet random read / write performance requirements. Flash memory is a type of storage chip whose data can be modified through specific programs. In the electronics and semiconductor fields, "flash" often refers to Flash Memory, commonly known as "flash storage." However, in practical applications, to improve read / write efficiency, conventional flash memory typically relies on a matching static random access memory (SRAM) for fast data writing. This means that in the event of a power outage, the data to be written to the SRAM may be lost due to the SRAM's failure after power loss, resulting in data loss during data storage. Summary of the Invention

[0003] This application provides a data storage device, the main purpose of which is to implement a data storage device that avoids the loss of newly written data in the event of a power outage.

[0004] To address the aforementioned technical problems, this application provides the following technical solutions:

[0005] In a first aspect, this application provides a data storage device, the device comprising:

[0006] First storage area, second storage area, and controller;

[0007] The first storage area is based on static random access memory (SRAM), and the second storage area is based on flash memory.

[0008] The second storage area contains at least one storage block, and each storage block is a storage unit set up in bytes according to a preset rule;

[0009] The controller is configured to, when detecting first data to be written, write the first data to the target storage block of the second storage area if it determines that there is no data identical to the first data in the first storage area.

[0010] Optionally, the second storage area includes a backup partition, the storage capacity of which is equal to the storage capacity of at least one EEPROM memory.

[0011] Optionally, the controller is further configured to write the data in the first storage area to the backup partition when the power failure command is detected.

[0012] Optionally, the second storage area further includes a frequent recording partition and a non-frequent recording partition, each of which contains at least one of the storage blocks;

[0013] The frequently recorded partition is used to store data that users frequently use, while the infrequently recorded partition is used to record historical data.

[0014] Optionally, the frequently recorded partition further includes at least one storage page, which includes at least one of the storage blocks; wherein each storage page is provided with a storage page identifier, which is used to indicate whether data is stored in the storage page;

[0015] The controller is further configured to select, based on the storage page identifier, a storage page that does not contain data from among the plurality of storage pages as a target storage page, and select the target storage block from the target storage page.

[0016] Optionally, the controller is further configured to back up the second data to the infrequent recording partition when the target storage block contains the second data, and write the first data to the target storage block after performing an erase operation on the target storage block.

[0017] Optionally, the infrequent recording partition further includes at least one storage page, each storage page containing at least one of the storage blocks; each storage page is provided with a storage page identifier;

[0018] The controller is further configured to, in the infrequent recording partition, select a storage page that has not recorded data from a plurality of storage pages as a backup storage page based on the storage page identifier, select a backup storage block from a plurality of storage blocks in the backup storage page, and write the second data to the backup storage block.

[0019] Optionally, the storage pages in both the frequent recording partition and the infrequent recording partition are arranged sequentially according to their addresses;

[0020] The controller is further configured to, according to the address order, back up the data in the adjacent storage pages of the target storage page to a non-frequent recording partition when it is determined that data is recorded in the adjacent storage pages of the target storage page; and, when data is recorded in the adjacent storage pages of the backup storage page, back up the data of the adjacent storage pages of the backup storage page to the remaining storage pages in the non-frequent recording partition.

[0021] Optionally, the target storage block includes a data storage block and a verification block;

[0022] The controller is used to write the first data into the data storage block and add a verification identifier to the verification block. The verification identifier is information for verifying the integrity of the first data when it is read from the storage block.

[0023] Optionally, the target storage block further includes an address record block and a data length block; the capacity of the data storage block is greater than the sum of the capacities of the address record block, the data length block, and the verification block.

[0024] The controller is further configured to add address information to the address record block of the storage block according to the position of the first data in the storage block, and add the data length of the written data determined based on the address information to the data length block of the storage block.

[0025] By employing the above-described technical solution, the technical solution provided in this application has at least the following advantages:

[0026] This application provides a data storage device, which includes a first storage area, a second storage area, and a controller. The first storage area is based on Static Random Access Memory (SRAM), and the second storage area is a flash memory-based storage area. The second storage area contains at least one storage block, each storage block being a storage unit configured in bytes according to a preset rule. The controller, when detecting first data to be written, if it determines that no data identical to the first data exists in the first storage area, writes the first data to the target storage block in the second storage area. Thus, during data storage using this device, if the controller determines that first data exists and is not present in the first storage area, writing the first data to the second storage area ensures that the first data will remain in the second storage area even in the event of a power outage, unlike the data in the first storage area which is lost during a power outage. This avoids the problem of data loss during the writing process when the first data is written to the first storage area due to a power outage, and avoids the problem in existing technologies where the newly written first data is lost due to a power outage. This invention solves the problem of data loss in flash memory due to power failure, which affects data storage. Furthermore, because the second storage area in this application uses target byte blocks instead of traditional kilobyte blocks, it allows for separate management of multiple different data sets within the same block size. This avoids the common problem where, in conventional methods, storing different data in a single block results in the complete erasure of the entire block during an erase operation.

[0027] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description

[0028] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of this application are illustrated by way of example and not limitation, with the same or corresponding reference numerals denoteing the same or corresponding parts, wherein:

[0029] Figure 1 This illustration shows a schematic diagram of the composition of a data storage device provided in an embodiment of this application;

[0030] Figure 2This illustration shows a schematic diagram of another data storage device provided in an embodiment of this application;

[0031] Figure 3 This illustration shows a schematic diagram of the composition of another data storage device provided in an embodiment of this application;

[0032] Figure 4 This illustration shows a schematic diagram of the composition of another data storage device provided in an embodiment of this application;

[0033] Figure 4-a This illustration shows a schematic diagram of a data storage device according to an embodiment of the present application storing data;

[0034] Figure 5 This illustration shows a schematic diagram of another data storage device provided in an embodiment of this application;

[0035] Figure 5-a This illustration shows a schematic diagram of another data storage device provided in an embodiment of this application storing data;

[0036] Figure 6 This illustration shows a schematic diagram of a storage block structure in a data storage device according to an embodiment of this application;

[0037] Figure 7 A schematic diagram of a storage block structure in another data storage device provided in an embodiment of this application is shown. Detailed Implementation

[0038] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.

[0039] It should be noted that, unless otherwise stated, the technical or scientific terms used in this application shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains.

[0040] This application provides a data storage device, such as... Figure 1 As shown, the device includes: a first storage area 11, a second storage area 12, and a controller 13;

[0041] Wherein, the first storage area 11 is based on static random access memory (SRAM), and the second storage area 12 is a storage area built on flash memory;

[0042] The second storage area 12 contains at least one storage block 14, each of which is a storage unit set up in bytes according to a preset rule;

[0043] When the controller 13 detects the first data to be written, if it determines that there is no data identical to the first data in the first storage area 11, it writes the first data to the target storage block of the second storage area 12.

[0044] Since data writing is generally based on user-issued write operation commands, in this embodiment, when storing data, the controller first needs to determine whether a write operation has occurred before data storage, i.e., to detect the write operation command. When a write operation command is detected, it means that the user needs to write some data to the storage device; that is, there is first data to be written. At this point, it is necessary to determine which data(s) need to be written based on the write operation command, i.e., to determine the first data. In this embodiment, the form, type, and quantity of the first data are not limited and can be determined according to the user's actual situation. In this embodiment, the controller can be understood as a control module in the data storage device, used to control the storage location and storage method of the input data.

[0045] When the controller determines that there is first data that needs to be written, it can further determine whether the first data is new or old data. At this time, it can be identified based on the first storage area 11. Since the first storage area 11 is a storage area built based on SRAM, the data in this storage area is data that users frequently need to read and write, that is, old data. If the first data is stored in the first storage area 11, then this data is very likely to be previously used data, not new data.

[0046] If it is determined that there is no data identical to the first data in the first storage area 11, it means that the first data was not recorded in the first storage area 11. The first data is very likely new data that needs to be stored. In the event of a power failure, the first data may be lost before it is written to the second storage area 12. Therefore, the controller needs to control the first data to be written directly to the second storage area 12. In this way, based on the characteristics of flash memory, the first data will be saved by the second storage area 12 even in the event of a power failure, thus avoiding the problem of data loss.

[0047] Meanwhile, in this embodiment, when writing the first data to the second storage area 12, a target storage block is selected from the second storage area 12 for storage. Since the target storage block is a storage block 14 that meets the writing conditions, and the storage block 14 in this embodiment is different from the storage block in a conventional flash memory, in a conventional original storage block, the size of each storage block is between 1kb and severalkb, that is, the storage space is set according to kilobytes (KB). Thus, when the amount of the first data is small each time, in order to realize the function of managing each different data separately, it is necessary to store only one data in each original storage block, which will cause a lot of storage space to be wasted. Once multiple different data are written to one original storage block, once the original storage block needs to be erased, the different data will be eliminated, which will lead to the problem of accidental deletion of data. Therefore, in this embodiment, by setting the storage block 14 to a storage unit of the target byte size, it is possible to form multiple different small storage units within the 1kb or severalkb space of the original storage block. That is to say, the storage block in the second storage area 12 described in this embodiment is set to a storage unit in bytes (B), rather than the traditional storage block in kilobytes (KB). This allows multiple different data to be stored in the space of the original storage block size, and also enables the management of each data, thus saving storage space and avoiding accidental deletion.

[0048] Based on this, this application provides a data storage device. Compared with the prior art, during the data storage process, the device of this application can, based on the controller's determination that there is first data to be written, and that the first data does not exist in the first storage area, write the first data to the second storage area. This ensures that in the event of a power outage, the first data will still exist in the second storage area, unlike the data in the first storage area which would be lost during a power outage. This avoids the problem of data loss caused by writing the first data to the first storage area during the data writing process if a power outage occurs. It also avoids the problem in the prior art where the first data written to the first storage area is lost due to a power outage. Furthermore, it solves the problem that the data in the flash memory is lost due to a power outage, thus affecting data storage. Meanwhile, since the storage blocks in the second storage area of ​​this application are set up in terms of the target number of bytes, which is different from the original storage blocks in terms of kilobytes in the past, it is possible to achieve the effect of separate management of multiple different data within the storage space of the original storage block size. This avoids the problem that when different data are stored in one original storage block in the conventional way, once an erase operation is performed, the data corresponding to the entire original storage block may be deleted at the same time.

[0049] In some embodiments, such as Figure 2 As shown, the second storage area 12 includes a backup partition 121, the storage capacity of which is the storage capacity of at least one EEPROM memory.

[0050] Among them, EEPROM (Electrically Erasable Programmable Read-Only Memory) is a user-modifiable read-only memory that can be erased and reprogrammed (i.e., rewritten) by applying a voltage higher than normal. EEPROM is a type of memory chip that does not lose data after power failure and has good random read / write performance.

[0051] By setting the storage space of backup partition 121 to the storage capacity of at least one EEPROM memory, it is ensured that data loss during power failure is avoided while maintaining the capacity of the EEPROM during the execution of the method of this embodiment, thus achieving a storage method that simulates the characteristics of EEPROM memory. Since EEPROM circuitry is complex and costly, the solution in this embodiment simulates a storage method similar to EEPROM storage, ensuring good random read / write performance and capacity. Therefore, users do not need to consider capacity differences when using the device described in this embodiment to replace EEPROM memory, reducing replacement costs.

[0052] In some embodiments, the controller 13 is further configured to write the data in the first storage area 11 to the backup partition 121 when the power failure command is detected.

[0053] When the controller 13 detects a power failure command, it can write all the data in the first storage area to the backup partition 121. Since the backup partition 121 is also part of the second storage area built from flash, this ensures that even if the entire device loses power, the data originally stored in the first storage area 11 built from SRAM will not be lost, thus ensuring data reliability.

[0054] In some embodiments, such as Figure 3 As shown, the second storage area 12 also includes a frequent recording partition 122 and a non-frequent recording partition 123, and each of the frequent recording partition 122 and the non-frequent recording partition 123 contains at least one of the storage blocks 14.

[0055] The frequently recorded partition 122 is used to store data that users frequently use, while the infrequently recorded partition 123 is used to record historical data.

[0056] In practical applications, the data stored in flash memory can be divided into two types according to the frequency of reading and writing: one is frequently used data, which is data that users often use, and the other is rarely used data, which is historical data. Therefore, in order to facilitate retrieval, these two types of data can be stored in different partitions in the second storage area, namely, frequently recorded partition 122 and infrequently recorded partition 123.

[0057] Based on this, the controller 13 can perform the following steps when writing data to the second storage area: when the second storage area includes frequent recording partitions and infrequent recording partitions, select a target storage block from multiple storage blocks in the frequent recording partitions; when it is determined that no data is stored in the target storage block, write the first data to the target storage block.

[0058] The method of this embodiment ensures that when the second storage area is divided into a frequent recording partition 122 and a non-frequent recording partition 123, a target storage block is selected from multiple storage blocks in the frequent recording partition 122. If the target storage block does not contain any data, the first data is directly written into the target storage block. This achieves the goal of prioritizing data writing to the frequent recording partition during data storage. Since the first data is data to be written based on instructions, it is highly likely that the user will need it at any time. This ensures that when the user subsequently calls and reads the first data again, it can be directly retrieved from the frequent recording partition 122. This achieves the effect of storing frequently used data in the frequent recording partition 122, which is beneficial for fast data retrieval and reading.

[0059] Of course, in practical applications, the process of the controller 13 writing data to the second storage area 12 includes, but is not limited to, the above methods. For example, when the user has a clear instruction indicating that data A is not frequently used data, the controller 13 can also directly write data A to the infrequent recording partition 123 based on the instruction. That is, the controller selects the target storage block from the multiple storage blocks 14 in the infrequent recording partition 123 to store the data A.

[0060] In some embodiments, to further facilitate data storage and management, the second storage area 12 can be further divided into frequent record partitions 122 and infrequent record partitions 123, that is, the storage blocks can be managed in the form of "pages".

[0061] Based on this, such as Figure 4As shown, the frequent recording partition 122 further includes at least one storage page 1221, and the storage page 1221 includes at least one of the storage blocks 14; wherein, each storage page 1221 is provided with a storage page identifier, which is used to indicate whether data is stored in the storage page 1221;

[0062] The controller 13 is further configured to select a storage page 1221 that does not contain data as a target storage page from among the plurality of storage pages 1221 based on the storage page identifier, and select the target storage block from the target storage page.

[0063] In this embodiment, each of the frequently recorded partitions 122 contains at least one storage page 1221; the storage pages 1221 are arranged sequentially according to the writing order, and each storage page 1221 contains at least one storage block 14 and a storage page identifier. The storage page identifier is used to characterize whether the storage page stores data content, that is, the storage page identifier can indicate whether the storage page allows write operations.

[0064] In this way, during the selection of the target storage block, the controller 13 can select a storage page 1221 without stored data content from multiple storage pages 1221 according to the storage page identifier. This allows the controller to select a storage page 1221 that can perform write operations during the data storage process, avoiding the need for data backup during the write process and improving data storage efficiency.

[0065] Specifically, during the storage process of the device described in this embodiment, you can refer to... Figure 4-a As shown, for example, when a frequently recorded partition contains multiple storage pages from storage page 1 to storage page x, each storage page has a storage page identifier. The storage page identifier indicates whether the storage page can be used to write new data. In this process, the storage page identifier of each storage page can be traversed sequentially from storage page 1 to storage page 2 to storage page m and finally to storage page x to determine which storage page meets the write requirement. When storage page m is determined to be the target storage page for which a write operation is allowed based on the storage page identifier m, then storage page m can be designated as the target storage page. Then, when storage block Bm is determined to be the target storage block within storage page m, the first data can be written to storage block Bm subsequently based on the controller.

[0066] In some embodiments, after the target storage page is determined, the target storage block is determined based on a certain write order. At this time, it is found that there may be data content in the target storage page, that is, the target storage page is not a "blank storage block". In this case, it may be necessary to back up the original data content recorded in the target storage page.

[0067] Based on this, the controller 13 in this embodiment is further configured to back up the second data to the infrequent recording partition 123 when the target storage block contains the second data, and write the first data to the target storage block after performing an erase operation on the target storage block.

[0068] In this embodiment, when the controller 13 selects the target storage block in the target storage page, the selected storage block 14 is determined based on the write order, and this storage block 14 is not a "blank storage block," meaning it contains the second data. At this point, it's necessary to consider whether the second data needs to be backed up, i.e., transferred to the infrequently recorded partition 123. When it's determined that the second data needs to be backed up, it indicates that the second data may be data needed by the user, but compared to the first data, it is not frequently used. Therefore, it can be backed up in the infrequently recorded partition 123. Then, an erase operation is performed on the target storage block. At this point, the target storage block no longer contains any data, and the controller 13 can then write the first data into the target storage block. This avoids the problem of deleting and losing old data (second data) when writing new data (first data), ensuring data stability and preventing data loss when writing new data.

[0069] In some embodiments, similar to the frequent recording partition 122, the storage blocks 14 in the infrequent recording partition 123 can also be divided into "pages" to improve the ease of searching the storage blocks 14. Based on this, as... Figure 5 As shown, the infrequent recording partition 123 further includes at least one storage page 1231, each storage page 1231 containing at least one storage block 14; each storage page 1231 is provided with a storage page identifier;

[0070] The controller 13 is further configured to, in the infrequent recording partition 123, select a storage page 1231 that has not recorded data from a plurality of storage pages 1231 as a backup storage page based on the storage page identifier, select a backup storage block from a plurality of storage blocks 14 in the backup storage page, and write the second data to the backup storage block.

[0071] Specifically, in conjunction with the methods of the foregoing embodiments, this embodiment can be executed in the following manner: Figure 5-aAs shown, when the controller traverses and queries from storage page 1 to storage page m in the frequently recorded partition, and determines that each storage page contains data based on its storage page identifier, the controller can then determine which storage page needs to be written to according to the writing order. When storage page m is determined to be the target storage page for the write operation, the data stored in storage page m can be backed up. In this embodiment, the backup storage page can be understood as a storage page in the non-frequently recorded area that allows write operations; that is, the backup storage page is preferably a storage page that has not saved any data. When the controller traverses and queries from storage page α to storage page φ, and determines that storage page β is a storage page that allows write operations based on its storage page identifier β, then storage page β can be designated as the backup storage page. As the preceding steps show, storage page m in the frequently recorded partition needs to be backed up. Therefore, the data (second data) in storage page m can be written to storage page β. This means selecting a backup storage block in storage page β and writing the second data from the target storage block to that backup storage block, thus completing the backup. Then, an erase operation is performed on storage page m. After erasing, storage page m is a "blank storage page" because the original data has been cleared. Any storage block from storage block Am to storage block Nm can be selected as the target storage block within storage page m. Of course, in practical applications, the selection can be based on the order of these storage blocks. For example, according to the order of the storage blocks in storage page m, since storage block Am is the first storage block, it can be selected as the target storage block, and the controller can write the first data into storage block Am.

[0072] It should be noted that, in this embodiment, the storage page identifier carried in each storage page can be... Figure 4-a and Figure 5-aAs shown, this is a separate storage space within a storage page, similar to a storage block, except that this storage space only stores the storage page identifier and does not store the data content for write operations. The storage page identifier is only modified after an erase operation is performed on the storage page. This avoids the problem of accidentally deleting or modifying the storage page identifier during each erase operation, which could affect subsequent erased records. Furthermore, in this embodiment, the storage page identifier can be the EraseCount in the storage page. Whether a storage page allows write operations based on the storage page identifier can be determined by checking if the EraseCount is invalid. When the EraseCount is valid, it means that the storage page stores data content and write operations cannot be performed; conversely, when the EraseCount is invalid, it means that the storage page does not store data and write operations can be performed. Additionally, it should be noted that in this embodiment, after data is written to the storage page, the storage page identifier needs to be modified, just like other types of memory, to ensure that it can be identified when subsequent write operations are performed. Specifically, the EraseCount is restored to a valid state. This process is consistent with the way erase records or erase identifiers are modified in other memory, and the specific details will not be elaborated here.

[0073] Furthermore, in actual use, the device described in this embodiment may also contain data in the backup storage block. Therefore, it is necessary to further determine whether the data in the backup storage block needs to be backed up. Thus, when storing data, the aforementioned device can also select the backup storage block from among the multiple storage blocks 14 in the backup storage page and write the second data to the backup storage block. Specifically, this process can be as follows:

[0074] If it is determined that the backup storage block contains third data, then the third data is backed up in the remaining storage blocks 14 in the non-frequent recording partition 123, excluding the backup storage block.

[0075] The erase operation is performed on the backup storage block, and the second data is written into the backup storage block that has undergone the erase operation.

[0076] Since the backup storage block is selected from the backup storage page, and the backup storage page is determined in the infrequent recording partition 123, the third data in the backup storage block is likely to be infrequently used historical data. However, when it is determined that the third data still needs to be backed up, a storage block 14 that meets the conditions can be directly selected from the infrequent recording partition 123 for backup. That is, the other storage blocks 14 in the infrequent recording partition 123 that do not record data are selected for backup, except for the backup storage block, and then the backup storage block is erased. This ensures that when the second data that needs to be backed up is backed up to the infrequent recording partition 123 during the process of writing the first data, the third data in the backup storage block can also be backed up. This effectively avoids the problem that the historical data in the original infrequent recording partition 123 is replaced by the data that needs to be backed up due to the writing of new data, and further ensures the stability and reliability of the data during the data storage process.

[0077] In some embodiments, to avoid the possibility that writing data may affect some already stored data due to excessively dense data storage, this embodiment can also analyze whether the adjacent storage pages of the frequently recorded partition 122 are blank storage pages after the first data is written.

[0078] In this embodiment, the storage pages in the frequent recording partition 122 and the infrequent recording partition 123 are arranged sequentially according to their addresses.

[0079] Based on this, the controller 13 is further configured to, according to the address order, back up the data in the adjacent storage pages of the target storage page to the infrequent recording partition 123 when it is determined that data is recorded in the adjacent storage pages of the target storage page.

[0080] Meanwhile, the storage density of data stored in the infrequently recorded partition 123 also needs to be adjusted. Therefore, in this embodiment, it is also possible to determine whether the storage pages adjacent to the backup storage page are blank storage pages.

[0081] Based on this, the controller 13 is also configured to back up the data of the adjacent storage pages of the backup storage page to the remaining storage pages in the infrequent recording partition 123 when data is recorded in the adjacent storage pages of the backup storage page.

[0082] In this embodiment, after determining the target storage page 1221 where the first data is written is located based on address order, the controller 13 can continue to determine whether data is recorded in adjacent storage pages 1221 within the target storage page. Since each storage page 1221 has a storage page identifier, this determination can be based on the storage page identifier. When it is determined that data is stored in adjacent storage pages 1221 of the target storage page, to ensure the required data storage density, this data can be transferred to the infrequent recording partition 123. Specifically, the data in the adjacent storage pages 1221 of the target storage page is written to storage pages 1231 in the infrequent recording partition 123 and then erased. This makes the adjacent storage pages 1221 of the target storage page "blank," ensuring that the data in the adjacent storage pages 1221 is not accidentally erased under certain circumstances, while also guaranteeing the required data storage density near the target storage page.

[0083] Specifically, if it is determined that write operations are not allowed in the adjacent storage page 1221 of the target storage page, it means that the storage page 1221 contains data and is a "dirty page". In order to avoid data storage being too dense, the adjacent storage page 1221 needs to be erased. However, before erasing, it is necessary to determine whether the data in the adjacent storage page 1221 is important data that needs to be backed up.

[0084] Based on the judgment results, there are two scenarios: One scenario is when it's determined that the adjacent storage page 1221 of the target storage page needs to be backed up. This indicates that although the data in storage page 1221 affects the storage density requirements when storing the first data, it is still relatively important data and cannot be directly erased; it needs to be backed up. In this case, backup needs to be performed in the infrequent recording area 123. After the backup is complete, the erase operation can be performed on storage page 1221. Thus, the adjacent storage pages 1221 of the target storage page are "blank storage pages." This ensures that during each write operation, the adjacent storage pages 1221 of the target storage page are not "dirty pages" after the write operation. This reduces the data storage density, avoiding the problem of accidental data deletion caused by excessive storage density in certain special cases. Furthermore, in subsequent write operations, when storage density is not a concern, writing can be performed directly on these "blank storage pages," saving the erase operation and improving write efficiency.

[0085] In another scenario, if it is determined that the adjacent storage page 1221 of the target storage page does not need to be backed up, it means that the data stored in the storage page 1221 is actually discarded data. Backing up this data would be a waste of valuable storage space. Therefore, in this step, the erase operation can be directly performed on the adjacent storage page 1221.

[0086] Similarly, for the second data transferred and backed up to the infrequent recording partition 123, when considering data storage density, it is also necessary to analyze whether the adjacent storage pages 1231 of the backup storage page to which the backup storage block of the second data storage belongs contain data. The analysis process for adjacent storage pages of the target storage page is the same as described above and will not be repeated here. Of course, since the backup storage page itself is already located in the infrequent recording partition 123, during the backup process of the data stored in the adjacent storage pages 1231 of the backup storage page, the remaining storage pages 1231 in the infrequent recording partition 123 can be selected directly.

[0087] In this embodiment, the reason for determining whether a storage page needs to be backed up is whether the data it stores is frequently used by the user. Data that is not frequently used by the user actually indicates that the data is of low importance. Storing such data in the storage space will waste the storage space resources saved by the user. Therefore, in the process of determining whether adjacent storage pages need to be backed up, the determination can be based on whether the same data is stored in the first storage area.

[0088] Based on this, in determining whether the adjacent storage pages of the target storage page or backup storage page need to be backed up, the controller can sequentially determine whether the data content of each storage block in the storage page adjacent to the target storage page or backup storage page matches the data content in the first storage area; if there is a matching storage block, then it is determined that the adjacent storage page needs to be backed up.

[0089] Since the data in the first storage area 11, i.e. the SRAM memory, consists of data that the user has recently used, when the data content of a storage page matches the data content in the first storage area, it means that the data therein is data that the user has recently used. Since recently used data is generally more important than historical data, it means that the data in the storage pages adjacent to the target storage page or backup storage page is relatively important. Therefore, it can be determined that the adjacent storage page needs to be backed up.

[0090] In this way, by judging whether the data content of each storage block in the storage page adjacent to the target storage page or the backup storage page matches the data content in the first storage area, it is possible to analyze the user's data usage. This achieves the effect of analyzing the importance of the data in a relatively direct and simple way, thereby ensuring the accuracy of subsequent backups and avoiding the problem of wasting storage space by backing up unimportant storage pages.

[0091] In some embodiments, such as Figure 6 As shown, the target storage block includes a data storage block 1411 and a verification block 1412;

[0092] The controller 13 is used to write the first data into the data storage block 1411 and add a verification identifier to the verification block 1412. The verification identifier is information for verifying the integrity of the first data when it is read from the storage block 1411.

[0093] In this way, during the process of writing the first data, the controller 13 can not only write the data content of the first data into the storage block, but also add the verification identifier that reflects the data integrity to the storage block. This ensures that when the first data is read or called in the future, the integrity of the first data can be verified based on the verification identifier in the verification block 1412, which effectively avoids the failure of reading the first data when the data is missing, and lays the foundation for the stability of the subsequent data reading and use process.

[0094] In some embodiments, the target storage block further includes an address record block 1413 and a data length block 1414; the capacity of the data storage block 1411 is greater than the sum of the capacities of the address record block 1413, the data length block 1414, and the verification block 1412.

[0095] The controller 13 is further configured to add address information to the address record block 1413 of the storage block 14 according to the position of the first data in the storage block 1411, and add the data length of the written data determined based on the address information to the data length block 1414 of the storage block 14.

[0096] In this way, during the storage of the first data, the controller 13 can also record the overall length of the first data in the data length block 1414, and at the same time, the controller 13 can also record the address of the first data in the storage block in the address recording block 1413. This is beneficial for locating the storage location and determining the amount of data at the system level. In this way, during the subsequent reading and retrieval of the first data, analysis can be performed based on the above information, which is convenient for users to analyze and troubleshoot the data.

[0097] Specifically, it can be like Figure 7 As shown in the diagram, the storage block A1 occupies the largest space within it, and this space is used to store the actual data content. Simultaneously, during the storage process, the data content's storage location is identified and recorded as address information, which is then added to the address record block. Furthermore, the data content may not completely occupy the entire storage block. For example, if the storage block is 10 bytes and the data content is 5 bytes, then when storing the data content, the total length of the data, i.e., the actual space occupied, is also recorded, which is the data length described in this embodiment, 5 bytes. Additionally, during data storage, it is necessary to identify whether the stored data content is erroneous; that is, a verification identifier is added to the verification block. It should be noted that the specific verification identifier can be different, depending on whether the data content stored in the storage block is erroneous and the degree of error. The type and format of the verification identifier are not limited here; any existing verification identifier used in data storage processes can be adopted.

[0098] This application provides a data storage device, which includes a first storage area, a second storage area, and a controller. The first storage area is based on Static Random Access Memory (SRAM), and the second storage area is a flash memory-based storage area. The second storage area contains at least one storage block, each storage block being a storage unit configured in bytes according to a preset rule. The controller, when detecting first data to be written, if it determines that no data identical to the first data exists in the first storage area, writes the first data to the target storage block in the second storage area. Thus, during data storage using this device, if the controller determines that first data exists and it does not exist in the first storage area, writing the first data to the second storage area ensures that the first data will remain in the second storage area even in the event of a power outage, unlike the data in the first storage area which would be lost during a power outage. This avoids the problem of data loss during the writing process when the first data is written to the first storage area due to a power outage, and avoids the problem in existing technologies where the newly written first data is lost due to a power outage. This invention solves the problem of data loss in flash memory due to power failure, which affects data storage. Furthermore, because the second storage area in this application uses target byte blocks instead of traditional kilobyte blocks, it allows for separate management of multiple different data sets within the same block size. This avoids the common problem where, in conventional methods, storing different data in a single block results in the complete erasure of the entire block during an erase operation.

[0099] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application 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.) containing computer-usable program code.

[0100] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. 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 apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0101] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0102] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0103] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0104] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0105] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0106] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0107] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application 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.) containing computer-usable program code.

[0108] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A data storage device, characterized in that, The device includes: a first storage area, a second storage area, and a controller; The first storage area is based on static random access memory (SRAM), and the second storage area is based on flash memory. The second storage area contains at least one storage block, and each storage block is a storage unit set up in bytes according to a preset rule; The controller is configured to, when detecting first data to be written, if it determines that there is no data identical to the first data in the first storage area, write the first data to the target storage block of the second storage area, wherein the second storage area includes a backup partition, and the storage capacity of the backup partition is the storage capacity of at least one EEPROM memory. The controller is also configured to write the data in the first storage area to the backup partition when a power failure command is detected; The second storage area further includes a frequent recording partition and a non-frequent recording partition. Each frequent recording partition and the non-frequent recording partition contains at least one storage page. Each storage page includes at least one of the storage blocks. The storage pages in the frequent recording partition and the non-frequent recording partition are arranged in address order. The controller is further configured to, according to the address order, back up the data in the adjacent storage pages of the target storage page to a non-frequent recording partition when it is determined that data is recorded in the adjacent storage pages of the target storage page; and, when data is recorded in the adjacent storage pages of the backup storage page, back up the data of the adjacent storage pages of the backup storage page to the remaining storage pages in the non-frequent recording partition; wherein the target storage page is a storage page that does not record data selected from a plurality of storage pages in the frequent recording partition, and the backup storage page is a storage page that does not record data selected from a plurality of storage pages in the non-frequent recording partition; The controller sequentially determines whether the data content of each storage block in the storage page adjacent to the target storage page or the backup storage page matches the data content in the first storage area; if a matching storage block exists, it is determined that the adjacent storage page needs to be backed up.

2. The device according to claim 1, characterized in that, Both the frequent recording partition and the infrequent recording partition contain at least one of the storage blocks; The frequently recorded partition is used to store data that users frequently use, while the infrequently recorded partition is used to record historical data.

3. The device according to claim 1, characterized in that, The frequent recording partition further includes at least one storage page, which includes at least one of the storage blocks; wherein, each storage page is provided with a storage page identifier, which is used to indicate whether the storage page stores data; The controller is further configured to select, based on the storage page identifier, a storage page that does not contain data from among the plurality of storage pages as a target storage page, and select the target storage block from the target storage page.

4. The device according to claim 3, characterized in that, The controller is further configured to back up the second data to the infrequent recording partition when the target storage block contains the second data, and to write the first data to the target storage block after performing an erase operation on the target storage block.

5. The device according to claim 4, characterized in that, The infrequent recording partition further includes at least one storage page, and each storage page contains at least one of the storage blocks; each storage page is provided with a storage page identifier; The controller is further configured to, in the infrequent recording partition, select a storage page that has not recorded data from a plurality of storage pages as a backup storage page based on the storage page identifier, select a backup storage block from a plurality of storage blocks in the backup storage page, and write the second data to the backup storage block.

6. The device according to any one of claims 1-5, characterized in that, The target storage block includes a data storage block and a verification block; The controller is used to write the first data into the data storage block and add a verification identifier to the verification block. The verification identifier is information for verifying the integrity of the first data when it is read from the storage block.

7. The device according to claim 6, characterized in that, The target storage block further includes an address record block and a data length block; the capacity of the data storage block is greater than the sum of the capacities of the address record block, the data length block, and the verification block. The controller is further configured to add address information to the address record block of the storage block according to the position of the first data in the storage block, and add the data length of the written data determined based on the address information to the data length block of the storage block.

Citation Information

Patent Citations

  • Non-volatile memory data management method and non-volatile memory device

    CN101751341A

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

    CN103377152A

  • Wiping and writing management method and system for non-volatile flash memory

    CN104156317A

  • Storage method and storage device for real-time data

    CN105677233A

  • Data storage apparatus and operating method thereof

    CN112416242A