A kind of flash data management system, method, flash chip and storage device
Technical field
The invention belongs to technical field of memory, more particularly to a kind of flash data management system, method, flash chip and deposit
Storage device.
Background technology
In existing flash translation layer (FTL) Flash Transfer Layer (FTL) algorithm, active block is reclaimed(Garbage
Collection, GC) generally all it is that the block (Block) for selecting invalid page (Invalid Page) more does merging.So
Cause a problem in that, when there is excessive invalid page (Invalid Page) in the flash block (Block Memory), meeting
Useless much times can be consumed in the integration of data, some and the compatibility issue on main frame (Host) are also often derived.
The content of the invention
The embodiments of the invention provide a kind of flash data management system, method, flash chip and storage device, it is intended to solves
Certainly existing the problem of.
In embodiments of the present invention there is provided a kind of flash data management system, the system include flash controller and
Flash memory,
The flash controller be used for when external data writes, external data is classified, distinguish continuous data and with
Machine data;
The flash memory includes system area, working area and data field,
The system area includes the randomized block for storing the random data and the continuous blocks for storing the continuous data;
The working area, stores effective in the randomized block when being arranged for the flash controller to the randomized block
Page, when effective number of pages in the working area meets the condition of setting, the data field is dumped to by the active page.
In embodiments of the present invention, the flash controller distinguishes consecutive numbers according to the data length of the external data
According to and random data.
In embodiments of the present invention, when the data in the continuous blocks are filled up, the flash controller is by the continuous blocks
Data-moving to the data field, and discharge the continuous blocks.
In embodiments of the present invention, when the data in the randomized block are filled up, the flash controller is to the randomized block
Active page arranged, and by active page storage into the working area.
In embodiments of the present invention, when the quantity of the active page in the working area is not reaching to the quantity of setting, institute
State flash controller and discharge the randomized block, and the active page in the working area is moved to the randomized block.
In embodiments of the present invention, a kind of flash data management method is additionally provided, the flash memory includes system area, kept in
Area and data field, methods described include:
Pre-treatment step:When external data writes, external data is classified, continuous data and random data is distinguished;
Data storing steps:Sorted external data is deposited into the system area, wherein, the system area includes random
Block and continuous blocks, the random data are deposited into the randomized block, and the continuous data storage is into the continuous blocks;
Data preparation step:Active page in the randomized block is arranged, and the active page is deposited into described keep in
Area;
Data conversion storage step:Judge whether the quantity of active page in the working area meets the condition of setting, when the active page
Quantity meet setting condition when, the active page is dumped into the data field.
In the pre-treatment step, continuous data and random data are distinguished according to the data length of the external data.
In the data storing steps, when the data in the continuous blocks are filled up, by the data-moving in the continuous blocks
To the data field, and discharge the continuous blocks.
In the data preparation step, the active page in the working area is moved to the data field, release is described
Randomized block and the working area.
In the data conversion storage step, when the quantity of the active page in the working area is not reaching to the quantity of setting,
The randomized block is discharged, and the active page in the working area is moved to the randomized block.
In embodiments of the present invention, a kind of flash chip is additionally provided, the flash chip includes an at least processor, deposited
Reservoir and interface, at least a processor, memory and the interface are connected by bus;
The memory storage computer executed instructions;
The computer executed instructions of memory storage described at least one described computing device so that the flash chip is performed
Above-mentioned flash data management method.
In embodiments of the present invention, the instruction that is stored with a kind of storage device, the storage device is additionally provided, it is described to refer to
The step of order realizes above-mentioned flash data management method when being executed by processor.
Compared with prior art, in technical scheme, the memory space of flash memory is divided into system area, working area
And data field, when external data writes, external data is classified, continuous data and random data is distinguished, and writing
When entering data, system area is first write data into, and the active page of the random data in working area is arranged using working area,
Finally reduced data is deposited into data field so that the data in the memory headroom are in good order, be not in compared with
Many invalid pages, improve the speed of data preparation and the compatibility of system.
Brief description of the drawings
Fig. 1 is the structural representation for the flash data management system that the embodiment of the present invention one is provided;
Fig. 2 is the state that the flash data management system that the embodiment of the present invention one is provided is arranged to the randomized block in system area
Schematic diagram;
Fig. 3 is the state that the flash data management system that the embodiment of the present invention one is provided is arranged to the randomized block in system area
Schematic diagram;
Fig. 4 is the flow chart for the flash data management method that the embodiment of the present invention two is provided;
Fig. 5 is the structural representation for the flash chip that the embodiment of the present invention three is provided.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
The realization of the present invention is described in detail below in conjunction with specific embodiment:
Embodiment one
In the present embodiment, describe a kind of flash data management system and internally deposit the method being managed within the system.
Fig. 1 shows the structural representation for the flash data management system that the embodiment of the present invention one is provided, the system bag
Flash controller 10 and flash memory 20 are included, the flash memory 20 is divided into system area 21, working area 22 and data field 23.Carry out below
Describe in detail.
The flash controller 10, for when external data writes, classifying to external data, distinguishing consecutive numbers
According to and random data.It should be noted that when external data writes, it is possible to which external data is scattered data, it is also possible to
It is the data of continuous monoblock.The flash controller 10 to external data when classifying, according to the external data
Data length distinguishes continuous data and random data, when external data is scattered data, is then classified as random data,
When external data is the data of monoblock, then continuous data is classified as.
The system area 21 includes randomized block 211 and continuous blocks 212, and the randomized block 211 is used to store the random number
According to the continuous blocks 212 are used to store the continuous data.External data is distinguished continuous data by the flash controller 10
After random data, the random data is write into the randomized block 211, the continuous data is write into the continuous blocks 212.
When a continuous blocks 212 in system area 21 write full, the flash controller 10 is by the continuous data in the continuous blocks 212
Move in the data field 23, and discharge the continuous blocks 212.
The working area 22, stored when being arranged for 10 pairs of the flash controller randomized block 211 it is described with
Active page in machine block 211, when effective number of pages in the working area 22 meets the condition of setting, by the active page unloading
To the data field 23
The data field 23, it is continuous in the active page and the continuous blocks 212 that are sorted out from the randomized block 211 for storing
Data.
Fig. 2, Fig. 3 show the embodiment of the present invention one provide flash data management system in the system area 21 with
The process that machine block 221 is arranged.When the randomized block 211 in system area 21 writes full, write described in 10 pairs of the flash controller
Full randomized block 211 is arranged, and the active page of the randomized block 211 is put into the working area 22, and count active page
Quantity, when the quantity of the active page in the working area 22 is not reaching to the quantity of setting, the flash controller 10 discharges
The randomized block 211, and the active page in the working area 22 is moved to the randomized block 211, the randomized block 211 continues
Receive receipt.When the quantity of active page in the working area 22 meets the condition of setting, the flash controller 10 will be described
Active page dumps to the data field 23, and discharges the working area 22.
Using above-mentioned flash data management system so that the data in the memory headroom are in good order, be not in compared with
Many invalid pages, improve the speed of data preparation and the compatibility of system.
Embodiment two
In the flow for the flash data management method that the shown embodiment of the present invention two of Fig. 4 is provided, the present embodiment, flash memory includes
System area, working area and data field, methods described are realized using step S1 to step S4.It is specifically described below.
Step S1, pre-treatment step:When external data writes, external data is classified, continuous data is distinguished
And random data.
It should be noted that when external data writes, it is possible to which external data is scattered data, it is also possible to continuous
Monoblock data, therefore, in the pre-treatment step, distinguished according to the data length of the external data continuous data and
Random data, when external data is scattered data, is then classified as random data, when external data is the data of monoblock,
Then it is classified as continuous data.
Step S2, data storing steps:Sorted external data is deposited into the system area.Wherein, the system
System area includes randomized block and continuous blocks, and the random data is deposited into the randomized block, and the continuous data storage is described in
In continuous blocks.
It should be noted that in the data storing steps, will be described continuous when the data in the continuous blocks are filled up
Data-moving in block discharges the continuous blocks to the data field;When the data in the randomized block are filled up, start step
Rapid S3, is arranged to the active page in the randomized block.
Step S3, data preparation step:Active page in the randomized block is arranged, and the active page is stored in
To the working area.
It should be noted that in the data preparation step, the active page in the working area is moved to the data
Qu Hou, discharges the randomized block and the working area.
Step S4, data conversion storage step:Judge whether the quantity of active page in the working area meets the condition of setting, when
When the quantity of the active page meets the condition of setting, the active page is dumped into the data field.
It should be noted that in the data conversion storage step, when the quantity of the active page in the working area is not reaching to
During the quantity of setting, the randomized block is discharged, and the active page in the working area is moved to the randomized block, it is described random
Block continues to random external data.
Be not in more nothing after above-mentioned steps are handled so that the data in the memory headroom are in good order
The page is imitated, the speed of data preparation and the compatibility of system is improved.
Embodiment three
As shown in figure 5, the embodiment of the present invention three is provided in embodiments of the present invention there is provided a kind of flash chip, it is included at least
One processor 310, memory 320 and interface 330, at least a processor 310, memory 320 and the interface 330 are by total
Line is connected;
The memory 320 stores computer executed instructions;
At least one described processor 310 performs the computer executed instructions that the memory 320 is stored so that the flash memory core
Piece performs the flash data management method described in embodiment two.
In embodiments of the present invention, the instruction that is stored with a kind of storage device, the storage device is additionally provided, it is described to refer to
The step of order realizes the flash data management method of embodiment two when being executed by processor.
In summary, using flash data management system, method, flash chip and the storage device of the present invention, by flash memory
Memory space be divided into system area, working area and data field, when external data writes, external data is classified, distinguish
Go out continuous data and random data, and when writing data, first write data into system area, and using working area to temporary
The active page of random data in area is arranged, and finally reduced data is deposited into data field so that the memory headroom
In data it is in good order, be not in more invalid page, improve the speed of data preparation and the compatibility of system.
It is worth noting that, one of ordinary skill in the art will appreciate that:The step of realizing above method embodiment or portion
It can be completed step by step by the related hardware of programmed instruction, foregoing program can be stored in embodied on computer readable storage Jie
In matter, the program upon execution, performs the step of including above method embodiment, and foregoing storage medium includes:ROM、
RAM, magnetic disc or CD etc. are various can be with the medium of store program codes.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
Any modifications, equivalent substitutions and improvements made within refreshing and principle etc., should be included in the scope of the protection.