Methods, systems and computer readable medium for writing and reading data

Information

  • Patent Grant
  • 8838937
  • Patent Number
    8,838,937
  • Date Filed
    Wednesday, May 23, 2012
    12 years ago
  • Date Issued
    Tuesday, September 16, 2014
    9 years ago
Abstract
A flash memory controller, a computer readable medium and a method for writing to a flash memory device, the method may include receiving multiple logical pages, each logical page having a logical address; determining to write a logical page into a selected physical page of the flash memory device; calculating a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) a physical page index, to provide multiple hash values of the multiple logical pages.
Description
BACKGROUND OF THE INVENTION

Flash memory devices store information with high density on flash memory cells with ever smaller dimensions. In addition, Multi-Level Cells (MLC) may store several bits per cell (bpc) by setting the amount of charge in a cell. Flash memory devices are organized into (physical) pages. Each physical page includes a section allocated for data (e.g., 512 bytes-16 KB and expected larger in the future) and a small amount of spare bytes (e.g., 64-1024 or more bytes for every page) for storing redundancy and metadata. The redundancy bytes are used to store error correcting information, for correcting errors which may have occurred during flash lifetime and the page read process. Each program (write) operation is performed on an entire page. A number of pages are grouped together to form an erase block (also referred to as block). A page cannot be erased unless the entire erase block which includes that page is erased.


One common application of flash memory devices is Secure Digital (SD) cards. Another common application of flash memory devices is Solid State Disks (SSDs). An SSD may typically include a flash memory device and a flash memory controller. The flash memory controller translates commands coming in through the SSD interface into actions (Read/Write/Erase) on the flash memory device. The most common SSD commands may be read commands and write commands of one or more sectors, where a sector may be, but is not limited to, a sequence of 512 bytes.


The read commands or write commands may be of a single sector or multiple sectors. These commands may refer to logical addresses. These addresses may then be redirected to new addresses on the flash memory device which need not directly correspond to the logical addresses that might be referenced by the read or write commands.


This is due to memory management that may be carried out by the flash memory controller in order to support several features such as wear-leveling, bad block management, firmware code and data, error-correction, and others. The erase function is performed on an entire erase block. Because of this functionality, before the data of a selected block may be replaced such as during a write function, the new data must be written in an alternative location before an erase can occur, to preserve the integrity of the stored data.


In some SSDs, the flash memory controller may typically have only a small random access memory (RAM) available for storage. The small size of the RAM limits the type of memory management which may be carried out by the flash memory controller with regard to the data stored in the flash memory device and received from the interface.


The flash memory controller of an SSD may typically manage the flash memory device at the page level. In this approach, each logical page address is associated with an arbitrary physical page address, and the flash memory controller must maintain this association (mapping). In this method, part of the physical space is mapped to logical data, and the rest is set aside for management purposes and is typically named over provisioning. At each time, one or more blocks may be open for writing. When a logical page is to be written, the flash memory controller writes its content into the next available physical page in an open block and updates the physical association of this logical page to the new location. The previous physical location which held the data of this logical address prior to the write is typically designated as obsolete or superseded. The remaining physical pages in a block which are not superseded are called valid physical pages. Once all of the physical pages of an open block are written, a fresh block from the over provisioning is taken, and future writes resume to this block.


Once no more free blocks from the over provisioning are available to host new pages, or the number of free blocks is reduced below some threshold, the flash memory controller begins a process in which valid physical pages from a first block with superseded physical pages are copied into a second empty block, and once no more valid physical pages are left in the first block, the first block is added to the list of free blocks. This process is typically called cleaning.


A logical page designated by a logical page address is read by first looking up its physical address and then reading the data from the physical address which is associated to this logical page.


The flash memory controller may implement a logical to physical (L2P) mapping between a logical page address and a physical page address by means of a L2P table.


The L2P table may be a list of entries that hold, for each logical page which is mapped in the user space, a corresponding physical address.


An example of a prior art L2P table 10 is depicted in FIG. 1. The L2P table 10 includes M entries 10(0)-10(M−1), each entry stores the address of a physical page (physical address) and each entry is pointed by a logical address of a page out of logical pages 0 till (M−1) 20(0)-20(M−1).



FIG. 1 illustrates that the physical pages that are pointed by sequential logical addresses are non-sequential. Thus, L2P table includes the following sequence of physical addresses—physical page 17, physical page 1009, physical page 7289 till physical page 2284.



FIG. 2 illustrates the j′th entry (10, j) of the prior art L2P table 10 of FIG. 1. The j′th entry (10, j) can include a block address 10(j, 1) that is N1 bits long and a page address 10(j, 2) that is N2 bits long. The block address designates the block address and the page address determines the page address within that block.


The number (M) of entries in the L2P table is the number of user-mapped pages, while the size of each entry is the number of bits required to represent the address of each of the physical pages in the disk.


For example, for an SSD with physical size C of 256 GB (2^30 bytes), logical user space U of 256 GB (10^9 bytes), and page size P of 4 KB, the minimal size in bytes required for the complete L2P table is given by:










S

L





2





P


=


U
P

*





log
2



(

C
P

)




/
8








=




256
*

10

9



4
*

2

10



*





log
2



(


256
*

2

30



4
*

2

10



)




/
8


=

193.7
*

2


20




[
Bytes
]











If pages of size 4 KB are used in an SSD of 256 GB, where 4 bytes are used to hold the physical address of each logical page, then, a L2P table of size 256 MB would be required.


Such large memory requirements may often be accommodated by means of external volatile memory (e.g., DRAM). This requirement introduces additional costs to the complete system. Storing the L2P tables more efficiently can potentially cut down some of these costs.


There is a growing need to reduce the size of the L2P table.


SUMMARY OF THE INVENTION

According to an embodiment of the invention a method for writing to a flash memory device may be provided and may include receiving multiple logical pages, each logical page having a logical address; determining to write a logical page into a selected physical page of the flash memory device, the selected physical page has a selected physical page address that is represented by a physical page index, a set index and a block index; the physical page index being indicative of an order of the selected physical page within a selected set of physical pages, the selected set of physical pages is being identified by the set index, the block index is indicative of a block of the flash memory device that comprises the selected set of physical pages; calculating a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages; searching for a matching logical page that is associated with a hash value that matches the set index; writing the matching logical page to the selected physical page and updating a first data structure to be indicative of a mapping between a logical address of the matching logical page and the selected physical address; and writing a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address—if neither one of the multiple logical pages is associated with a hash value that matches the set index.


The updating of the first data structure and the second data structure may include writing the physical page index of the selected physical page to the first data structure and writing the set index to the second data structure.


The method may include selecting a matching logical page out of a plurality of matching logical pages.


The method may include selecting the matching logical page in response to an age of each of the plurality of matching logical pages.


The method may include electing the mismatch logical page based upon a distribution of hash values of the multiple logical pages.


The method may include selecting the mismatch logical page out of a largest group of logical pages that share a same hash value.


The selected set of physical pages may include a consecutive sequence of physical pages.


The selected set of physical pages may include non-consecutive physical pages that are located at a same relative position in sub-blocks of the selected block.


The method may include storing the multiple logical pages in a buffer before writing to the selected physical page.


The multiple logical pages may fill the buffer.


The multiple logical pages may partially fill the buffer.


The method may include receiving a request to read a requested logical page from the flash memory device, the requested logical page has a requested logical address; searching the second data structure for a logical address of a mismatch logical page that equals the requested logical address; retrieving the requested logical page based upon the first and second data structures if it is determined that the second data structure may include a logical address of a mismatch logical page that equals the requested logical address; and retrieving the requested logical page based upon the first data structures and not upon the second data structure if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.


The method may include calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, (b) a set index that is stored in the second data structure and is associated with the requested logical address, and (c) a physical page index stored in the first data structure and is associated with the requested logical page address, if it is determined that the second data structure may include the logical address of the mismatch logical page that equals the requested logical address.


The method may include calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, and (b) a physical page index stored in the first data structure and is associated with the requested logical address, if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.


Further embodiments of the invention include a computer readable medium that is non-transitory and may store instructions for performing the above-described methods and any steps thereof, including any combinations of same. For example, the computer readable medium may store instructions for receiving multiple logical pages, each logical page having a logical address; determining to write a logical page into a selected physical page of the flash memory device, the selected physical page has a selected physical page address that is represented by a physical page index, a set index and a block index; the physical page index being indicative of an order of the selected physical page within a selected set of physical pages, the selected set of physical pages is being identified by the set index, the block index is indicative of a block of the flash memory device that comprises the selected set of physical pages; calculating a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages; searching for a matching logical page that is associated with a hash value that matches the set index; writing the matching logical page to the selected physical page and updating a first data structure to be indicative of a mapping between a logical address of the matching logical page and the selected physical address; and writing a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address—if neither one of the multiple logical pages is associated with a hash value that matches the set index.


