CN115469802A - Data storage device - Google Patents

Data storage device Download PDF

Info

Publication number
CN115469802A
CN115469802A CN202211054673.6A CN202211054673A CN115469802A CN 115469802 A CN115469802 A CN 115469802A CN 202211054673 A CN202211054673 A CN 202211054673A CN 115469802 A CN115469802 A CN 115469802A
Authority
CN
China
Prior art keywords
storage
data
block
page
memory
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202211054673.6A
Other languages
Chinese (zh)
Inventor
王海江
唐朋朋
周乃彪
蒋科
陈健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Eswin Computing Technology Co Ltd
Original Assignee
Beijing Eswin Computing Technology Co Ltd
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 Beijing Eswin Computing Technology Co Ltd filed Critical Beijing Eswin Computing Technology Co Ltd
Priority to CN202211054673.6A priority Critical patent/CN115469802A/en
Publication of CN115469802A publication Critical patent/CN115469802A/en
Pending legal-status Critical Current

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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

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)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses data storage equipment relates to the technical field of storage. The apparatus of the present application includes: a first storage area, a second storage area and a controller; the first storage area is a Static Random Access Memory (SRAM) based storage area, and the second storage area is a flash-constructed storage area; the second storage area comprises at least one storage block, and each storage block is a storage unit which is set by taking bytes as a unit according to a preset rule; the controller is configured to, when first data to be written is detected, write the first data into a target storage block of the second storage area if it is determined that data identical to the first data does not exist in the first storage area.

Description

