WO2016165597A1 - 数据存储的处理方法及装置 - Google Patents

数据存储的处理方法及装置 Download PDF

Info

Publication number
WO2016165597A1
WO2016165597A1 PCT/CN2016/078983 CN2016078983W WO2016165597A1 WO 2016165597 A1 WO2016165597 A1 WO 2016165597A1 CN 2016078983 W CN2016078983 W CN 2016078983W WO 2016165597 A1 WO2016165597 A1 WO 2016165597A1
Authority
WO
WIPO (PCT)
Prior art keywords
data block
partition
updated
block
physical address
Prior art date
Application number
PCT/CN2016/078983
Other languages
English (en)
French (fr)
Inventor
卢晓妹
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016165597A1 publication Critical patent/WO2016165597A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation

Definitions

  • This document relates to, but is not limited to, the field of communications, and in particular, to a method and apparatus for processing data storage.
  • the method of satisfying the key data access requirements includes a flash double block backup scheme, and the flash dual block backup scheme stores key data in at least two different blocks when saving key data.
  • the flash dual block backup scheme stores key data in at least two different blocks when saving key data.
  • the writing adopts the method of successive time, ensuring that even in the process of writing, an extreme power failure abnormality occurs in the system.
  • At least one backup data before the power failure exception will exist, which can ensure the normal boot and operation of the system.
  • the flash block block is erased too frequently. Every time the key data is written, the flash block needs to be erased, which reduces the service life of the flash. At the same time, multiple backups of key data are written and occupied.
  • the runtime of the central processing unit (CPU) reduces storage efficiency;
  • the storage capacity of the required block block often only accounts for a very small part of the total storage capacity of the flash block, resulting in a large amount of storage space remaining per block block, resulting in waste of block block storage resources.
  • the key data must be read and written by the flash physical device, and the access efficiency is not high.
  • the flash block for storing critical data in the embedded system of the related art has a short service life, low access efficiency, and low storage space utilization.
  • the embodiment of the invention provides a data storage processing method and device, which can prolong the service life of the flash block of the embedded product, improve the access efficiency, and improve the utilization of the storage space.
  • An embodiment of the present invention provides a data storage processing method, including: erasing all blocks on a flash memory storage space, and establishing a partition in a flash memory storage space in which block erasure is completed;
  • An update data block corresponding to each updated key data is stored on the partition.
  • the update data block includes: a data block identifier, and/or key data, and/or a check value;
  • the data block identifier is used to indicate: update the physical address of the data block; and/or write the physical address of the writable data block of the partition after the update data block.
  • the method further includes:
  • Reading according to the updated data block physical address of the latest update data block in the determined partition, the key data corresponding to the updated data block into the requested memory space.
  • the method further includes:
  • the memory is requested to be the same size as the initialized update data block, and the key data corresponding to the updated update data block obtained by the initialization is read into the requested memory space.
  • the updating the data block corresponding to the key data stored in each update includes:
  • the partition When the partition does not include enough storage space for storing the updated data block, the partition is erased according to a preset policy, and the updated data block is stored.
  • the update data block is: a data block corresponding to the latest updated key data synchronized in memory.
  • the partition is in units of physical block size.
  • the erasing the partition according to a preset policy, and storing the updated data block includes:
  • an embodiment of the present invention further provides a data storage processing apparatus, including:
  • the erasing module is configured to erase all the block blocks on the flash memory storage space, and establish a partition in the flash storage space that completes the block block erasing;
  • the storage module is configured to store, on the created partition, an update data block corresponding to each updated key data.
  • the update data block includes: a data block identifier, and/or key data, and/or a check value;
  • the data block identifier is used to indicate: update the physical address of the data block; and/or write the physical address of the writable data block of the partition after the update data block.
  • the device further includes a synchronous memory module, and the memory synchronization unit is configured to:
  • Reading according to the updated data block physical address of the latest update data block in the determined partition, the key data corresponding to the updated data block into the requested memory space.
  • the device further includes a synchronous memory module, and the memory synchronization unit is configured to:
  • the partition is erasured once, and the update data block is initialized with default values
  • the memory is requested to be the same size as the initialized update data block, and the key data corresponding to the updated update data block obtained by the initialization is read into the requested memory space.
  • the storage module is set to:
  • the partition When the partition does not include enough storage space for storing the updated data block, the partition is erased according to a preset policy, and the updated data block is stored.
  • the update data block includes data corresponding to the latest updated key data synchronized in memory. Piece.
  • the partition includes a partition in units of physical block sizes.
  • the storage module is set to:
  • the technical solution provided by the embodiment of the present invention includes: erasing all blocks on a flash storage space, and establishing a partition in a flash storage space in which the block block is erased;
  • the method further includes: storing, on the created partition, an update data block corresponding to each updated key data; the method of the embodiment of the invention prolongs the service life of the flash block of the embedded product by reducing the erasure frequency, and improves access of the key data.
  • Efficiency increasing the utilization of storage space.
  • FIG. 1 is a flowchart of a method for processing data storage according to an embodiment of the present invention
  • FIG. 2 is a structural block diagram of a processing device for data storage according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of a method according to a first application example of the present invention.
  • FIG. 4 is a schematic diagram of a flash small-capacity storage system according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of an application example partition of the present invention.
  • FIG. 6 is a flowchart of a method according to a second application example of the present invention.
  • FIG. 7 is a flowchart of a method according to a third application example of the present invention.
  • FIG. 8 is a flowchart of a method according to a fourth application example of the present invention.
  • FIG. 9 is a flowchart of a method according to a fifth application example of the present invention.
  • FIG. 1 is a flowchart of a data storage processing method according to an embodiment of the present invention. As shown in FIG. 1 , the process includes:
  • Step 102 erasing all blocks on the flash storage space, and establishing a partition in the flash storage space that completes the block block erasure;
  • the flash here includes the flash in the embedded system; the process of establishing the partition can be performed only once.
  • Step 104 Store, on the created partition, an update data block corresponding to each updated key data.
  • the embodiment of the present invention is described by a processing method including only one type of key data.
  • the flash memory storage space for completing the block block erasure may be divided and included.
  • a partition corresponding to the key data, and the implementation of the method of the embodiment of the present invention is performed on each partition.
  • the update data block includes: a data block identifier, a key data, and a check value; wherein the data block identifier is used to indicate an update data block physical address; and, the update data is written.
  • the embedded system when the embedded system is powered on, the latest in the partition is obtained through step 603.
  • the physical address of the data block is updated and stored in the memory space, and when the new data is written, the physical address of the latest update data block in the memory is synchronously updated.
  • the size of the updated data block can be customized according to requirements, and the size after customization can be fixed.
  • the storage of updated data blocks can be contiguous. Therefore, the physical address of the writable data block can be obtained by the physical address of the latest update data block plus the size of the update data block.
  • the starting physical address and storage size of the partition are fixed.
  • the physical address to be written to the update data block plus the size of the update data block is the sum address. If the sum address exceeds the end physical address of the partition (the partition start address plus the partition size), the remaining space is considered insufficient to store one. To update a data block, you need to erase it according to the preset policy.
  • the method of the embodiment of the present invention further includes: when a process in the system needs to use key data,
  • the key data corresponding to the updated data block is read into the requested memory space according to the latest updated data block physical address in the determined partition.
  • the partition is erased once and the update data block is initialized with default values
  • the memory is requested to have the same size as the initialized update data block, and the key data corresponding to the updated update data block obtained by the initialization is read into the requested memory space.
  • the physical address of the latest update data block and the physical address of the remaining writable data block of the partition after the update data block is written may be found according to the data block identifier of the update data block. It can be used to write the physical address of the subsequent update data block.
  • the key data corresponding to the latest update data block can be read into the memory;
  • the physical address of the updated data block in the partition is determined according to the data block identifier (the physical address in the flash where the updated data block is located); in the case of finding, the space for updating the data block size is requested from the memory, according to the update.
  • Data block physically The address reads the key data corresponding to the determined update data block into the memory space.
  • the method of the embodiment of the invention reduces the time for erasing the block by accessing the key data corresponding to the updated data block in the partition, and improves the efficiency of reading the key data.
  • the physical address of the updated data block of the updated data block is searched in the partition (the physical address in the flash); if not found, the partition is erased once; using the default
  • the value initializes the update data block, requests the memory to have the same size as the initialized update data block, and reads the key data corresponding to the updated update data block obtained by the initialization into the requested memory space.
  • the access data through the read interface is prevented from being abnormal at this time.
  • storing the update data block corresponding to each updated key data includes:
  • the partition contains enough storage space for storing the update data block, apply for the same size as the updated data block to the partition, and write the update data block to the physical address of the writable data;
  • the partition When the partition does not contain enough storage space for storing the update data block, the partition is erased according to the preset policy, and the update data block is stored.
  • the partition can be erased.
  • the update data block corresponding to the key data updated in the partition the length of the key data for storing the update is reduced, the storage efficiency is improved, the erasure frequency of the block is reduced, and the service life of the flash storage space is improved.
  • erasing the partition according to the preset policy, and storing the updated data block includes:
  • the partition is in units of physical block size.
  • the first block of the partition can be erased first, and the data block corresponding to the updated data is written into the first block, and the first block is written. After the entry is successful, all the remaining blocks in the partition are erased.
  • the block corresponding to the key data for storing the update is provided by the preset policy, and after the update of the updated data block corresponding to the updated key data is completed, the partition is updated for storing the update data block corresponding to the key data of each subsequent update.
  • the other blocks in the block perform one-time erasure, the block erasure frequency is less, the life of the flash memory space is prolonged, and the one-time erasing process reduces the time consumption of each erasing separately, thereby improving the storage efficiency;
  • the method of the embodiment of the invention prolongs the service life of the flash block of the embedded product by reducing the erasure frequency, improves the access efficiency of the key data, and improves the utilization of the storage space.
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used for the processing method of the data storage.
  • FIG. 2 is a structural block diagram of a processing device for data storage according to an embodiment of the present invention. As shown in FIG. 2, the device includes:
  • the erasing module 22 is configured to erase all the block blocks on the flash memory storage space, and establish a partition in the flash storage space that completes the block block erasing;
  • the storage module 24 is configured to store, on the established partition, an update data block corresponding to each updated key data.
  • the update data block includes: a data block identifier, a key data, a check value; wherein the data block identifier is used to indicate an update data block physical address; and, the update data is written The physical address of the writable block of data after the block.
  • the apparatus further includes a synchronous memory module 26:
  • the sync memory module 26 is also set to:
  • the partition is erased once and the update data block is initialized with default values
  • the memory is requested to have the same size as the initialized update data block, and the key data corresponding to the updated update data block obtained by the initialization is read into the requested memory space.
  • the storage module is set to:
  • the partition contains enough storage space for storing the update data block, apply for the same size as the updated data block to the partition, and write the update data block to the physical address of the writable data;
  • the partition When the partition does not contain enough storage space for storing the update data block, the partition is erased according to the preset policy, and the update data block is stored.
  • the partition includes partitions in units of physical block sizes.
  • the update data block is a data block corresponding to the latest updated key data of the on-memory synchronization.
  • the storage module is set to:
  • the partition contains enough storage space for storing the update data block, apply for the same size as the updated data block to the partition, and write the update data block to the physical address of the writable data;
  • This application example updates the writeable data block physical address of each completed update data block when the data block is written in the partition, and determines the storage that can store the updated data block from the updated writable data block physical address. Space; each updated update data block can be written in physical address order;
  • This application example greatly improves the efficiency of reading and writing critical data.
  • the storage process of key data is simplified: when the partition contains enough storage space for storing updated data blocks, it is no longer necessary to perform the erase operation.
  • the updated data block written is the key data that needs to be saved. There is no need to write a lot of redundant and invalid data during the block operation.
  • When reading the key data it is no longer necessary to actually operate the flash. It is directly taken out from the memory space synchronized with the latest data stored by flash.
  • FIG. 3 is a flowchart of a method according to a first application example of the present invention. As shown in FIG. 3, the method includes:
  • Step 301 the flash storage space can be divided into one to multiple partitions, and the partitions are in units of physical block blocks, and each partition separately stores updated data blocks of key data of different structures.
  • Step 302 Each partition is an independent flash storage space, and is used to store updated data blocks of key data of the corresponding structure;
  • Step 303 Before obtaining the key data in the partition, first indexing the updated data block physical address of the latest updated update data block, and reading the key data in the updated data block into the memory.
  • the updated data block physical address of the newly updated update data block includes the physical location of the latest update data block in the partition in the flash;
  • Step 304 reading key data from the memory; the key data read by the application example can be used for process access in the embedded system.
  • Step 305 When updating the key data in the partition, first modify the in-memory update data block according to the updated key data, and synchronize the updated data block corresponding to the key data of the memory update to the physical address of the partition writable data block; that is, in the partition.
  • the data block corresponding to the latest updated key data is stored.
  • Step 306 If the storage space corresponding to the physical address of the writable data block in the partition cannot satisfy the storage of the updated data block when updating the update data block corresponding to the key data, then one or one of the preset positions of the partition is erased first. The above block, the updated data block corresponding to the updated key data is written into the block of the preset position;
  • one or more blocks of this preset position include the first block of the partition.
  • the method of the embodiment of the invention realizes reliable storage of key data of the embedded flash device.
  • FIG. 4 is a schematic diagram of a flash small-capacity storage system according to an embodiment of the present invention. As shown in FIG. 4, the system includes an access module 10, an access module 11, an access module 12, a system 13 of the application example of the present invention, and a storage device 18, wherein:
  • the access module 11 is a process for acquiring key data in an embedded system; the application example system includes a synchronization function 14, a read function 15, a write function 16 and an erase function 17; the storage device 18 is included Flash memory space chip.
  • FIG. 5 is a schematic structural diagram of an application example partition of the present invention.
  • the entire flash storage space may be divided into one or more partitions of different sizes according to requirements (category of key data); the partition is in units of blocks.
  • a partition may be composed of multiple blocks.
  • Each partition in this application example generally includes two or more blocks; a data block (DataStruct) is a data block corresponding to the key data actually stored, and includes a data block identifier and a key. Data, check value.
  • the system searches for the updated DataStruct of the latest updated key data and the writable data block physical address according to the data block identifier, and is used for writing the update data block corresponding to the updated key data.
  • FIG. 6 is a flow chart of a method of a second application example of the present invention. As shown in Figure 6, it includes:
  • step 601 the embedded system is powered on.
  • step 602 a process in the system needs to access key data in the partition, and the initialization interface is called before accessing.
  • Step 603 by calling the initialization interface, determining the latest update data block physical address in the partition according to the data block identifier; the search process may cycle back from the start address.
  • step 604 when the physical address of the latest update data block is determined, the space in the memory is requested to be the same as the critical data size that the process needs to access, and is used to store the key data corresponding to the latest updated update data block in the partition;
  • Step 605 Read, according to the latest updated data block physical address in the determined partition, the key data corresponding to the updated data block to the requested memory space; and synchronize the key data in the memory with the partition.
  • Step 606 If the latest update data block physical address in the partition is not determined, perform one-time erasure on the partition, and initialize the update data block with default values; where the latest update data block physical address in the partition is not determined. It is considered that there is no update data block corresponding to the key data in the partition.
  • Step 607 Applying, to the memory, the same size as the initialized update data block, and reading the key data corresponding to the updated update data block obtained by the initialization into the requested memory space.
  • the key data in the memory is initialized with the default value.
  • This application example can perform one-time erasure on all blocks in the partition to complete the erasing process. After that, in the partition, the data block corresponding to each updated key data is written in the order of the physical address of the writable data block, until the partition does not contain enough storage space for storing the updated data block, and the partition is preset according to the partition. The policy is erased.
  • FIG. 7 is a flowchart of a method according to a third application example of the present invention. As shown in FIG. 7, the process is as follows:
  • Step 701 running a process in the embedded system, the process access needs to depend on the key data in the partition;
  • Step 702 Obtain key data obtained from synchronization in the partition from the storage space of the memory.
  • This application example obtains key data from memory through a set read interface
  • Step 703 returning the obtained key data to the process for process access
  • This application example can directly return the acquired key data directly to the accessed process through the read interface.
  • FIG. 8 is a flowchart of a method according to a fourth application example of the present invention. As shown in FIG. 8, the process is as follows:
  • Step 801 the process in the embedded system needs to update access depends on the key data in the partition
  • Step 802 updating key data in a memory space synchronized with the partition
  • This application example obtains the latest updated key data through the write interface.
  • Step 803 Determine, according to the physical address of the writable data of the recorded partition, whether the remaining space of the partition is enough to be written into the updated data block corresponding to the latest updated key data in the memory;
  • This application example performs the above operations by the write interface.
  • Step 804 If the remaining storage space of the partition is enough to write the data block corresponding to the latest updated key data, the key data and the data block identifier in the memory are synchronously written to the physical address of the writable data block in the partition; the data is about to be updated.
  • the block is stored in the partition, and this application example performs the above operations by the write interface.
  • Step 805 Feedback the latest updated key data in the partition to the process in the embedded system for process access;
  • This application example returns the result to the access module
  • Step 806 if the remaining storage space of the partition cannot meet the requirement of writing the latest updated data block, erase the first block of the partition, and write the key data synchronization data block identifier in the first block of the memory. initial address;
  • Step 807 after completing the writing of the updated data block, erasing all the remaining blocks of the partition at one time;
  • Step 808 feedback the latest updated key data in the partition to the process in the embedded system for process access
  • This application example returns the results to the access module.
  • FIG. 9 is a flowchart of a method according to a fifth application example of the present invention. As shown in FIG. 9, the process is as follows:
  • step 901 when the embedded system is powered on, the physical address of the latest update data block in the partition is obtained; optionally, the application example 2 is used, and step 603 is implemented;
  • Step 902 calling the set write interface, and writing the key data corresponding to the latest update data block;
  • key data is written into the memory through the set write interface, and key data is synchronously written to the storage space on the flash;
  • Step 903 updating the latest update data block physical address; that is, the physical address of the latest update data block in the memory space;
  • This application example can update the physical address of the latest data block in the memory space.
  • the write interface calculates the physical address of the update data block to be written by the physical address of the latest update data block in the memory, plus the size of the update data block, and uses this address to update the physical address of the latest update data block in the memory;
  • the physical address to be written to the update data block plus the size of the update data block is a sum address, and the sum address exceeds the end physical address of the partition, and the write interface is processed according to steps 806, 807, and 808 in the application example 3.
  • the physical address of the latest block in the memory is updated with the physical address of the first block in the partition.
  • the storage medium is further arranged to store program code for performing the steps of the above-described embodiments:
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the processor executes the method of the above embodiment according to the stored program code in the storage medium.
  • the above technical solution extends the service life of the flash block of the embedded product, improves the access efficiency of key data, and improves the utilization of the storage space.