The updating of the first data structure and the second data structure may include writing the physical page index of the selected physical page to the first data structure and writing the set index to the second data structure.


The computer readable program may store instructions for selecting a matching logical page out of a plurality of matching logical pages.


The computer readable program may store instructions for selecting the matching logical page in response to an age of each of the plurality of matching logical pages.


The computer readable program may store instructions for electing the mismatch logical page based upon a distribution of hash values of the multiple logical pages.


The computer readable program may store instructions for selecting the mismatch logical page out of a largest group of logical pages that share a same hash value.


The selected set of physical pages may include a consecutive sequence of physical pages.


The selected set of physical pages may include non-consecutive physical pages that are located at a same relative position in sub-blocks of the selected block.


The computer readable program may store instructions for storing the multiple logical pages in a buffer before writing to the selected physical page.


The multiple logical pages may fill the buffer.


The multiple logical pages may partially fill the buffer.


The computer readable program may store instructions for receiving a request to read a requested logical page from the flash memory device, the requested logical page has a requested logical address; searching the second data structure for a logical address of a mismatch logical page that equals the requested logical address; retrieving the requested logical page based upon the first and second data structures if it is determined that the second data structure may include a logical address of a mismatch logical page that equals the requested logical address; and retrieving the requested logical page based upon the first data structures and not upon the second data structure if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.


The computer readable program may store instructions for calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, (b) a set index that is stored in the second data structure and is associated with the requested logical address, and (c) a physical page index stored in the first data structure and is associated with the requested logical page address, if it is determined that the second data structure may include the logical address of the mismatch logical page that equals the requested logical address.


The computer readable program may store instructions for calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, and (b) a physical page index stored in the first data structure and is associated with the requested logical address, if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.


Additional embodiments of the invention include a system arranged to execute any or all of the methods described above, including any stages-and any combinations of same. For example, the system may include (i) a flash memory controller that may include a buffer arranged to receive and store multiple logical pages, each logical page having a logical address; a write circuit arranged to determine to write a logical page into a selected physical page of a flash memory device that is coupled to the flash memory controller, the selected physical page has a selected physical page address that is represented by a physical page index, a set index and a block index; the physical page index being indicative of an order of the selected physical page within a selected set of physical pages, the selected set of physical pages is being identified by the set index, the block index is indicative of a block of the flash memory device that comprises the selected set of physical pages; a hash circuit arranged to calculate a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages; a search circuit arranged to search for a matching logical page that is associated with a hash value that matches the set index; wherein the write circuit is arranged to write the matching logical page to the selected physical page and updating a first data structure to be indicative of a mapping between a logical address of the matching logical page and the selected physical address; and write a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address—if neither one of the multiple logical pages is associated with a hash value that matches the set index.





BRIEF DESCRIPTION OF THE DRAWINGS

The subject matter regarded as the invention is particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings in which:



FIG. 1 illustrates a prior art logical to physical (L2P) table;



FIG. 2A illustrates a prior art entry of the L2P table of FIG. 1;



FIG. 2B illustrates an entry of a L2P table according to an embodiment of the invention;



FIG. 3A illustrates a partition of a block of a flash memory device to multiple sets of physical pages according to an embodiment of the invention;



FIG. 3B illustrates a partition of a block a flash memory device to multiple sets of physical pages according to an embodiment of the invention;



FIGS. 4-6 illustrate methods for writing to a flash memory device according to an embodiment of the invention;



FIG. 7 illustrates a second data structure according to an embodiment of the invention;



FIG. 8 illustrates a method for reading from a flash memory device according to an embodiment of the invention;



FIG. 9 illustrates a method for writing to a flash memory device according to an embodiment of the invention;



FIG. 10 illustrates a method for reading from a flash memory device according to an embodiment of the invention;



FIG. 11 illustrates an example of relationship between memory saving and a size of an entry of a first data structure according to an embodiment of the invention; and



FIG. 12 illustrates a system according to an embodiment of the invention.





It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.


DETAILED DESCRIPTION OF THE DRAWINGS

In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be understood by those skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the present invention.


The subject matter regarded as the invention is particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings.


It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.


Because the illustrated embodiments of the present invention may for the most part, be implemented using electronic components and circuits known to those skilled in the art, details will not be explained in any greater extent than that considered necessary as illustrated above, for the understanding and appreciation of the underlying concepts of the present invention and in order not to obfuscate or distract from the teachings of the present invention.


The symbol “^” means power. Thus a^b means a by the power of b.


The following terms may be construed either in accordance with any definition thereof appearing in the prior art literature or in accordance with the specification, or as follows:


Flash memory cell: a component of flash memory device that stores one bit of information (in single-level cell devices) or n bits of information (in a multi-level device having 2^n levels). Typically, each cell includes a floating-gate transistor. “Multi-level” means that the physical levels in the cell are, to an acceptable level of certainty, statistically partitionable into multiple distinguishable regions, plus a region corresponding to zero, such that digital values each comprising multiple bits can be represented by the cell. In contrast, in single-level cells, the physical levels in the cell are assumed to be statistically partitionable into only two regions, one corresponding to zero and one other, non-zero region, such that only one bit can be represented by a single-level cell.


Flash memory device: a non-volatile computer memory including cells that are erased block by block, each block typically comprising more than one page, but are written into and read from, page by page. Includes NOR-type flash memory, NAND-type flash memory, and PRAM, e.g. Samsung PRAM, inter alia, and flash memory devices with any suitable number of levels per cell, such as but not limited to 2, 4, or 8.


Logical page: a portion of typically sequential data, whose amount is typically less than or equal to a predetermined amount of data defined to be a page full of data, which has typically been defined by a host (data source/destination) or user thereof, as a page, and which is sent by the host to a flash memory device for storage and is subsequently read by the host from the flash memory device.


Physical Page: a portion, typically 512 or 2048 or 4096 bytes in size, of a flash memory device e.g. a NAND or NOR flash memory device. Writing and reading is typically performed physical page by physical page, as opposed to erasing which can be performed only at a granularity of an erase sector. A few bytes, typically 16-32 for every 512 data bytes are associated with each page (typically 16, 64 or 128 per page), for storage of error correction information. A typical block may include 32 512-byte pages or 64 2048-byte pages or 256 8 Kbyte pages.


Alternatively, a physical page is an ordered set (e.g. sequence or array) of flash memory cells which are all written in simultaneously by each write operation, the set typically comprising a predetermined number of typically physically adjacent flash memory cells containing actual data written by and subsequently read by the host, as well as, typical error correction information and back pointers used for recognizing the true address of a page.


Embodiments of the present invention seek to reduce the memory size required for a logical to physical translation (L2P) table, hence reducing the cost associated with a Flash memory system.


Certain embodiments of the present invention reduce the size of the L2P table by reducing the size of each L2P entry.



FIG. 2B shows an example of a L2P table 11 and an L2P entry 11(j) according to an embodiment of the invention.


L2P table 11 has M entries such as 11(0)-11(M−1), each is (N1+N2-m) bits long. The j′th entry is divided into two parts, one of which (of size N1 bits) designates the block address 11(j,1) and another (of size [N2−m] bits) and denoted 11(j,2) designates a page index that is further processed (with the logical address) to provide a set of physical pages. Each set of physical pages can have a unique set index value.


The block index, set index and the page index determine the physical address of physical page that stores the logical page that has a logical address that is used to access the j′th entry 11(j). The SSD may have one or more blocks which are open for writing at each instant. These blocks may be written in order, starting from the first physical page in the block and ending at the last physical page in the block. When a new physical page is to be written to the SSD, the flash memory controller decides to which of the open blocks the logical page is written, and updates the L2P table with the bits corresponding to the block index and the page index.


According to certain embodiments of the present invention, the number of bits which is used to designate the page address within the block may be reduced by m bits. Reducing the number of bits in this way may result in two logical pages having an identical L2P entry. However, since every logical page should be uniquely mapped to a physical page, it follows that the logical page address is also used to determine the exact physical page. In other words, each logical address is linked a-priori to some set of possible physical addresses. At each instant, an incoming write transaction may either be linked to the next available physical page or not.


In certain embodiments of the present invention, the logical page addresses of the write transactions are randomly spread over some part or of the user space or its entirety. Therefore, it may occur that the logical address of an incoming logical page is not linked to the currently selected set of physical pages (the set of physical pages that is being written to). Certain embodiments of the invention may store the incoming logical page in a buffer until the currently selected set of physical pages matches the incoming logical page. The SSD may continue to store incoming logical pages until receiving a logical page that is associated with the currently selected set of physical pages. Once a logical page arrives which matches the currently selected set of physical pages, the logical page is written to a current physical page of the currently selected set of physical pages. If the currently selected set of physical pages changes after this write operation, the flash memory controller searches the buffer for logical pages which match the new currently selected set of pages.


In certain embodiments of the present invention, the L2P entry size may be reduced by removing some or all of the bits used to designate the block address.