Data storage device
Technical Field
The application relates to the technical field of storage, in particular to a data storage device.
Background
As technology advances, storage technology also advances. At present, in order to ensure a better random access performance under a more economical condition, a conventional technology generally utilizes a Flash Memory (Flash EEPROM Memory, abbreviated as Flash Memory) to meet the requirement of random read-write performance. The flash memory is one of the memory chips, and the data in the flash memory can be modified through a specific program. Flash generally means a Flash Memory in the field of electronics and semiconductors, and is also called "Flash Memory". However, in practical application, in order to improve the read-write efficiency, a conventional flash memory generally performs fast data writing by means of a static random access memory matched with the conventional flash memory, so that when a power failure occurs, after data to be written is written into the static random access memory, the part of the data which is written just after the data is written into the static random access memory is lost due to power failure of the static random access memory, and thus the problem of power failure loss exists in the data storage process.
Disclosure of Invention
The embodiment of the application provides a data storage device, and mainly aims to realize the data storage device and avoid the problem that data which is just written in is lost under the condition of power failure.
In order to solve the above technical problem, an embodiment of the present application provides the following technical solutions:
in a first aspect, the present application provides a data storage device, the device comprising:
a first storage area, a second storage area and a controller;
the first storage area is a Static Random Access Memory (SRAM) based storage area, and the second storage area is a storage area constructed based on flash;
the second storage area comprises at least one storage block, and each storage block is a storage unit which is set by taking bytes as a unit according to a preset rule;
the controller is configured to, when first data to be written is detected, write the first data into a target storage block of the second storage area if it is determined that data identical to the first data does not exist in the first storage area.
Optionally, the second storage area includes a backup partition, and a storage capacity of the backup partition is a storage capacity of the at least one EEPROM memory.
Optionally, the controller is further configured to write the data in the first storage area into the backup partition when the power-down instruction is detected.
Optionally, the second storage area further includes a frequent recording partition and an infrequent recording partition, and both the frequent recording partition and the infrequent recording partition include at least one of the storage blocks;
the frequent recording partition is used for storing data frequently used by a user, and the infrequent recording partition is used for recording historical data.
Optionally, the frequent recording partition further includes at least one storage page, where the storage page includes at least one storage block; each storage page is provided with a storage page identifier, and the storage page identifier is used for representing whether data is stored in the storage page or not;
the controller is further configured to select, based on the storage page identifier, a storage page in which data is not recorded from among the plurality of storage pages as a target storage page, and select the target storage block from the target storage page.
Optionally, the controller is further configured to, when second data is stored in the target storage block, backup the second data to the infrequent recording partition, and write the first data to the target storage block after performing an erasing operation on the target storage block.
Optionally, the infrequently recorded partition further includes at least one memory page, and each memory page includes at least one memory block; each storage page is provided with a storage page identifier;
the controller is further configured to select, in the infrequent recording partition, a storage page in which data is not recorded from the plurality of storage pages as a backup storage page based on the storage page identifier, select a backup storage block from the plurality of storage blocks in the backup storage page, and write the second data into the backup storage block.
Optionally, the storage pages in the frequent recording partition and the non-frequent recording partition are all sequentially arranged according to an address sequence;
the controller is further configured to backup data in the adjacent storage pages of the target storage page to an infrequently recorded partition when it is determined that data is recorded in the adjacent storage pages of the target storage page according to the address sequence; and when data is recorded in the adjacent storage pages of the backup storage pages, backing up the data of the adjacent storage pages of the backup storage pages in the rest storage pages in the infrequent recording partition.
Optionally, the target storage block includes a data storage block and a verification block;
the controller is configured to write the first data into the data storage block, and add a verification identifier to the verification block, where the verification identifier is information for verifying integrity of the first data when the first data stored in the storage block is read.
Optionally, the target storage block further includes an address record block and a data length block; the capacity of the data storage block is larger 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 blocks of the storage block according to the position of the first data in the storage block, and add the data length of the write data determined based on the address information to the data length blocks of the storage block.
By means of the technical scheme, the technical scheme provided by the application at least has the following advantages:
the application provides a data storage device, which comprises a first storage area, a second storage area and a controller; the first storage area is a Static Random Access Memory (SRAM) based storage area, and the second storage area is a flash-constructed storage area; the second storage area comprises at least one storage block, and each storage block is a storage unit which is set by taking bytes as a unit according to a preset rule; the controller is configured to, when first data to be written is detected, write the first data into a target storage block of the second storage area if it is determined that data identical to the first data does not exist in the first storage area. Therefore, in the process of data storage through the device, when the first data to be written is determined to exist based on the controller, and the first data does not exist in the first storage area, the first data is written into the second storage area, so that the first data can still exist in the second storage area under the condition of power failure, and the data in the first storage area can not be lost when the power failure occurs, so that the problem that the data is lost once the first data is written into the first storage area under the condition of power failure in the process of writing the data is avoided, and the problem that the first data which is just written is lost due to the power failure after the first data is written into the first storage area in the prior art is avoided. The problem that data storage is influenced because data in a Static Random Access Memory (SRAM) matched with the flash memory is lost due to power failure is solved. Meanwhile, the mode of setting the storage block in the second storage area in the application is the storage block set by the target byte number, which is different from the original storage block taking the kilobyte as the unit in the past, so that the effect of respectively managing a plurality of different data in the storage space of the size of the original storage block can be realized, and the problem that once different data are stored in one original storage block in a conventional mode, once erasing operation is performed, the data corresponding to the whole original storage block are probably removed simultaneously is avoided.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present application will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present application are illustrated by way of example and not by way of limitation in the figures of the accompanying drawings and in which like reference numerals refer to similar or corresponding parts and in which:
FIG. 1 is a schematic diagram illustrating a data storage device according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram illustrating an alternative data storage device according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a composition of another data storage device provided by an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a composition of another data storage device provided by an embodiment of the present application;
FIG. 4-a is a schematic diagram of a data storage device provided by an embodiment of the present application when storing data;
FIG. 5 is a schematic diagram illustrating an alternative data storage device according to an embodiment of the present application;
FIG. 5-a is a schematic diagram of another data storage device provided by an embodiment of the present application when storing data;
FIG. 6 is a schematic diagram illustrating a memory block structure in a data storage device according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating a memory block structure in another data storage device according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
It is to be noted that, unless otherwise specified, technical terms or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which this application belongs.
An embodiment of the present application provides a data storage device, as shown in fig. 1, the device includes: a first storage area 11, a second storage area 12, and a controller 13;
the first storage area 11 is based on a Static Random Access Memory (SRAM), and the second storage area 12 is based on a flash;
the second storage area 12 comprises at least one storage block 14, and each storage block 14 is a storage unit arranged in units of bytes according to a preset rule;
the controller 13 is configured to, when first data to be written is detected, if it is determined that data identical to the first data does not exist in the first storage area 11, write the first data into a target storage block of the second storage area 12.
Since the data writing process is generally implemented based on a write operation command issued by a user, when storing data in this embodiment, it needs to be determined based on the controller whether a write action exists before storing data, that is, the write operation command is detected. When a write operation command is detected, which indicates that a user needs to write some data into the storage device, that is, there is currently first data to be written, it is necessary to determine which data or data needs to be written, that is, determine the first data, based on the write operation command. In this embodiment, the form, the kind, and the number of the first data are not limited, and may be determined according to the actual situation of the user. In this embodiment, the controller may be understood as a control module in the data storage device, configured to control a storage manner of a storage location of input data.
When the controller determines that there is first data to be written, it can further determine whether the first data is new data or old data, and then can perform identification based on the first storage area 11. Since the first storage area 11 is a storage area constructed based on SRAM, and the data existing in the storage area is data that the user often needs to read and write, that is, old data, if the first data is stored in the first storage area 11, it is highly possible that the data is data that has been used before, and is not new data.
When it is determined that the first storage area 11 does not have the same data as the first data, it is determined that the first data is not recorded in the first storage area 11, the first data is most likely to be new data and needs to be stored, and a problem that the first data is lost before being written into the second storage area 12 may occur once a power failure condition occurs, so that the controller is required to control the first data to be directly written into the second storage area 12, so that the first data is stored in the second storage area 12 even if the power failure condition occurs, and the problem of data loss is avoided.
Meanwhile, in this embodiment, when the first data is written into the second storage area 12, the target storage block is selected from the second storage area 12 for storage, because the target storage block is the storage block 14 meeting the writing condition, and the storage block 14 in this embodiment is different from a storage block in a conventional flash memory, in a conventional original storage block, the size of each storage block is different from 1KB to several KB, that is, a storage space set according to Kilobytes (KB), so that, when the data amount of the first data is small each time, in order to implement a function of separately managing each different data, only one data needs to be stored in each original storage block, which results in a waste of a large amount of storage space, and once a plurality of different data are written into one original storage block, once the original storage block needs to be erased, different data are eliminated, which results in a problem of mistaken deletion of data. Therefore, in the present embodiment, by setting the storage block 14 to a storage unit with a size of a target byte number, it is possible to implement a form of forming a plurality of different small storage units in a space of 1KB or several KB in the original storage block, that is, a storage unit set in a byte (B) unit when the storage block in the second storage area 12 is described in the present embodiment, and a non-conventional storage block is in a Kilobyte (KB) unit, so that a plurality of different data can be stored in a space with a size of the original storage block, and each data can be managed, that is, a storage space is saved, and a situation of mistaken deletion can be avoided.
Based on this, the application provides a data storage device, compared with the prior art, in the process of data storage of the device, when it is determined that first data to be written exists based on a controller, and the first data does not exist in a first storage area, the first data is written into a second storage area, it can be ensured that the first data still exists in the second storage area under the condition of power failure, and the first data is not lost as the data in the first storage area is lost under the condition of power failure, so that the problem that in the process of data writing, once the first data is written into the first storage area under the condition of power failure, the data is lost is avoided, the problem that in the prior art, the first data which is just written is lost due to power failure after the first data is written into the first storage area is solved, and the problem that data storage of a flash memory is influenced due to power failure caused by the loss of the data in a static random access memory SRAM matched with the flash memory is solved. Meanwhile, the mode of setting the storage block in the second storage area in the application is the storage block set by the target byte number, which is different from the original storage block taking the kilobyte as the unit in the past, so that the effect of respectively managing a plurality of different data in the storage space of the size of the original storage block can be realized, and the problem that once different data are stored in one original storage block in a conventional mode, once erasing operation is performed, the data corresponding to the whole original storage block are probably removed simultaneously is avoided.
In some embodiments, as shown in fig. 2, the second storage area 12 includes a backup partition 121, and the storage capacity of the backup partition 121 is the storage capacity of at least one EEPROM memory.
Among them, an EEPROM (Electrically Erasable Programmable read only memory, abbreviated as EEPROM) is also called an Electrically Erasable Programmable read only memory, and is a read only memory that can be changed by a user, and can be erased and reprogrammed by the action of a voltage higher than a common voltage, i.e., rewritten, and the EEPROM is a memory chip in which data is not lost after power failure, and has a better random read/write performance.
By setting the storage space of the backup partition 121 to the storage capacity of at least one EEPROM memory, it is ensured that the problem of data loss during power failure can be avoided in the process of executing the method of the present embodiment, and the storage mode that simulates the characteristics of an EEPROM memory is realized by taking the capacity of the EEPROM into consideration. Because the EEPROM circuit is complex and has the problem of higher cost, the scheme based on the embodiment realizes the storage method simulating the EEPROM storage scheme, thereby ensuring better random reading and writing and capacity, enabling a user to replace the EEPROM memory by the equipment in the embodiment without considering the problem of capacity difference, and reducing the replacement cost.
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-down instruction is detected.
Thus, when the controller 13 detects a power-down instruction, all data in the first storage area can be written into the backup partition 121, and since the backup partition 121 is also a part of the second storage area constructed by the flash, it is ensured that even after the subsequent whole device is powered down, the data originally stored in the first storage area 11 constructed based on the SRAM is not lost, and the reliability of the data is ensured.
In some embodiments, as shown in fig. 3, the second storage area 12 further includes a frequent recording partition 122 and an infrequent recording partition 123, and each of the frequent recording partition 122 and the infrequent recording partition 123 includes at least one of the storage blocks 14;
the frequent recording partition 122 is used for storing data commonly used by users, and the infrequent recording partition 123 is used for recording historical data.
In the actual application process, the data stored in the flash may be divided into two types according to the difference of the read-write frequency, one type is frequently-used data, that is, data frequently used by a user, and the other type may be rarely-used data, that is, historical data, so that for easy calling, the two types of data may be stored in different partitions, that is, the frequent recording partition 122 and the infrequent recording partition 123, in the second storage area.
Based on this, the controller 13 may be, in writing data to the second storage area: when the second storage area comprises a frequent recording partition and an infrequent recording partition, selecting a target storage block from a plurality of storage blocks in the frequent recording partition; when it is determined that no data is stored in the target storage block, writing the first data to the target storage block.
By the method of the embodiment, when the second storage area is divided into the frequent recording partition 122 and the infrequent recording partition 123, the target storage block is preferentially selected from the plurality of storage blocks in the frequent recording partition 122, and when no data is stored in the target storage block, the first data is directly written into the target storage block, so that the data can be preferentially written into the frequent recording partition during data storage, and since the first data is determined to be data to be written based on an instruction, the data is highly likely to be required by a user at any time, at this time, the subsequent user can be ensured to directly obtain the data from the frequent recording partition 122 when calling and reading the first data again, the effect of storing the data which is likely to be frequently used by the user in the frequent recording partition 122 is realized, and the rapid calling and reading of the data are facilitated.
Of course, in practical applications, the process of writing data into the second storage area 12 by the controller 13 includes, but is not limited to, the above manner, for example, when the user has an explicit instruction to indicate that the data a is the non-use data, then the controller 13 may also directly write the data a into the non-frequent recording partition 123 through the instruction, that is, select a target storage block from the plurality of storage blocks 14 in the non-frequent recording partition 123 to store the data a.
In some embodiments, for further convenience of data storage and management, the second storage area 12 may be further divided into a frequent recording partition 122 and an infrequent recording partition 123, that is, storage blocks are managed in a "page" manner.
Based on this, as shown in fig. 4, the frequent recording partition 122 further includes at least one storage page 1221, where the storage page 1221 includes at least one storage block 14; each storage page 1221 is provided with a storage page identifier, and the storage page identifier is used to represent whether data is stored in the storage page 1221;
the controller 13 is further configured to select, based on the storage page identifier, a storage page 1221, in which data is not recorded, from the plurality of storage pages 1221 as a target storage page, and select the target storage block from the target storage page.
In this embodiment, the frequent recording partitions 122 each include at least one of the storage pages 1221; the storage pages 1221 are arranged in sequence according to a writing order, and each of the storage pages 1221 includes at least one of the storage blocks 14 and a storage page identifier, where the storage page identifier is used to represent whether data content is stored in the storage page, that is, the storage page identifier can represent whether the storage page allows a writing operation to be performed.
In this way, in the process of selecting the target storage block, the controller 13 can select the storage page 1221 without storing data content from the plurality of storage pages 1221 as the target storage page according to the storage page identifier, so that one storage page 1221 capable of performing a write operation can be selected in the process of storing data, a process of data backup in the write process is avoided, and the storage efficiency of data can be improved.
In the process of performing storage by the device according to this embodiment, for example, when a frequent recording partition includes a plurality of storage pages from storage page 1 to storage page x, each storage page has a storage page identifier, and the storage page identifier can represent whether the storage page can be used for writing new data, in this process, the storage page identifier of each storage page may be sequentially searched from storage page 1 to storage page 2 to storage page m and finally to storage page x, so as to determine which storage page meets the writing requirement. When it is determined that the memory page m is a target memory page allowing the write operation to be performed based on the memory page identifier m, the memory page m may be determined as the target memory page. Then, when it is determined that the memory block Bm is the target memory block in the memory page m, the first data may be written into the memory block Bm subsequently based on the controller.
In some embodiments, there is a case where, after determining the target storage page, the determined target storage block is determined based on a certain writing sequence, and it is found that the data content may exist in the target storage page, that is, the target storage page is not a "blank storage block", and it may be necessary to back up the data content originally recorded in the target storage page.
Based on this, in this embodiment, the controller 13 is further configured to, when second data is stored in the target storage block, backup the second data to the infrequently recording partition 123, and write the first data to the target storage block after performing an erasing operation on the target storage block.
In the present embodiment, in the process of selecting the target memory block in the target memory page by the controller 13, the memory block 14 is determined based on the writing order, and the memory block 14 is not a "blank memory block", that is, a case where the second data is stored. It is considered that the second data needs to be backed up, i.e., transferred to the infrequently recording partition 123. When it is determined that the second data needs to be backed up, it indicates that the second data may be data that is needed by the user, but is not frequently used compared to the first data, and thus the backup may be performed in the infrequent recording partition 123. Then, the target storage block is erased, and at this time, no data is stored in the target storage block, and at this time, the controller 13 can write the first data into the target storage block, so that the problem that old data (second data) is deleted and lost when new data (first data) is written is avoided, the stability of the data is ensured, and the problem of data loss when new data is written is avoided.
In some embodiments, the partitions 122 are frequently recorded, and the memory blocks 14 in the non-frequently recorded partitions 123 may also be divided in a "page" manner, so as to improve the convenience of searching the memory blocks 14. Based on this, as shown in fig. 5, the infrequently recorded partition 123 further includes at least one memory page 1231, where each memory page 1231 includes at least one memory block 14; each storage page 1231 is provided with a storage page identifier;
the controller 13 is further configured to select, in the infrequently recorded partition 123, a storage page 1231 with no data recorded therein from the plurality of storage pages 1231 as a backup storage page based on the storage page identifier, select a backup storage block from the plurality of storage blocks 14 in the backup storage page, and write the second data into the backup storage block.
Specifically, in combination with the method of the foregoing embodiment, the present embodiment may be implemented as follows: as shown in fig. 5-a, after the controller performs traversal query from the storage page 1 to the storage page m in the frequent recording partition, it is determined according to the storage page identifier of each storage page that data is recorded in each storage page, at this time, the controller may determine, according to the writing order, which storage page should be subjected to the writing operation, and when it is determined that the storage page m is a target storage page that is required to be subjected to the writing operation, the data stored in the storage page m may be backed up. In this embodiment, the backup storage page may be understood as a storage page that can perform a write operation among a plurality of storage pages in the infrequent recording area, that is, the backup storage page is preferably a storage page that has not stored data. When the controller traverses the query from the memory page α to the memory page Φ, when it is determined that the memory page β is a memory page that is allowed to perform a write operation based on the memory page identification β, it may be determined that the memory page β is a backup memory page. Since the foregoing steps indicate that the storage page m in the frequent recording partition needs to be backed up, the data (second data) in the storage page m can be written into the storage page β, that is, the backup storage block is selected from the storage page β, and the second data in the target storage block is written into the backup storage block, so that the backup is completed. Then, an erase operation is performed on the memory page m, so that the erased memory page m is a "blank memory page" because the originally stored data content has been cleared, and any one of the memory blocks Am to Nm in the memory page m is selected as a target memory block. Of course, in practical applications, the memory blocks may be selected in sequence with reference to the sorting order of the memory blocks, for example, according to the sorting order of the memory blocks in the memory page m, since the memory block Am is the first memory block, the memory block Am may be selected as the target memory block, and the controller may write the first data into the memory block Am.
It should be noted that, in this embodiment, the storage page identifier carried in each storage page may be as shown in fig. 4-a and fig. 5-a, and is a storage space separately opened in the storage page, which is similar to a storage block, except that the storage space is only responsible for storing the storage page identifier and is not responsible for storing data content during a write operation, and only after an erase operation is performed on the storage page, the storage page identifier related thereto is modified, so that a problem that a subsequent erased record is affected due to mistaken deletion of the storage page identifier every time the storage page is erased can be avoided. In addition, in this embodiment, the storage page identifier may be an erasiecount in the storage page, and determining whether the storage page allows the write operation to be performed based on the storage page identifier may be performed by determining whether the erasiecount is invalid. When the EraseCount is valid, it indicates that the data content is stored in the storage page, and the write operation cannot be executed, whereas when the EraseCount is invalid, it indicates that the data is not stored in the storage page, and the write operation can be executed. In addition, it should be noted that, in this embodiment, after data is written in the memory page, as with other types of memories, the memory page identifier also needs to be modified to ensure that the identification is performed during subsequent write operation, and the specific process is to restore the erascecount to an effective state, which is consistent with the manner of modifying the erasure records or the erasure identifiers in other memories, and details thereof are not described again.
In addition, in actual use of the device according to this embodiment, because data content may also exist in the backup storage block, at this time, it is further necessary to further determine whether the data content in the backup storage block needs to be backed up, so that when the device stores data, the device may further select the backup storage block from the plurality of storage blocks 14 in the backup storage page, and write the second data into the backup storage block, specifically, this process may be:
if it is determined that third data is stored in the backup storage block, backing up the third data in the remaining storage blocks 14 except for the backup storage block in the infrequently recording partition 123;
and executing the erasing operation on the backup storage block, and writing the second data into the backup storage block on which the erasing operation is executed.
Because the backup storage block is selected from the backup storage pages determined in the infrequent recording partition 123, that is, the third data in the backup storage block is likely to be the most used historical data, when it is determined that the third data still needs to be backed up, the storage block 14 meeting the conditions can be directly selected from the infrequent recording partition 123 for backup, that is, the rest of the storage blocks 14 which do not record data except the backup storage block are selected from the infrequent recording partition 123 for backup, and then the backup storage block is erased, so that when the second data which needs to be backed up is backed up to the infrequent recording partition 123 in the writing process of the first data, the third data in the backup storage block can be further backed up, the problem that the original historical data in the infrequent recording partition 123 is replaced by the data which needs to be backed up due to the writing of new data is effectively avoided, and the stability and reliability of the data in the data storage process are further ensured.
In some embodiments, in order to avoid that the data is too dense when the data is stored, so that the written data may affect some stored data in some cases, in this embodiment, whether the adjacent storage page of the frequent recording partition 122 after the first data writing is a blank storage page may also be analyzed.
In this embodiment, the memory pages in the frequent recording partition 122 and the non-frequent recording partition 123 are arranged in order of address.
Based on this, the controller 13 is further configured to, when it is determined that data is recorded in the adjacent storage page of the target storage page according to the address order, backup the data in the adjacent storage page of the target storage page into the infrequently recorded partition 123.
Meanwhile, the storage density of the data stored in the infrequently recorded partition 123 also needs to be adjusted, so that in this embodiment, it may be determined whether a storage page adjacent to the backup storage page is blank.
Based on this, the controller 13 is further configured to back up the data of the adjacent storage page of the backup storage page in the remaining storage pages in the infrequently recording partition 123 when the data is recorded in the adjacent storage page of the backup storage page.
In this embodiment, after determining the storage page 1221 in which the target storage block in which the first data is written is located, that is, the target storage page, based on the address sequence, the controller 13 may continue to determine whether data is recorded in the adjacent storage page 1221 of the target storage page based on the address sequence, and of course, since each storage page 1221 is provided with a storage page identifier, the determination may be based on the storage page identifier. When it is determined that data is stored in the memory page 1221 adjacent to the target memory page, in order to ensure the requirement of data storage density, the data may be transferred to the infrequently recording partition 123, that is, the data in the memory page 1221 adjacent to the target memory page is written into the memory page 1231 in the infrequently recording partition 123 and erased. In this way, the memory page 1221 adjacent to the target memory page becomes a "blank" memory page 1221, which can ensure that the data of the memory page 1221 adjacent to the target memory page is not erased by mistake in some cases, and also ensure the requirement of the data storage density near the target memory page.
Specifically, when it is determined that the write operation is not allowed in the storage page 1221 adjacent to the target storage page, it is described that the storage page 1221 stores data and belongs to a "dirty page", in order to avoid that the data storage is too intensive, the adjacent storage page 1221 needs to be erased, but before the erasure, it is also necessary to determine whether the data in the adjacent storage page 1221 belongs to important data that needs to be backed up.
Based on the determination result, two cases are divided: one case is when it is determined that the storage page 1221 adjacent to the target storage page needs to be backed up, which means that although the data in this storage page 1221 affects the requirement of the storage density when storing the first data, it is also the more important data, and cannot be directly erased, but needs to be backed up. Then 123 backups in the infrequent recording area are required in this process. When the backup is complete, an erase operation may be performed on the memory page 1221. The adjacent storage pages 1221 arranged in the target storage page are blank storage pages, so that in the process of executing writing operation each time, the adjacent storage pages 1221 of the written target storage page can be ensured not to be dirty pages, the data storage density is reduced, the problem of data mistaken deletion caused by deleting the data content in the two adjacent storage pages 1221 under certain special conditions due to overhigh storage density can be avoided, direct writing can be directly carried out in the blank storage pages under certain special conditions without considering the storage density when writing operation is subsequently executed, the erasing operation process is saved, and the writing efficiency is improved.
For another case of judgment, when it is determined that the storage page 1221 adjacent to the target storage page does not need to be backed up, it indicates that the data stored in the storage page 1221 is actually useless obsolete data, and then the data occupies a data space to back up, which wastes valuable storage space, so that an erasing operation can be directly performed on the storage page 1221 in this step.
Similarly, for the second data to be transferred and backed up to the infrequently recorded partition 123, when considering the problem of data storage density, it is necessary to analyze whether or not the data is stored in the storage page 1231 adjacent to the backup storage page to which the backup storage block of the second data storage belongs. As with the foregoing analysis process for the adjacent storage pages of the target storage page, no further description is given here, and of course, since the backup storage page itself is already located in the infrequent recording partition 123, the rest of the storage pages 1231 may be directly selected from the infrequent recording partition 123 in the process of backing up the data stored in the adjacent storage pages 1231 of the backup storage page.
In this embodiment, since the reason for determining whether a storage page needs to be backed up is that whether the stored data is frequently used by a user, and the data that is not frequently used by the user actually indicates that the importance of the data is low, the storage space resources saved by the user will be wasted when the data is placed in the storage space, and in view of this, in the process of determining whether an adjacent storage page needs to be backed up, it may be determined based on whether the same data is saved in the first storage area.
Based on the above, the controller may sequentially determine whether the data content of each of the storage blocks in the storage pages adjacent to the target storage page or the backup storage page matches the data content in the first storage area; and if the storage blocks which are matched exist, determining that the adjacent storage pages need to be backed up.
Since the data in the first storage area 11, i.e. the SRAM memory, are all data recently used by the user, when the data content of the storage page matches the data content in the first storage area, it is indicated that the data therein is data recently used by the user, and the importance of the data recently used is generally higher than that of the historical data, so that it is indicated that the data in the storage page adjacent to the target storage page or the backup storage page is more important, and it can be determined that the adjacent storage page needs to be backed up at this time.
Therefore, whether the data content of each storage block in the target storage page or the storage page adjacent to the backup storage page is matched with the data content in the first storage area or not is judged, the condition that the user uses the data can be analyzed, the effect of analyzing the importance degree of the data in the storage block is achieved in a direct and simple mode, the accuracy in subsequent backup is ensured, and the problem that the storage space is wasted due to the fact that unimportant storage pages are backed up is avoided.
In some embodiments, as shown in FIG. 6, the target storage blocks include a data storage block 1411 and a verification block 1412;
the controller 13 is configured to write the first data into the data storage partition 1411, and add a verification identifier to the verification partition 1412, where the verification identifier is information for verifying integrity of the first data when the first data stored in the storage partition 1411 is read.
In this way, in 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 representing the integrity of the data into the storage block, which ensures that the integrity of the first data can be verified based on the verification identifier in the verification sub-block 1412 when the first data is subsequently read and called, thereby effectively avoiding the occurrence of failure in reading the first data when the data is missing, and laying a foundation for the stability of the subsequent data reading and using processes.
In some embodiments, the target memory block further includes an address record block 1413 and a data length block 1414; the capacity of the data storage partition 1411 is greater than the sum of the capacities of the address record partition 1413, the data length partition 1414 and the verification partition 1412;
the controller 13 is further configured to add address information to the address recording block 1413 of the storage block 14 according to the location of the first data in the storage block 1411, and add the data length of the write data determined based on the address information to the data length block 1414 of the storage block 14.
Thus, during the process of storing the first data, the controller 13 can also record the entire length of the first data in the data length partition 1414, and at the same time, the controller 13 can also record the address condition of the first data in the storage block in the address recording partition 1413, which is beneficial for locating the storage position of the first data and determining the data amount in the system layer. Therefore, in the subsequent process of reading and calling the first data, analysis can be carried out based on the information, and a user can conveniently analyze and investigate the data.
Specifically, as shown in fig. 7, in the storage block A1, the storage block is the largest occupied space in the storage block A1, and the space is used for storing specific data contents. Meanwhile, the data content is actually required to identify the storage position during the storage process, is recorded as address information and is added to the address record block. Also, the entire space of the block may not be completely stored due to the data content. For example, when the storage block is 10 bytes and the data content is 5 bytes, the total length of the data, that is, the size of the space actually occupied, i.e., the data length described in this embodiment, is also required to be recorded when the data content is stored. In addition, it is also necessary to identify whether the stored data content is incorrect during the data storage process, that is, to add a verification identifier to the verification block. It should be noted that the validation identifiers may be different specifically, which is determined based on whether the data content stored in the storage block is incorrect and the degree of the error, and the type and format of the validation identifier are not limited herein, and any existing validation identifier in the data storage process may be adopted.
The embodiment of the application provides a data storage device, and the device comprises a first storage area, a second storage area and a controller; the first storage area is a Static Random Access Memory (SRAM) based storage area, and the second storage area is a flash-constructed storage area; the second storage area comprises at least one storage block, and each storage block is a storage unit which is set by taking bytes as a unit according to a preset rule; the controller is configured to, when first data to be written is detected, write the first data into a target storage block of the second storage area if it is determined that data identical to the first data does not exist in the first storage area. Therefore, in the process of data storage through the device, when the first data to be written is determined to exist based on the controller and the first data does not exist in the first storage area, the first data is written into the second storage area, so that the first data can still remain in the second storage area under the condition of power failure, and the data in the first storage area cannot be lost when the power failure occurs, the problem that the first data is written into the first storage area to cause data loss in the process of writing the data is avoided, and the problem that the first data which is written into is lost due to the power failure after the first data is written into the first storage area in the prior art is avoided. The problem that data storage is influenced because data in a Static Random Access Memory (SRAM) matched with the flash memory is lost due to power failure is solved. Meanwhile, the mode of setting the storage block in the second storage area in the application is the storage block set by the target byte number, which is different from the original storage block taking the kilobytes as the unit in the past, so that the effect of respectively managing a plurality of different data in the storage space of the original storage block size can be realized, and the problem that once different data are stored in one original storage block in a conventional mode, once erasing operation is carried out, the data corresponding to the whole original storage block are likely to be simultaneously removed is solved.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may 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, and so forth) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may 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, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may 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, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A data storage device, the device comprising: a first storage area, a second storage area and a controller;
the first storage area is a Static Random Access Memory (SRAM) based storage area, and the second storage area is a flash-constructed storage area;
the second storage area comprises at least one storage block, and each storage block is a storage unit which is set by taking bytes as a unit according to a preset rule;
the controller is configured to, when first data to be written is detected, write the first data into a target storage block of the second storage area if it is determined that data identical to the first data does not exist in the first storage area.
2. The apparatus of claim 1, wherein the second storage area comprises a backup partition, the storage capacity of the backup partition being the storage capacity of at least one EEPROM memory.
3. The apparatus of claim 2, wherein the controller is further configured to write the data in the first storage area to the backup partition upon detecting the power-down instruction.
4. The apparatus according to claim 1, wherein the second storage area further comprises a frequent recording partition and an infrequent recording partition, each of the frequent recording partition and the infrequent recording partition including at least one of the storage blocks;
the frequent recording partition is used for storing data frequently used by a user, and the infrequent recording partition is used for recording historical data.
5. The apparatus of claim 1, wherein the frequent recording partition further comprises at least one memory page, the memory page comprising at least one of the memory blocks; each storage page is provided with a storage page identifier, and the storage page identifier is used for representing whether data is stored in the storage page or not;
the controller is further configured to select, based on the storage page identifier, a storage page in which data is not recorded from among the plurality of storage pages as a target storage page, and select the target storage block from the target storage page.
6. The apparatus of claim 5,
the controller is further configured to backup the second data to the infrequent recording partition when the target storage block stores the second data, and write the first data to the target storage block after performing an erase operation on the target storage block.
7. The apparatus of claim 6, wherein the infrequently recorded partition further comprises at least one memory page, each of the memory pages containing at least one of the memory blocks; each storage page is provided with a storage page identifier;
the controller is further configured to select, in the infrequent recording partition, a storage page with no data recorded therein from the plurality of storage pages as a backup storage page based on the storage page identifier, select a backup storage block from the plurality of storage blocks in the backup storage page, and write the second data into the backup storage block.
8. The apparatus according to claim 7, wherein the memory pages in the frequent recording partition and the non-frequent recording partition are sequentially arranged in address order;
the controller is further configured to, according to the address sequence, backup data in an adjacent storage page of the target storage page to an infrequently recorded partition when it is determined that data is recorded in the adjacent storage page of the target storage page; and when data is recorded in the adjacent storage pages of the backup storage pages, backing up the data of the adjacent storage pages of the backup storage pages in the rest storage pages in the infrequent recording partition.
9. The apparatus of any of claims 1-8, wherein the target storage block comprises a data storage block and a verification block;
the controller is configured to write the first data into the data storage block, and add a verification identifier to the verification block, where the verification identifier is information for verifying integrity of the first data when the first data stored in the storage block is read.
10. The apparatus of claim 9, wherein the target memory block further comprises an address record block and a data length block; the capacity of the data storage block is larger 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 recording blocks of the storage block according to the location of the first data in the storage block, and add the data length of the write data determined based on the address information to the data length blocks of the storage block.
CN202211054673.6A 2022-08-31 2022-08-31 Data storage device Pending CN115469802A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211054673.6A CN115469802A (en) 2022-08-31 2022-08-31 Data storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211054673.6A CN115469802A (en) 2022-08-31 2022-08-31 Data storage device

