CN107391030B - Data storage method, data storage device, computer-readable storage medium and computer equipment - Google Patents

Data storage method, data storage device, computer-readable storage medium and computer equipment Download PDF

Info

Publication number
CN107391030B
CN107391030B CN201710494335.7A CN201710494335A CN107391030B CN 107391030 B CN107391030 B CN 107391030B CN 201710494335 A CN201710494335 A CN 201710494335A CN 107391030 B CN107391030 B CN 107391030B
Authority
CN
China
Prior art keywords
user data
index
space
written
address
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.)
Active
Application number
CN201710494335.7A
Other languages
Chinese (zh)
Other versions
CN107391030A (en
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.)
Hitachi Building Technology Guangzhou Co Ltd
Original Assignee
Hitachi Building Technology Guangzhou 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 Hitachi Building Technology Guangzhou Co Ltd filed Critical Hitachi Building Technology Guangzhou Co Ltd
Priority to CN201710494335.7A priority Critical patent/CN107391030B/en
Publication of CN107391030A publication Critical patent/CN107391030A/en
Application granted granted Critical
Publication of CN107391030B publication Critical patent/CN107391030B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • 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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • 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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • 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]

Abstract

The invention provides a data storage method and device, a computer readable storage medium and computer equipment, wherein an index is stored in a ROM space in a processor, user data is stored in a Flash space, and the storage of the user data can be realized by the ROM space and the Flash space of the processor without expanding the ROM space and the RAM space outside the processor to store the user data, so that the hardware cost is saved, and the market competitiveness can be improved especially for product occasions with lower operation cost; judging whether the user data to be written is written into a Flash space or not by searching an index, directly accessing the index to retrieve the user data without copying the index into an RAM for retrieval, greatly improving the retrieval efficiency, and having more obvious advantages particularly in products with a large amount of user data such as an IC card security system; and new user data is written into an available external address in a Flash space, so that the service life of the Flash is prolonged.

Description