In certain embodiments of the present invention, the block is divided into sets of physical pages, and the bits in the L2P entry which typically are used to hold the page index within the block may store only the index (page index) of the physical page within the set of physical pages. A set index may be determined by some hashing function that is applied on (i) the logical address and (ii) the page index. The set index is used to index one of 2^m sets of physical pages. The page index is used to index the pages belonging to some set of physical pages.


According to some embodiments of the invention, let Np=2^N2 be the number of pages in a block, and let m be the number of bits which are removed from the entry of the L2P entry.


The physical pages in each block may be partitioned to (2^m) sets of physical pages of equal size Ns=Np/(2^n) pages. There are numerous ways to partition the block.


According to some embodiments of the invention, the block may be partitioned according to the scheme depicted in FIG. 3A. According to this scheme, the first set of physical pages 40(1) includes physical pages 1, 2, . . . , N, p1, p2, . . . , pz4, the second set of physical pages 40(2) includes physical pages Ns+1, Ns+2, . . . , 2*Ns, and the last set of physical pages 40(2^m) includes physical pages (2^m−1)*Ns+1, (2^m−1)*Ns+2, . . . , (2^m)*Ns.


According to some embodiments of the invention, let A1, A2, . . . be a sequence of logical addresses each associated with a 4 KB page write transaction, and let there be defined Ns hashing function h(A, t), t=1, 2, . . . , Ns, which maps each logical address to one of the elements in the set {1, 2, . . . , (2^m)}.


According to some embodiments of the invention, the write flow proceeds as follows. At each time instant a selected physical page of a selected set of physical pages of a selected block may be open for writing. The selection can be made in a manner that sequentially scans each set of physical pages and sequentially scans each block.


The flash memory controller may write the logical pages to the selected block in the following order (see FIG. 3A). First, it may write to physical page 1 of set of physical pages 1, continue with writing to physical page 2 of set of physical pages 1, and so on, until writing to physical page Ns of set of physical pages 1. After completing writing all the pages in set of physical pages 1, it may continue to write to physical page 1 of set of physical pages 2, write to physical page 2 of set of physical pages 2, and so on.


According to some embodiments of the invention, every time a request is made to write a logical page, the logical page enters a buffer of fixed length L. Once the buffer is full (or once a predetermined portion of the buffer is filled), the flash memory controller may begin writing logical pages from the buffer into the flash memory device. According to some embodiments, the flash memory controller may write logical pages to the selected block in order, starting with the first physical page of the selected block, and ending at the last physical page of the selected block.


According to some embodiments, prior to every such write, the flash memory controller may compute the hash values of the logical address corresponding to all (or a subset of all) logical pages which are stored in the buffer. For each such logical page, the flash memory controller may compute the hash value by computing the value of h(A, p), A being the logical address of the logical page and p being the page index of the selected physical page—indicative of the order of the selected physical page within the selected set of physical pages.


If multiple logical pages (multiple matching logical pages) are associated with a hash value that matches the set index of the selected set of physical pages (the selected set of physical pages includes a selected physical page that should be currently written) then the flash memory controller may select one of these matching logical pages to be written to the selected physical page. The matching logical page that is selected may be the oldest matching logical page in the buffer. If only a single matching logical page is found then it is written to the selected physical page.


The flash memory controller may then update the L2P entry of the selected logical page with the page index of the matching logical page (either the selected matching logical page or of the single matching logical page).


If no matching logical page is found in the buffer (that hash value associated with neither one of the logical pages stored in the buffer matches the set index of the selected set of physical pages) then a miss (or mismatch) is declared and the flash memory controller may elect a mismatch logical pages out of the logical pages stored in the buffer and write the mismatch logical page to the selected physical page.


The election can be based upon the distribution of the hash values. For example—the flash memory controller may elect a mismatch logical page out of a largest group of mismatch logical pages that share the same hash. The election (between members of the group) may be based upon the time of receiving the mismatch logical page (elect the oldest page of the group) or on any other parameter.


The flash memory controller may then update the L2P entry with the block index and the page index of the mismatch logical page and update a second data structure (such as a miss list) with the set index of the mismatch logical page (this set index represents a set of physical pages that differs from the selected set of physical pages that includes a selected physical page that should be currently written to) and association information that associates the mismatching page with the entry of the second data structure. The association information may be the logical address of the mismatch logical page.



FIG. 4 illustrates a method 210 for managing a buffer and writing to a flash memory device according to an embodiment of the invention.


Method 210 starts by stage 212 of receiving a page write request to logical address A.


Stage 212 may be followed by stage 214 of storing the logical page and logical address A in a buffer.


Stage 214 may be followed by stage 216 of checking if the buffer full—either completely full or full enough to trigger a writing operation to a selected physical memory page.


If the buffer is not full enough stage 216 is followed by stage 212—else it is followed by stage 218 of performing page write to flash memory device and emptying the buffer.



FIG. 5 illustrates a method 220 for writing to a selected physical page according to an embodiment of the invention.


Method 220 starts by a sequence of stages 222, 224 and 226.


Stage 222 may include determining to write a logical page to a selected physical page that is the p′th physical page of the s′th set of physical pages of the b′th block of a flash memory device.


Stage 224 may include computing hash values in response to (i) logical addresses of all pages of information in the buffer and (ii) p. Stage 226 may include searching for a matching logical page that is stored in the buffer and is associated with a hash value that equals s.


Stage 226 is followed by query stage 228 of determining whether one or more matching logical pages have been found during the searching of stage 226.


If no such matching logical page is found then stage 228 is followed by stage 240 of handling a page miss.


If a plurality of matching logical pages are found then stage 228 is followed by stage 231 of selecting one matching logical page of the plurality of matching logical pages and jumping to stage 230.


If a single matching logical page is found then stage 228 is followed by stage 230 of writing the matching logical page to the selected physical logical page.


Stage 230 is followed by stage 234 of updating L2P entry of logical address A, with value p and by stage 232 of removing the logical page from the buffer.



FIG. 6 illustrates a method 240 for managing a page miss according to an embodiment of the invention.


Method 240 may include a sequence of stages 242, 244, 246, 248, 250 and 252.


Stage 242 may include finding the hash index h for which the number of associated mismatch logical pages in the buffer is highest.


Stage 244 may include electing a mismatch logical page.


Stage 246 may include writing the mismatch logical page to block b, page set s, and page index p.


Stage 248 may include updating L2P entry of logical address A, with values p and b.


Stage 250 may include adding an entry to the miss list with logical address A, set index s.


Stage 252 may include removing the mismatch logical page from buffer.



FIG. 7 illustrates a second data structure such as linked list 100 according to an embodiment of the invention.


The second data structure can differ from a linked list. Using a linked list allows to support any number of miss events, without predefined and fixed memory allocation.


The linked list 100 of FIG. 7 has three list elements 100(1)-100(3) and a pointer to the first element of the linked list 102. The number of the list elements can differ from three—and match the number of mismatch logical pages.


Each list element may include (i) a logical address of a mismatch logical page (may be 4 bytes long or any other size), (ii) a set index of the selected set of physical pages to which the mismatch logical page was actually written (may be m bits long), and (iii) a pointer to the next list element (may be {32-m} bits long)—if such next list element exists.


Thus, list elements 100(1)-100(3) include logical address of mismatch logical pages 101(1)-101(3), set indexes of selected sets of physical pages to which the mismatch logical pages were written 102(1)-102(3), and pointers (only includes in list elements 100(1) and 100(2) to the next list element 103(1) and 103(2).


According to some embodiments, the second data structure can be a sorted list that is sorted according to the logical addresses.


According to some embodiments of the invention, when the flash memory controller performs cleaning of a block, it may remove from the page miss list entries belonging to mismatch logical pages of that block which are moved to new locations.


According to embodiments of the invention, the read flow may proceed as follows. Whenever a request is made to read a requested logical page having a requested logical address, the flash memory controller may search the second data structure (for example a page miss list) for an entry that stores a logical address that matches the requested logical address. If such an entry is found, the flash memory controller may continue to read the L2P entry associated with the logical page address, and obtain the page index. The flash memory controller may then calculate the physical address of the physical pages that stores the requested logical page in response to (a) the set index from the miss page list, (b) the page index from the L2P table, and (c) the requested logical address. The flash memory controller may then read the content of the physical page that resided at that physical address.


According to some embodiments, if no entry exists in the second data structure (such as the page miss list) which corresponds to the requested logical page address, the flash memory controller may read the L2P entry associated with the requested logical page address and obtain the page index. The flash memory controller may then calculate the set index corresponding to the logical page address by passing the logical address and the page index through the hashing function. Finally, the flash memory controller may then calculate the physical address of the physical page that stores the requested logical page in response to (a) the set index calculated based upon the L2P entry, (b) the page index from the L2P table, and (c) the requested logical address. The flash memory controller may then read the content of the physical page that resided at that physical address.



FIG. 8 illustrates a method 260 for reading a requested logical page having a requested logical address according to an embodiment of the invention.


Method 200 may start by stage 261 of receiving a request to read a requested logical page having a requested logical address A.


Stage 261 may be followed by stage 262 of searching miss list for entry that has a logical address that matches a requested logical address (A) of a requested logical page.


If it is determined that the miss list includes such an entry then stage 262 is followed by a sequence of stages 264 and 266. Else-it is followed by a sequence of stages 265 and 267. Stages 266 and 267 are followed by stage 268.


Stage 264 may include getting set index s from entry in miss list for logical address A.


Stage 266 may include getting block index b and page index p from the L2P entry pointed by requested logical address A.


Stage 265 may include getting block index b and page index p from the L2P entry pointed by requested logical address A.


Stage 267 may include calculating the set index s by applying a hashing function h(A, p).


Stage 268 may include reading requested logical page from a physical page that has a block index b, set index s, and page index p. According to an embodiment of the invention, the order of operations can be changed from this mentioned above. For example—the order can be reversed. The controller may first turn to the lookup table and see if the requested page has a valid address (pages in the miss list may be denoted by special value in the lookup table to signify that that they are found in the miss-list). If the address is not valid, it may then turn to look at the linked list.


According to some embodiments of the invention, the flash memory controller may partition the pages in the block according to the location of the physical pages within consecutive sub-blocks, each sub-block include a continuous sequence of physical pages and each set of physical pages includes different physical pages that are located at the same location at different sub-blocks.


Referring to the example set forth in FIG. 3B, block 30 is partitioned to Ns sub-blocks 50(1)-50(Ns). Each sub-block includes a sequence of (2^m) physical pages.


The first set of physical pages 40′(1) includes pages 1, (2^m)+1, . . . , (Ns−1)*(2^m)+1, the second set of physical pages (not shown) includes pages 2, (2^m)+2, . . . , (Ns−1)*(2^m)+2, and finally the last set (2^m)'th of physical pages includes pages (Ns−1)*(2^m)+1, (Ns−1)*(2^m)+2, . . . , Ns*(2^m).


In such a case, the flash memory controller may define (2^m) hashing functions h(A, t), t=1, 2, . . . , (2^m), which map each logical address to one of the elements in the set {1, 2, . . . , Ns}. A man skilled in the art can infer similar write and read flows to those presented above in a complimentary fashion.



FIG. 9 illustrates method 300 for writing to a flash memory device, according to an embodiment of the invention.


Method 300 may start by stage 310 of receiving multiple logical pages, each logical page having a logical address. Stage 310 may include storing the multiple logical pages in a buffer. The buffer may be volatile or non-volatile.


Stage 310 may be followed by stage 320 of determining to write a logical page into a selected physical page of the flash memory device. The selected physical page has a selected physical page address that is represented by a physical page index (p), a set index (s) and a block index (b).


The physical page index being indicative of an order of the selected physical page within a selected set of physical pages.


The selected set of physical pages may include a consecutive sequence of physical pages. Alternatively, the selected set of physical pages may include non-consecutive physical pages that are located at a same relative position in sub-blocks of the selected block. The selected set of physical pages is being identified by the set index.


The block index is indicative of a block of the flash memory device that comprises the selected set of physical pages. The block can be written in a sequential manner and the selected physical page may be the next open physical page after the last written physical page.


Stage 320 may be followed by stage 330 of calculating a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages. The hashing function can be applied on both values (logical address and physical page index). Alternatively, the physical page index can be used to select which hashing function out of multiple hash function to apply on the logical address. At the end of stage 330 each logical page of the multiple logical pages has an associated hash value.


Stage 330 may be followed by stage 340 of searching for a matching logical page that is associated with a hash value that matches the set index. The matching logical page is a page (out of the multiple logical pages) that is associated with a hash value (calculated during stage 320) that equals the set index (s).


If one or more matching logical pages are found then stage 340 is followed by stage 350 of writing a matching logical page to the selected physical page and updating a first data structure to be indicative of the mapping between the logical address of the matching logical page and the selected physical address. The first data structure can be a L2P table that is much smaller than a prior art L2P table.


Stage 350 may include stage 352 of selecting a matching logical page out of a plurality of matching logical pages—if each of the plurality of matching pages is associated with a hash value that matches the set index. Thus, if a plurality of matching pages are found only one should be regarded as the matching logical page to be written to the selected physical page. The selecting of the matching logical page can be responsive to an age of each page of the plurality of pages. The oldest logical page can be selected.


Stage 350 may include stage 354 of writing the block index and the physical page index to the first data structure.


If there is a miss—there is no matching logical pages—if neither one of the multiple logical pages is associated with a hash value that matches the set index then a mismatch (or miss) is declared and stage 340 is followed by stage 360 of writing a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address. The second data structure can be a miss list.


Stage 360 may include stage 362 of writing the block index and the physical page index of the selected physical page to the first data structure and writing the set index to the second data structure.


Stage 360 may include stage 364 of electing the mismatch logical page based upon a distribution of hash values of the multiple logical pages. Stage 362 may include electing the mismatch logical page out of a largest group of logical pages that share a same has value.


Some examples of the execution of method 300 are illustrated in table 1. It is assumed that a logical page should be written to a sequence of physical pages of the s′th set of physical pages—starting from the p′th physical page of the s′th set of physical pages of the b′th block of the flash memory device and that a buffer stores five logical pages PI(1)-PI(5) that have logical addresses A1-A5.


The right most column indicates how the second data structure DS2 is updated (if updated at all). The second column to the right indicates how the first data structure DS1 is updated. The third column indicates which logical page is written to the available physical page. The fourth column indicates if there is a match (+) or not—if there were found at least one matching page or not. The leftmost column is indicative of the physical page that is being written—starting from the p′th physical page of the s′th set of physical pages and ending by the (p+4)'th physical page of the s′th set of physical pages. The fifth till ninth columns are indicative of the hash values generated during each iteration.














TABLE 1








Hash value of (physical page






Page
index, logical address)




















index
PI(1)
PI(2)
PI(3)
PI(4)
PI(5)
M
WR
DS1
DS2





p
S
S + 1
S + 3
S − 4
S + 5
+
PI(1)
A1,b



(p + 1)

S
S
S + 2
S − 7
+
PI(3)
A3,b



(p + 2)

S + 2

S + 1
S + 1

PI(4)
A4,b
S + 1


(p + 3)

S


S + 2
+
PI(2)
A2,b



(p + 4)




S
+
PI(5)
S5,b











FIG. 10 illustrates method 400 for reading from a flash memory device, according to an embodiment of the invention.


Method 400 may start by stage 410 of receiving a request to read a requested logical page from the flash memory device. The requested logical page has a requested logical address.


Stage 410 may be followed by stage 420 of searching the second data structure for a logical address of a mismatch logical page that equals the requested logical address.


If it is determined (the outcome of the searching) that the second data structure includes a logical address of a mismatch logical page that equals the requested logical address then stage 420 may be followed by stage 430 of retrieving the requested logical page based upon the first and second data structures.


Stage 430 may include stage 432 of comprising calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, (b) a set index that is stored in the second data structure and is associated with the requested logical address, and (c) a physical page index stored in the first data structure and is associated with the requested logical page address.


If it is determined (the outcome of the searching) that the second data structure does not include a logical address of a mismatch logical page that equals the requested logical address then stage 420 may be followed by stage 440 of retrieving the requested logical page based upon the first data structures and not upon the second data structure.


Stage 440 may include stage 442 of calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, and (b) a physical page index stored in the first data structure and is associated with the requested logical address.


Any methods illustrated above can be combined and any combination of any stages of any method mentioned above may be combined.


According to some embodiments of this invention, the amount of memory which is saved in representing the L2P tables for a given number of bits reduced from the L2P entry and for a given buffer size is given by:







S


(

m
,
L

)


=


α
·
m

-

β
·
L

-

γ
·


(

1
-

1

2
m



)

L








where α, β, and γ are constants which depend on the SSD's parameters, and where the first term is the amount of memory which is reduced from the L2P table due to removing m bits from each L2P entry, the second term is the amount of memory occupied by the buffer, and the third term is the amount of memory which is required for the page miss list.


Given a number of reduced bits from the L2P entry, the value of the buffer size L which maximizes the memory saving is given by







L
*

=



log


(


c
b



log


(


2
m



2
m

-
1


)



)



log


(


2
m



2
m

-
1


)



.





According to some embodiments of this invention, the maximum memory saving is obtained by performing the maximization









max
m







S
(

m
,
L




*)

,





where the maximization is performed over all values of m which satisfy the following constraints: 0<m<=log2(Np), and 2^(32−m)>=U/P*(1−1/2^m)^L*, where the first constraint ensures that bit removal is done only from the page address field in the L2P entry (see FIG. 2), and the second constraint ensures that the “pointer to next record” field in each record of the page miss list is large enough (see FIG. 7).


According to some embodiments of this invention, for the SSD example above, the constants α, β, and γ are given by









α
=

U

P
*
8
*

2

20









=



256
*

10

9



4
*

2

10

*
8
*

2

20



=

7.45




[

MB

reduced





bit


]








β
=

P

2

20








=



4
*

2

10



2

20


=

0.0039




[

MB
page

]








γ
=


U
*
8


P
*

2

20









=



256
*

10

9

*
8


4
*

2

10

*

2

20



=

4777




[
MB
]









Where in the calculation of α, “8*2^20” accounts for translating bit units to MB units, in the calculation of β, “2^20” accounts for translating byte units to MB units, and in the calculation of γ, the “8” accounts for the number of bytes allocated to each record in the miss list (4 bytes for the logical page address, m bits for the set of physical pages to which the page was actually written, and the remaining 32-m bits for pointing to the next record in the list) and “2^20” accounts for translating byte units to MB units







L
*

=


log
(


c





log



2
m



2
m

-
1



b

)


log


(


2
m



2
m

-
1


)








FIG. 11 depicts the amount of memory saving due to reducing 2 till 11 bits (m ranges between 2 and 11) from the page address field of the L2P entry. It is seen that the maximum memory saving is obtained for m=9, the amount of memory saved is 54 MB, and the required buffer size is L=2800. It can be verified that this value of m satisfies both constraints above.


According to some embodiments of this invention, if constraint 2 above is met with a strict inequality, and such that 32−m>log2(U/P*(1−1/2^m)^L*)+1, the memory saving associated with the L2P table may be further increased by reducing the amount of memory required for each entry of the miss list by floor (32-m−log2(U/P*(1−1/2^m)^L*)).


For example, in the example above 32-m=23 and log2(U/P*(1−1/2^m)^L*)=17.99.


An additional saving of 5 bits per miss page entry is possible, which is equivalent to a saving of 5*(U/P)*(1−1/2^m)^L*/(8*2^20)=0.1562 MB, where in the above calculation, “8*2^20” is used to translate bit units to MB units.


Additional embodiments of the invention include a system arranged to execute any or all of the methods described above, including any stages—and any combinations of same. FIG. 12 illustrates a system 500 according to an embodiment of the invention.


System 500 includes a flash memory device 510 and a flash memory controller 520. The flash memory device 510 is illustrated as including multiple blocks 510(1)-510(B). It may include one or more flash memory dies.


The flash memory controller 520 may include a buffer 521 (volatile or non-volatile), a write circuit 522, a read circuit 526, and a erase circuit 527.


The flash memory controller 520 may include a memory management circuit 523 that may include a hash circuit 524 and a search circuit 525. The read circuit 526 may include the memory management circuit 523, the read circuit 526 may include the memory management circuit 523. Each one of the read circuit 526 and the write circuit 522 can include the memory management circuit 523. Alternatively, neither one of the read circuit 526 and the write circuit 522 may include the memory management circuit 523.


The buffer 521 may be arranged to receive and store multiple logical pages, each logical page having a logical address.


The write circuit 522 may be arranged to determine to write a logical page into a selected physical page of a flash memory device that is coupled to the flash memory controller, the selected physical page has a selected physical page address that is represented by a physical page index, a set index and a block index; the physical page index being indicative of an order of the selected physical page within a selected set of physical pages, the selected set of physical pages is being identified by the set index, the block index is indicative of a block of the flash memory device that comprises the selected set of physical pages.


The hash circuit 524 may be arranged to calculate a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages.


The search circuit 525 may be arranged to search for a matching logical page that is associated with a hash value that matches the set index.


The write circuit 526 may be arranged to write the matching logical page to the selected physical page, update a first data structure to be indicative of a mapping between a logical address of the matching logical page and the selected physical address; and write a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address—if neither one of the multiple logical pages is associated with a hash value that matches the set index.


The erase circuit 527 may erase blocks of the flash memory device.


The read circuit 526 may be arranged to receive a request to read a requested logical page from the flash memory device, the requested logical page has a requested logical address.


The search circuit 525 may be arranged to search the second data structure for a logical address of a mismatch logical page that equals the requested logical address.


The hash circuit 524 may be arranged to assign in calculating the physical address of the physical page that stores the requested logical page.


The read circuit 526 may be arranged to retrieve the requested logical page based upon the first and second data structures if it is determined that the second data structure includes a logical address of a mismatch logical page that equals the requested logical address.


The read circuit 526 may be arranged to retrieve the requested logical page based upon the first data structures and not upon the second data structure if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.


The hash circuit 524 may be arranged to assist in calculating the physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, (b) a set index that is stored in the second data structure and is associated with the requested logical address, and (c) a physical page index stored in the first data structure and is associated with the requested logical page address, if it determines that the second data structure includes the logical address of the mismatch logical page that equals the requested logical address.


The hash circuit 526 may be arranged to assist in calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, and (b) a physical page index stored in the first data structure and is associated with the requested logical address, if it determines that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.


The invention may also be implemented in a computer program for running on a computer system, at least including code portions for performing steps of a method according to the invention when run on a programmable apparatus, such as a computer system or enabling a programmable apparatus to perform functions of a device or system according to the invention.


A computer program is a list of instructions such as a particular application program and/or an operating system. The computer program may for instance include one or more of: a subroutine, a function, a procedure, an object method, an object implementation, an executable application, an applet, a servlet, a source code, an object code, a shared library/dynamic load library and/or other sequence of instructions designed for execution on a computer system.


The computer program may be stored internally on a non-transitory computer readable medium. All or some of the computer program may be provided on computer readable media permanently, removably or remotely coupled to an information processing system. The computer readable media may include, for example and without limitation, any number of the following: magnetic storage media including disk and tape storage media; optical storage media such as compact disk media (e.g., CD-ROM, CD-R, etc.) and digital video disk storage media; nonvolatile memory storage media including semiconductor-based memory units such as FLASH memory, EEPROM, EPROM, ROM; ferromagnetic digital memories; MRAM; volatile storage media including registers, buffers or caches, main memory, RAM, etc.


A computer process typically includes an executing (running) program or portion of a program, current program values and state information, and the resources used by the operating system to manage the execution of the process. An operating system (OS) is the software that manages the sharing of the resources of a computer and provides programmers with an interface used to access those resources. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the system.


The computer system may for instance include at least one processing unit, associated memory and a number of input/output (I/O) devices. When executing the computer program, the computer system processes information according to the computer program and produces resultant output information via I/O devices.


In the foregoing specification, the invention has been described with reference to specific examples of embodiments of the invention. It will, however, be evident that various modifications and changes may be made therein without departing from the broader spirit and scope of the invention as set forth in the appended claims.


Moreover, the terms “front,” “back,” “top,” “bottom,” “over,” “under” and the like in the description and in the claims, if any, are used for descriptive purposes and not necessarily for describing permanent relative positions. It is understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in other orientations than those illustrated or otherwise described herein.


The connections as discussed herein may be any type of connection suitable to transfer signals from or to the respective nodes, units or devices, for example via intermediate devices. Accordingly, unless implied or stated otherwise, the connections may for example be direct connections or indirect connections. The connections may be illustrated or described in reference to being a single connection, a plurality of connections, unidirectional connections, or bidirectional connections. However, different embodiments may vary the implementation of the connections. For example, separate unidirectional connections may be used rather than bidirectional connections and vice versa. Also, plurality of connections may be replaced with a single connection that transfers multiple signals serially or in a time multiplexed manner. Likewise, single connections carrying multiple signals may be separated out into various different connections carrying subsets of these signals. Therefore, many options exist for transferring signals.


Although specific conductivity types or polarity of potentials have been described in the examples, it will be appreciated that conductivity types and polarities of potentials may be reversed.


Each signal described herein may be designed as positive or negative logic. In the case of a negative logic signal, the signal is active low where the logically true state corresponds to a logic level zero. In the case of a positive logic signal, the signal is active high where the logically true state corresponds to a logic level one. Note that any of the signals described herein can be designed as either negative or positive logic signals. Therefore, in alternate embodiments, those signals described as positive logic signals may be implemented as negative logic signals, and those signals described as negative logic signals may be implemented as positive logic signals.


Furthermore, the terms “assert” or “set” and “negate” (or “deassert” or “clear”) are used herein when referring to the rendering of a signal, status bit, or similar apparatus into its logically true or logically false state, respectively. If the logically true state is a logic level one, the logically false state is a logic level zero. And if the logically true state is a logic level zero, the logically false state is a logic level one.


Those skilled in the art will recognize that the boundaries between logic blocks are merely illustrative and that alternative embodiments may merge logic blocks or circuit elements or impose an alternate decomposition of functionality upon various logic blocks or circuit elements. Thus, it is to be understood that the architectures depicted herein are merely exemplary, and that in fact many other architectures can be implemented which achieve the same functionality.


Any arrangement of components to achieve the same functionality is effectively “associated” such that the desired functionality is achieved. Hence, any two components herein combined to achieve a particular functionality can be seen as “associated with” each other such that the desired functionality is achieved, irrespective of architectures or intermedial components. Likewise, any two components so associated can also be viewed as being “operably connected,” or “operably coupled,” to each other to achieve the desired functionality.


Furthermore, those skilled in the art will recognize that boundaries between the above described operations merely illustrative. The multiple operations may be combined into a single operation, a single operation may be distributed in additional operations and operations may be executed at least partially overlapping in time. Moreover, alternative embodiments may include multiple instances of a particular operation, and the order of operations may be altered in various other embodiments.


Also for example, in one embodiment, the illustrated examples may be implemented as circuitry located on a single integrated circuit or within a same device. Alternatively, the examples may be implemented as any number of separate integrated circuits or separate devices interconnected with each other in a suitable manner.


Also for example, the examples, or portions thereof, may implemented as soft or code representations of physical circuitry or of logical representations convertible into physical circuitry, such as in a hardware description language of any appropriate type.


Also, the invention is not limited to physical devices or units implemented in non-programmable hardware but can also be applied in programmable devices or units able to perform the desired device functions by operating in accordance with suitable program code, such as mainframes, minicomputers, servers, workstations, personal computers, notepads, personal digital assistants, electronic games, automotive and other embedded systems, cell phones and various other wireless devices, commonly denoted in this application as ‘computer systems’.


However, other modifications, variations and alternatives are also possible. The specifications and drawings are, accordingly, to be regarded in an illustrative rather than in a restrictive sense.


In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word ‘comprising’ does not exclude the presence of other elements or steps then those listed in a claim. Furthermore, the terms “a” or “an,” as used herein, are defined as one or more than one. Also, the use of introductory phrases such as “at least one” and “one or more” in the claims should not be construed to imply that the introduction of another claim element by the indefinite articles “a” or “an” limits any particular claim containing such introduced claim element to inventions containing only one such element, even when the same claim includes the introductory phrases “one or more” or “at least one” and indefinite articles such as “a” or “an.” The same holds true for the use of definite articles. Unless stated otherwise, terms such as “first” and “second” are used to arbitrarily distinguish between the elements such terms describe. Thus, these terms are not necessarily intended to indicate temporal or other prioritization of such elements. The mere fact that certain measures are recited in mutually different claims does not indicate that a combination of these measures cannot be used to advantage.


While certain features of the invention have been illustrated and described herein, many modifications, substitutions, changes, and equivalents will now occur to those of ordinary skill in the art. It is, therefore, to be understood that the appended claims are intended to cover all such modifications and changes as fall within the true spirit of the invention.

Claims
  • 1. A method for writing to a flash memory device, the method comprising: receiving multiple logical pages, each logical page having a logical address;determining to write a logical page into a selected physical page of the flash memory device, the selected physical page has a selected physical page address that is represented by a physical page index, a set index and a block index; the physical page index being indicative of an order of the selected physical page within a selected set of physical pages, the selected set of physical pages is being identified by the set index, the block index is indicative of a block of the flash memory device that comprises the selected set of physical pages;calculating a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages;searching for a matching logical page that is associated with a hash value that matches the set index;writing the matching logical page to the selected physical page and updating a first data structure to be indicative of a mapping between a logical address of the matching logical page and the selected physical address; andwriting a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address, if neither one of the multiple logical pages is associated with a hash value that matches the set index.
  • 2. The method according to claim 1, wherein the updating of the first data structure and the second data structure comprises writing the physical page index of the selected physical page to the first data structure and writing the set index to the second data structure.
  • 3. The method according to claim 1, comprising selecting a matching logical page out of a plurality of matching logical pages.
  • 4. The method according to claim 3, comprising selecting the matching logical page in response to an age of each of the plurality of matching logical pages.
  • 5. The method according to claim 1, comprising electing the mismatch logical page based upon a distribution of hash values of the multiple logical pages.
  • 6. The method according to claim 5, comprising selecting the mismatch logical page out of a largest group of logical pages that share a same hash value.
  • 7. The method according to claim 1, wherein the selected set of physical pages comprises a consecutive sequence of physical pages.
  • 8. The method according to claim 1, wherein the selected set of physical pages comprises non-consecutive physical pages that are located at a same relative position in sub-blocks of the selected block.
  • 9. The method according to claim 1, comprising storing the multiple logical pages in a buffer before writing to the selected physical page.
  • 10. The method according to claim 9, wherein the multiple logical pages fill the buffer.
  • 11. The method according to claim 9, wherein the multiple logical pages partially fill the buffer.
  • 12. The method according to claim 1, comprising: receiving a request to read a requested logical page from the flash memory device, the requested logical page has a requested logical address;searching the second data structure for a logical address of a mismatch logical page that equals the requested logical address;retrieving the requested logical page based upon the first and second data structures if it is determined that the second data structure comprises a logical address of a mismatch logical page that equals the requested logical address; andretrieving the requested logical page based upon the first data structures and not upon the second data structure if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.
  • 13. The method according to claim 12, comprising calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, (b) a set index that is stored in the second data structure and is associated with the requested logical address, and (c) a physical page index stored in the first data structure and is associated with the requested logical page address, if it is determined that the second data structure comprises the logical address of the mismatch logical page that equals the requested logical address.
  • 14. The method according to claim 12, comprising calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, and (b) a physical page index stored in the first data structure and is associated with the requested logical address, if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.
  • 15. A non-transitory computer readable medium that stores instructions comprising: receiving multiple logical pages, each logical page having a logical address;determining to write a logical page into a selected physical page of the flash memory device, the selected physical page has a selected physical page address that is represented by a physical page index, a set index and a block index; the physical page index being indicative of an order of the selected physical page within a selected set of physical pages, the selected set of physical pages is being identified by the set index, the block index is indicative of a block of the flash memory device that comprises the selected set of physical pages;calculating a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages;searching for a matching logical page that is associated with a hash value that matches the set index;writing the matching logical page to the selected physical page and updating a first data structure to be indicative of a mapping between a logical address of the matching logical page and the selected physical address; andwriting a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address—if neither one of the multiple logical pages is associated with a hash value that matches the set index.
  • 16. The non-transitory computer readable medium according to claim 15, wherein the updating of the first data structure and the second data structure comprises writing the physical page index of the selected physical page to the first data structure and writing the set index to the second data structure.
  • 17. The non-transitory computer readable medium according to claim 15 that stores instructions for selecting a matching logical page out of a plurality of matching logical pages.
  • 18. The non-transitory computer readable medium according to claim 17 that stores instructions for comprising selecting the matching logical page in response to an age of each of the plurality of matching logical pages.
  • 19. The non-transitory computer readable medium according to claim 15 that stores instructions for electing the mismatch logical page based upon a distribution of hash values of the multiple logical pages.
  • 20. The non-transitory computer readable medium according to claim 19 that stores instructions for selecting the mismatch logical page out of a largest group of logical pages that share a same hash value.
  • 21. The non-transitory computer readable medium according to claim 15, wherein the selected set of physical pages comprises a consecutive sequence of physical pages.
  • 22. The non-transitory computer readable medium according to claim 15, wherein the selected set of physical pages comprises non-consecutive physical pages that are located at a same relative position in sub-blocks of the selected block.
  • 23. The non-transitory computer readable medium according to claim 15 that stores instructions for storing the multiple logical pages in a buffer before writing to the selected physical page.
  • 24. The non-transitory computer readable medium according to claim 23, wherein the multiple logical pages fill the buffer.
  • 25. The non-transitory computer readable medium according to claim 23 wherein the multiple logical pages partially fill the buffer.
  • 26. The non-transitory computer readable medium according to claim 15, that stores instructions comprising: receiving a request to read a requested logical page from the flash memory device, the requested logical page has a requested logical address;searching the second data structure for a logical address of a mismatch logical page that equals the requested logical address;retrieving the requested logical page based upon the first and second data structures if it is determined that the second data structure comprises a logical address of a mismatch logical page that equals the requested logical address; andretrieving the requested logical page based upon the first data structures and not upon the second data structure if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.
  • 27. The non-transitory computer readable medium according to claim 26 that stores instructions for calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, (b) a set index that is stored in the second data structure and is associated with the requested logical address, and (c) a physical page index stored in the first data structure and is associated with the requested logical page address, if it is determined that the second data structure comprises the logical address of the mismatch logical page that equals the requested logical address.
  • 28. The non-transitory computer readable medium according to claim 26, that stores instructions for calculating a physical address of a physical page that stores the requested logical page based upon (a) the requested logical address, and (b) a physical page index stored in the first data structure and is associated with the requested logical address, if it is determined that the second data structure does not comprise a logical address of a mismatch logical page that equals the requested logical address.
  • 29. A flash memory controller, comprising: a buffer arranged to receive and store multiple logical pages, each logical page having a logical address;a write circuit arranged to determine to write a logical page into a selected physical page of a flash memory device that is coupled to the flash memory controller, the selected physical page has a selected physical page address that is represented by a physical page index, a set index and a block index; the physical page index being indicative of an order of the selected physical page within a selected set of physical pages, the selected set of physical pages is being identified by the set index, the block index is indicative of a block of the flash memory device that comprises the selected set of physical pages;a hash circuit arranged to calculate a hash value for each logical page of the multiple logical pages in response to (a) a logical address of the logical page and (b) the physical page index, to provide multiple hash values of the multiple logical pages;a search circuit arranged to search for a matching logical page that is associated with a hash value that matches the set index;wherein the write circuit is arranged towrite the matching logical page to the selected physical page and updating a first data structure to be indicative of a mapping between a logical address of the matching logical page and the selected physical address; andwrite a mismatch logical page to the selected physical page, updating the first data structure and the second data structure to be indicative of a mapping between a logical address of the mismatch logical page and the selected physical address—if neither one of the multiple logical pages is associated with a hash value that matches the set index.
US Referenced Citations (324)
Number Name Date Kind
4430701 Christian et al. Feb 1984 A
4463375 Macovski Jul 1984 A
4584686 Fritze Apr 1986 A
4589084 Fling et al. May 1986 A
4777589 Boettner et al. Oct 1988 A
4866716 Weng Sep 1989 A
5003597 Merkle Mar 1991 A
5077737 Leger et al. Dec 1991 A
5297153 Baggen et al. Mar 1994 A
5305276 Uenoyama Apr 1994 A
5592641 Doyle et al. Jan 1997 A
5623620 Alexis et al. Apr 1997 A
5640529 Hasbun Jun 1997 A
5657332 Auclair et al. Aug 1997 A
5663901 Harari et al. Sep 1997 A
5724538 Morris et al. Mar 1998 A
5729490 Calligaro et al. Mar 1998 A
5740395 Wells et al. Apr 1998 A
5745418 Hu et al. Apr 1998 A
5778430 Ish et al. Jul 1998 A
5793774 Usui et al. Aug 1998 A
5920578 Zook et al. Jul 1999 A
5926409 Engh et al. Jul 1999 A
5933368 Hu et al. Aug 1999 A
5956268 Lee Sep 1999 A
5956473 Hu et al. Sep 1999 A
5968198 Balachandran et al. Oct 1999 A
5982659 Irrinki et al. Nov 1999 A
6011741 Harari et al. Jan 2000 A
6016275 Han Jan 2000 A
6038634 Ji et al. Mar 2000 A
6081878 Estakhri et al. Jun 2000 A
6094465 Stein et al. Jul 2000 A
6119245 Hiratsuka Sep 2000 A
6182261 Haller et al. Jan 2001 B1
6192497 Yang et al. Feb 2001 B1
6195287 Hirano Feb 2001 B1
6199188 Shen et al. Mar 2001 B1
6209114 Wolf et al. Mar 2001 B1
6259627 Wong Jul 2001 B1
6272052 Miyauchi Aug 2001 B1
6278633 Wong et al. Aug 2001 B1
6279133 Vafai et al. Aug 2001 B1
6301151 Engh et al. Oct 2001 B1
6370061 Yachareni et al. Apr 2002 B1
6374383 Weng Apr 2002 B1
6504891 Chevallier Jan 2003 B1
6532169 Mann et al. Mar 2003 B1
6532556 Wong et al. Mar 2003 B1
6553533 Demura et al. Apr 2003 B2
6560747 Weng May 2003 B1
6637002 Weng et al. Oct 2003 B1
6639865 Kwon Oct 2003 B2
6674665 Mann et al. Jan 2004 B1
6675281 Oh et al. Jan 2004 B1
6704902 Shinbashi et al. Mar 2004 B1
6751766 Guterman et al. Jun 2004 B2
6772274 Estakhri Aug 2004 B1
6781910 Smith Aug 2004 B2
6792569 Cox et al. Sep 2004 B2
6873543 Smith et al. Mar 2005 B2
6891768 Smith et al. May 2005 B2
6914809 Hilton et al. Jul 2005 B2
6915477 Gollamudi et al. Jul 2005 B2
6952365 Gonzalez et al. Oct 2005 B2
6961890 Smith Nov 2005 B2
6968421 Conley Nov 2005 B2
6990012 Smith et al. Jan 2006 B2
6996004 Fastow et al. Feb 2006 B1
6999854 Roth Feb 2006 B2
7010739 Feng et al. Mar 2006 B1
7012835 Gonzalez et al. Mar 2006 B2
7038950 Hamilton et al. May 2006 B1
7068539 Guterman et al. Jun 2006 B2
7079436 Perner et al. Jul 2006 B2
7149950 Spencer et al. Dec 2006 B2
7177977 Chen et al. Feb 2007 B2
7188228 Chang et al. Mar 2007 B1
7191379 Adelmann et al. Mar 2007 B2
7196946 Chen et al. Mar 2007 B2
7203874 Roohparvar Apr 2007 B2
7212426 Park et al May 2007 B2
7290203 Emma et al. Oct 2007 B2
7292365 Knox Nov 2007 B2
7301928 Nakabayashi et al. Nov 2007 B2
7315916 Bennett et al. Jan 2008 B2
7388781 Litsyn et al. Jun 2008 B2
7395404 Gorobets et al. Jul 2008 B2
7441067 Gorobets et al. Oct 2008 B2
7443729 Li et al. Oct 2008 B2
7450425 Aritome Nov 2008 B2
7454670 Kim et al. Nov 2008 B2
7466575 Shalvi et al. Dec 2008 B2
7533328 Alrod et al. May 2009 B2
7558109 Brandman et al. Jul 2009 B2
7593263 Sokolov et al. Sep 2009 B2
7610433 Randell et al. Oct 2009 B2
7613043 Cornwell et al. Nov 2009 B2
7619922 Li et al. Nov 2009 B2
7697326 Sommer et al. Apr 2010 B2
7706182 Shalvi et al. Apr 2010 B2
7716538 Gonzalez et al. May 2010 B2
7804718 Kim Sep 2010 B2
7805663 Brandman et al. Sep 2010 B2
7805664 Yang et al. Sep 2010 B1
7844877 Litsyn et al. Nov 2010 B2
7911848 Eun et al. Mar 2011 B2
7961797 Yang et al. Jun 2011 B1
7975192 Sommer et al. Jul 2011 B2
8020073 Emma et al. Sep 2011 B2
8108590 Chow et al. Jan 2012 B2
8122328 Liu et al. Feb 2012 B2
8159881 Yang Apr 2012 B2
8190961 Yang et al. May 2012 B1
8250324 Haas et al. Aug 2012 B2
8300823 Bojinov et al. Oct 2012 B2
8305812 Levy et al. Nov 2012 B2
8327246 Weingarten et al. Dec 2012 B2
8407560 Ordentlich et al. Mar 2013 B2
8417893 Khmelnitsky et al. Apr 2013 B2
20010034815 Dugan et al. Oct 2001 A1
20020063774 Hillis et al. May 2002 A1
20020085419 Kwon et al. Jul 2002 A1
20020154769 Petersen et al. Oct 2002 A1
20020156988 Toyama et al. Oct 2002 A1
20020174156 Birru et al. Nov 2002 A1
20030014582 Nakanishi Jan 2003 A1
20030065876 Lasser Apr 2003 A1
20030101404 Zhao et al. May 2003 A1
20030105620 Bowen Jun 2003 A1
20030177300 Lee et al. Sep 2003 A1
20030192007 Miller et al. Oct 2003 A1
20040015771 Lasser et al. Jan 2004 A1
20040030971 Tanaka et al. Feb 2004 A1
20040059768 Denk et al. Mar 2004 A1
20040080985 Chang et al. Apr 2004 A1
20040153722 Lee Aug 2004 A1
20040153817 Norman et al. Aug 2004 A1
20040181735 Xin Sep 2004 A1
20040203591 Lee Oct 2004 A1
20040210706 In et al. Oct 2004 A1
20050013165 Ban Jan 2005 A1
20050018482 Cemea et al. Jan 2005 A1
20050083735 Chen et al. Apr 2005 A1
20050117401 Chen et al. Jun 2005 A1
20050120265 Pline et al. Jun 2005 A1
20050128811 Kato et al. Jun 2005 A1
20050138533 Le-Bars et al. Jun 2005 A1
20050144213 Simkins et al. Jun 2005 A1
20050144368 Chung et al. Jun 2005 A1
20050169057 Shibata et al. Aug 2005 A1
20050172179 Brandenberger et al. Aug 2005 A1
20050213393 Lasser Sep 2005 A1
20050243626 Ronen Nov 2005 A1
20060059406 Micheloni et al. Mar 2006 A1
20060059409 Lee Mar 2006 A1
20060064537 Oshima et al. Mar 2006 A1
20060101193 Murin May 2006 A1
20060195651 Estakhri et al. Aug 2006 A1
20060203587 Li et al. Sep 2006 A1
20060221692 Chen Oct 2006 A1
20060248434 Radke et al. Nov 2006 A1
20060268608 Noguchi et al. Nov 2006 A1
20060282411 Fagin et al. Dec 2006 A1
20060284244 Forbes et al. Dec 2006 A1
20060294312 Walmsley Dec 2006 A1
20070025157 Wan et al. Feb 2007 A1
20070063180 Asano et al. Mar 2007 A1
20070081388 Joo Apr 2007 A1
20070098069 Gordon May 2007 A1
20070103992 Sakui et al. May 2007 A1
20070104004 So et al. May 2007 A1
20070109858 Conley et al. May 2007 A1
20070124652 Litsyn et al. May 2007 A1
20070140006 Chen et al. Jun 2007 A1
20070143561 Gorobets Jun 2007 A1
20070150694 Chang et al. Jun 2007 A1
20070168625 Cornwell et al. Jul 2007 A1
20070171714 Wu et al. Jul 2007 A1
20070171730 Ramamoorthy et al. Jul 2007 A1
20070180346 Murin Aug 2007 A1
20070223277 Tanaka et al. Sep 2007 A1
20070226582 Tang et al. Sep 2007 A1
20070226592 Radke Sep 2007 A1
20070228449 Takano et al. Oct 2007 A1
20070253249 Kang et al. Nov 2007 A1
20070253250 Shibata et al. Nov 2007 A1
20070263439 Cornwell et al. Nov 2007 A1
20070266291 Toda et al. Nov 2007 A1
20070271494 Gorobets Nov 2007 A1
20070297226 Mokhlesi Dec 2007 A1
20080010581 Alrod et al. Jan 2008 A1
20080028014 Hilt et al. Jan 2008 A1
20080049497 Mo Feb 2008 A1
20080055989 Lee et al. Mar 2008 A1
20080082897 Brandman et al. Apr 2008 A1
20080092026 Brandman et al. Apr 2008 A1
20080104309 Cheon et al. May 2008 A1
20080112238 Kim et al. May 2008 A1
20080116509 Harari et al. May 2008 A1
20080126686 Sokolov et al. May 2008 A1
20080127104 Li et al. May 2008 A1
20080128790 Jung Jun 2008 A1
20080130341 Shalvi et al. Jun 2008 A1
20080137413 Kong et al. Jun 2008 A1
20080137414 Park et al. Jun 2008 A1
20080141043 Flynn et al. Jun 2008 A1
20080148115 Sokolov et al. Jun 2008 A1
20080158958 Shalvi et al. Jul 2008 A1
20080159059 Moyer Jul 2008 A1
20080162079 Astigarraga et al. Jul 2008 A1
20080168216 Lee Jul 2008 A1
20080168320 Cassuto et al. Jul 2008 A1
20080181001 Shalvi Jul 2008 A1
20080198650 Shalvi et al. Aug 2008 A1
20080198652 Shalvi et al. Aug 2008 A1
20080201620 Gollub Aug 2008 A1
20080209114 Chow et al. Aug 2008 A1
20080219050 Shalvi et al. Sep 2008 A1
20080225599 Chae Sep 2008 A1
20080250195 Chow et al. Oct 2008 A1
20080263262 Sokolov et al. Oct 2008 A1
20080282106 Shalvi et al. Nov 2008 A1
20080285351 Shlick et al. Nov 2008 A1
20080301532 Uchikawa et al. Dec 2008 A1
20090024905 Shalvi et al. Jan 2009 A1
20090027961 Park et al. Jan 2009 A1
20090043951 Shalvi et al. Feb 2009 A1
20090046507 Aritome Feb 2009 A1
20090072303 Prall et al. Mar 2009 A9
20090091979 Shalvi Apr 2009 A1
20090103358 Sommer et al. Apr 2009 A1
20090106485 Anholt Apr 2009 A1
20090106486 Kim et al. Apr 2009 A1
20090113275 Chen et al. Apr 2009 A1
20090125671 Flynn et al. May 2009 A1
20090132755 Radke May 2009 A1
20090144598 Yoon et al. Jun 2009 A1
20090144600 Perlmutter et al. Jun 2009 A1
20090150599 Bennett Jun 2009 A1
20090150748 Egner et al. Jun 2009 A1
20090157964 Kasorla et al. Jun 2009 A1
20090158126 Perlmutter et al. Jun 2009 A1
20090168524 Golov et al. Jul 2009 A1
20090187803 Anholt et al. Jul 2009 A1
20090199074 Sommer Aug 2009 A1
20090213653 Perlmutter et al. Aug 2009 A1
20090213654 Perlmutter et al. Aug 2009 A1
20090228761 Perlmutter et al. Sep 2009 A1
20090240872 Perlmutter et al. Sep 2009 A1
20090282185 Van Cauwenbergh Nov 2009 A1
20090282186 Mokhlesi et al. Nov 2009 A1
20090287930 Nagaraja Nov 2009 A1
20090300269 Radke et al. Dec 2009 A1
20090323942 Sharon et al. Dec 2009 A1
20100005270 Jiang Jan 2010 A1
20100025811 Bronner et al. Feb 2010 A1
20100030944 Hinz Feb 2010 A1
20100058146 Weingarten et al. Mar 2010 A1
20100064096 Weingarten et al. Mar 2010 A1
20100088557 Weingarten et al. Apr 2010 A1
20100091535 Sommer et al. Apr 2010 A1
20100095186 Weingarten Apr 2010 A1
20100110787 Shalvi et al. May 2010 A1
20100115376 Shalvi et al. May 2010 A1
20100122113 Weingarten et al. May 2010 A1
20100124088 Shalvi et al. May 2010 A1
20100131580 Kanter et al. May 2010 A1
20100131806 Weingarten et al. May 2010 A1
20100131809 Katz May 2010 A1
20100131826 Shalvi et al. May 2010 A1
20100131827 Sokolov et al. May 2010 A1
20100131831 Weingarten et al. May 2010 A1
20100146191 Katz Jun 2010 A1
20100146192 Weingarten et al. Jun 2010 A1
20100149881 Lee et al. Jun 2010 A1
20100172179 Gorobets et al. Jul 2010 A1
20100174853 Lee et al. Jul 2010 A1
20100180073 Weingarten et al. Jul 2010 A1
20100199149 Weingarten et al. Aug 2010 A1
20100211724 Weingarten Aug 2010 A1
20100211833 Weingarten Aug 2010 A1
20100211856 Weingarten Aug 2010 A1
20100241793 Sugimoto et al. Sep 2010 A1
20100246265 Moschiano et al. Sep 2010 A1
20100251066 Radke Sep 2010 A1
20100253555 Weingarten et al. Oct 2010 A1
20100257309 Barsky et al. Oct 2010 A1
20100269008 Leggette et al. Oct 2010 A1
20100293321 Weingarten Nov 2010 A1
20100318724 Yeh Dec 2010 A1
20110051521 Levy et al. Mar 2011 A1
20110055461 Steiner et al. Mar 2011 A1
20110093650 Kwon et al. Apr 2011 A1
20110096612 Steiner et al. Apr 2011 A1
20110099460 Dusija et al. Apr 2011 A1
20110119562 Steiner et al. May 2011 A1
20110153919 Sabbag Jun 2011 A1
20110161775 Weingarten Jun 2011 A1
20110194353 Hwang et al. Aug 2011 A1
20110209028 Post et al. Aug 2011 A1
20110214029 Steiner et al. Sep 2011 A1
20110214039 Steiner et al. Sep 2011 A1
20110246792 Weingarten Oct 2011 A1
20110246852 Sabbag Oct 2011 A1
20110252187 Segal et al. Oct 2011 A1
20110252188 Weingarten Oct 2011 A1
20110271043 Segal et al. Nov 2011 A1
20110302428 Weingarten Dec 2011 A1
20120001778 Steiner et al. Jan 2012 A1
20120005554 Steiner et al. Jan 2012 A1
20120005558 Steiner et al. Jan 2012 A1
20120005560 Steiner et al. Jan 2012 A1
20120008401 Katz et al. Jan 2012 A1
20120008414 Katz et al. Jan 2012 A1
20120017136 Ordentlich et al. Jan 2012 A1
20120051144 Weingarten et al. Mar 2012 A1
20120063227 Weingarten et al. Mar 2012 A1
20120066441 Weingarten Mar 2012 A1
20120110250 Sabbag et al. May 2012 A1
20120117354 Tatsumura et al. May 2012 A1
20120124273 Goss et al. May 2012 A1
20120246391 Meir et al. Sep 2012 A1
20120278569 Kawakami et al. Nov 2012 A1