Abstract

一种数据存储的处理方法及装置,其中,对闪存(flash)存储空间上的所有区(block)块进行擦除,并在完成block块擦除的闪存存储空间建立分区(S102);在建立的分区上存储每一次更新的关键数据对应的更新数据块(S104);所述方法通过减少擦除频率延长了flash块的使用寿命,提高了存取效率,提升了存储空间的利用率。

Description

数据存储的处理方法及装置 技术领域
本文涉及但不限于通信领域,尤其涉及一种数据存储的处理方法及装置。
背景技术
在嵌入式产品开发应用中,经常会遇到一些相对独立且关键的少量数据的存储需求,为了便于后续陈述,本文将这些数据简称为关键数据,关键数据涉及:系统正常启动、版本更新的关键参数;系统运行不同阶段代码时,用来同步一些操作的关键标志等。因为关键数据在系统的引导阶段就有读写的需求,故不能使用操作系统下成熟的文件系统来存取。因此,基于嵌入式系统中常用的资料储存型闪存(nand flash)、非易失闪存(nor flash)等存储设备,设计出能够满足关键数据存储要求的高效、可靠的存储系统是一件非常有意义的事情。
相关技术中,能够满足关键数据存取要求的做法包括flash双区块(block)备份的方案,flash双block备份的方案在保存关键数据的时,先后将关键数据存储在至少两个不同的block块中,避免由于nand flash在数据备份时产生坏块,影响关键数据的备份;写入采用先后不同时间进行的方式,确保了即使在写入过程中发生了极端的掉电异常,系统中也至少会存有一份掉电异常之前的备份数据,可以保证系统的正常引导和运行。
flash双block备份的方案虽然可以满足关键数据的存储需求,但明显存在一些不合理的设计且效率低下,包括以下缺点:
1、flash区块(block)块擦除过于频繁,每一次进行关键数据写入时,都需要将flash块擦除,降低了flash的使用寿命,同时,多份关键数据的备份写入,占用中央处理器(CPU)的运行时间,降低了存储效率;
2、关键数据存储到flash block块时,所需的block块的存储容量往往只占flash block总存储容量的极少部分,导致每块block块剩余大量的存储空间,形成block块存储资源的浪费;
3、关键数据的读写都必须实际操作flash物理设备,存取效率不高。
综上,相关技术中的嵌入式系统中用于存储关键数据的flash块使用寿命短、存取效率低、存储空间利用率低。
发明内容
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本发明实施例提供一种数据存储的处理方法及装置,能够延长嵌入式产品的flash块的使用寿命,提高存取效率,提升存储空间的利用率。
本发明实施例提供了一种数据存储的处理方法,包括:对闪存flash存储空间上的所有区块(block)进行擦除,并在完成block擦除的闪存存储空间建立分区;
在所述分区上存储每一次更新的关键数据对应的更新数据块。
可选的,所述更新数据块包括:数据块标记符、和/或关键数据、和/或校验值;
所述数据块标记符用于指示:更新数据块物理地址;和/或写入更新数据块后所述分区的可写数据块的物理地址。
可选的,所述方法还包括:
系统中的进程需要使用关键数据时,
根据所述数据块标记符确定所述分区中最新的更新数据块的更新数据块物理地址;
确定到分区中最新的更新数据块物理地址时,向内存申请与分区中最新的所述更新数据块大小相同的空间;
根据确定的分区中最新的更新数据块的所述更新数据块物理地址读取所述更新数据块对应的关键数据至申请到的内存空间中。
可选的,所述方法还包括:
系统中的进程需要使用关键数据时,
根据所述数据块标记符确定所述分区中最新的更新数据块的更新数据块物理地址;
未确定到分区中最新的所述更新数据块的更新数据块物理地址时;对所述分区做一次性擦除,并用缺省值初始化所述更新数据块;
向内存申请与初始化的所述更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。
可选的,所述存储每一次更新的关键数据对应的更新数据块包括:
根据所述数据块标记符指示的可写数据块的物理地址,判断所述分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
所述分区中包含足够的存储空间用于存储所述更新数据块时,向所述分区申请与所述更新的数据块大小相同的空间,将所述更新数据块写入到所述可写数据块物理地址上;
所述分区中不包含足够的存储空间用于存储所述更新数据块时,按照预设策略对所述分区进行擦除,并存储所述更新数据块。
可选的,所述更新数据块是:内存上同步的最新更新的关键数据对应的数据块。
可选的,所述分区以物理的block大小为单位。
可选的,所述按照预设策略对所述分区进行擦除,并存储所述更新的数据块包括:
先擦除所述的预设位置的一个或一个以上block,将所述更新的关键数据对应的更新数据块写入所述预设位置的block;
完成所述更新的数据块的写入后,擦除所述分区中剩下的所有block。
另一方面,本发明实施例还提供了一种数据存储的处理装置,包括:
擦除模块设置为,对闪存flash存储空间上的所有区block块进行擦除,并在完成block块擦除的闪存存储空间建立分区;
存储模块设置为,在建立的所述分区上存储每一次更新的关键数据对应的更新数据块。
可选的,所述更新数据块包括:数据块标记符、和/或关键数据、和/或校验值;
所述数据块标记符用于指示:更新数据块物理地址;和/或,写入更新数据块后所述分区的可写数据块的物理地址。
可选的,所述装置还包括同步内存模块,内存同步单元设置为:
系统中的进程需要使用关键数据时,
根据所述数据块标记符确定分区中最新的更新数据块的更新数据块物理地址;
确定到分区中最新的更新数据块物理地址时,向内存申请与分区中最新的所述更新数据块大小相同的空间;
根据确定的分区中最新的更新数据块的所述更新数据块物理地址读取所述更新数据块对应的关键数据至申请到的内存空间中。
可选的,所述装置还包括同步内存模块,内存同步单元设置为:
系统中的进程需要使用关键数据时,
根据所述数据块标记符确定分区中最新的更新数据块的更新数据块物理地址;
未确定到分区中最新的所述更新数据块的更新数据块物理地址时,对所述分区做一次性擦除,并用缺省值初始化所述更新数据块;
向内存申请与初始化的所述更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。
可选的,存储模块是设置为:
根据所述数据块标记符指示的可写数据块的物理地址,判断所述分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
所述分区中包含足够的存储空间用于存储所述更新数据块时,向所述分区申请与所述更新的数据块大小相同的空间,将所述更新数据块写入到所述可写数据的物理地址上;
所述分区中不包含足够的存储空间用于存储所述更新数据块时,按照预设策略对所述分区进行擦除,并存储所述更新数据块。
可选的,更新数据块包括内存上同步的最新更新的关键数据对应的数据 块。
可选的,所述分区包括以物理的block大小为单位的分区。
存储模块是设置为:
根据所述数据块标记符指示的可写数据块的物理地址,判断所述分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
所述分区中包含足够的存储空间用于存储所述更新数据块时,向所述分区申请与所述更新的数据块大小相同的空间,将所述更新数据块写入到所述可写数据的物理地址上;
先擦除所述分区的预设位置的一个或一个以上block,将所述更新的关键数据对应的更新数据块写入所述预设位置的block;
完成所述更新的数据块的写入后,擦除所述分区中剩下的所有block。
与相关技术相比,本发明实施例提供的技术方案,包括:对闪存(flash)存储空间上的所有区块(block)进行擦除,并在完成block块擦除的闪存存储空间建立分区;还包括:在建立的分区上存储每一次更新的关键数据对应的更新数据块;本发明实施例方法通过减少擦除频率延长了嵌入式产品的flash块的使用寿命,提高了关键数据的存取效率,提升了存储空间的利用率。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图概述
图1是本发明实施例数据存储的处理方法的流程图;
图2是本发明实施例数据存储的处理装置的结构框图;
图3为本发明第一应用示例的方法流程图;
图4是本发明实施例flash小容量存储系统的示意图;
图5是本发明应用示例分区的结构示意图
图6为本发明第二应用示例的方法流程图;
图7为本发明第三应用示例的方法流程图;
图8为本发明第四应用示例的方法流程图;
图9为本发明第五应用示例的方法流程图。
本发明的实施方式
下文中将结合附图对本申请的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
在本实施例中提供了一种数据存储的处理方法,图1是本发明实施例数据存储的处理方法的流程图,如图1所示,该流程包括:
步骤102,对闪存(flash)存储空间上的所有区块(block)进行擦除,并在完成block块擦除的闪存存储空间建立分区;
需要说明的是,这里的flash包括嵌入式系统中的flash;建立分区的过程可以只执行一次。
本发明实施例方法还包括:
步骤104,在建立的分区上存储每一次更新的关键数据对应的更新数据块;
需要说明的是,本发明实施例以仅包括一种类型的关键数据的处理方法进行说明,当包含多种类型的关键数据时,可以将完成block块擦除的闪存存储空间划分出与包含每一种类关键数据相对应的分区,在每一分区上分别进行本发明实施例方法的实施。
通过上述步骤,擦除在嵌入式设备上的flash存储空间上的所有block块,并建立分区,用于存储与引导相关的关键数据对应的更新数据块;在更新关键数据时,在分区上依次写入每一次更新的关键数据对应的更新数据块。
可选的,本发明实施例方法中,更新数据块包括:数据块标记符、关键数据、校验值;其中,该数据块标记符用于指示更新数据块物理地址;以及,写入更新数据块后分区的可写数据块的物理地址。
需要说明的是,当嵌入式系统上电时,通过步骤603,获取到分区中最新的 更新数据块的物理地址,并且存放到内存空间,当写入新的数据时,同步更新内存中的最新的更新数据块的物理地址。本发明实施例方法中,更新数据块的大小是可以根据需求定制的,定制后大小可以是固定的。更新数据块的存储可以是连续的。因此,通过最新的更新数据块的物理地址加上更新数据块的大小,就可以获得可写数据块的物理地址。另外,分区的起始物理地址和存储空间大小是固定的。即将写入更新数据块的物理地址加上更新数据块的大小得一个和地址,如果这个和地址超过分区的结束物理地址(分区起始地址加上分区大小),则认为剩余空间不足以存放一个更新数据块,需要按照预设策略进行擦除处理。
本发明实施例方法还包括:系统中的进程需要使用关键数据时,
根据数据块标记符确定分区中最新的更新数据块物理地址;
确定到分区中最新的更新数据块物理地址时,向内存申请与分区中最新的更新数据块大小相同的空间;
根据确定的分区中最新的更新数据块物理地址读取更新数据块对应的关键数据至申请到的内存空间中。
可选的,系统中的进程需要使用关键数据时,
根据数据块标记符确定分区中最新的更新数据块物理地址;
未确定到分区中最新的更新数据块物理地址时,对分区做一次性擦除,并用缺省值初始化更新数据块;
向内存申请与初始化的更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。
换句话说,在本实施例中,可以根据更新数据块的数据块标记符来查找到更新数据块写入后,最新的更新数据块所在的物理地址和分区剩余的可写数据块物理地址,即可用于写入后续更新数据块的物理地址,另外,根据上述更新数据块物理地址和分区剩余的可写数据块物理地址可以将最新的更新数据块对应的关键数据读取到内存中;可选的,根据数据块标记符确定在分区中的更新数据块物理地址(更新数据块所在flash中的物理地址);在查找到的情况下,向内存申请该更新数据块大小的空间,根据更新数据块物理地 址读取确定的更新数据块对应的关键数据至内存空间中。本发明实施例方法通过在分区中存取更新数据块对应的关键数据,减少了擦除区块的时间,提高了读取关键数据的效率。
另外,根据该数据块标记符在该分区中查找更新数据块的更新数据块物理地址(所在flash中的物理地址);在没有查找到的情况下,对分区做一次性擦除;用缺省值初始化该更新数据块,向内存申请与初始化的更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。这里,针对当分区中未存放关键数据时对内存中关键数据的初始化,防止此时通过读接口访问数据出现异常。
可选的,本发明实施例方法中,存储每一次更新的关键数据对应的更新数据块包括:
根据数据块标记符指示的可写数据块的物理地址,判断分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
分区中包含足够的存储空间用于存储更新数据块时,向分区申请与更新的数据块大小相同的空间,将更新数据块写入到可写数据的物理地址上;
分区中不包含足够的存储空间用于存储更新数据块时,按照预设策略对分区进行擦除,并存储更新数据块。
换句话说,在本实施例中,可以根据数据块标记符指示的可写数据块物理地址,判断分区中是否能够容纳更新数据块的存储空间,在分区剩余存储空间足够的情况下,将更新数据块写到可写数据块物理地址上;其中,可以将将内存上同步的最新更新的关键信息对应的关键数据块写到可写数据块物理地址上,若在分区剩余存储空间不足够的情况下,可以擦除分区。通过在分区进行更新的关键数据对应的更新数据块的存取,减少了存储更新的关键数据的时长,提高了存储效率,减少区块的擦除频率,提高了闪存存储空间的使用寿命。
可选的,本发明实施例方法中,按照预设策略对分区进行擦除,并存储更新的数据块包括:
先擦除分区的预设位置的一个或一个以上block,将更新的关键数据对应 的更新数据块写入预设位置的block;
完成更新的数据块的写入后,擦除分区中剩下的所有block。
换句话说,本发明实施例中,分区以物理的block大小为单位。并且在擦除该分区的方式可以有很多种,例如:可以首先擦除该分区第一个block,将该更新的数据对应的数据块写入该第一个block,在该第一个block写入成功之后,再擦除该分区中剩下的所有block。通过预设策略提供用于存储更新的关键数据对应的区块,完成更新的关键数据对应的更新数据块的存储后,为了对后续每一次更新的关键数据对应的更新数据块进行存储,将分区中的其他区块进行一次性擦除,较少区块擦除频率,延长闪存存储空间的寿命,一次性擦除处理,减少了每一次分别进行擦除的时耗,提高了存储效率;
需要说明的是,本发明实施例上述方法可以由嵌入式产品执行上述操作。
本发明实施例方法通过减少擦除频率延长了嵌入式产品的flash块的使用寿命,提高了关键数据的存取效率,提升了存储空间的利用率。
本发明实施例还提供一种计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于上述数据存储的处理方法。
图2是本发明实施例数据存储的处理装置的结构框图,如图2所示,该装置包括:
擦除模块22设置为,对闪存flash存储空间上的所有区block块进行擦除,并在完成block块擦除的闪存存储空间建立分区;
存储模块24设置为,在建立的分区上存储每一次更新的关键数据对应的更新数据块。
通过上述装置,擦除在嵌入式设备上的flash存储空间上所有block块,并建立的分区,存储与引导相关的关键数据对应的数据块;在更新关键数据时,在分区上依次写入每一次更新的关键数据对应的更新数据块。
在本实施例中,更新数据块包括:数据块标记符、关键数据、校验值;其中,该数据块标记符用于指示更新数据块物理地址;以及,写入更新数据 块后分区的可写数据块的物理地址。
在本实施例中,该装置还包括同步内存模块26:
系统中的进程需要使用关键数据时,
根据数据块标记符确定分区中最新的更新数据块物理地址;
确定到分区中最新的更新数据块物理地址时,向内存申请与分区中最新的更新数据块大小相同的空间;
根据确定的分区中最新的更新数据块物理地址读取更新数据块对应的关键数据至申请到的内存空间中;
同步内存模块26还设置为:
系统中的进程需要使用关键数据时,
根据数据块标记符确定分区中最新的更新数据块物理地址;
未确定到分区中最新的更新数据块物理地址时,对分区做一次性擦除,并用缺省值初始化更新数据块;
向内存申请与初始化的更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。
可选的,存储模块是设置为:
根据数据块标记符指示的可写数据块的物理地址,判断分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
分区中包含足够的存储空间用于存储更新数据块时,向分区申请与更新的数据块大小相同的空间,将更新数据块写入到可写数据的物理地址上;
分区中不包含足够的存储空间用于存储更新数据块时,按照预设策略对分区进行擦除,并存储更新数据块。
在本实施例中,分区包括以物理的block大小为单位的分区。
可选的,更新数据块是内存上同步的最新更新的关键数据对应的数据块。
可选的,存储模块是设置为:
根据数据块标记符指示的可写数据块的物理地址,判断分区中是否包含 足够的存储空间用于存储更新的关键数据对应的更新数据块;
分区中包含足够的存储空间用于存储更新数据块时,向分区申请与更新的数据块大小相同的空间,将更新数据块写入到可写数据的物理地址上;
先擦除分区的预设位置的一个或一个以上block,将更新的关键数据对应的更新数据块写入预设位置的block;
完成更新的数据块的写入后,擦除分区中剩下的所有block。
下面结合应用示例对本发明实施例进行清楚详细的说明。
应用示例1
本应用示例不再使用相关技术中的多block备份的机制,包括:
对分配的用于备份关键数据的flash存储空间做统筹擦除动作,即在关键数据对应的更新数据块的写入前对所有block块进行一次擦除,对完成block块擦除的flash存储空间建立存储关键数据对应的更新数据块的分区;后续存储关键数据对应的更新数据块时,只有在分区剩余的可写数据块物理地址对应的存储空间不满足更新数据块的写入时,才对整个分区按照预设策略进行擦除;本应用示例减少了flash存储空间的擦除频度;
本应用示例在分区中写入数据块时,对每一次完成更新数据块的写入后的可写数据块物理地址进行更新,从更新的可写数据块物理地址确定可存储更新数据块的存储空间;可按照物理地址顺序写入每一次更新的更新数据块;
本应用示例极大的提高了关键数据的读写效率,关键数据的存储过程得到了简化处理:在分区中包含足够的存储空间用于存储更新数据块时,不再需要执行擦除动作,同时写入的更新数据块即是实际需要保存的关键数据,不再有块操作时的大量冗余、无效数据的写入;在读取关键数据的时候,也不再需要去实际操作flash,而是直接从跟flash最新存储的数据同步的内存空间中取出即可。
图3为本发明第一应用示例的方法流程图,如图3所示,包括:
步骤301,将flash存储空间可划分为一个至多个分区,分区以物理的区(block)块为单位,每一个分区分别存储相应的不同结构的关键数据的更新数据块。
步骤302,每个分区为独立的flash存储空间,用于存储相应的结构的关键数据的更新数据块;
本应用示例分区,在第一次写入更新数据块之前,对整个分区所有block块进行一次擦除。关键数据有更新,将每一次更新的更新数据块在分区中依次写入。
步骤303,获取分区中关键数据前,先索引到最新更新的更新数据块的更新数据块物理地址,并读取更新数据块中的关键数据至内存中。这里,最新更新的更新数据块的更新数据块物理地址包括分区中最新的更新数据块在flash中的物理位置;
步骤304,从内存读取关键数据;本应用示例读取的关键数据可以用于嵌入式系统中的进程访问。
步骤305,更新分区中的关键数据时,先根据更新的关键数据修改内存中更新数据块,同步内存更新的关键数据对应的更新数据块到分区的可写数据块的物理地址上;即在分区中存入最新更新的关键数据对应的数据块。
步骤306,若在更新关键数据对应的更新数据块时,分区中可写数据块物理地址对应的存储空间无法满足更新数据块的存储时,则按照先擦除分区的预设位置的一个或一个以上block,将更新的关键数据对应的更新数据块写入预设位置的block;
完成更新数据块的写入后,擦除分区中剩下的所有block。
需要说明的是,这个的预设位置的一个或一个以上block包括分区的第一个block。
本发明实施例方法,实现了嵌入式flash设备的关键数据的可靠存储。
应用示例2
图4是本发明实施例flash小容量存储系统的示意图,如图4所示,包括访问模块10、访问模块11、访问模块12、本发明应用示例的系统13、存储设备18,其中:
访问模块11是嵌入式系统中获取关键数据的进程;本应用示例系统包括同步功能14、读功能15、写功能16和擦除功能17;存储设备18则是包含 flash存储空间的芯片。
图5是本发明应用示例分区的结构示意图,如图5所示,整个flash存储空间可以根据需求(关键数据的种类)划分为大小不一的一个或一个以上分区;分区是以block为单位,分区可以由多个block组成,本应用示例中的每一分区一般包含两个或两个以上block;更新数据块(DataStruct)为实际存储的关键数据对应的数据块,包含数据块标记符、关键数据、校验值。系统根据数据块标记符查找最新更新的关键数据的更新DataStruct以及可写数据块物理地址,用于进行更新的关键数据对应的更新数据块的写入。
图6为本发明第二应用示例的方法流程图。如图6所示,包括:
步骤601,嵌入式系统上电工作。
步骤602,系统中有进程需要访问依赖于分区中的关键数据,访问之前先调用初始化接口。
步骤603,通过调用初始化接口,根据数据块标记符确定分区中最新的更新数据块物理地址;查找过程可以从起始地址循环往后查找。
步骤604,确定到最新的更新数据块物理地址时,在内存中申请与进程需要访问依赖的关键数据大小相同的空间,用于存放分区中获取到最新更新的更新数据块对应的关键数据;
步骤605、根据确定的分区中最新的更新数据块物理地址读取更新数据块对应的关键数据至申请到的内存空间中;实现分区与内存中关键数据的同步。
步骤606、若未确定到分区中最新的更新数据块物理地址时,对分区做一次性擦除,并用缺省值初始化更新数据块;这里,未确定到分区中最新的更新数据块物理地址时认为该分区中没有关键数据对应的更新数据块。
步骤607、向内存申请与初始化的更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。
若没有关键数据对应的更新数据块,则用缺省值初始化内存中的关键数据。
本应用示例可以对分区内的所有block做一次性擦除,完成擦除处理之 后,在分区中按照可写数据块物理地址的顺序写入每一次更新的关键数据对应的数据块,直至分区中不包含足够的存储空间用于存储更新的数据块时,对分区按照预设策略进行擦除。
应用示例3
图7为本发明第三应用示例的方法流程图,如图7所示,该流程如下:
步骤701,嵌入式系统中运行进程,进程访问需要依赖于分区中的关键数据;
步骤702,从内存的存储空间中获得从分区中同步得到的关键数据。
本应用示例,通过设定的读接口从内存中获得关键数据;
步骤703,将获得的关键数据返回给进程,进行进程访问;
本应用示例可以通过读接口直接将获取的关键数据直接返回给访问的进程。
应用示例4
图8为本发明第四应用示例的方法流程图,如图8所示,该流程如下:
步骤801,嵌入式系统中的进程需要更新访问依赖于分区中的关键数据;
本应用示例调用写接口;
步骤802,更新与分区同步的内存空间中的关键数据;
本应用示例通过写接口获取最新更新的关键数据。
步骤803,根据记录的分区的可写数据的物理地址判断分区剩余空间是否够写入内存中最新更新的关键数据对应的更新数据块;
本应用示例由写接口进行上述操作。
步骤804,若分区剩余的存储空间足够写入最新更新的关键数据对应的数据块,将内存中的关键数据及数据块标记符同步写入到分区中的可写数据块物理地址;即将更新数据块存储到分区中,本应用示例由写接口执行上述操作。
步骤805,将分区中最新更新的关键数据反馈给嵌入式系统中的进程,进行进程访问;
本应用示例给访问模块返回结果;
步骤806,若分区剩余的存储空间无法满足写入最新更新的数据块的要求,擦除分区的第一个block,并将内存中的关键数据同步数据块标记符写到的第一个block的起始地址;
步骤807,完成更新数据块的写入后,再将分区剩余的所有block一次性擦除;
步骤808,将分区中最新更新的关键数据反馈给嵌入式系统中的进程,进行进程访问;
本应用示例给访问模块返回结果。
应用示例5
图9为本发明第五应用示例的方法流程图,如图9所示,该流程如下:
步骤901,嵌入式系统上电时,获取到分区中最新的更新数据块的物理地址;可选的,可以采用应用示例2中,步骤603实现;
步骤902,调用设定的写接口,写入最新的更新数据块对应的关键数据;
本应用示例,通过设定的写接口,将关键数据写入到内存中,并将关键数据同步写入到flash上的存储空间;
步骤903,更新最新的更新数据块物理地址;即内存空间中的最新的更新数据块的物理地址;
本应用示例可以通更新内存空间中的最新的数据块的物理地址。写接口通过内存中当前最新的更新数据块的物理地址,加上更新数据块的大小计算即将写入的更新数据块的物理地址,并用这个地址更新内存中最新的更新数据块的物理地址;如果即将写入更新数据块的物理地址加上更新数据块的大小得一个和地址,而这个和地址超过分区的结束物理地址,那么写接口会按照应用示例3中的步骤806、807、808处理,此时则用分区中第一个block的物理地址来更新内存中最新的更新数据块的物理地址。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本 发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例该的方法。
可选地,存储介质还被设置为存储用于执行上述实施例步骤的程序代码:
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行上述实施例的方法。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的每个模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序/指令来实现其相应功能。本发明不限制于任何特定形式的硬件和软件的结合。”
虽然本申请所揭露的实施方式如上,但所述的内容仅为便于理解本申请而采用的实施方式,并非用以限定本申请,如本发明实施方式中的具体的实现方法。任何本申请所属领域内的技术人员,在不脱离本申请所揭露的精神和范围的前提下,可以在实施的形式及细节上进行任何的修改与变化,但本申请的专利保护范围,仍须以所附的权利要求书所界定的范围为准。
工业实用性
上述技术方案延长了嵌入式产品的flash块的使用寿命,提高了关键数据的存取效率,提升了存储空间的利用率。

Claims (16)

  1. 一种数据存储的处理方法,所述处理方法包括:对闪存flash存储空间上的所有区block块进行擦除,并在完成block块擦除的闪存存储空间建立分区;
    在建立的所述分区上存储每一次更新的关键数据对应的更新数据块。
  2. 根据权利要求1所述的处理方法,其中,所述更新数据块包括:数据块标记符、和/或关键数据、和/或校验值;
    所述数据块标记符用于指示:更新数据块物理地址;和/或,写入更新数据块后所述分区的可写数据块的物理地址。
  3. 根据权利要求2所述的处理方法,所述方法还包括:
    系统中的进程需要使用关键数据时,
    根据所述数据块标记符确定分区中最新的更新数据块的更新数据块物理地址;
    确定到分区中最新的更新数据块的更新数据块物理地址时,向内存申请与分区中最新的所述更新数据块大小相同的空间;
    根据确定的分区中最新的更新数据块的所述更新数据块物理地址读取所述更新数据块对应的关键数据至申请到的内存空间中。
  4. 根据权利要求2所述的处理方法,所述方法还包括:
    系统中的进程需要使用关键数据时,
    根据所述数据块标记符确定分区中最新的更新数据块的更新数据块物理地址;
    未确定到分区中最新的所述更新数据块的更新数据块物理地址时,对所述分区做一次性擦除,并用缺省值初始化所述更新数据块;
    向内存申请与初始化的所述更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。
  5. 根据权利要求2所述的处理方法,其中,所述存储每一次更新的关键 数据对应的更新数据块包括:
    根据所述数据块标记符指示的可写数据块的物理地址,判断所述分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
    所述分区中包含足够的存储空间用于存储所述更新数据块时,向所述分区申请与所述更新的数据块大小相同的空间,将所述更新数据块写入到所述可写数据的物理地址上;
    所述分区中不包含足够的存储空间用于存储所述更新数据块时,按照预设策略对所述分区进行擦除,并存储所述更新数据块。
  6. 根据权利要求5所述的处理方法,其中,所述更新数据块是内存上同步的最新更新的关键数据对应的数据块。
  7. 根据权利要求1~6任一项所述的处理方法,其中,所述分区包括以物理的block大小为单位的分区。
  8. 根据权利要求5所述的处理方法,其中,所述按照预设策略对所述分区进行擦除,并存储所述更新的数据块包括:
    先擦除所述分区的预设位置的一个或一个以上block,将所述更新的关键数据对应的更新数据块写入所述预设位置的block;
    完成所述更新的数据块的写入后,擦除所述分区中剩下的所有block。
  9. 一种数据存储的处理装置,所述装置包括:
    擦除模块设置为,对闪存flash存储空间上的所有区block块进行擦除,并在完成block块擦除的闪存存储空间建立分区;
    存储模块设置为,在建立的所述分区上存储每一次更新的关键数据对应的更新数据块。
  10. 根据权利要求9所述的处理装置,其中,所述更新数据块包括:数据块标记符、和/或关键数据、和/或校验值;其中,
    所述数据块标记符用于指示:更新数据块物理地址;和/或,写入更新数据块后所述分区的可写数据块的物理地址。
  11. 根据权利要求9所述的处理装置,所述装置还包括同步内存模块,内 存同步单元设置为:
    系统中的进程需要使用关键数据时,
    根据所述数据块标记符确定分区中最新的更新数据块的更新数据块物理地址;
    确定到分区中最新的更新数据块物理地址时,向内存申请与分区中最新的所述更新数据块大小相同的空间;
    根据确定的分区中最新的更新数据块的所述更新数据块物理地址读取所述更新数据块对应的关键数据至申请到的内存空间中。
  12. 根据权利要求9所述的处理装置,所述装置还包括同步内存模块,内存同步单元设置为:
    系统中的进程需要使用关键数据时,
    根据所述数据块标记符确定分区中最新的更新数据块的更新数据块物理地址;
    未确定到分区中最新的所述更新数据块的更新数据块物理地址时,对所述分区做一次性擦除,并用缺省值初始化所述更新数据块;
    向内存申请与初始化的所述更新数据块大小相同的空间,读取初始化获得的更新数据块对应的关键数据至申请到的内存空间中。
  13. 根据权利要求10所述的处理装置,其中,所述存储模块是设置为:
    根据所述数据块标记符指示的可写数据块的物理地址,判断所述分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
    所述分区中包含足够的存储空间用于存储所述更新数据块时,向所述分区申请与所述更新的数据块大小相同的空间,将所述更新数据块写入到所述可写数据的物理地址上;
    所述分区中不包含足够的存储空间用于存储所述更新数据块时,按照预设策略对所述分区进行擦除,并存储所述更新数据块。
  14. 根据权利要求10所述的处理方法,其中,所述更新数据块是内存上同步的最新更新的关键数据对应的数据块。
  15. 根据权利要求9~14任一项所述的处理装置,其中,所述分区包括以物理的block大小为单位的分区。
  16. 根据权利要求10所述的处理装置,其中,所述存储模块是设置为:
    根据所述数据块标记符指示的可写数据块的物理地址,判断所述分区中是否包含足够的存储空间用于存储更新的关键数据对应的更新数据块;
    所述分区中包含足够的存储空间用于存储所述更新数据块时,向所述分区申请与所述更新的数据块大小相同的空间,将所述更新数据块写入到所述可写数据的物理地址上;
    先擦除所述分区的预设位置的一个或一个以上block,将所述更新的关键数据对应的更新数据块写入所述预设位置的block;
    完成所述更新的数据块的写入后,擦除所述分区中剩下的所有block。
PCT/CN2016/078983 2015-04-16 2016-04-11 数据存储的处理方法及装置 WO2016165597A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510180629.3 2015-04-16
CN201510180629.3A CN106155915B (zh) 2015-04-16 2015-04-16 数据存储的处理方法及装置

Publications (1)

Publication Number Publication Date
WO2016165597A1 true WO2016165597A1 (zh) 2016-10-20

Family

ID=57125708

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/078983 WO2016165597A1 (zh) 2015-04-16 2016-04-11 数据存储的处理方法及装置

Country Status (2)

Country Link
CN (1) CN106155915B (zh)
WO (1) WO2016165597A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110795040A (zh) * 2019-10-28 2020-02-14 浙江互灵科技有限公司 简易文件管理系统及其实现方法

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108121663B (zh) * 2016-11-29 2022-05-03 群联电子股份有限公司 数据存储方法、存储器存储装置及存储器控制电路单元
CN106649654A (zh) * 2016-12-12 2017-05-10 京信通信技术(广州)有限公司 一种数据更新的方法和装置
CN107797765B (zh) * 2017-09-26 2020-09-25 昆明理工大学 一种延长电可擦除存储元件使用寿命的方法
EP3726364B1 (en) 2017-12-28 2022-07-27 Huawei Technologies Co., Ltd. Data write-in method and solid-state drive array
CN108710578B (zh) * 2018-04-20 2022-07-26 深圳市战音科技有限公司 基于闪存的数据存储方法和装置
CN108804346A (zh) * 2018-05-30 2018-11-13 广东思诺伟智能技术有限公司 一种电池soc数据在flash存储器存储的方法
CN110764704B (zh) * 2019-10-18 2023-09-05 浙江大华技术股份有限公司 一种环境变量写入方法、存储介质及电子装置
CN113204316A (zh) * 2021-05-19 2021-08-03 中国人民解放军93216部队 一种使用flash进行高效数据存储的方法
CN113946288A (zh) * 2021-09-15 2022-01-18 长江存储科技有限责任公司 数据擦除方法、装置、电子设备及计算机存储介质
CN114115743A (zh) * 2021-11-29 2022-03-01 苏州迅镭激光科技有限公司 一种延长数据存储芯片寿命的方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101446921A (zh) * 2008-12-23 2009-06-03 青岛海信宽带多媒体技术股份有限公司 一种Flash存储器的动态存储方法
CN101887750A (zh) * 2009-05-15 2010-11-17 康佳集团股份有限公司 一种利用Flash存储器进行动态数据存储的方法
CN103294615A (zh) * 2012-02-24 2013-09-11 北京四达时代软件技术股份有限公司 一种存储机顶盒用户信息的方法
US20140040681A1 (en) * 2012-08-02 2014-02-06 Sandisk Technologies Inc. Device based wear leveling
CN104820641A (zh) * 2015-04-16 2015-08-05 上海冉能自动化科技有限公司 减少flash擦除次数的方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070204271A1 (en) * 2006-02-28 2007-08-30 Andrew Gaiarsa Method and system for simulating a multi-CPU/multi-core CPU/multi-threaded CPU hardware platform
CN101251826B (zh) * 2007-02-27 2010-09-01 深圳市同洲电子股份有限公司 闪速存储器、用于闪速存储器的数据管理方法及设备
CN101419573A (zh) * 2008-12-01 2009-04-29 成都市华为赛门铁克科技有限公司 一种存储管理的方法、系统和存储设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101446921A (zh) * 2008-12-23 2009-06-03 青岛海信宽带多媒体技术股份有限公司 一种Flash存储器的动态存储方法
CN101887750A (zh) * 2009-05-15 2010-11-17 康佳集团股份有限公司 一种利用Flash存储器进行动态数据存储的方法
CN103294615A (zh) * 2012-02-24 2013-09-11 北京四达时代软件技术股份有限公司 一种存储机顶盒用户信息的方法
US20140040681A1 (en) * 2012-08-02 2014-02-06 Sandisk Technologies Inc. Device based wear leveling
CN104820641A (zh) * 2015-04-16 2015-08-05 上海冉能自动化科技有限公司 减少flash擦除次数的方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110795040A (zh) * 2019-10-28 2020-02-14 浙江互灵科技有限公司 简易文件管理系统及其实现方法

Also Published As

Publication number Publication date
CN106155915B (zh) 2021-01-08
CN106155915A (zh) 2016-11-23

Similar Documents

Publication Publication Date Title
WO2016165597A1 (zh) 数据存储的处理方法及装置
US9092323B2 (en) Systems and methods for recovering addressing data
CN100377085C (zh) 嵌入式操作系统硬件镜像启动优化的实现方法
WO2017132872A1 (zh) 虚拟机备份方法、备份装置及宿主机
CN101625897B (zh) 用于快闪存储器的数据写入方法、储存系统与控制器
CN102521289B (zh) 一种文件同步方法、装置及系统
WO2017050064A1 (zh) 共享内存数据库的内存管理方法及装置
CN105574141B (zh) 一种对数据库进行数据迁移的方法和装置
CN101876885A (zh) 一种分配逻辑盘符的方法及设备
WO2017045491A1 (zh) 一种对 sqlite3 型嵌入式数据库进行升级的方法及系统
CN104104705B (zh) 分布式存储系统的接入方法和设备
US11640244B2 (en) Intelligent block deallocation verification
TW201220047A (en) Method for performing automatic boundary alignment and related non-volatile memory device
US20220253252A1 (en) Data processing method and apparatus
CN103955389A (zh) 一种基于pcm的系统启动方法
WO2014100954A1 (zh) 数据控制方法及系统
CN104866388A (zh) 数据处理方法及装置
CN114528029A (zh) 一种实现bios选项设置的方法、系统、设备和存储介质
TW201308193A (zh) 一種文件分配表的資料儲存方法
CN104407990A (zh) 一种磁盘访问方法及装置
CN104268097A (zh) 一种元数据处理方法及系统
WO2016206070A1 (zh) 一种文件更新方法及存储设备
US11176089B2 (en) Systems and methods for implementing dynamic file systems
CN111124294B (zh) 一种扇区映射信息的管理方法及装置、存储介质和设备
CN104808953A (zh) 控制数据存储的方法、装置及移动终端

Legal Events

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

Ref document number: 16779572

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16779572

Country of ref document: EP

Kind code of ref document: A1