Publications (1)

Publication Number Publication Date
CN115469802A true CN115469802A (en) 2022-12-13

Family

ID=84370584

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211054673.6A Pending CN115469802A (en) 2022-08-31 2022-08-31 Data storage device

Country Status (1)

Country Link
CN (1) CN115469802A (en)

Similar Documents

Publication Publication Date Title
KR100453053B1 (en) Flash memory file system
JP3662510B2 (en) Remapping control method for flash memory and flash memory structure by the same
US8312204B2 (en) System and method for wear leveling in a data storage device
CN1760875B (en) Transparent migration of files among various types of storage volumes based on file access properties
US8086787B2 (en) Wear leveling method, and storage system and controller using the same
KR101274181B1 (en) Apparatus and method for managing flash memory
KR101447188B1 (en) Method and apparatus for controlling I/O to optimize flash memory
KR101329068B1 (en) Nonvolatile memory with block management
WO2009079478A1 (en) Distributing metadata across multiple different disruption regions within an asymmetric memory system
KR20070060070A (en) Fat analysis for optimized sequential cluster management
US10922234B2 (en) Method and system for online recovery of logical-to-physical mapping table affected by noise sources in a solid state drive
CN103270500A (en) Transaction log recovery
CN101763309A (en) Nonvolatile storage device, information recording system, and information recording method
CN113568582B (en) Data management method, device and storage equipment
KR100703680B1 (en) Flash file system
US20070005929A1 (en) Method, system, and article of manufacture for sector mapping in a flash device
CN107203341A (en) Date storage method, device and flash chip based on flash memory
EP2264602A1 (en) Memory device for managing the recovery of a non volatile memory
CN115373608A (en) Data storage method and device
CN110658981B (en) Method for prolonging service life of Flash
CN114281242B (en) Memory load balancing method, device and equipment
CN115469802A (en) Data storage device
CN115328851A (en) Data protection method, device, equipment and medium
CN111444114B (en) Method, device and system for processing data in nonvolatile memory
CN110471623B (en) Hard disk file writing method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination