CN104636285B - A kind of flash-memory storage system and read-write thereof, delet method - Google Patents

A kind of flash-memory storage system and read-write thereof, delet method Download PDF

Info

Publication number
CN104636285B
CN104636285B CN201510056206.0A CN201510056206A CN104636285B CN 104636285 B CN104636285 B CN 104636285B CN 201510056206 A CN201510056206 A CN 201510056206A CN 104636285 B CN104636285 B CN 104636285B
Authority
CN
China
Prior art keywords
physical storage
storage block
flash memory
memory address
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510056206.0A
Other languages
Chinese (zh)
Other versions
CN104636285A (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.)
Beijing Zeshi Technology Co.,Ltd.
Original Assignee
NETBRIC 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 NETBRIC TECHNOLOGY Co Ltd filed Critical NETBRIC TECHNOLOGY Co Ltd
Priority to CN201510056206.0A priority Critical patent/CN104636285B/en
Publication of CN104636285A publication Critical patent/CN104636285A/en
Application granted granted Critical
Publication of CN104636285B publication Critical patent/CN104636285B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of flash-memory storage system and read-write thereof, delet method, flash-memory storage system comprises buffer memory, main control module, cache metadata record sheet, reads mapping table and write mapping table, described mapping table of writing is for storing the corresponding relation writing logical memory blocks and physical storage block in the buffer, described mapping table of reading is for storing the corresponding relation reading logical memory blocks and physical storage block in the buffer, and described cache metadata record sheet is for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address.This flash-memory storage system, can reduce the unnecessary write to rear end flash memory or reading, realizes the zero-copy read and write data on path, eliminates unnecessary intermediate copy process, thus improves read-write efficiency; And the read and write access of front end applications and rear end flash memory size can be made to match.

Description