Data storage method, data storage device, computer-readable storage medium and computer equipment
Technical Field
The present invention relates to the field of data storage, and in particular, to a method and an apparatus for data storage, a computer-readable storage medium, and a computer device
Background
The data storage comprises index storage of data and storage of the data, and in some product application occasions with a large amount of data to be stored, such as an IC card security system, the data storage is used for storing relevant information of a user card.
The current storage circuit for storing a large amount of data adopts an ARM9 processor chip or a higher-performance processor chip, and expands a hardware scheme of a large-capacity RAM memory and a ROM memory, so that the product cost is high.
Disclosure of Invention
Based on the above, the invention provides a data storage method, a data storage device, a computer-readable storage medium and a computer device, which can prolong the service life of a data storage circuit.
A method of data storage comprising the steps of:
acquiring user data to be written, and calculating an index of the user data to be written according to the user data to be written;
searching the index in an internal ROM space of the processor, if the index is not stored in the internal ROM space of the processor, and if the current user data storage quantity in a Flash space is less than the preset maximum storable user data quantity in the Flash space, and if an available index item is searched in the ROM space, writing the index of the user data to be written in a first internal address corresponding to the available index item in the ROM space;
and writing the user data to be written in an available first external address in the Flash space corresponding to the first internal address.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the data storage method as described above.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the data storage method when executing the program.
A data storage device comprising:
the acquisition and calculation module is used for acquiring the user data to be written and calculating the index of the user data to be written according to the user data to be written;
a lookup module for looking up the index in an internal ROM space of a processor;
an index writing module, configured to write an index of the user data to be written in a first internal address corresponding to an available index entry in a ROM space if the index is not stored in an internal ROM space of a processor, and if a current user data storage amount in a Flash space is smaller than a preset maximum storable user data amount, and if an available index entry is found in the ROM space;
and the user data writing module is used for writing the user data to be written in an available first external address in the Flash space corresponding to the first internal address.
According to the data storage method and device, the computer readable storage medium and the computer equipment, the index is stored in the ROM space in the processor, the user data is stored in the Flash space, the storage of the user data can be realized by the ROM space and the Flash space of the processor, the ROM space and the RAM space of the processor are not required to be expanded to store the user data, the hardware cost is saved, and particularly for product occasions with lower operation cost, the market competitiveness can be improved; judging whether the user data to be written is written into a Flash space or not by searching an index, directly accessing the index to retrieve the user data without copying the index into an RAM for retrieval, greatly improving the retrieval efficiency, and having more obvious advantages particularly in products with a large amount of user data such as an IC card security system; and if the user data to be written is new user data, and the current user data storage quantity in the Flash space is less than the preset maximum storable user data quantity in the Flash space, allowing the new user data to be written, and writing the new user data into an available external address in the Flash space, so that the service life of the Flash is prolonged.
Drawings
FIG. 1 is a schematic flow chart of a data storage method according to the present invention;
FIG. 2 is a schematic diagram of an embodiment of a data storage circuit;
FIG. 3 is a flow diagram that illustrates a method for storing user data, in one embodiment;
FIG. 4 is a flow diagram illustrating a method for storing user data in one embodiment;
FIG. 5 is a flowchart illustrating a process of modifying user data corresponding to an index in an embodiment.
FIG. 6 is a diagram illustrating a structure of a storage space of a Flash memory according to an embodiment;
FIG. 7 is a diagram illustrating a corresponding structure of an internal ROM space address for storing an index and an external address of a Flash memory for storing user data in the single chip microcomputer in one embodiment;
FIG. 8 is a flow diagram that illustrates a method for user data erasure in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a data storage method according to the present invention;
in this embodiment, the data storage method may include the steps of:
s11: acquiring user data to be written, and calculating an index of the user data to be written according to the user data to be written;
s12: looking up the index in an internal ROM space of a processor;
s13: if the index is not stored in an internal ROM space of the processor, and if the current user data storage quantity in the Flash space is less than the preset maximum storable user data quantity in the Flash space, and if an available index entry is found in the ROM space, writing the index of the user data to be written in a first internal address corresponding to the available index entry in the ROM space;
s14: and writing the user data to be written in an available first external address in the Flash space corresponding to the first internal address.
In the embodiment, the index is stored in the ROM space in the processor, the user data is stored in the Flash space, and the user data can be stored in the ROM space and the Flash space of the processor without expanding the ROM space and the RAM space outside the processor to store the user data, so that the hardware cost is saved, and the market competitiveness can be improved particularly for product occasions with lower operation cost; judging whether the user data to be written is written into a Flash space or not by searching an index, directly accessing the index to retrieve the user data without copying the index into an RAM for retrieval, greatly improving the retrieval efficiency, and having more obvious advantages particularly in products with a large amount of user data such as an IC card security system; and if the user data to be written is new user data, and the current user data storage quantity in the Flash space is less than the preset maximum storable user data quantity in the Flash space, allowing the new user data to be written, and writing the new user data into an available external address in the Flash space, so that the service life of the Flash is prolonged.
In one embodiment, if no available index entry is found in the ROM space, the invalid index in the ROM space is erased, and the user data in the Flash space corresponding to the invalid index in the ROM space is erased, so that the ROM space has an available index entry.
The data storage method of the present invention can be implemented in a data storage circuit as shown in fig. 2, and fig. 2 is a schematic structural diagram of the data storage circuit in an embodiment. The data storage circuit comprises a processor with an internal ROM space and a Flash memory; the Flash memory is used for storing user data, and the internal ROM space is used for storing indexes of the user data; the Flash memory can be SPI Flash, namely serial FLASH, and is connected with the processor through an SPI bus. The processor can be a single chip microcomputer, and specifically can be a C51 single chip microcomputer, a Cortex-M0 microcontroller, a Cortex-M3 microcontroller or a Cortex-M4 microcontroller. The C51 single chip microcomputer, the Cortex-M0 microcontroller, the Cortex-M3 microcontroller or the Cortex-M4 microcontroller are all provided with an internal ROM storage space and do not have an external ROM memory and a RAM memory. Referring to fig. 2, the data storage circuit further includes a power module and other modules for enabling the data storage circuit to normally operate.
In one embodiment, referring to fig. 3, after the internal ROM space of the processor searches the index, before writing the index of the user data to be written in the first internal address corresponding to the available index entry of the ROM space, the method includes the following steps:
s131: if the index is stored in an internal ROM space of the processor, acquiring first user data corresponding to the index stored in the ROM space;
s132: and if the corresponding first user data is different from the user data to be written, invalidating the index stored in the ROM space.
In this embodiment, the index saved in the ROM space is invalidated, that is, the index saved in the ROM space is cleared, so that the first user data corresponding to the saved index cannot be successfully accessed through the index. The index is dynamically modified to correspond to the user data, so that the service life of the data storage circuit is prolonged.
Fig. 4 is a flow chart illustrating a specific data storage method.
In one embodiment, the preset maximum storable user data amount of the Flash space is smaller than the preset maximum storable data amount of the Flash space; the first external address is an address where user data is not written in the address where the user data can be stored maximally and preset in the Flash space.
In this embodiment, because the preset maximum storable user data amount of the Flash space is smaller than the preset maximum storable data amount of the Flash space, the number of times of dynamically modifying the user data corresponding to the index is greatly increased. Compared with a fixed storage mode of a Flash memory, the dynamic storage mode of the Flash memory changes the internal address of the index and continuously changes the user data corresponding to the index, and the corresponding user data sequentially corresponds to different external addresses, so that the service life of the Flash memory is greatly prolonged.
In one embodiment, the index written at the first internal address of the ROM space is: a new index created for the data to be written or the index corresponding to the first user data.
The modification process of the index corresponding to the user data is further described below by a specific implementation. Referring to fig. 5, an index 1, an index 2, an index 3, and an index 4 are written in addresses of an internal ROM storage space of a processor, and correspondingly, a user data 1, a user data 2, a user data 3, and a user data 4 are encapsulated into a data element format, taking the index 2 as an example, before modifying the user data corresponding to the index 2, the index 2 is cleared from an address where the index 2 is located, and then the index 2 is rewritten in a first 0xff address of the internal ROM storage space in the figure, and the data element 2 originally corresponding to the index 2 remains at an original external address. And writing a new data element 2 of the second user data into a first 0xff address of the external storage space, wherein the first 0xff address of the external storage space is an address corresponding to a preset free storage space.
The principle of the improvement of the service life of the Flash memory is exemplified below. The modifiable times of the Flash memory > (maximum storable data quantity of the Flash memory-maximum storable user data quantity of the Flash memory) multiplied by the modifiable times of the fixed storage mode of the Flash memory.
Referring to fig. 6, the Flash memory is because the user data may not occupy the maximum storage space available for storing the user data in the Flash memory, that is, the current amount of stored user data in the Flash memory is less than or equal to the maximum amount of user data storable in the Flash memory, so the number of times of modification is at least (the maximum amount of data storable in the Flash memory — the maximum amount of user data storable in the Flash memory) × the number of times of modification of the fixed storage mode of the Flash memory.
For example, the maximum storable data amount of the Flash memory can be 50000, the large storable user data amount of the Flash memory is 30000, and the modifiable times of the fixed storage mode of the Flash memory are 105. Wherein the data comprises user data.
For example, the user data is modified daily by update 104Service life of Flash memory>=(50000-30000)×105÷104365 ═ 548 year.
When the Flash memory is in a fixed storage mode, the service life of the Flash memory is 105÷104Day 10.
It can be seen that the data storage method of this embodiment is a method for dynamically modifying user data corresponding to an index, that is, one index may sequentially and respectively correspond to different data, where the different data respectively correspond to different external storage addresses, and due to the existence of the free storage space, the number of times that the dynamically modified index corresponds to the user data is greatly increased. Compared with a fixed storage mode of a Flash memory, the dynamic storage mode of the Flash memory changes the internal address of the index and continuously changes the user data corresponding to the index, and the corresponding user data sequentially corresponds to different external addresses, so that the service life of the Flash memory is greatly prolonged. The smaller the amount of data used for storing the user is, the longer the Flash memory is.
The index is data for retrieving user data, and may be specifically a number, for example, user data in an IC card is to be retrieved, and a storage address of the user data can be acquired through the index, so that the user data content is accessed. The storage address of the index and the storage address of the user data have a linear corresponding relation, namely the address of the user data corresponding to the index can be obtained by obtaining the address of the index. In an embodiment, referring to fig. 7, in fig. 7, the processor is a single chip microcomputer, the Flash memory is an spiflah memory, the index is stored in a ROM storage space inside the single chip microcomputer, the user data is stored in a storage space of an external SPI Flash memory, the index and user data can be stored in a sequential manner from small to large according to the address, and the address of each index entry and the address of the corresponding data element of the external Flash are in a linear correspondence relationship. The corresponding relation between the initial address used for storing the index in the ROM storage space inside the processor, the initial address used for storing the user data, the data length of the index and the data length of the user data can be established. Specifically, the length of data occupied by each index entry or user data is fixed and consistent, the length is a multiple of 4, and the length occupied by each index entry should be as short as possible. And establishing a corresponding relation between the address for storing the index and the address for storing the user data.
In one embodiment, writing the user data to be written in a first external address in a Flash space corresponding to a first internal address in the ROM space includes the following steps:
acquiring a starting address used for storing an index in a ROM space inside a processor, acquiring a starting address used for storing user data in a Flash space, acquiring the data length of the index of the user data to be written, and acquiring the data length of the user data to be written;
calculating a first external address of the user data to be written according to the following linear correspondence:
the linear corresponding relation is as follows: the first external address of the user data to be written is equal to the initial address used for storing the index subtracted from the first internal address in the ROM space, then the first external address is divided by the data length of the first index, the data length of the user data to be written is multiplied, and the initial address used for storing the user data in the Flash space is added.
In this embodiment, the storage address of the index of the user data and the storage address of the user data form the following linear correspondence relationship: the storage address of the user data is: the difference between the storage address of the index minus the start address used to store the index is divided by the data length of the index, multiplied by the data length of the user data, plus the start address used to store the user data.
For example, the length of data occupied by the ith user data packaged in a data element format is L, the length of data occupied by the corresponding ith index is L, and the address of the ith user data is:
DATA_ELEMENT_ADDR=DATA_ELEMENT_START_ADDR+((Data_Index_START_ADDR-Data_Index_START_ADDR)/l)*L。
DATA _ ELEMENT _ START _ ADDR represents a START address for storing user DATA, DATA _ Index _ START _ ADDR represents a START address for storing an Index, DATA _ ELEMENT _ ADDR is an address where ith user DATA is located, and DATA _ Index _ START _ ADDR is an address where ith Index is located.
In one embodiment, after writing the second user data, the method comprises the following steps:
when the data storage circuit does not write user data, calculating whether the number of the currently stored user data is greater than or equal to the preset maximum storable user data number, and if the number of the currently stored user data is greater than or equal to the preset maximum storable user data storage space, not writing the user data;
in this embodiment, that is, it is ensured that the storage space for currently storing the user data is not higher than the preset maximum storage space capable of storing the user data, and if the storage space is greater than or equal to the preset maximum storage space capable of storing the user data, the user data is not written in; and erasing the corresponding user data of the invalidated index in the storage space of the currently stored user data. The method can ensure that the number of the currently stored user data is less than the preset maximum number of the stored user data, so as to ensure the service life of the flash memory.
In an embodiment, referring to fig. 8, after the user data to be written is written in the available first external address in the Flash space corresponding to the first internal address, the method includes the following steps:
if the storage space which can currently store the user data in the Flash space is smaller than a preset critical value and the user data writing operation is not executed, the following erasing work is executed at least twice in sequence:
in the internal ROM storage space, sequentially searching invalid indexes in a segmented mode from a starting address for storing the indexes;
erasing the searched invalid index and the user data in the flash space corresponding to the invalid index;
if new user data need to be written, writing the index corresponding to the new user data back to the address of the ROM space where the erased invalid index is located, and writing the new user data back to the address where the erased user data is located in the flash space; the address corresponds to the address of the ROM space.
Since the sector erase operation (the erase operation takes a long time) is not required in most cases when writing user data. When data is written, a large amount of time is consumed to perform data erasing operation when no writable space exists, so that the situation is avoided as much as possible, when the system is in an idle state, the data amount of the writable space is periodically detected after the user data to be written is written into the available first external address in the Flash space corresponding to the first internal address, and the erasing operation is performed if the data amount is lower than a certain value NOT _ WR _ COUNT _ LIMIT.
In one embodiment, the step of looking up the index in the internal ROM space of the processor comprises the steps of:
setting a first index pointer and a second index pointer for accessing an index address according to the index;
traversing odd index items in the ROM space, traversing even index items in the ROM space, respectively accessing the odd index items in the ROM space by using the first index pointer, and searching the index in the odd index items; and respectively accessing even index entries in the ROM space by using the second index pointers, and searching the index in the index.
In the embodiment, the index is stored in the ROM space of the single chip microcomputer, and the program can directly access the index to perform data retrieval without copying the index into the RAM for retrieval, so that the retrieval efficiency is greatly improved.
For example, 100 indexes, if the index is traversed from the first item index to the 100 th item index, the index needs to be retrieved at most 100 times. The 100 indexes are divided into 1 st, 3 rd and 5 th odd-term indexes 99 and 2 nd, 4 th and 6 th even-term indexes 100, two sub-loops traversing the odd-term indexes and two sub-loops traversing the even-term retrieval are simultaneously arranged in the retrieval loop, and the required indexes can be retrieved only by retrieving 50 times at most. The retrieval rate can be doubled.
Specifically, the manner of directly accessing the index may be implemented by the following procedure.
Figure GDA0002316866830000091
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the data storage method as described above.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the data storage method when executing the program.
A data storage device comprising:
the acquisition and calculation module is used for acquiring the user data to be written and calculating the index of the user data to be written according to the user data to be written;
a lookup module for looking up the index in an internal ROM space of a processor;
an index writing module, configured to write an index of the user data to be written in a first internal address corresponding to an available index entry in a ROM space if the index is not stored in an internal ROM space of a processor, and if a current user data storage amount in a Flash space is smaller than a preset maximum storable user data amount, and if an available index entry is found in the ROM space;
and the user data writing module is used for writing the user data to be written in an available first external address in the Flash space corresponding to the first internal address.
According to the data storage device, the computer readable storage medium and the computer equipment, the index is stored in the ROM space in the processor, the user data is stored in the Flash space, the user data can be stored without expanding the ROM space and the RAM space outside the processor, so that the hardware cost is saved, and particularly, the market competitiveness can be improved on product occasions with lower operation cost; judging whether the user data to be written is written into a Flash space or not by searching an index, directly accessing the index to retrieve the user data without copying the index into an RAM for retrieval, greatly improving the retrieval efficiency, and having more obvious advantages particularly in products with a large amount of user data such as an IC card security system; and if the user data to be written is new user data, and the current user data storage quantity in the Flash space is less than the preset maximum storable user data quantity in the Flash space, allowing the new user data to be written, and writing the new user data into an available external address in the Flash space, so that the service life of the Flash is prolonged.
The data storage device, the computer-readable storage medium, and the computer device of the present invention correspond to the data storage method of the present invention, and embodiments of the data storage method of the present invention are also applicable to the data storage device, the computer-readable storage medium, and the computer device of the present invention.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express a few embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of storing data, comprising the steps of:
acquiring user data to be written, and calculating an index of the user data to be written according to the user data to be written;
searching the index in an internal ROM space of the processor, if the index is not stored in the internal ROM space of the processor, and if the current user data storage quantity in a Flash space is less than the preset maximum storable user data quantity in the Flash space, and if an available index item is searched in the ROM space, writing the index of the user data to be written in a first internal address corresponding to the available index item in the ROM space;
writing the user data to be written in an available first external address in a Flash space corresponding to the first internal address;
the method for writing the user data to be written in the Flash space corresponding to the first internal address in the ROM space comprises the following steps:
acquiring a starting address used for storing an index in a ROM space inside a processor, acquiring a starting address used for storing user data in a Flash space, acquiring the data length of the index of the user data to be written, and acquiring the data length of the user data to be written;
calculating a first external address of the user data to be written according to the following linear correspondence:
the linear corresponding relation is as follows: and the first external address of the user data to be written is equal to the initial address used for storing the user data in the Flash space, after the initial address used for storing the index is subtracted from the first internal address in the ROM space, the first external address is divided by the data length of the first index, the data length of the user data to be written is multiplied, and the initial address used for storing the user data in the Flash space is added.
2. The method according to claim 1, wherein after the internal ROM space of the processor is searched for the index, before the index of the user data to be written is written at the first internal address corresponding to the available index entry of the ROM space, the method comprises the following steps:
if the index is stored in an internal ROM space of the processor, acquiring first user data corresponding to the index stored in the ROM space;
and if the corresponding first user data is different from the user data to be written, invalidating the index stored in the ROM space.
3. The method according to claim 1 or 2,
the preset maximum storable user data quantity of the Flash space is smaller than the preset maximum storable data quantity of the Flash space; the first external address is an address where user data is not written in the address where the user data can be stored maximally and preset in the Flash space.
4. The method according to claim 1 or 2,
if the available index entry is not found in the ROM space, the invalid index in the ROM space is erased, and the user data in the Flash space corresponding to the invalid index in the ROM space is erased, so that the ROM space has the available index entry.
5. The method of claim 2, wherein the index written at the first internal address of the ROM space is: a new index created for the user data to be written or the index corresponding to the first user data.
6. The method according to claim 1 or 2, characterized in that after the user data to be written is written to the available first external address in the Flash space corresponding to the first internal address, the method comprises the following steps:
if the storage space which can store the user data currently in the Flash space is smaller than a preset critical value, the following erasing work is executed at least twice in sequence:
in the internal ROM storage space, sequentially searching invalid indexes in a segmented mode from a starting address for storing the indexes;
erasing the searched invalid index and the user data in the Flash space corresponding to the invalid index;
if new user data need to be written, writing the index corresponding to the new user data back to the address of the ROM space where the erased invalid index is located, and writing the new user data back to the address where the erased user data is located in the Flash space; the address corresponds to the address of the ROM space.
7. Method according to claim 1 or 2, wherein the step of looking up the index in an internal ROM space of a processor comprises the steps of:
setting a first index pointer and a second index pointer for accessing an index address according to the index;
traversing odd index items in the ROM space, traversing even index items in the ROM space, respectively accessing the odd index items in the ROM space by using the first index pointer, and searching the index in the odd index items; and respectively accessing even index entries in the ROM space by using the second index pointers, and searching the indexes in the even index entries.
8. A data storage device, comprising:
the acquisition and calculation module is used for acquiring the user data to be written and calculating the index of the user data to be written according to the user data to be written;
a lookup module for looking up the index in an internal ROM space of a processor;
an index writing module, configured to write an index of the user data to be written in a first internal address corresponding to an available index entry in a ROM space if the index is not stored in an internal ROM space of a processor, and if a current user data storage amount in a Flash space is smaller than a preset maximum storable user data amount, and if an available index entry is found in the ROM space;
the user data writing module is used for writing the user data to be written in an available first external address in a Flash space corresponding to the first internal address;
the user data writing module also comprises a first external data address module; the first external data address module is used for acquiring a starting address used for storing an index in a ROM space inside the processor, acquiring a starting address used for storing user data in a Flash space, acquiring the data length of the index of the user data to be written in and acquiring the data length of the user data to be written in; calculating a first external address of the user data to be written according to the following linear correspondence:
the linear corresponding relation is as follows: and the first external address of the user data to be written is equal to the initial address used for storing the user data in the Flash space, after the initial address used for storing the index is subtracted from the first internal address in the ROM space, the first external address is divided by the data length of the first index, the data length of the user data to be written is multiplied, and the initial address used for storing the user data in the Flash space is added.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the data storage method according to any one of claims 1 to 7.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the data storage method of any one of claims 1-7 when executing the program.
CN201710494335.7A 2017-06-26 2017-06-26 Data storage method, data storage device, computer-readable storage medium and computer equipment Active CN107391030B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710494335.7A CN107391030B (en) 2017-06-26 2017-06-26 Data storage method, data storage device, computer-readable storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710494335.7A CN107391030B (en) 2017-06-26 2017-06-26 Data storage method, data storage device, computer-readable storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN107391030A CN107391030A (en) 2017-11-24
CN107391030B true CN107391030B (en) 2020-04-28

Family

ID=60333140

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710494335.7A Active CN107391030B (en) 2017-06-26 2017-06-26 Data storage method, data storage device, computer-readable storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN107391030B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108520763B (en) * 2018-04-13 2021-07-16 广州醇美电子有限公司 Data storage method, device, equipment and storage medium
CN108647278B (en) * 2018-05-03 2021-07-02 中北大学 File management method and system
CN108664577B (en) * 2018-05-03 2021-03-12 中北大学 File management method and system based on FLASH idle area
CN109979498A (en) * 2019-01-24 2019-07-05 深圳市景阳信息技术有限公司 The method and device of the write-in of disk video data, reading
CN110427161B (en) * 2019-08-09 2023-02-14 山东远大朗威教育科技股份有限公司 Data storage method for serial flash memory

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104598161A (en) * 2013-10-31 2015-05-06 腾讯科技(深圳)有限公司 Data reading and writing method and device and data storage structure
CN105512232A (en) * 2015-11-30 2016-04-20 北京金山安全软件有限公司 Data storage method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6978342B1 (en) * 1995-07-31 2005-12-20 Lexar Media, Inc. Moving sectors within a block of information in a flash memory mass storage architecture

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104598161A (en) * 2013-10-31 2015-05-06 腾讯科技(深圳)有限公司 Data reading and writing method and device and data storage structure
CN105512232A (en) * 2015-11-30 2016-04-20 北京金山安全软件有限公司 Data storage method and device

Also Published As

Publication number Publication date
CN107391030A (en) 2017-11-24

Similar Documents

Publication Publication Date Title
CN107391030B (en) Data storage method, data storage device, computer-readable storage medium and computer equipment
CN111221776B (en) Method, system and medium for realizing file system oriented to nonvolatile memory
US10169226B2 (en) Persistent content in nonvolatile memory
US20180089074A1 (en) Techniques to Manage Key-Value Storage at a Memory or Storage Device
US20150113230A1 (en) Directory storage method and query method, and node controller
CN100367306C (en) Nonvolatile memory card
JP5709814B2 (en) Fast tree flattening for systems with non-volatile memory
JP2013137770A (en) Lba bitmap usage
CN109918234B (en) Metadata recovery method, device, equipment and medium based on SSD
CN109976669B (en) Edge storage method, device and storage medium
CN108664577B (en) File management method and system based on FLASH idle area
CN108664482B (en) FLASH memory and storage file management method
US11662932B2 (en) Tiered storage system with defragmentation based on weighted flash fragmentation factor
US10782895B2 (en) Management method of metadata for preventing data loss and memory device using the same
CN112395215B (en) DRAM-less solid state disk mapping table management method and device, computer equipment and storage medium
CN107590077B (en) Spark load memory access behavior tracking method and device
KR102321346B1 (en) Data journaling method for large solid state drive device
CN108717395B (en) Method and device for reducing memory occupied by dynamic block mapping information
CN116301614A (en) Memory data access method, system, device and storage medium
US8019789B2 (en) System and method of object-oriented persistence
CN116880746A (en) Data processing method, device, electronic equipment and computer readable storage medium
CN114089915A (en) File additional writing operation method and device based on FLASH memory
CN112148639A (en) High-efficiency small-capacity cache memory replacement method and system
KR101939361B1 (en) Method for logging using non-volatile memory
CN107301073B (en) Configuration information retrieval method and device based on solid state disk system

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
CB02 Change of applicant information

Address after: Nanxiang three road, Science City high tech Industrial Development Zone, Guangzhou city of Guangdong Province, No. 2 510660

Applicant after: Hitachi building technologies (Guangzhou) Co. Ltd.

Address before: Nanxiang Road three Guangzhou Science City 510660 high tech Industrial Development Zone, Guangdong city of Guangzhou province No. 2

Applicant before: Guangzhou Ropente Science and Technology Development Co., Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant