CN106293530A - A kind of method for writing data and device - Google Patents

A kind of method for writing data and device Download PDF

Info

Publication number
CN106293530A
CN106293530A CN201610647504.1A CN201610647504A CN106293530A CN 106293530 A CN106293530 A CN 106293530A CN 201610647504 A CN201610647504 A CN 201610647504A CN 106293530 A CN106293530 A CN 106293530A
Authority
CN
China
Prior art keywords
physical block
block
physical
data
update times
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.)
Granted
Application number
CN201610647504.1A
Other languages
Chinese (zh)
Other versions
CN106293530B (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.)
Shenzhen Vast Information Technology Co Ltd
Tencent Technology Shenzhen Co Ltd
Original Assignee
Shenzhen Vast Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Vast Information Technology Co Ltd filed Critical Shenzhen Vast Information Technology Co Ltd
Priority to CN201610647504.1A priority Critical patent/CN106293530B/en
Publication of CN106293530A publication Critical patent/CN106293530A/en
Application granted granted Critical
Publication of CN106293530B publication Critical patent/CN106293530B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • 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
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention is applicable to field of data storage, it is provided that a kind of method for writing data and device.Data-storage system of the present invention is according to the data search logical block obtained, and obtains the update times of this logical block;According to the update times of this logical block, built-in multiple physical blocks are chosen the physical block of these data write;Write the data into the physical block chosen, and update the update times of this logical block.The present invention judges the update times of these data by the update times of logical block, generally, the update times of data can be with the importance of response data, update times according to these data chooses suitable physical block write data in multiple physical blocks, i.e. write suitable physical block according to the significance level of data, decrease the error bit that data write occurs, improve the reliability of storage system.

Description

A kind of method for writing data and device
Technical field
The invention belongs to field of data storage, particularly relate to a kind of method for writing data and device.
Background technology
Nand flash memory has the advantages such as memory capacity is big, volume is little, energy consumption is low, anti-vibration, temperature adaptation wide ranges.Compare In traditional electromagnetism storage device, nand flash memory has block erasing and the hardware that directly cannot update on original bit is special Property.Therefore, when nand flash memory is applied to active computer storage system, nand flash memory must use specific flash memory management machine System.
The method for writing data that existing nand flash memory administrative mechanism uses is: storage system is according to the ground of built-in physical block Data are write physical block by location successively, and when being written to last physical block, system is scanned according to physical block address, seeks Look for blank physical block, and write data in the block of blank physical.Use existing method for writing data can occur in a large number cannot The error bit corrected, can cause loss of data simultaneously, and the reliability of storage system is relatively low.
Summary of the invention
The present invention provides a kind of method for writing data and device, it is intended to solves the error bit of generation during data write and causes Loss of data, stores the problem that the reliability of system is low.
For solving above-mentioned technical problem, a kind of method for writing data that the present invention is realized in, described method includes:
Data-storage system is according to the data search logical block obtained, and determines the update times of described logical block;According to The update times of described logical block, chooses the physical block of described data write in built-in multiple physical blocks;By described data Write described physical block, and update the update times of described logical block.
A kind of data transfer apparatus, described device includes:
Determine that module is for according to the data search logical block obtained, and determining the update times of described logical block;Choose Module, for the update times according to described logical block, chooses the physics of described data write in built-in multiple physical blocks Block;Writing module is for writing described physical block by described data, and updates the update times of described logical block.
The present invention compared with prior art, has the beneficial effects that: in the present invention, and data-storage system is according to the data obtained Search logical block, and obtain the update times of this logical block;According to the update times of this logical block, at built-in multiple physical blocks In choose these data write physical block;Write the data into the physical block chosen, and update the update times of this logical block.This Invention judges the update times of these data by the update times of logical block, and generally, the update times of data can be with response data Importance, according to the update times of these data choose in multiple physical blocks suitable physical block write data, i.e. according to number According to significance level write suitable physical block, decrease data write occur error bit, improve the reliable of storage system Property.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing In having technology to describe, the required accompanying drawing used is briefly described, it should be apparent that, the accompanying drawing in describing below is only this Some embodiments of invention.
Fig. 1 be first embodiment of the invention provide a kind of method for writing data realize schematic flow sheet;
Fig. 2 be second embodiment of the invention provide a kind of method for writing data realize schematic flow sheet;
Fig. 3 is the schematic diagram of a kind of data transfer apparatus that third embodiment of the invention provides;
Fig. 4 is the schematic diagram of a kind of data transfer apparatus that fourth embodiment of the invention provides.
Detailed description of the invention
For making the goal of the invention of the present invention, feature, the advantage can be the most obvious and understandable, below in conjunction with the present invention Accompanying drawing in embodiment, is clearly and completely described the technical scheme in the embodiment of the present invention, it is clear that described reality Executing example is only a part of embodiment of the present invention, and not all embodiments.Based on the embodiment in the present invention, people in the art All other embodiments that member is obtained under not making creative work premise, broadly fall into the scope of protection of the invention.
It is hard that the method for writing data that the embodiment of the present invention provides can apply to flash disk, safety digital storage card, solid-state In the core memory device of the storage devices such as dish.
Refer to the method for writing data that Fig. 1, Fig. 1 provide for first embodiment of the invention realizes schematic flow sheet, can Being applied in all memory devices with data write-in functions, the method for writing data shown in Fig. 1 mainly comprises the steps that
S101, data-storage system are according to the data search logical block obtained, and determine the update times of this logical block;
This data-storage system can be: the core of the storage devices such as flash disk, safety digital storage card, solid state hard disc is deposited Memory device.
This data-storage system obtains the method for these data and is not construed as limiting, and can obtain the data of terminal, can obtain net The data that network is downloaded, it is also possible to obtain data from other storage device.
This logical block and physical block are mapping relations, by the mapping relations of this logical block Yu physical block, search this physics Block, the number of times of the physical block write data that this logical block is corresponding is associated with the update times of this logical block.
S102, update times according to this logical block, choose the physics of these data write in built-in multiple physical blocks Block;
The update times of this logical block is associated with the number of times of the renewal of these data, and in actual applications, these data are more New number of times reflects the significance level of these data, if data update times is few, then these data are important, if data update frequently, then These data are inessential.
S103, write the data into this physical block, and update the update times of this logical block.
Write the data in the physical block chosen, and update the update times of this logical block, in order to when number occurs again During according to write, can judge according to the update times of the logical block after updating.
The embodiment of the present invention, data-storage system is according to the data search logical block obtained, and obtains this logical block more New number of times;According to the update times of this logical block, built-in multiple physical blocks are chosen the physical block of these data write;Should Data write the physical block chosen, and update the update times of this logical block.The present invention can be sentenced by the update times of logical block The update times of these data disconnected, generally, the update times of these data can react the importance of these data, according to these data more New number of times chooses suitable physical block write data in multiple physical blocks, i.e. writes, according to the significance level of data, the thing being suitable for Reason block, decreases the error bit that data write occurs, improves the reliability of storage system.
Refer to the method for writing data that Fig. 2, Fig. 2 provide for second embodiment of the invention realizes schematic flow sheet, can Being applied in all memory devices with data write-in functions, the method for writing data shown in Fig. 2 mainly comprises the steps that
S201, data-storage system are according to the data search logical block obtained;
This data-storage system can be: the core of the storage devices such as flash disk, safety digital storage card, solid state hard disc is deposited Memory device.
This data-storage system obtains the method for data and is not construed as limiting, and can obtain terminal data, it is also possible to obtain network The data of upper download, it is also possible to obtain the data in other storage device.
S202, obtain mapping table according to this logical block, and determine the update times of this logical block according to this mapping table;
This mapping table includes the mapping relations of this logical block and this physical block, and the update times of this logical block.Pass through This logical block, searches the update times of this logical block in this mapping table.This logical block and this physical block are mapping relations, this thing Reason block includes multiple Physical Page, writes data into this physical block, i.e. writes data in the Physical Page that this physical block comprises. The update times of this logical block is the data write number of times of target physical page in physical block, and this target physical page is in this physical block The Physical Page that data write number of times is most.
S203, the multiple physical blocks in this data-storage system are divided into the first physical block set and the second physical block collection Close;
In this data-storage system, physical block performance is different, when writing data into the good physical block of performance, mistake occurs By mistake the probability of position is low, and data storing reliability is high, and when writing data into the physical block of poor performance, it may appear that a large amount of error bits from And causing data forever to be lost, data storing reliability is low.Generally, this physical block can be judged by block erasing times Performance, block erasing times is the most, and the performance of this physical block is the poorest, and block erasing times is the fewest, and the performance of this physical block is the best.
These physical blocks multiple are divided into the first physical block set and the second physical block by the block erasing times according to this physical block Set, wherein, sets this first physical block set and includes the block erasing times multiple physical blocks less than preset value, be performance good Physical block, this preset value is integer, set this second physical block set include block erasing times more than or equal to preset value many Individual physical block, is the physical block of poor performance.
The concrete numeral of this preset value can be configured according to the practical situation of this storage system.
It should be noted that the order of step S203 is not construed as limiting, before step S204.
S204, update times according to this logical block, choose the physics of these data write in built-in multiple physical blocks Block;
Further, according to the update times of this logical block, built-in multiple physical blocks are chosen the write of these data Physical block, specifically comprises the following steps that
When the update times of this logical block is 0, the first physical block choosing blank from this first physical block set is made The physical block write for these data;
When the update times of this logical block is 0, from the first physical block set that performance is good, choose the first physics of blank Block write data.The update times setting this logical block is first condition as 0.In actual applications, when the renewal of this logical block When number of times is 0, from this first physical block set, choose the step of the physical block that the first blank physical block writes as these data Also include before rapid: in this mapping table, search the update times of this logical block.
When the update times of logical block is 1, it is judged that whether the space of the first physical block chosen under this first condition It is fully written;
The first physical block chosen under this first condition is under this first condition, in the first blank physical block write data After physical block.The update times setting this logical block is second condition as 1.Judge the first thing chosen under this first condition Whether the space of reason block is fully written and i.e. judges whether the Physical Page of the first physical block chosen under this first condition is fully written.
If the space of the first physical block chosen under this first condition is not fully written, determines and select under this first condition The first physical block taken is the physical block of these data write;
If the space of the first physical block chosen under this first condition is fully written, select from this first physical block set Take the physical block that the first physical block of blank writes as these data;
When the update times of this logical block is more than 1 and less than preset threshold value, it is judged that the chosen under this second condition Whether the space of one physical block is fully written;
The physical block chosen under this second condition includes: after the first physical block write data chosen in the first condition Physical block after the first blank physical block write data under physical block and second condition.Set the update times of this logical block More than 1 and less than this preset threshold value be third condition.This preset threshold value is the natural number more than 2, can be the most right This preset threshold value is configured.Judge whether the space of the first physical block chosen under this second condition is fully written i.e. to judge Whether the Physical Page of the first physical block chosen under this second condition is fully written.
If the space of the first physical block chosen under this second condition is not fully written, determines and select under this second condition The first physical block taken is the physical block of these data write;
If the space of the first physical block chosen under this second condition is fully written, select from this first physical block set Take the physical block that the first physical block of blank writes as these data;
When the update times of this logical block is more than or equal to this preset threshold value, it is judged that the chosen under this third condition Whether the space of one physical block is fully written;
The first physical block chosen under this third condition includes: the first physical block write data chosen under a second condition After physical block and third condition under physical block after the first blank physical block write data.Judge under this third condition Whether the space of the first physical block chosen is fully written the Physical Page of the first physical block i.e. judging to choose under this third condition Whether it is fully written.
If the space of the first physical block chosen under this third condition is not fully written, determines and select under this third condition The first physical block taken is the physical block of these data write;
If the space of the first physical block chosen under this third condition is fully written, select from this second physical block set Take the physical block that the second physical block of blank writes as these data.
S205, write the data into this physical block, and update the update times of this logical block.
Concrete, the update times of this logical block is updated, i.e. to this logical block update times in this mapping table It is updated.
Further, write the data into this physical block, and update the update times of this logical block, specifically include:
Write the data into the Physical Page of this physical block;
Obtain the number of times of each Physical Page write data in this physical block, and in these Physical Page multiple, choose this data The target physical page that write number of times is most;
Data corresponding for this target physical page are write the number of times update times as this logical block;
This target physical page is the Physical Page that in this physical block, data write number of times is most.
It should be noted that the data write number of times of each Physical Page is different, when data write Physical Page in this physical block After, the data write number of times of this Physical Page is updated, if this Physical Page after Geng Xining is the thing that data write number of times is most Reason page, using this Physical Page as target physical page, if after Geng Xining, this Physical Page is not the Physical Page that data write that number of times is most, then The number of times update times as this logical block is write using the data of this target physical page.
The update times of this logical block is associated with the write number of times of these data, and the update times of this logical block reflects this number According to significance level, judge whether these data update frequently according to the update times of this logical block, if the renewal of this logical block time Number is more than this preset threshold value, then it represents that these data update frequently, and then judge that these data are inessential;If the renewal of this logical block time Number is less than this preset threshold value, then it represents that this data update times is few, and then judges that these data are important.
The embodiment of the present invention, data-storage system, according to the data search logical block obtained, is obtained by this logical block and reflects Firing table, and the update times of logical block is determined according to this mapping table;Multiple physical blocks in this data-storage system are divided into One physical block set and the second physical block set;According to the update times of this logical block, this first physical block set and this Two physical block set are chosen the physical block of these data write;Write the data in this physical block, and update this logical block Update times.The update times of logical block of the present invention reflects the importance of these data, and built-in multiple physical blocks are divided into performance The first good physical block set and the second physical block set of poor performance, and important data are write from the first physical block set In good the first physical block of the performance chosen, the of the poor performance that the write of unessential data is chosen from the second physical block set Two physical blocks, thus the error bit occurred when decreasing significant data write, improve the reliability of storage system.
Refer to the structural representation that Fig. 3, Fig. 3 are the data transfer apparatus that third embodiment of the invention provides, in order to just In explanation, illustrate only the part relevant to the embodiment of the present invention.The data transfer apparatus of Fig. 3 example can be earlier figures 1 He The executive agent of the method for writing data that embodiment illustrated in fig. 2 provides, can be in data storage device or data storage device A control module.The data transfer apparatus of Fig. 3 example, specifically includes that and determines module 31, chooses module 32 and writing module 33.The most each functional module describes in detail as follows:
Determine module 31, for the data search logical block according to acquisition, and determine the update times of this logical block;
This logical block and physical block are mapping relations, by the mapping relations of this logical block Yu physical block, search this physics Block, the number of times of the physical block write data that this logical block is corresponding is associated with the update times of this logical block.
Choose module 32, for the update times according to this logical block, in built-in multiple physical blocks, choose this data The physical block of write;
The update times of this logical block is associated with the number of times of the renewal of these data, and in actual applications, these data are more New number of times reflects the significance level of these data, if data update times is few, then these data are important, if data update frequently, then These data are inessential.
Writing module 33, is used for writing the data into this physical block, and updates the update times of this logical block.
Write the data in the physical block chosen, and update the update times of this logical block, in order to when number occurs again During according to write, can judge according to the update times of the logical block after updating.
The present embodiment do not use up details, refer to the first embodiment shown in Fig. 1, do not repeat them here.
The embodiment of the present invention, determines the module 31 data search logical block according to acquisition, and obtains in data-storage system The update times of this logical block;Choose the module 32 update times according to this logical block, choose in built-in multiple physical blocks The physical block of these data write;Writing module 33 writes the data into the physical block chosen, and updates the renewal time of this logical block Number.The present invention judges the update times of these data by the update times of logical block, and generally, the update times of data can reflect The importance of these data, chooses suitable physical block write data according to the update times of these data, i.e. in multiple physical blocks Write suitable physical block according to the significance level of data, decrease the error bit that data write occurs, improve storage system Reliability.
Refer to the structural representation that Fig. 4, Fig. 4 are the data transfer apparatus that fourth embodiment of the invention provides, in order to just In explanation, illustrate only the part relevant to the embodiment of the present invention.The data transfer apparatus of Fig. 4 example can be earlier figures 1 He The executive agent of the method for writing data that embodiment illustrated in fig. 2 provides, can be in data storage device or data storage device A control module.The data transfer apparatus of Fig. 4 example, specifically include that determine module 41, divide module 42, choose module 43 and writing module 44, wherein it is determined that module 41 includes: the first acquisition module 411 and search module 412;Choose module 43 to wrap Include: first chooses module 431;Choose module 43 also to include: the first judge module 432 and second chooses module 433;Choose module 43 also include: the second judge module 434 and the 3rd chooses module 435;Choose module 43 also to include: the 3rd judge module 436 He 4th chooses module 437;Writing module 44 includes: Data write. module the 441, second acquisition module 442 and more new module 443. The most each functional module describes in detail as follows:
Determine module 41, for the data search logical block according to acquisition, and determine the update times of this logical block;
Wherein it is determined that module 41 includes:
First acquisition module 411, for obtaining mapping table according to this logical block;
This mapping table includes: this logical block and the mapping relations of this physical block and the update times of this logical block.
Search module 412, in this mapping table, search the update times of this logical block.
Search module 412 in this mapping table, searched the update times of this logical block by this logical block.This logical block with Physical block is mapping relations, and this physical block includes multiple Physical Page, writes data into this physical block, i.e. writes data into this In the Physical Page that physical block comprises.The update times of this logical block is the data write number of times of target physical page in physical block, should Target physical page is the Physical Page that in this physical block, data write number of times is most.
Divide module 42, for the multiple physical blocks in this data-storage system are divided into the first physical block set and second Physical block set;
In this data-storage system, physical block performance is different, when writing data into the good physical block of performance, mistake occurs By mistake the probability of position is low, and data storing reliability is high, and when writing data into the physical block of poor performance, it may appear that a large amount of error bits from And causing data forever to be lost, data storing reliability is low.Generally, this physical block can be judged by block erasing times Performance, block erasing times is the most, and the performance of this physical block is the poorest, and block erasing times is the fewest, and the performance of this physical block is the best.
Divide physical block 42, according to the block erasing times of this physical block, these physical blocks multiple are divided into the first physical block set With the second physical block set, wherein, set this first physical block set and include the block erasing times multiple physics less than preset value Block, is the physical block that performance is good, and this preset value is integer, and preferably 2, set this second physical block set and include block erasing time Number, more than or equal to multiple physical blocks of this preset value, is the physical block of poor performance.
Choose module 43, for the update times according to this logical block, in built-in multiple physical blocks, choose this data The physical block of write;
Wherein, choose module 43 to include:
First chooses module 431, for when the update times of this logical block is 0, selects from this first physical block set Take the physical block that the first physical block of blank writes as these data;
When the update times of this logical block is 0, first chooses module 431 chooses from the first physical block set that performance is good The first blank physical block write data.The update times setting this logical block is first condition as 0.In actual applications, choosing Delivery block 43 also includes: updates and searches module, for searching the update times of this logical block in this mapping table.
Choose module 43 also to include:
First judge module 432, for when the update times of this logical block is 1, it is judged that choose under this first condition The space of the first physical block whether be fully written;
The first physical block chosen under this first condition is under this first condition, in the first blank physical block write data After physical block.The update times setting this logical block is second condition as 1.
Second chooses module 433, when the space of the first physical block for choosing under this first condition is not fully written, Determine the physical block that the first physical block chosen under this first condition is the write of these data;
Second chooses module 433, when the space of the first physical block being additionally operable to choose under this first condition is fully written, The physical block that the first physical block of blank writes is chosen as these data from this first physical block set.
Choose module 43 also to include:
Second judge module 434, for when the update times of this logical block is more than 1 and is less than preset threshold value, it is judged that Whether the space of the first physical block chosen under this second condition is fully written;
The physical block chosen under this second condition includes: after the first physical block write data chosen in the first condition Physical block after the first blank physical block write data under physical block and second condition.Set the update times of this logical block More than 1 and less than this preset threshold value be third condition.This preset threshold value is the natural number more than 2, can be the most right This preset threshold value is configured.
3rd chooses module 435, when the space of the first physical block for choosing under this second condition is not fully written, Determine the physical block that the first physical block chosen under this second condition is the write of these data;
3rd chooses module 435, when the space of the first physical block being additionally operable to choose under this second condition is fully written, The physical block that the first physical block of blank writes is chosen as these data from this first physical block set.
Choose module 43 also to include:
3rd judge module 436, for when the update times of this logical block is more than or equal to this preset threshold value, it is judged that Whether the space of the first physical block chosen under this third condition is fully written;
The first physical block chosen under this third condition includes: the first physical block write data chosen under a second condition After physical block and third condition under physical block after the first blank physical block write data.
4th chooses module 437, when the space of the first physical block for choosing under this third condition is not fully written, Determine the physical block that the first physical block chosen under this third condition is the write of these data;
4th chooses module 437, when the space of the first physical block being additionally operable to choose under this third condition is fully written, The physical block that the second physical block of blank writes is chosen as these data from this second physical block set.
Writing module 44, is used for writing the data into this physical block, and updates the update times of this logical block.
The update times of this logical block is updated, i.e. the logical block update times in this mapping table is updated.
Wherein, writing module 44 includes:
Data write. module 441, in the Physical Page writing the data into this physical block;
Second acquisition module 442, for obtaining the data write number of times of each Physical Page in this physical block;
More new module 443, in these Physical Page multiple, chooses the target physical page that these data write number of times is most, Corresponding for this target physical page is write the number of times update times as this logical block.
This target physical page is the Physical Page that in this physical block, data write number of times is most.It should be noted that data are write Enter module 441 and the data of Physical Page each in this physical block are write number of times difference, after data write Physical Page, more new module The data write number of times of 443 pairs of these Physical Page is updated, if this Physical Page after Geng Xining is the thing that data write number of times is most Manage page, more new module 443 using this Physical Page as target physical page, if this Physical Page is not that data write number of times is most after Geng Xining Physical Page, more new module 443 then writes the number of times update times as this logical block using the data of this target physical page.
The present embodiment do not use up details, refer to the second example shown in Fig. 2, do not repeat them here.
The embodiment of the present invention, in data-storage system, cover half block 41, according to the data search logical block obtained, passes through really This logical block obtains mapping table, and determines the update times of logical block according to this mapping table;Divide module 42 these data to be stored Multiple physical blocks in system are divided into the first physical block set and the second physical block set, choose module 43 according to this logical block Update times, chooses the physical block of these data write in this first physical block set and this second physical block set;Writing module 44 write the data into this physical block, and update the update times of this logical block.The update times reflection of logical block of the present invention should Built-in multiple physical blocks are divided into the first physical block set and the second physical block of poor performance that performance is good by the importance of data Set, and important data are write the first physical block that the performance chosen from this first physical block set is good, unessential Second physical block of the poor performance that data write is chosen from this second physical block set, thus decrease significant data write and send out Raw error bit, improves the reliability of storage system.
In multiple embodiments provided herein, it should be understood that disclosed method and apparatus, can be passed through other Mode realize.Such as, device embodiment described above is only schematically, such as, and the division of described module, only Dividing for a kind of logic function, actual can have when realizing other dividing mode, the most multiple modules or the assembly can be in conjunction with Or it is desirably integrated into another system, or some features can be ignored, or do not perform.Another point, shown or discussed phase Coupling between Hu or direct-coupling or communication linkage can be the INDIRECT COUPLING by some interfaces, device or module or communication Link, can be electrical, machinery or other form.
The described module illustrated as separating component can be or may not be physically separate, shows as module The parts shown can be or may not be physical module, i.e. may be located at a place, or can also be distributed to multiple On mixed-media network modules mixed-media.Some or all of module therein can be selected according to the actual needs to realize the mesh of the present embodiment scheme 's.
It addition, each functional module in each embodiment of the present invention can be integrated in a processing module, it is also possible to It is that modules is individually physically present, it is also possible to two or more modules are integrated in a module.Above-mentioned integrated mould Block both can realize to use the form of hardware, it would however also be possible to employ the form of software function module realizes.
If described integrated module realizes and as independent production marketing or use using the form of software function module Time, can be stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially The part that in other words prior art contributed or this technical scheme completely or partially can be with the form of software product Embodying, this computer software product is stored in a storage medium, including some instructions with so that a computer Equipment (can be personal computer, server, or the network equipment etc.) performs the complete of method described in each embodiment of the present invention Portion or part steps.And aforesaid storage medium includes: USB flash disk, portable hard drive, read only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can store journey The medium of sequence code.
It should be noted that for aforesaid each method embodiment, in order to simplicity describes, therefore it is all expressed as a series of Combination of actions, but those skilled in the art should know, the present invention is not limited by described sequence of movement because According to the present invention, some step can use other order or carry out simultaneously.Secondly, those skilled in the art also should know Knowing, it might not be all this that embodiment described in this description belongs to preferred embodiment, involved action and module Bright necessary.
In the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, and does not has the portion described in detail in certain embodiment Point, may refer to the associated description of other embodiments.
It is more than the description to method for writing data provided by the present invention and device, for those skilled in the art, According to the thought of the embodiment of the present invention, the most all will change, to sum up, this specification Content should not be construed as limitation of the present invention.

Claims (16)

1. a method for writing data, it is characterised in that described method includes:
Data-storage system is according to the data search logical block obtained, and determines the update times of described logical block;
According to the update times of described logical block, built-in multiple physical blocks are chosen the physical block of described data write;
Described data are write described physical block, and updates the update times of described logical block.
2. the method for claim 1, it is characterised in that the described update times determining described logical block, specifically includes:
Obtaining mapping table according to described logical block, described mapping table includes: described logical block and the mapping relations of described physical block And the update times of described logical block;
In described mapping table, search the update times of described logical block.
3. the method for claim 1, it is characterised in that the described update times according to described logical block, built-in Before multiple physical blocks are chosen the physical block of described data write, specifically include:
Multiple physical blocks in described data-storage system are divided into the first physical block set and the second physical block set.
4. method as claimed in claim 3, it is characterised in that the described update times according to described logical block, built-in Multiple physical blocks are chosen the physical block of described data write, specifically include:
When the update times of described logical block is 0, the first physical block choosing blank from described first physical block set is made The physical block write for described data, the update times of described logical block is 0 for first condition.
5. method as claimed in claim 4, it is characterised in that the described update times according to described logical block, built-in Multiple physical blocks are chosen the physical block of described data write, the most also include:
When the update times of described logical block is 1, it is judged that the space of the first physical block chosen under described first condition is No being fully written, the update times of described logical block is 1 to be second condition;
If the space of the first physical block chosen under described first condition is not fully written, determines and select under described first condition The first physical block taken is the physical block of described data write;
If the space of the first physical block chosen under described first condition is fully written, select from described first physical block set Take the physical block that the first physical block of blank writes as described data.
6. method as claimed in claim 5, it is characterised in that the described update times according to described logical block, built-in Multiple physical blocks are chosen the physical block of described data write, the most also include:
When the update times of described logical block is more than 1 and less than preset threshold value, it is judged that the chosen under described second condition Whether the space of one physical block is fully written, and the update times of described logical block is Article 3 more than 1 and less than described preset threshold value Part;
If the space of the first physical block chosen under described second condition is not fully written, determines and select under described second condition The first physical block taken is the physical block of described data write;
If the space of the first physical block chosen under described second condition is fully written, select from described first physical block set Take the physical block that the first physical block of blank writes as described data.
7. method as claimed in claim 6, it is characterised in that the described update times according to described logical block, built-in Multiple physical blocks are chosen the physical block of described data write, the most also include:
When the update times of described logical block is more than or equal to described preset threshold value, it is judged that choose under described third condition Whether the space of the first physical block is fully written;
If the space of the first physical block chosen under described third condition is not fully written, determines and select under described third condition The first physical block taken is the physical block of described data write;
If the space of the first physical block chosen under described third condition is fully written, select from described second physical block set Take the physical block that the second physical block of blank writes as described data.
8. the method for claim 1, it is characterised in that described by the described data described physical block of write, and update institute State the update times of logical block, specifically include:
Described data are write in the Physical Page of described physical block;
Obtain the data write number of times of each Physical Page in described physical block;
In multiple described Physical Page, choose the target physical page that described data write number of times is most, by described target physical page Corresponding data write number of times is as the update times of described logical block.
9. a data transfer apparatus, it is characterised in that described device includes:
Determine module, for the data search logical block according to acquisition, and determine the update times of described logical block;
Choose module, for the update times according to described logical block, in built-in multiple physical blocks, choose described data write The physical block entered;
Writing module, for described data are write described physical block, and updates the update times of described logical block.
10. device as claimed in claim 9, it is characterised in that described determine that module includes:
First acquisition module, for obtaining mapping table according to described logical block, described mapping table includes: described logical block is with described The mapping relations of physical block and the update times of described logical block;
Search module, in described mapping table, search the update times of described logical block.
11. devices as claimed in claim 9, it is characterised in that described device also includes:
Divide module, for the multiple physical blocks in described data-storage system are divided into the first physical block set and the second thing Reason set of blocks.
12. devices as claimed in claim 11, it is characterised in that described in choose module and include:
First chooses module, for when the update times of described logical block is 0, chooses sky from described first physical block set The physical block that the first white physical block writes as described data, the update times of described logical block is 0 to be first condition.
13. devices as claimed in claim 12, it is characterised in that described in choose module and also include:
First judge module, for when the update times of described logical block is 1, it is judged that the chosen under described first condition Whether the space of one physical block is fully written, and the update times of described logical block is 1 for second condition;
Second chooses module, when the space of the first physical block for choosing under described first condition is not fully written, determines The first physical block chosen under described first condition is the physical block of described data write;
Second chooses module, when the space of the first physical block being additionally operable to choose under described first condition is fully written, from institute State and the first physical block set is chosen the physical block that the first physical block of blank writes as described data.
14. devices as claimed in claim 13, it is characterised in that described in choose module and also include:
Second judge module, for when the update times of described logical block is more than 1 and less than preset threshold value, it is judged that described the Whether the space of the first physical block chosen under the conditions of two is fully written, and the update times of described logical block is more than 1 and less than described Preset threshold value is third condition;
3rd chooses module, when the space of the first physical block for choosing under described second condition is not fully written, determines The first physical block chosen under described second condition is the physical block of described data write;
3rd chooses module, when the space of the first physical block being additionally operable to choose under described second condition is fully written, from institute State and the first physical block set is chosen the physical block that the first physical block of blank writes as described data.
15. devices as claimed in claim 14, it is characterised in that described in choose module and also include:
3rd judge module, for when the update times of described logical block is more than or equal to described preset threshold value, it is judged that in institute Whether the space stating the first physical block chosen under third condition is fully written;
4th chooses module, when the space of the first physical block for choosing under described third condition is not fully written, determines The first physical block chosen under described third condition is the physical block of described data write;
4th chooses module, when the space of the first physical block being additionally operable to choose under described third condition is fully written, from institute State and the second physical block set is chosen the physical block that the second physical block of blank writes as described data.
16. devices as claimed in claim 9, it is characterised in that said write module includes:
Data write. module, in the Physical Page that described data write described physical block;
Second acquisition module, for obtaining the data write number of times of each Physical Page in described physical block;
More new module, in multiple described Physical Page, chooses the target physical page that described data write number of times is most, by institute State data write number of times corresponding to the target physical page update times as described logical block.
CN201610647504.1A 2016-08-09 2016-08-09 A kind of method for writing data and device Active CN106293530B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610647504.1A CN106293530B (en) 2016-08-09 2016-08-09 A kind of method for writing data and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610647504.1A CN106293530B (en) 2016-08-09 2016-08-09 A kind of method for writing data and device

Publications (2)

Publication Number Publication Date
CN106293530A true CN106293530A (en) 2017-01-04
CN106293530B CN106293530B (en) 2019-05-21

Family

ID=57667359

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610647504.1A Active CN106293530B (en) 2016-08-09 2016-08-09 A kind of method for writing data and device

Country Status (1)

Country Link
CN (1) CN106293530B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108897492A (en) * 2018-05-30 2018-11-27 新华三技术有限公司 A kind of method for writing data and device
WO2020113440A1 (en) * 2018-12-04 2020-06-11 深圳市大疆创新科技有限公司 Data storage method, flash device, intelligent battery, and movable platform

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102375779A (en) * 2010-08-16 2012-03-14 深圳市朗科科技股份有限公司 Data processing method and data processing module
CN102693185A (en) * 2011-02-17 2012-09-26 索尼公司 Management device and management method
US20140189420A1 (en) * 2008-03-01 2014-07-03 Kabushiki Kaisha Toshiba Memory system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140189420A1 (en) * 2008-03-01 2014-07-03 Kabushiki Kaisha Toshiba Memory system
CN102375779A (en) * 2010-08-16 2012-03-14 深圳市朗科科技股份有限公司 Data processing method and data processing module
CN102693185A (en) * 2011-02-17 2012-09-26 索尼公司 Management device and management method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108897492A (en) * 2018-05-30 2018-11-27 新华三技术有限公司 A kind of method for writing data and device
CN108897492B (en) * 2018-05-30 2021-06-29 新华三技术有限公司 Data writing method and device
WO2020113440A1 (en) * 2018-12-04 2020-06-11 深圳市大疆创新科技有限公司 Data storage method, flash device, intelligent battery, and movable platform

Also Published As

Publication number Publication date
CN106293530B (en) 2019-05-21

Similar Documents

Publication Publication Date Title
US10831734B2 (en) Update-insert for key-value storage interface
US9846542B2 (en) Storage controller, storage device, storage system and method of operating the storage controller
US8041883B2 (en) Restoring storage devices based on flash memories and related circuit, system, and method
TWI515561B (en) Data tree storage methods, systems and computer program products using page structure of flash memory
CN105573681B (en) Method and system for establishing RAID in SSD
US20180089074A1 (en) Techniques to Manage Key-Value Storage at a Memory or Storage Device
US20150026391A1 (en) Block grouping method for garbage collection of solid state drive
CN103995855A (en) Method and device for storing data
CN105117355A (en) Memory, memory system and data process method
CN106326134A (en) Flash Translation Layer (FTL) address mapping method and device
CN103164490B (en) A kind of efficient storage implementation method of not fixed-length data and device
US9021218B2 (en) Data writing method for writing updated data into rewritable non-volatile memory module, and memory controller, and memory storage apparatus using the same
CN112506814B (en) Memory, control method thereof and memory system
CN104126178A (en) SLC-MLC wear balancing
CN106598479A (en) Method and device for fail-safe erase of flash memory
CN101354681A (en) Memory system, abrasion equilibrium method and apparatus of non-volatile memory
CN106155915A (en) The processing method and processing device of data storage
CN104298606A (en) Garbage collection action control method in SSD
CN106775436B (en) Data access method, memorizer control circuit unit and memory
CN106372000B (en) Map table updating method, memorizer control circuit unit and memory storage apparatus
CN109992202A (en) Data storage device, its operating method and the data processing system including it
CN109101437A (en) A kind of date storage method and terminal
CN107870868A (en) Storage device and storage system
CN103365786A (en) Data storage method, device and system
CN106293530A (en) A kind of method for writing data and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Room 513, building B, area 5, honghualing Industrial Zone, Taoyuan Street, Nanshan District, Shenzhen City, Guangdong Province

Patentee after: Shenzhen congenitally magnanimity Technology Co., Ltd

Address before: 518000 Guangdong city of Shenzhen province Nanshan District Taoyuan street Tianliao industrial A District 21 building 3 floor East

Patentee before: SHENZHEN SUNWORLD INFORMATION TECHNOLOGY Co.,Ltd.

CP03 Change of name, title or address