A kind of flash-memory storage system and read-write thereof, delet method
[technical field]
The present invention relates to field of storage, be specifically related to a kind of flash-memory storage system and read-write thereof, delet method.
[background technology]
The solid-state memory system of NANDFlash is used to become a kind of very popular storage system (SolidStateDisk, SSD) newly gradually.Along with the development of flash memory technology, single page capacity of MLC (Multi-LevelCell) develops into 8KB gradually from 4KB, 16KB, 32KB, and along with the maturation of TLC technology, single page capacity can reach 64KB, and 128KB is even higher.But the serviceable life of Flash is limited (the erasable number of times of 25nmMLC is at about 3000 times).
Zero-copy (zero-copy) is the major technique realizing the equipment such as main frame or router high speed network interfaces at first.Zero duplication technology made a general reference the number of times that can reduce data copy and shared bus operation afterwards, eliminate the intermediate copy process that data are unnecessary between storer, effectively improving communication efficiency, is one of design high-speed interface passage, the gordian technique realizing high-speed servers and router.
Two large deficiencies of current cache technology:
Because Flash is limited for serviceable life, before Flash, increasing level cache, thus reduce erasable to Flash, be traditional common way, but storage system read and write access size is 4KB, and the write unit of flash memory is page.And along with flash memory technology development, the capacity of single page can reach 16KB, 32KB.If traditionally, using request of access size 4KB as the load of buffer memory, flush unit, then can cause and write amplification.Increase the erasable number of times of Flash, reduce the Flash life-span.Then can cause the waste of spatial cache if simple according to page size application buffer memory, thus reduce cache hit rate.
Conventional flash memory be buffered in read-write time, need through twice data copy, thus reduce the access speed of buffer memory.Affect the performance of whole storage system.
[summary of the invention]
In order to overcome the deficiencies in the prior art, the invention provides a kind of flash-memory storage system and read-write thereof, delet method, to reduce the intermediate copy process between buffer memory and rear end flash memory.
A data writing method for flash-memory storage system, described flash-memory storage system comprises buffer memory, main control module, cache metadata record sheet and writes mapping table; Wherein, described in write mapping table for storing the corresponding relation writing logical memory blocks and physical storage block in the buffer, described cache metadata record sheet is for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address; The data writing method of described flash-memory storage system comprises the steps:
S1, the order data in the first write logical memory blocks being write the first rear end flash memory address that described main control module receiving front-end application sends;
S2, write mapping table described in described main control module reads, acquisition writes the first physical storage block in described buffer memory corresponding to logical memory blocks with described first;
S3, described main control module calculates described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
S4, described main control module reads described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
S5, described in described master control module judges, whether the first rear end flash memory address is identical with current back end flash memory address;
S6, if described first rear end flash memory address is identical with described current back end flash memory address, then replaces present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet by described first physical storage block;
S7, if described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and the first physical storage block are substituted described current back end flash memory address and present physical storage block respectively.
In one embodiment, described flash-memory storage system also comprises reference count table, free physical block FIFO and recycling module, described free physical block FIFO is for depositing physical storage block idle in described buffer memory, described reference count table quotes number of times for storing physical storage block with corresponding, when the physical storage block of free time dispenses by described free physical block FIFO, the number of times of quoting of the physical storage block dispensed is set to first and quotes time numerical value;
Also comprise and reclaim physical storage block step:
For the physical storage block be replaced, that reads corresponding physical storage block in described reference count table quotes number of times, if the number of times of quoting of corresponding physical storage block is greater than described first and quotes time numerical value, the number of times of quoting of the physical storage block of correspondence is reduced and surely quotes number of times, if the number of times of quoting of corresponding physical storage block equals first and quotes time numerical value, then the physical storage block of correspondence writes in described free physical block FIFO by described recycling module.
In one embodiment, described cache metadata record sheet is also for storing the physical storage block effective marker position corresponding with physical storage block, the value of physical storage block effective marker position corresponding before described physical storage block stores data is set to insignificant values, and the value of physical storage block effective marker position corresponding after described physical storage block stores data is set to effective value;
In described step S6, before described first physical storage block is replaced present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet, also comprise the steps:
The value judging the physical storage block effective marker position of the present physical storage block that described current back end flash memory address is corresponding in described cache metadata record sheet is effective value or insignificant values, if effective value then performs reclaim physical storage block step.
In one embodiment, described flash-memory storage system also comprises cache metadata state table;
In described cache metadata record sheet, described physical storage block has multiple, and multiple physical storage block is corresponding with the continuous multiple rear ends flash memory address being benchmark with described rear end flash memory address respectively;
Described cache metadata record sheet is also for storing the physical storage block effective marker position corresponding with physical storage block, the value of physical storage block effective marker position corresponding before physical storage block stores data is set to insignificant values, and the value of physical storage block effective marker position corresponding after physical storage block stores data is set to effective value;
Described cache metadata state table is used for storing metadata table address, corresponding relation between busy flag position and empty zone bit, the value of described busy flag position comprises and represents that list item corresponding to described metadata table address is occupied and do not have occupied occupation value and unoccupied value respectively, and the value of described empty zone bit comprises the physical storage block represented respectively in described metadata table address and is written into data and is not written into non-null value and the null value of data;
Between described step S3 and step S4, also comprise the steps:
S3.1, described main control module reads described cache metadata record sheet, judges whether the value of the busy flag position that described first metadata table address is corresponding is occupation value, if then wait for, otherwise performs step S3.2;
S3.2, whether the value of the empty zone bit that the first metadata table address is corresponding described in described master control module judges is non-null value, if then perform step S4;
In described step S6, also comprise the steps:
S6.1, judges in described cache metadata record sheet, and whether the value of the physical storage block effective marker position of the physical storage block corresponding with described first rear end flash memory address is effective value;
S6.2, if effective value then performs reclaim physical storage block step, and performs step S6.4;
S6.3, the value of the physical storage block effective marker position of correspondence is then set to effective value by valid value that were it not for, and performs step S6.4;
S6.4, writes the correspondence position of described cache metadata record sheet by described first physical storage block.
In one embodiment, after step S6 and step S7, for described first write logical memory blocks distributes new physical storage block from described free physical block FIFO.
Present invention also offers a kind of data reading method of flash-memory storage system, described flash-memory storage system comprises buffer memory, main control module, cache metadata record sheet and reads mapping table; Wherein, described in read mapping table for storing the corresponding relation reading logical memory blocks and physical storage block in the buffer, described cache metadata record sheet is for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address; The data reading method of described flash-memory storage system comprises the steps:
S1, the order data of the first rear end flash memory address write first read in logical memory blocks that described main control module receiving front-end application sends;
S2, described main control module calculates described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
S3, described main control module reads described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
S4, described in described master control module judges, whether the first rear end flash memory address is identical with current back end flash memory address;
S5, if described first rear end flash memory address is identical with described current back end flash memory address, then to read described in present physical storage block corresponding with described first rear end flash memory address in described cache metadata record sheet being write in mapping table and with described first to read logical memory blocks corresponding;
S6, if described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and new physical storage block are substituted described current back end flash memory address and present physical storage block respectively, and will to read described in described new physical storage block write in mapping table and with described first to read logical memory blocks corresponding.
In one embodiment, described flash-memory storage system also comprises reference count table, free physical block FIFO and recycling module, described free physical block FIFO is for depositing physical storage block idle in described buffer memory, described reference count table quotes number of times for storing described physical storage block with corresponding, when the physical storage block of free time dispenses by described free physical block FIFO, the number of times of quoting of the physical storage block dispensed is set to first and quotes time numerical value; Also comprise and reclaim physical storage block step:
In step s 5, read after in mapping table when described in the present physical storage block write that described first rear end flash memory address is corresponding, also comprise the steps:
S5.1, the number of times of quoting of the present physical storage block corresponding with described first rear end flash memory address is increased setting and quotes number of times, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
In step s 6, read after in mapping table described in described new physical storage block write, also comprise the steps:
S6.1, increases setting quote number of times by the number of times of quoting of described new physical storage block, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
For the physical storage block replaced and be replaced, that reads physical storage block in described reference count table quotes number of times, if the number of times of quoting of physical storage block is greater than described first and quotes time numerical value, then the number of times of quoting of the physical storage block of correspondence is reduced and surely quotes number of times, if the number of times of quoting of physical storage block equals first and quotes time numerical value, then the physical storage block of correspondence writes in described free physical block FIFO by described recycling module.
In one embodiment, described flash-memory storage system also comprises cache metadata state table;
In described cache metadata record sheet, described physical storage block has multiple, and multiple physical storage block is corresponding with the continuous multiple rear ends flash memory address being benchmark with described rear end flash memory address respectively;
Described cache metadata record sheet is also for storing the physical storage block effective marker position corresponding with physical storage block, the value of physical storage block effective marker position corresponding before physical storage block stores data is set to insignificant values, and the value of physical storage block effective marker position corresponding after physical storage block stores data is set to effective value;
Described cache metadata state table is used for storing metadata table address, corresponding relation between busy flag position and empty zone bit, the value of described busy flag position comprises and represents that list item corresponding to described metadata table address is occupied and do not have occupied occupation value and unoccupied value respectively, and the value of described empty zone bit comprises the physical storage block represented respectively in described metadata table address and is written into data and is not written into non-null value and the null value of data;
Between described step S2 and step S3, also comprise the steps:
S3.1, described main control module reads described cache metadata record sheet, judges whether the value of the busy flag position that described first metadata table address is corresponding is occupation value, if then wait for, otherwise performs step S3.2;
S3.2, whether the value of the empty zone bit that the first metadata table address is corresponding described in described master control module judges is non-null value, if then perform step S3;
In described step S5, also comprise the steps:
S5.1, judges in described cache metadata record sheet, and whether the value of the physical storage block effective marker position of the physical storage block corresponding with described first rear end flash memory address is effective value;
S5.2, if effective value then performs reclaim physical storage block step;
S5.3, the value of the physical storage block effective marker position of correspondence is then set to effective value by valid value that were it not for.
The deletion data method of the present invention's also a kind of flash-memory storage system, described flash-memory storage system comprises buffer memory, main control module and buffer memory meta-data record; Wherein, described cache metadata record sheet is used for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address; The deletion data method of described flash-memory storage system comprises the steps:
S1, described main control module receiving front-end applies the order of the data of the deletion first rear end flash memory address sent;
S2, described main control module calculates described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
S3, described main control module reads described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
S4, described in described master control module judges, whether the first rear end flash memory address is identical with current back end flash memory address;
S5, if described first rear end flash memory address is identical with described current back end flash memory address, then deletes list item corresponding for current back end flash memory address, and performs step S7;
S6, if described first rear end flash memory address is different from described current back end flash memory address, then performs step S7;
S7, is sent to rear end flash memory by the order of the data of described deletion first rear end flash memory address.
Present invention also offers a kind of flash-memory storage system, comprise buffer memory, main control module, cache metadata record sheet, read mapping table and write mapping table; Wherein, described mapping table of writing is for storing the corresponding relation writing logical memory blocks and physical storage block in the buffer, described mapping table of reading is for storing the corresponding relation reading logical memory blocks and physical storage block in the buffer, and described cache metadata record sheet is for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address;
Described main control module is used for the order data in the first write logical memory blocks being write the first rear end flash memory address that receiving front-end application sends;
Described main control module writes mapping table described in reading, and acquisition writes the first physical storage block in described buffer memory corresponding to logical memory blocks with described first;
Described main control module is used for calculating described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
Described main control module, for reading described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
Whether described main control module is identical with current back end flash memory address for judging described first rear end flash memory address, if described first rear end flash memory address is identical with described current back end flash memory address, then described first physical storage block is replaced present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet; If described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and the first physical storage block are substituted described current back end flash memory address and present physical storage block respectively;
Described main control module is used for the order data of the first rear end flash memory address write first read in logical memory blocks that receiving front-end application sends;
Described main control module is used for calculating described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
Described main control module, for reading described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
Whether described main control module is identical with current back end flash memory address for judging described first rear end flash memory address; If described first rear end flash memory address is identical with described current back end flash memory address, then to read described in present physical storage block corresponding with described first rear end flash memory address in described cache metadata record sheet being write in mapping table and with described first to read logical memory blocks corresponding; If described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and new physical storage block are substituted described current back end flash memory address and present physical storage block respectively, and will to read described in described new physical storage block write in mapping table and with described first to read logical memory blocks corresponding.
In one embodiment, described flash-memory storage system also comprises reference count table, free physical block FIFO and recycling module, described free physical block FIFO is for depositing physical storage block idle in described buffer memory, described reference count table quotes number of times for storing described physical storage block with corresponding, when the physical storage block of free time dispenses by described free physical block FIFO, the number of times of quoting of the physical storage block dispensed is set to first and quotes time numerical value;
Read after in mapping table when described in the present physical storage block write that described first rear end flash memory address is corresponding, the number of times of quoting of the present physical storage block corresponding with described first rear end flash memory address is increased setting and quotes number of times, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
Read after in mapping table described in described new physical storage block write, the number of times of quoting of described new physical storage block is increased setting and quotes number of times, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
For the physical storage block replaced and be replaced, that reads physical storage block in described reference count table quotes number of times, if the number of times of quoting of physical storage block is greater than described first and quotes time numerical value, then the number of times of quoting of the physical storage block of correspondence is reduced and surely quotes number of times, if the number of times of quoting of physical storage block equals first and quotes time numerical value, then the physical storage block of correspondence writes in described free physical block FIFO by described recycling module.
In one embodiment, have four physical storage blocks in a list item of described cache metadata record sheet, the size of each physical storage block is 4KB.
This flash-memory storage system, can reduce the unnecessary write to rear end flash memory or reading, realizes the zero-copy read and write data on path, eliminates unnecessary intermediate copy process, thus improves read-write efficiency;
And the read and write access of front end applications and rear end flash memory size can be made to match.
[accompanying drawing explanation]
Fig. 1 is the flash-memory storage system workflow schematic diagram of an embodiment of the present invention;
Fig. 2 is the flash-memory storage system theory diagram of an embodiment of the present invention;
Fig. 3 is logical memory blocks and physical store block address transition diagram in the buffer memory of an embodiment of the present invention;
Fig. 4 is the schematic flow sheet of the recovery physical storage block of an embodiment of the present invention;
Fig. 5 is that the order of an embodiment of the present invention completes queue processing schematic flow sheet;
Fig. 6 is the cache metadata record sheet schematic diagram of an embodiment of the present invention;
Fig. 7 is the cache metadata state representation intention of an embodiment of the present invention;
Fig. 8 is the schematic flow sheet of the deletion rear end flash data of an embodiment of the present invention;
Fig. 9 is the schematic flow sheet of the write of the flash memory to the back-end data of an embodiment of the present invention;
Figure 10 is the schematic flow sheet reading in data from rear end flash memory of an embodiment of the present invention;
Figure 11 writes mapping table schematic diagram when being the original state of an embodiment of the present invention;
Figure 12 reads mapping table schematic diagram when being the original state of an embodiment of the present invention;
Cache metadata state representation intention when Figure 13 is the original state of an embodiment of the present invention;
When Figure 14 is the original state of an embodiment of the present invention, idle physical block FIFO stores schematic diagram;
Figure 15 is that the free physical block FIFO of Figure 14 is distributing a part of physical storage block to the schematic diagram after writing mapping table;
Figure 16 is first time of an embodiment of the present invention cache metadata record sheet schematic diagram before write request;
Figure 17 is the schematic diagram of cache metadata record sheet after first time write request of Figure 16;
Figure 18 is the schematic diagram writing of an embodiment of the present invention mapping table before write request for the first time;
Figure 19 be Figure 18 write the schematic diagram of mapping table after first time write request;
Figure 20 be an embodiment of the present invention first time cache metadata state table before write request schematic diagram;
Figure 21 is the schematic diagram of cache metadata state table after first time write request of an embodiment of the present invention;
Figure 22 is the schematic diagram of cache metadata record sheet before certain read request of an embodiment of the present invention;
Figure 23 is the schematic diagram of Figure 22 cache metadata record sheet after this read request;
Figure 24 is the schematic diagram reading mapping table before certain read request of an embodiment of the present invention;
Figure 25 be Figure 24 read mapping table at the schematic diagram after this read request;
Figure 26 is the schematic diagram of cache metadata state table before certain read request of an embodiment of the present invention;
Figure 27 is that the cache metadata state table of Figure 26 is at the schematic diagram after this read request;
Figure 28 is the order schematic diagram that the main control module of an embodiment of the present invention sends to rear end flash memory;
Figure 29 is the order ID of Figure 28 is cache metadata state representation intention before 16 recovery;
Figure 30 is the order ID of Figure 28 is cache metadata state representation intention after 16 recovery.
[embodiment]
Below the preferred embodiment of invention is described in further detail.
As shown in Figure 1, the flash-memory storage system workflow schematic diagram of an embodiment of the present invention.
In the present embodiment, this flash-memory storage system comprises: buffer memory, read-write requests address mapping module, buffer memory free block administration module, cache metadata record sheet, cache metadata state table and main control module, described main control module is in caching system.
In the present embodiment, be all that buffer memory is divided into several physical storage blocks according to the size of 4KB sized by 4KB to the read and write access request of buffer memory.Such as capacity is the DDR of 1GB, can be divided into 1GB/4KB=256K physical storage block, be called PBN1 ~ PBN256K.PBN and physicalblocknum, physical store block number, that corresponding with it is LBN, i.e. logicblocknum, logical storage block number.
Caching system can virtual a small amount of logical memory blocks, and use to front-end access, for 1GB spatial cache, it contains 256K physical storage block.Caching system can fictionalize 1K logical memory blocks (being also 4KB size), and use to front end applications, between this 1K and 256K size above, it doesn't matter, and both can adopt other numerical value and relation.
During front end applications write access, first first select the logical memory blocks (time initial, all pieces is all idle) that 1 idle, data are write this logical memory blocks, be assumed to be logical memory blocks 1, as shown in the step 1 of Fig. 1.
Then front end applications says the word to the main control module of buffer memory, allows it move the 4KB data in logical memory blocks 1 certain address of rear end flash memory storage to, as shown in step 2.
In the flash memory that its actual write rear end not necessarily stores by buffer memory at once, but temporarily exist in self space.But forward end application transmission one can complete message, inform that its this data-moving completes, as shown in step 3.
Front end applications has received message, thinks that these data have write the flash memory of rear end, logical memory blocks 1 is discharged.Write request so below just can utilize logical memory blocks 1 to operate again.
When front end applications wants the data reading certain address, rear end from the flash memory of rear end, order of first losing one's life, allows caching system move the data of certain address, rear end the logical memory blocks of certain free time to, supposes it is logical memory blocks 1, as shown in step 2.
Buffer memory by DSR, can be placed in logical memory blocks 1.Likely these data inherently exist in buffer memory, i.e. cache hit, also may read in buffer memory from rear end flash memory.
After buffer memory is ready to, can message be sent, inform that front end data is ready to, as shown in step 3.
The data of logical address 1 can be read in front end, complete access, as shown in step 1.
Except read-write requests, front end applications access can also have a kind of removal request, asks the data of certain address stored rear end to be deleted.This is to improve flash memory utilization factor, just the removal request only having flash-memory storage system to have.Receive this request after, first caching system can check the data whether storing this address in self, if had, is then deleted, then by this command routing to the flash memory of rear end, the request of forward end application report completes.
Step 4 in Fig. 1 is caching systems writing (flush), read (load) or to delete when (del) operates module to the back-end sends order.
Step 5 is that rear module completes flush, during load, del operation, has returned to caching system.
Step 6 is rear module command informations according to flush and load, controls and complete data and rear end in buffer memory to store the exchange of data.
As shown in Figure 2, a kind of flash-memory storage system structural drawing of embodiment, is described each formation below.
Physical storage block
Also being physical cache unit, is one piece of DDR, for storing actual data.It is divided into several physical storage blocks by the size according to 4KB.
Read-write requests address mapping module
As shown in Figure 3, front end applications request of access is when reading the data of a certain logical memory blocks in buffer memory, and read request address mapping block can according to certain rule by the physical storage block of reality a certain in this address maps to buffer memory.Such as, the data reading cache logic storage block 1 are wanted in front-end access request, but this request is actual, and what read is the data of the physical storage block 15 of buffer memory.
There are two mapping tables read-write requests address mapping module inside, and one is read mapping table, and one is write mapping table.Each write logical memory blocks has a list item writing in mapping table, a corresponding physical storage block, specifically write logical memory blocks correspondence physical storage block number in a list item.Each reads logical memory blocks and is reading there is a list item in mapping table, a corresponding physical storage block.For above, suppose that caching system provides 1K to write logical memory blocks, then this writes mapping table 1K list item, can leave in a ram.
Read-write requests address mapping module can be connected between front end and physical cache unit bus, as shown in Figure 2.Such as read-write requests address mapping module can intercept and read address, then by the logical memory blocks number reading address, as the allocation index reading mapping table, obtain this logical memory blocks number corresponding physical storage block number in ram, this physical storage block is sent to physical cache as finally reading address.
Read mapping table to be dynamically updated in real time by main control module with the content write in mapping table.The possible corresponding physical storage block 10 of certain logical memory blocks 1, when accessing next time, the possible just corresponding physical storage block 50 of logical memory blocks 1.
With read request address mapping class seemingly, front-end access request is when writing a certain blocks of data in buffer memory, and writing mapping table be mapped to its write address on other a certain actual physical storage block according to certain rule.
Buffer memory free block administration module
Buffer memory free block administration module is in charge of application and the recovery of the physical storage block of buffer memory.It comprises 1 reference count table, 1 free block fifo queue and 1 recycling module composition.
For the physical storage block of all buffer memorys, reference count table has a corresponding list item, for above: capacity is the DDR of 1GB, can be divided into 1GB/4KB=256K physical storage block, then have 256K list item in reference count table.
The queue depth of free physical block FIFO is identical with the list item number of reference count table, as above shown in example, is also 256K, deposit be current idle can the numbering of physical storage block.When free physical block FIFO is stored as sky, represent current without available physical storage block.When free physical block FIFO is not empty, physical storage block corresponding in each digitized representation buffer memory of the inside can be used.During original state, all physical storage blocks, all in free physical block FIFO, are all untapped states.When main control module application uses new physical storage block, a free physical storage block numbering can be read from free physical block FIFO, return to main control module and use.When some physical storage blocks are finished using, when being recovered module recovery, free physical block FIFO can be write back again.
Recycling module completes queue with main control module (FTL) and is connected.Whenever completing queue and having new data, (have new order to complete), recycling module can detect new data, after process, the information completing queue is passed to main control module.
Be recycling module workflow as shown in Figure 4, be queue processing flow process as shown in Figure 5, treatment scheme is as follows:
If 1. this order completed is read command (load), or delete command.Then do not carry out any operation, be directly passed to main control module.
If 2. this order completed is write order (flush), then reads 4 physical store block numbers in this write order successively, and read 4 effective marker positions.To each effective physical store block number, using the allocation index of its numbering as reference count table, read Counter Value (quoting time numerical value) corresponding in reference count table, if it equals 1, then representing only has 1 logical memory blocks to be mapped on this physical storage block, its counter is set to 0, physical storage block is recycled, this physical store block number is write back free physical block FIFO.If it is greater than 1, indicates that unnecessary 1 logical memory blocks has been mapped on this physical storage block, the value of its counter is subtracted 1 (number of times is quoted in setting), but do not reclaimed.
Free physical block FIFO is when the new free block of every sub-distribution, and the free block reference count value that can be dispensed is set to 1 (first quotes time numerical value).
Cache metadata record sheet
As shown in Figure 6, cache metadata record sheet is used for which data of record buffer memory current cache.
The flash memory of each pagesize size, a list item in corresponding cache metadata record sheet.For pagesize16KB, what in cache metadata record sheet, each record was corresponding is 16KB space.Owing to during physical storage block being 4KB, then comprise 4 physical storage blocks in each list item and whether each physical storage block effectively indicates.Each list item also comprises the address (rear end flash memory address) of a rear end flash memory storage.The storage address (metadata table address) of cache metadata can obtain based on address, rear end (GBAx) hash conversion.
Main control module
Main control module is responsible for the request processing front end applications, manages whole buffer memory.
As shown in Figure 7, it comprises a cache metadata state table, list item one_to_one corresponding in each list item and buffer memory meta-data record, namely the address of some list items of cache metadata state table is identical with the address of the corresponding list item of cache metadata record sheet.
Cache metadata state table comprises following zone bit:
Busy flag position (lock zone bit), shows whether the corresponding list item of cache metadata state table is used, and it has two value lock and unlock, takies, quiescing if lock then represents; If unlock then represents unoccupied, allow operation.
Change zone bit (dirty zone bit), show whether the 16KB that the corresponding list item of cache metadata state table is corresponding passes through change, it has dirty (representing that data are modified) and clean (representing that data are not modified) two values.Such as just read from rear end flash memory certain physical storage block that (load) enters buffer memory, the value of the change zone bit of the cache metadata state table that this physical storage block is corresponding is clean.Value for change zone bit is clean, when not having modified, when writing (flush) and going out buffer memory, need not repeat to write rear end flash memory storage.
Empty zone bit (empty zone bit), show that whether the corresponding list item of cache metadata state table is effective, when initialization, the value of the empty zone bit of all list items is all empty.
Main control module is responsible for processing concrete read-write requests, and it can be resolved and perform the read write command that front end applications sends.
Front sort command is divided into 3 classes: removal request, write request and read request
Removal request
As shown in Figure 8, the data on certain rear end flash memory address are deleted in front end applications request, and main control module first can check this address whether in buffer memory.If, then the data of buffer memory are deleted.Then notify that rear module deletes the data on this address.After rear module completes, via main control module notice front end applications, complete deletion.
Write request
As shown in Figure 9, main control module first reads and writes mapping table, obtain logical memory blocks number corresponding physical storage block number, then hash process is done to rear end flash memory address, obtain the address (being also the address of cache metadata state table) of cache metadata record sheet.
Main control module reads metadata state table, judges whether the value of the busy flag position of the list item that the address of this cache metadata state table is corresponding is lock, if lock, then can wait for always, till the value of this busy flag position is unlock by the time.
If the value of the busy flag position of this list item is unlock, then main control module reads the value of the empty zone bit of this list item in metadata state table further.If the value of the empty zone bit of this list item is empty, then create (the so-called establishment herein of a new list item, create in this list item, also assignment in this list item can be referred to as), as shown in Figure 6, numerical value in empty list item can be an illegal value, such as, be the numerical value of the physical storage block number being greater than actual allocated, then this physical storage block number write into the correspondence position of this list item.Because write operation size is 4KB, the space of a list item is 16KB, comprises the position of 4 physical storage blocks, according to rear end flash memory address divided by the remainder of 4, decides this physical storage block and writes which physical storage block position.Such as, after the flash memory address of rear end, several is 0x0000, can divide exactly 4, then write on first physical storage block position, if 0x0002, then write on the 3rd physical storage block position, the rear end flash memory address GBAX of this list item is then 0x0000; Then be set as effectively by the value of the physical storage block effective marker of correspondence, four physical storage block effective marker positions are made up of four number of bits, represent that first physical storage block is to the 4th physical storage block successively, 1 representative effectively, 0 represent invalid; And then the empty of cache metadata state table mark, dirty mark are set as notempty and dirty respectively, return order.
If the value of the empty zone bit of this list item is notempty, then main control module judges that whether the current back end flash memory address in list item is identical with the rear end flash memory address of this minor actions further.
If different, then the content of this list item is sent a flush order to rear module, command format is additional the previous command ID and operation flag (flush operation) before contents in table, that is, the content in four physical storage blocks in this list item is stored into successively in corresponding rear end flash memory address.
Then new list item (to this list item again assignment) is created, as before, the physical storage block of this write operation number is write correspondence position, the physical storage block effective marker of correspondence is set as effectively, the empty of metadata state table mark and dirty mark are set as notempty and dirty respectively, return order.
If rear end flash memory address is identical, then cache hit is described, continues to judge that whether the effective marker that this physical storage block is corresponding is effective.
If invalid, then this address does not also write data, directly by this physical storage block number write list item, and identifies into effective by corresponding significance bit, has returned order.
If effectively, then the data of this address are capped, old physical storage block number is reclaimed, then by this physical storage block number write list item.Return order.
Read request
As shown in Figure 10, main control module does hash process to rear end flash memory address, obtains the address (being also the address of cache metadata state table) of cache metadata record sheet.
Main control module reads metadata state table, judges whether the lock flag of this list item is lock, if be lock, then can wait for always, till lock zone bit is unlock by the time.
If the zone bit of this list item is unlock, then main control module is further according to the empty zone bit of metadata state table, if empty zone bit is empty, then create new list item (also i.e. assignment in this list item), apply for 4 idle physical storage blocks number when creating, and a wherein corresponding physical storage block number is write read mapping table request position on.By number release of the old physical storage block of this position, physical storage block effective marker position corresponding for 4 physical storage blocks is all designated effectively, in cache metadata state table, lock zone bit, empty zone bit and clean flag are designated lock, notempty and clean respectively.Then main control module sends an order, requires that the 16KB data on the flash memory address of rear end are read on these 4 physical storage blocks by rear module successively respectively.Need the time owing to reading, now the lock zone bit of this list item in cache metadata state table is set to lock, thus this list item is locked, do not allow other orders to operate this list item, until data are read in by rear module.Caching system receive rear module complete order after, just can return order by front end module, and the lock zone bit of this list item in cache metadata state table has been set to unlock.
If the empty zone bit of this list item is notempty, then main control module judges that whether the current back end flash memory address in this list item is identical with the address, rear end of this minor actions further.
If different, then the content of this list item is sent a flush order to rear module, command format is additional the previous command ID and operation flag (flush operation) before contents in table, is stored in corresponding rear end flash memory address by the data in four physical storage blocks of this list item.After Flush (do not need etc. to be done), create a new list item (namely to this list item again assignment), 4 idle physical storage blocks number are applied for when creating, and a wherein corresponding physical storage block number is write read mapping table request position on, and the old physical storage block number release of correspondence position in mapping table will be read.Then in cache metadata state table, the physical storage block effective marker position of 4 physical storage blocks is all designated effectively, and lock zone bit, empty zone bit and clean zone bit are designated lock, notempty and clean respectively.Main control module sends an order, requires that the 16KB data on the flash memory address of rear end are read on these 4 physical storage blocks by rear module.
The main control module of caching system receive rear module complete order after, just can return order by front end module, and be unlock by the lock mark position of this list item in cache metadata state table.
If address, rear end is identical, then cache hit is described, continues to judge that whether the physical storage block effective marker that this physical storage block is corresponding is effective.
If invalid, data are not also read in the address that then this list item is corresponding, for invalid physical storage block positions all in this list item, apply for new physical storage block, and a wherein corresponding physical storage block number is write read mapping table request position on, and the old physical storage block number release of correspondence position in mapping table will be read.4 physical storage blocks are all designated effectively, in cache metadata state table, lock zone bit, empty zone bit and clean zone bit are masked as lock, notempty and clean respectively.Then main control module sends an order again, require that the data on the flash memory address of rear end are read on these new physical storage blocks by rear module, but original physical storage block flag is that effective physical storage block can not be capped, and only reads and covers originally invalid physical storage block.Caching system receive rear module complete order after, just can return order by front end module, and the lock zone bit of corresponding list item has been set to unlock.
If the physical storage block zone bit of correspondence is effective, illustrate that these data in the buffer, this physical storage block number is write on the position of reading mapping table request, and the reference count of this physical storage block number is added 1, the old physical storage block number release of this position in mapping table will be read simultaneously.
Write is read to the physical storage block of mapping table, in reference count table, the number of times of quoting of this physical storage block is added 1, and when certain physical storage block from read mapping table deleted time, then in reference count table, the number of times of quoting of this physical storage block is subtracted 1, thus ensure that the physical storage block read in mapping table is not recovered.
Embodiment 1
Suppose that physical storage block has 1000, size is 4KB, equals front end applications access size.
Suppose that the pagesize of rear end flash memory system is 16KB, then cache metadata record sheet and cache metadata state table are all 250 list items, because they are based on pagesize, 1000*4KB=250*16KB.
Suppose that the virtual logical storage block that front end applications can be seen has 100, how many can be random, fundamental purpose considers process time delay, establishes severally to be convenient to parallel processing more.
Under Figure 11 to 15 is each tables of data or storer original state:
During original state, write mapping table for each logical block number (LBN) has distributed corresponding physical storage block number, as shown in figure 11.Read the state that mapping table keeps empty, all list items write an invalid physical storage block number, such as " X " represents the numerical value being greater than effective physical storage block number, representing current is original state, like this front end applications read in certain read in logical memory blocks time, then countless certificate returns, as shown in figure 12.
As shown in figure 13, during original state, cache metadata record sheet is empty, because do not deposit any data in buffer memory, cache metadata state table (there are 250 list items the inside) is all the state of empty, unlock, clean.
As shown in figure 14, during original state, free physical block FIFO is full, and all physical storage blocks number (1000) are deposited in the inside.Under original state, all physical storage blocks are all untapped idle conditions.
During original state, main control module can in idle fifo queue first to file 100 (logical memory blocks number) physical storage block, write in mapping table, for each logical memory blocks write in mapping table distributes a physical storage block number.Because physical storage blocks all time initial are in free physical block FIFO, after front 100 physical storage blocks number to be assigned to and to write mapping table by main control module, free physical block FIFO just only remaining 900 physical storage blocks, as shown in figure 15.Subsequent physical storage block service condition is different, reclaims successively different, and the order of physical storage block in free physical block FIFO number will be mixed and disorderly.
Write request for the first time, as shown in Figure 16 to 21.
Data have first been write in logical memory blocks 1 by front end applications.Owing to writing mapping table, now logical address 1 correspondence is physical storage block 1, has been written in physical storage block 1 so data are actual.
Front end applications gives order, the data of logical memory blocks 1 is write certain address, rear end GBAx, supposes that the bit of minimum two of GBAx is 00.
Main control module have received this order, GBAx is done hash computing, show that the cache metadata allocation index of its correspondence is 15 (hypothesis).And inquire about write address mapping table, draw the corresponding physical storage block 1 of current logic storage block 1.
Main control module reads cache metadata state table, finds that the entry status of address 15 is empty, unlock and clean (because after initialization, all list items are all this states).
Main control module is a newly-built list item in the position of cache metadata record sheet 15, physical storage block 1 is write first physical storage block position.4 kinds of situations of minimum two bits 00 ~ 11 of GBAx, determine this physical storage block and will write which position, are corresponding in turn to first physical storage block position of list item to the 4th physical storage block position.
Latter two of GBAx in cache metadata record sheet is 0, because meta-data record list item size is 16KB, compares large 4 times with front sort command 4KB address, so last two bit address are recorded as 0.
Cache metadata state table the 15th list item is set to notempty, unlock and dirty, represents this list item and used, unlock and dirty then refers to the data of this list item comparatively new (with the data ratio that rear end GBAx stores) respectively.
Main control module is applying for a new physics storage block (supposing it is 101) to free physical block FIFO, write mapping table first position (position of logical memory blocks 1), as shown in figure 19, write logical memory blocks 1 more now, actual just write physical storage block 101.
Main control module forward end application return command completes.
Certain read request, as shown in Figure 22 to 27.
After several times operation, front end applications sends order, requires, by the data of address, rear end GBAy, to read in logical memory blocks 2.Then, after front end applications wait command completes, visit again logical memory blocks 2 and obtain data.
Main control module carries out hash calculating to GBAy, show that the address of the cache metadata record sheet of its correspondence is 30 (hypothesis).
As shown in figure 22, the list item of current address 30 has data, but the rear end memory address that this this list item is corresponding is GBAz, not identical with address, the rear end GBAy that will access, also namely buffer memory does not hit, need first the data of this list item (being also old list item) to be write in the flash memory of rear end, the new data of needs is read (load) simultaneously and come in.
Main control module first finds metadata address 30 data, but address, rear end GBAz be not equal to GBAy.
Main control module reading state table, finds that the dirty zone bit of the position of metadata address 30 is dirty, illustrates and needs the data of four of correspondence physical storage blocks to write rear end flash memory.
Main control module sends order, and notice rear module, by the data (altogether 16KB) of physical storage block 123, physical storage block 75, physical storage block 50 and physical storage block 100, is written in initial 16KB space, this address of GBAz.
Main control module does not need to wait for that last order completes, and is wiped by the list item 30 of meta-data record at once, and a newly-built list item, namely to list item 30 again assignment.To the physical storage block that buffer memory free block administration module application 4 is new, suppose it is physical storage block 400, physical storage block 500, physical storage block 600 and physical storage block 700, it is write successively first physical storage block position to the 4th position.
Two, the end supposing GBAy is 01, and representative is the 2nd in 4 4KB, is therefore write by the physical storage block 500 on second physical storage block position on the position of reading mapping table 2.
Before writing, the old physical storage block reading mapping table 2 correspondence is physical storage block 20, and the request of front-end access herein represents the data no longer needing logical memory blocks 2, and therefore physical storage block 20 can be released.Certain physical storage block 20 not necessarily can be write in free physical block FIFO, and this depends on the current reference count of physical storage block 20.This part has description detailed process in recycling module.
Main control module sends out an order again, requires that the 16KB data that GBAy (the low 2bit in address is 0, and address 16KB aligns) starts are read in physical storage block 400,500,600 and 700 (each physical storage block 4KB) by rear module successively.
This list item is set to lock, clean and notempty by main control module in cache metadata state table.
Need the time owing to reading, main control module now forward end can not return order at once, and he needs first to wait for that rear module returns reading and completes, and the lock zone bit then retelling list item 30 is set to unlock.
Certain rear end order completes, as shown in Figure 28 to 30.
As shown in figure 28, caching system issues rear end flash memory two order, order No. ID 15 be the operation of flush (writing), order No. ID 16 be that a load (reading) operates.Present rear module returns these two orders and completes.
For the order of No. ID 15, recycling module first can check that its action type is write operation, and then incite somebody to action wherein effective physical storage block number, be two in this example, physical storage block 18 and physical storage block 2, recycle.Recovery process still carries out according to the mode described before.
Can't front end be notified after recovery completes, just return before because the order of write operation returns.
To with the order of No. ID 16, recycling module can carry out hash calculating to GBAy, by example above, the 30th list item of its corresponding element data logger.The lock zone bit of this list item arranged in order to lock by caching system at that time, and now digital independent is returned, and the lock mark position of this list item can be unlock by caching system, and notify front-end module, this read command before completes simultaneously.
Above content is in conjunction with concrete preferred implementation further description made for the present invention, can not assert that specific embodiment of the invention is confined to these explanations.For general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, some simple deduction or replace can also be made, all should be considered as belonging to the scope of patent protection that the present invention is determined by submitted to claims.

Claims (12)

1. a data writing method for flash-memory storage system, is characterized in that, described flash-memory storage system comprises buffer memory, main control module, cache metadata record sheet and writes mapping table; Wherein, described in write mapping table for storing the corresponding relation writing logical memory blocks and physical storage block in the buffer, described cache metadata record sheet is for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address; The data writing method of described flash-memory storage system comprises the steps:
S1, the order data in the first write logical memory blocks being write the first rear end flash memory address that described main control module receiving front-end application sends;
S2, write mapping table described in described main control module reads, acquisition writes the first physical storage block in described buffer memory corresponding to logical memory blocks with described first;
S3, described main control module calculates described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
S4, described main control module reads described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
S5, described in described master control module judges, whether the first rear end flash memory address is identical with current back end flash memory address;
S6, if described first rear end flash memory address is identical with described current back end flash memory address, then replaces present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet by described first physical storage block;
S7, if described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and the first physical storage block are substituted described current back end flash memory address and present physical storage block respectively.
2. the data writing method of flash-memory storage system as claimed in claim 1, it is characterized in that, described flash-memory storage system also comprises reference count table, free physical block FIFO and recycling module, described free physical block FIFO is for depositing physical storage block idle in described buffer memory, described reference count table quotes number of times for storing physical storage block with corresponding, when the physical storage block of free time dispenses by described free physical block FIFO, the number of times of quoting of the physical storage block dispensed is set to first and quotes time numerical value;
Also comprise and reclaim physical storage block step:
For the physical storage block be replaced, that reads corresponding physical storage block in described reference count table quotes number of times, if the number of times of quoting of corresponding physical storage block is greater than described first and quotes time numerical value, the number of times of quoting of the physical storage block of correspondence is reduced and surely quotes number of times, if the number of times of quoting of corresponding physical storage block equals first and quotes time numerical value, then the physical storage block of correspondence writes in described free physical block FIFO by described recycling module.
3. the data writing method of flash-memory storage system as claimed in claim 2, it is characterized in that, described cache metadata record sheet is also for storing the physical storage block effective marker position corresponding with physical storage block, the value of physical storage block effective marker position corresponding before described physical storage block stores data is set to insignificant values, and the value of physical storage block effective marker position corresponding after described physical storage block stores data is set to effective value;
In described step S6, before described first physical storage block is replaced present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet, also comprise the steps:
The value judging the physical storage block effective marker position of the present physical storage block that described current back end flash memory address is corresponding in described cache metadata record sheet is effective value or insignificant values, if effective value then performs reclaim physical storage block step.
4. the data writing method of flash-memory storage system as claimed in claim 2, is characterized in that: described flash-memory storage system also comprises cache metadata state table;
In described cache metadata record sheet, described physical storage block has multiple, and multiple physical storage block is corresponding with the continuous multiple rear ends flash memory address being benchmark with described rear end flash memory address respectively;
Described cache metadata record sheet is also for storing the physical storage block effective marker position corresponding with physical storage block, the value of physical storage block effective marker position corresponding before physical storage block stores data is set to insignificant values, and the value of physical storage block effective marker position corresponding after physical storage block stores data is set to effective value;
Described cache metadata state table is used for storing metadata table address, corresponding relation between busy flag position and empty zone bit, the value of described busy flag position comprises and represents that list item corresponding to described metadata table address is occupied and do not have occupied occupation value and unoccupied value respectively, and the value of described empty zone bit comprises the physical storage block represented respectively in described metadata table address and is written into data and is not written into non-null value and the null value of data;
Between described step S3 and step S4, also comprise the steps:
S3.1, described main control module reads described cache metadata record sheet, judges whether the value of the busy flag position that described first metadata table address is corresponding is occupation value, if then wait for, otherwise performs step S3.2;
S3.2, whether the value of the empty zone bit that the first metadata table address is corresponding described in described master control module judges is non-null value, if then perform step S4;
In described step S6, also comprise the steps:
S6.1, judges in described cache metadata record sheet, and whether the value of the physical storage block effective marker position of the physical storage block corresponding with described first rear end flash memory address is effective value;
S6.2, if effective value then performs reclaim physical storage block step, and performs step S6.4;
S6.3, the value of the physical storage block effective marker position of correspondence is then set to effective value by valid value that were it not for, and performs step S6.4;
S6.4, writes the correspondence position of described cache metadata record sheet by described first physical storage block.
5. the data writing method of flash-memory storage system as claimed in claim 2, is characterized in that:
After step S6 and step S7, for described first write logical memory blocks distributes new physical storage block from described free physical block FIFO.
6. a data reading method for flash-memory storage system, is characterized in that, described flash-memory storage system comprises buffer memory, main control module, cache metadata record sheet and reads mapping table; Wherein, described in read mapping table for storing the corresponding relation reading logical memory blocks and physical storage block in the buffer, described cache metadata record sheet is for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address; The data reading method of described flash-memory storage system comprises the steps:
S1, the order data of the first rear end flash memory address write first read in logical memory blocks that described main control module receiving front-end application sends;
S2, described main control module calculates described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
S3, described main control module reads described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
S4, described in described master control module judges, whether the first rear end flash memory address is identical with current back end flash memory address;
S5, if described first rear end flash memory address is identical with described current back end flash memory address, then to read described in present physical storage block corresponding with described first rear end flash memory address in described cache metadata record sheet being write in mapping table and with described first to read logical memory blocks corresponding;
S6, if described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and new physical storage block are substituted described current back end flash memory address and present physical storage block respectively, and will to read described in described new physical storage block write in mapping table and with described first to read logical memory blocks corresponding.
7. the data reading method of flash-memory storage system as claimed in claim 6, is characterized in that,
Described flash-memory storage system also comprises reference count table, free physical block FIFO and recycling module, described free physical block FIFO is for depositing physical storage block idle in described buffer memory, described reference count table quotes number of times for storing described physical storage block with corresponding, when the physical storage block of free time dispenses by described free physical block FIFO, the number of times of quoting of the physical storage block dispensed is set to first and quotes time numerical value; Also comprise and reclaim physical storage block step:
In step s 5, read after in mapping table when described in the present physical storage block write that described first rear end flash memory address is corresponding, also comprise the steps:
S5.1, the number of times of quoting of the present physical storage block corresponding with described first rear end flash memory address is increased setting and quotes number of times, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
In step s 6, read after in mapping table described in described new physical storage block write, also comprise the steps:
S6.1, increases setting quote number of times by the number of times of quoting of described new physical storage block, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
For the physical storage block replaced and be replaced, that reads physical storage block in described reference count table quotes number of times, if the number of times of quoting of physical storage block is greater than described first and quotes time numerical value, then the number of times of quoting of the physical storage block of correspondence is reduced and surely quotes number of times, if the number of times of quoting of physical storage block equals first and quotes time numerical value, then the physical storage block of correspondence writes in described free physical block FIFO by described recycling module.
8. the data reading method of flash-memory storage system as claimed in claim 7, it is characterized in that, described flash-memory storage system also comprises cache metadata state table;
In described cache metadata record sheet, described physical storage block has multiple, and multiple physical storage block is corresponding with the continuous multiple rear ends flash memory address being benchmark with described rear end flash memory address respectively;
Described cache metadata record sheet is also for storing the physical storage block effective marker position corresponding with physical storage block, the value of physical storage block effective marker position corresponding before physical storage block stores data is set to insignificant values, and the value of physical storage block effective marker position corresponding after physical storage block stores data is set to effective value;
Described cache metadata state table is used for storing metadata table address, corresponding relation between busy flag position and empty zone bit, the value of described busy flag position comprises and represents that list item corresponding to described metadata table address is occupied and do not have occupied occupation value and unoccupied value respectively, and the value of described empty zone bit comprises the physical storage block represented respectively in described metadata table address and is written into data and is not written into non-null value and the null value of data;
Between described step S2 and step S3, also comprise the steps:
S3.1, described main control module reads described cache metadata record sheet, judges whether the value of the busy flag position that described first metadata table address is corresponding is occupation value, if then wait for, otherwise performs step S3.2;
S3.2, whether the value of the empty zone bit that the first metadata table address is corresponding described in described master control module judges is non-null value, if then perform step S3;
In described step S5, also comprise the steps:
S5.1, judges in described cache metadata record sheet, and whether the value of the physical storage block effective marker position of the physical storage block corresponding with described first rear end flash memory address is effective value;
S5.2, if effective value then performs reclaim physical storage block step;
S5.3, the value of the physical storage block effective marker position of correspondence is then set to effective value by valid value that were it not for.
9. a deletion data method for flash-memory storage system, is characterized in that, described flash-memory storage system comprises buffer memory, main control module and buffer memory meta-data record; Wherein, described cache metadata record sheet is used for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address; The deletion data method of described flash-memory storage system comprises the steps:
S1, described main control module receiving front-end applies the order of the data of the deletion first rear end flash memory address sent;
S2, described main control module calculates described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
S3, described main control module reads described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
S4, described in described master control module judges, whether the first rear end flash memory address is identical with current back end flash memory address;
S5, if described first rear end flash memory address is identical with described current back end flash memory address, then deletes list item corresponding for current back end flash memory address, and performs step S7;
S6, if described first rear end flash memory address is different from described current back end flash memory address, then performs step S7;
S7, is sent to rear end flash memory by the order of the data of described deletion first rear end flash memory address.
10. a flash-memory storage system, is characterized in that, comprises buffer memory, main control module, cache metadata record sheet, reads mapping table and write mapping table; Wherein, described mapping table of writing is for storing the corresponding relation writing logical memory blocks and physical storage block in the buffer, described mapping table of reading is for storing the corresponding relation reading logical memory blocks and physical storage block in the buffer, and described cache metadata record sheet is for storing metadata table address, corresponding relation between physical storage block and rear end flash memory address;
Described main control module is used for the order data in the first write logical memory blocks being write the first rear end flash memory address that receiving front-end application sends;
Described main control module writes mapping table described in reading, and acquisition writes the first physical storage block in described buffer memory corresponding to logical memory blocks with described first;
Described main control module is used for calculating described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
Described main control module, for reading described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
Whether described main control module is identical with current back end flash memory address for judging described first rear end flash memory address, if described first rear end flash memory address is identical with described current back end flash memory address, then described first physical storage block is replaced present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet; If described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and the first physical storage block are substituted described current back end flash memory address and present physical storage block respectively;
Described main control module is used for the order data of the first rear end flash memory address write first read in logical memory blocks that receiving front-end application sends;
Described main control module is used for calculating described first rear end flash memory address, obtains the first metadata table address corresponding with described first rear end flash memory address;
Described main control module, for reading described cache metadata record sheet, obtains the current back end flash memory address corresponding with described first metadata table address;
Whether described main control module is identical with current back end flash memory address for judging described first rear end flash memory address; If described first rear end flash memory address is identical with described current back end flash memory address, then to read described in present physical storage block corresponding with described first rear end flash memory address in described cache metadata record sheet being write in mapping table and with described first to read logical memory blocks corresponding; If described first rear end flash memory address is different from described current back end flash memory address, then the data of present physical storage block corresponding with described current back end flash memory address in described cache metadata record sheet are stored in the current back end flash memory address of rear end flash memory, and described first rear end flash memory address and new physical storage block are substituted described current back end flash memory address and present physical storage block respectively, and will to read described in described new physical storage block write in mapping table and with described first to read logical memory blocks corresponding.
11. flash-memory storage systems as claimed in claim 10, is characterized in that,
Described flash-memory storage system also comprises reference count table, free physical block FIFO and recycling module, described free physical block FIFO is for depositing physical storage block idle in described buffer memory, described reference count table quotes number of times for storing described physical storage block with corresponding, when the physical storage block of free time dispenses by described free physical block FIFO, the number of times of quoting of the physical storage block dispensed is set to first and quotes time numerical value;
Read after in mapping table when described in the present physical storage block write that described first rear end flash memory address is corresponding, the number of times of quoting of the present physical storage block corresponding with described first rear end flash memory address is increased setting and quotes number of times, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
Read after in mapping table described in described new physical storage block write, the number of times of quoting of described new physical storage block is increased setting and quotes number of times, and the described number of times of quoting reading to read with described first in mapping table old physical storage block corresponding to logical memory blocks is subtracted described setting and quotes number of times;
For the physical storage block replaced and be replaced, that reads physical storage block in described reference count table quotes number of times, if the number of times of quoting of physical storage block is greater than described first and quotes time numerical value, then the number of times of quoting of the physical storage block of correspondence is reduced and surely quotes number of times, if the number of times of quoting of physical storage block equals first and quotes time numerical value, then the physical storage block of correspondence writes in described free physical block FIFO by described recycling module.
12. flash-memory storage systems as claimed in claim 10, is characterized in that, have four physical storage blocks in a list item of described cache metadata record sheet, and the size of each physical storage block is 4KB.
CN201510056206.0A 2015-02-03 2015-02-03 A kind of flash-memory storage system and read-write thereof, delet method Active CN104636285B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510056206.0A CN104636285B (en) 2015-02-03 2015-02-03 A kind of flash-memory storage system and read-write thereof, delet method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510056206.0A CN104636285B (en) 2015-02-03 2015-02-03 A kind of flash-memory storage system and read-write thereof, delet method

Publications (2)

Publication Number Publication Date
CN104636285A CN104636285A (en) 2015-05-20
CN104636285B true CN104636285B (en) 2016-03-23

Family

ID=53215060

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510056206.0A Active CN104636285B (en) 2015-02-03 2015-02-03 A kind of flash-memory storage system and read-write thereof, delet method

Country Status (1)

Country Link
CN (1) CN104636285B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20160148940A (en) * 2015-06-17 2016-12-27 에스케이하이닉스 주식회사 Memory system and operation method for the same
KR20170057902A (en) * 2015-11-17 2017-05-26 에스케이하이닉스 주식회사 Memory system and operating method of memory system
CN105739926A (en) * 2016-01-29 2016-07-06 四川长虹电器股份有限公司 Method for improving starting speed of set top box and prolonging service life of Flash
CN107562648B (en) * 2016-07-01 2021-04-06 北京忆恒创源科技有限公司 Lock-free FTL (fiber to the Home) access method and device
CN108615077B (en) * 2016-12-09 2021-08-24 杭州海康威视数字技术股份有限公司 Cache optimization method and device applied to deep learning network
CN108446240A (en) * 2016-12-12 2018-08-24 中国航空工业集团公司西安航空计算技术研究所 Storage management circuit based on buffer unit ID
CN106649132A (en) * 2016-12-29 2017-05-10 记忆科技(深圳)有限公司 Solid-state drive junk recovery method
CN108628761A (en) * 2017-03-16 2018-10-09 北京忆恒创源科技有限公司 Atomic commands execute method and apparatus
CN108628760B (en) * 2017-03-16 2021-05-18 北京忆恒创源科技有限公司 Method and device for atomic write command
CN107256196A (en) * 2017-06-13 2017-10-17 北京中航通用科技有限公司 The caching system and method for support zero-copy based on flash array
CN107562646A (en) * 2017-08-28 2018-01-09 记忆科技(深圳)有限公司 A kind of method for lifting solid-state storage garbage reclamation performance
CN108509354B (en) * 2018-03-22 2020-06-23 雷科防务(西安)控制技术研究院有限公司 Method for recovering and managing hardware space of memory chip
CN108874685B (en) * 2018-06-21 2021-10-29 郑州云海信息技术有限公司 Data processing method of solid state disk and solid state disk
CN111026678A (en) * 2019-12-23 2020-04-17 深圳忆联信息系统有限公司 Cache design method and device based on solid state disk and computer equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101256536B (en) * 2007-03-01 2010-05-26 创惟科技股份有限公司 Flash memory address translation layer system
US8688897B2 (en) * 2010-05-28 2014-04-01 International Business Machines Corporation Cache memory management in a flash cache architecture
CN104268094B (en) * 2014-09-23 2017-05-03 浪潮电子信息产业股份有限公司 Optimized flash memory address mapping method

Also Published As

Publication number Publication date
CN104636285A (en) 2015-05-20

Similar Documents

Publication Publication Date Title
CN104636285B (en) A kind of flash-memory storage system and read-write thereof, delet method
CN104503710B (en) A kind of method and apparatus for improving flash memory writing speed
CN103608782B (en) Selective data storage in LSB page face and the MSB page
CN100590609C (en) Method for managing dynamic internal memory base on discontinuous page
CN102981963B (en) A kind of implementation method of flash translation layer (FTL) of solid-state disk
CN102576333B (en) Data cache in nonvolatile memory
CN102163175B (en) Hybrid address mapping method based on locality analysis
CN107256196A (en) The caching system and method for support zero-copy based on flash array
US20060218347A1 (en) Memory card
CN102841851B (en) Flash memory management method and flash memory device
CN104166634A (en) Management method of mapping table caches in solid-state disk system
CN103425600A (en) Address mapping method for flash translation layer of solid state drive
CN101692252B (en) Method for distributing and reclaiming idle blocks of file
CN100424699C (en) Attribute extensible object file system
CN105095116A (en) Cache replacing method, cache controller and processor
CN107066393A (en) The method for improving map information density in address mapping table
CN107515728A (en) Play the data managing method and device of concurrent characteristic inside flash memory device
CN106528443A (en) FLASH management system and method suitable for satellite-borne data management
CN101610197A (en) A kind of buffer management method and system thereof
CN107015763A (en) Mix SSD management methods and device in storage system
CN101271428A (en) Apparatus and method for object data storage management
CN109960471A (en) Date storage method, device, equipment and storage medium
CN108959113A (en) Method and system for flash memory perception heap memory management
CN109117084A (en) Logic block storage is dynamically readjusted into size
US9699254B2 (en) Computer system, cache management method, and computer

Legal Events

Date Code Title Description
PB01 Publication
C06 Publication
SE01 Entry into force of request for substantive examination
C10 Entry into substantive examination
GR01 Patent grant
C14 Grant of patent or utility model
TR01 Transfer of patent right

Effective date of registration: 20180807

Address after: 100013 11, 1 anding Gate Street, Chaoyang District, Beijing (anzhen incubator C218)

Patentee after: Beijing Jiangjiang science and Technology Center (limited partnership)

Address before: 100083 B-602-017 5, 1 building, 18 Zhongguancun East Road, Haidian District, Beijing.

Patentee before: NETBRIC TECHNOLOGY CO., LTD.

Effective date of registration: 20180807

Address after: 100013 11, 1 anding Gate Street, Chaoyang District, Beijing (anzhen incubator C218)

Patentee after: Beijing Jiangjiang science and Technology Center (limited partnership)

Address before: 100083 B-602-017 5, 1 building, 18 Zhongguancun East Road, Haidian District, Beijing.

Patentee before: NETBRIC TECHNOLOGY CO., LTD.

TR01 Transfer of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Flash memory storage system and reading, writing and deleting method thereof

Effective date of registration: 20200119

Granted publication date: 20160323

Pledgee: Zhongguancun Beijing technology financing Company limited by guarantee

Pledgor: Beijing Jiangjiang science and Technology Center (limited partnership)

Registration number: Y2020990000082

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20210305

Granted publication date: 20160323

Pledgee: Zhongguancun Beijing technology financing Company limited by guarantee

Pledgor: Beijing Jiangjiang science and Technology Center (L.P.)

Registration number: Y2020990000082

PC01 Cancellation of the registration of the contract for pledge of patent right
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210518

Address after: 100089 room 203-1, 2 / F, building 1, courtyard 1, Shangdi East Road, Haidian District, Beijing

Patentee after: Beijing Zeshi Technology Co.,Ltd.

Address before: 100013 11, 1 anding Gate Street, Chaoyang District, Beijing (anzhen incubator C218)

Patentee before: Beijing Jiangjiang science and Technology Center (L.P.)