# Patent

## Title
Reads and writes between a contiguous data block and noncontiguous sets of logical address blocks in a persistent storage device

## Abstract

In the present disclosure, a persistent storage device includes both persistent storage, which includes a set of persistent storage blocks, and a storage controller. The persistent storage device stores and retrieves data in response to commands received from an external host device. The persistent storage device stores data, from a contiguous data block, to two or more sets of logical address blocks in persistent storage. The persistent storage device also retrieves data, corresponding to a contiguous data block, from two or more sets of logical address blocks in persistent. In both instances, the two or more sets of logical address blocks in persistent storage, in aggregate, are not contiguous.

## Background
RELATED APPLICATIONS
This application claims priority to U.S. Provisional Patent Application No. 61/746,501, filed Dec. 27, 2012, which is hereby incorporated by reference in its entirety.


TECHNICAL FIELD
The disclosed embodiments relate generally to storage devices.
BACKGROUND
It is well known that logically contiguous storage provides for more efficient execution of input/output operations than logically noncontiguous storage. However, over time and as more operations are performed, storage typically becomes fragmented, thus leading to less efficient operations.
The embodiments described herein provide mechanisms and methods for more efficient reads and writes to storage devices.
SUMMARY
In the present disclosure, a persistent storage device includes persistent storage, which includes a set of persistent storage blocks, and a storage controller. The persistent storage device stores and retrieves data in response to commands received from an external host device. The persistent storage device stores data, from a contiguous data block, to two or more sets of logical address blocks in persistent storage. The persistent storage device also retrieves data, corresponding to a contiguous data block, from two or more sets of logical address blocks in persistent storage. In both instances, the two or more sets of logical address blocks in persistent storage, in aggregate, are not contiguous.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram illustrating a system that includes a persistent storage device and an external host device, in accordance with some embodiments.
FIG. 2A is a schematic diagram corresponding to processing a write command that stores data from a contiguous block in host memory on a host device to two or more sets of logical address blocks in a persistent storage device, in accordance with some embodiments.
FIG. 2B is a schematic diagram corresponding to processing a read command that retrieves data from two or more sets of logical address blocks in a persistent storage device and stores the data to a contiguous block in host memory on a host device, in accordance with some embodiments.
FIG. 3A-3B are flow diagrams illustrating the processing of host commands by a persistent storage device, in accordance with some embodiments.
FIGS. 4A-4C illustrate a flow diagram of a process for managing a persistent storage device, including processing host read and write commands, in accordance with some embodiments.



Like reference numerals refer to corresponding parts throughout the drawings.
DESCRIPTION OF EMBODIMENTS
In some embodiments, data stored by a host device in persistent storage becomes fragmented over time. When that happens, it is difficult to allocate contiguous storage. In some embodiments, applications on the host cause the host to perform input/output (I/O) operations using non-contiguous data stored in persistent storage. In such embodiments, performing I/O operations using non-contiguous data is less efficient than performing I/O operations using contiguous blocks of data. In some embodiments, the host defragments data once it has become fragmented. For example, in some cases, the host suspends all applications and runs processes for defragmenting data in persistent storage. In that case, an application cannot perform an operation until the defragmentation processes are complete. In another example, the host runs the defragmentation processes while an application is still running Because the defragmentation processes are running simultaneously with the application, the application's performance slows down. In both cases, the time for an application to complete an operation increases, thereby decreasing efficiency.
In the present disclosure, a persistent storage device includes persistent storage, which includes a set of persistent storage blocks, and a storage controller. The storage controller is configured to store and retrieve data in response to commands received from an external host device. The storage controller is also configured to respond to a host write command by storing data from a write data contiguous data block to persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host write command. Each set of logical address blocks specified by the host write command includes a set of contiguous logical address blocks, where the two or more sets of logical address blocks specified by the host write command, in aggregate, are not contiguous. The storage controller is further configured to respond to a host read command by retrieving data corresponding to a read data contiguous data block from persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host read command. Each set of logical address blocks specified by the host read command includes a set of contiguous logical address blocks, where the two or more sets of logical address blocks specified by the host read command, in aggregate, are not contiguous.
In some embodiments, the storage controller is further configured to execute the host write command or the host read command atomically. In some embodiments, the host write command specifies storage of a first block of data to a first persistent storage block corresponding to a first logical address block and storage of a second block of data to a second persistent storage block corresponding to a second logical address block, where the first and second blocks of data are contiguously stored in the write data contiguous data block, and wherein the first and second logical address blocks are noncontiguous. Similarly, in some embodiments, the host read command specifies retrieval of a first block of data from a first persistent storage block corresponding to a first logical address block and retrieval of a second block of data from a second persistent storage block corresponding to a second logical address block, where the first and second blocks of data are, after retrieval, contiguously stored in the read data contiguous data block, and wherein the first and second logical address blocks are noncontiguous. In some embodiments, the persistent storage device is implemented as a single, monolithic integrated circuit. In some embodiments, the persistent storage device also includes a host interface for interfacing the persistent storage device to a memory controller of the external host device.
In some embodiments, the persistent storage device includes a logical address to physical address map for associating logical block addresses with persistent storage blocks in the persistent storage device. In some embodiments, the two or more sets of logical address blocks specified by the host write command comprise logical block addresses, each associated with a corresponding persistent storage block, and the corresponding persistent storage blocks are identified by the storage controller using a logical block address to physical address mapping. Optionally, the write data contiguous data block or the read data contiguous data block corresponds to a contiguous data block in memory on the external host device.
In another aspect of the present disclosure, a method for managing a persistent storage device is provided. In some embodiments, the method is performed at the persistent storage device, which includes persistent storage and a storage controller. The persistent storage includes a set of persistent storage blocks. The method includes responding to a host write command received from an external host device by storing data from a write data contiguous data block to persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host write command. Each set of logical address blocks specified by the host write command includes a set of contiguous logical address blocks, where the two or more sets of logical address blocks specified by the host write command, in aggregate, are not contiguous. The method further includes responding to a host read command by retrieving data corresponding to a read data contiguous data block from persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host read command. Each set of logical address blocks specified by the host read command includes a set of contiguous logical address blocks, where the two or more sets of logical address blocks specified by the host read command, in aggregate, are not contiguous.
In yet another aspect of the present disclosure, a non-transitory computer readable storage medium stores one or more programs for execution by a storage controller of a persistent storage device. Execution of the one or more programs by the storage controller causes the storage controller to perform any of the methods described above.
Reference will now be made in detail to various embodiments, examples of which are illustrated in the accompanying drawings. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention and the described embodiments. However, the invention may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to unnecessarily obscure aspects of the embodiments.
FIG. 1 is a block diagram illustrating a system 100 that includes a persistent storage device 106 and an external host device 102 (sometimes herein called host 102), in accordance with some embodiments. For convenience, host 102 is herein described as implemented as a single server or other single computer. Host 102 includes one or more processing units (CPU's) 104, one or more memory interfaces 107, memory 108, and one or more communication buses 110 for interconnecting these components. The communication buses 110 optionally include circuitry (sometimes called a chipset) that interconnects and controls communications between system components. Memory 108 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices; and optionally includes non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Further, memory 108 optionally includes one or more storage devices remotely located from the CPU(s) 104. Memory 108, or alternately the non-volatile memory device(s) within memory 108, includes a non-volatile computer readable storage medium. In some embodiments, memory 108 or the non-volatile computer readable storage medium of memory 108 stores the following programs, modules and data structures, or a subset thereof:

    
    
        an operating system 112 that includes procedures for handling various basic system services and for performing hardware dependent tasks;
        one or more applications 114 which are configured to (or include instructions to) submit read and write commands to persistent storage device 106 using storage access functions 122 and persistent storage LBAs 124; one or more applications 114 optionally utilizes application memory 116 to store data 117, for example data used by or associated with one of the applications 114; data 117 optionally includes write data, to be written to persistent storage 150 in persistent storage device 106 from write data block 118, and/or read data that has been retrieved from persistent storage 150 in persistent storage device 106 to be stored in read data block 120; in some implementations, write data block 118 and read data block 120 are each a contiguous block of data.
        storage access functions 122 for reading and writing to persistent storage 150 of persistent storage device 106; and
        persistent storage LBAs 124 for maintaining a mapping of which logical block addresses, corresponding to persistent storage blocks in persistent storage 150, contain what data.
    
    


Each of the aforementioned host functions, such as storage access functions 122, is configured for execution by the one or more processors (CPUs) 104 of host 102, so as to perform the associated storage access task or function with respect to persistent storage 150 in persistent storage device 106.
In some embodiments, host 102 is connected to persistent storage device 106 via a memory interface 107 of host 102 and a host interface 126 of persistent storage device 106. Host 102 is connected to persistent storage device 106 either directly or through a communication network (not shown) such as the Internet, other wide area networks, local area networks, metropolitan area networks, wireless networks, or any combination of such networks. Optionally, in some implementations, host 102 is connected to a plurality of persistent storage devices 106, only one of which is shown in FIG. 1.
In some embodiments, persistent storage device 106 includes persistent storage 150, one or more host interfaces 126, and storage controller 134. Storage controller 134 includes one or more processing units (CPU's) 128, memory 130, and one or more communication buses 132 for interconnecting these components. In some embodiments, communication buses 132 include circuitry (sometimes called a chipset) that interconnects and controls communications between system components. Memory 130 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices; and optionally includes non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory 130 optionally includes one or more storage devices remotely located from the CPU(s) 128. Memory 130, or alternately the non-volatile memory device(s) within memory 130, includes a non-volatile computer readable storage medium. In some embodiments, memory 130 stores the following programs, modules and data structures, or a subset thereof:

    
    
        host interface functions 136 that include procedures for handling commands sent from host 102 and received by persistent storage device 106 via its host interface 126;
        storage (flash) functions 138 for handling persistent storage access commands issued by host 102; the storage functions 138 include a function 140 to write data to one or more specified persistent storage blocks and a function 142 to read data from one more specified persistent storage blocks;
        atomic command execution module 144 for executing host read and host write commands, received from host 102, atomically;
        one or more address translation functions 146 for translating logical block addresses to physical addresses; and
        one or more address translation tables 148 for storing logical to physical address mapping information.
    
    


Each of the aforementioned storage controller functions, such as storage functions 138, is configured for execution by the one or more processors (CPUs) 128 of storage controller 134, so as to perform the associated task or function with respect to persistent storage 150.
Address translation function(s) 146 together with address translation tables 148 implement logical block address (LBA) to physical address (PHY) mapping, shown as LBA to PHY mapping 206 in FIG. 2.
As used herein, the term “atomic” refers to an operation that either succeeds as a whole, or fails as a whole. For example, an atomic execution of a write command specifying two blocks of write data will not be interrupted until either both blocks of write data are written, or the operation fails and neither block is written. Thus, the atomic execution of the write command in the given example will end in either a write completion of both blocks of data, or a failure to write any blocks of data. In such an example, an atomic execution of the write command will not result in a partial completion, i.e., write completion of only one block of write data.
As used herein, the term “persistent storage” refers to any type of persistent storage used as mass storage or secondary storage. In some embodiments, persistent storage is flash memory. In some implementations, persistent storage 150 includes a set of persistent storage blocks.
In some embodiments, commands issued by host 102, using the storage access functions 122 described above, are implemented as input/output control (ioctl) function calls, for example Unix or Linux ioctl function calls or similar function calls implemented in other operating systems. In some embodiments, commands are issued to persistent storage device 106 as a result of function calls by host 102.
An example of a command issued by host 102 to write data (e.g., data 117 stored in application memory 116 in memory 108 of host 102) to one or more persistent storage blocks, for invoking the write to persistent storage block function 140 in persistent storage device 106, is given by:
vwrite(buf, block1, count1, block2, count2, . . . )
where buf refers to a location in application memory 116 in memory 108 on host 102 containing data to be written, block1 refers to a starting position in persistent storage 150 to which count1 blocks of data, starting at buf, is to be written, and block2 refers to a starting position in persistent storage 150 to which count2 blocks of data is to be written, the count2 blocks of data following the count1 blocks of data in a contiguous block of data starting at buf. The number of (block, count) pairs in the vwrite command has no specific limit, and can generally range from two pairs to several dozen pairs or, optionally, hundreds of pairs, depending on the implementation.
In specific examples of calls to vwrite illustrated below, the values of the “block#” fields refer to logical block addresses, which correspond to the starting positions of the specified logical address blocks. For example, if the block1 field of a write command has a value of 2, then the write command indirectly specifies a set of persistent storage blocks, the number of which is given by the count1 field, by specifying a set of logical block addresses starting at logical block address 2. Thus, for example, if the count1 field had a value of 4, then the write command specifies that 4 blocks of data be written to the persistent storage blocks associated with the 4 logical block addresses (e.g., logical block addresses 2, 3, 4, and 5) starting at the specified logical block address, 2.
In some implementations, buf indicates the starting location of write data block 118. In some implementations, the count1 blocks of data to be written to block1 and the count2 blocks of data to be written to block2 are contiguously stored in write data block 118, starting at buf. In some implementations, the count1 blocks of data to be written to block1 and the count2 blocks of data to be written to block2 are only a portion of write data block 118. In some implementations, the starting locations, block1 and block2, are logical block addresses, and count1 and count2 refer to integer numbers of blocks of data to be written. Each of the aforementioned blocks of data has a size corresponding to the size of a respective persistent storage block.
In some implementations, for either vwrite and vread (described below), or both, a first set of logical address blocks, defined by block1 and count1 , and a second set of persistent storage blocks, defined by block2 and count2, are neighboring sets of logical address blocks, but are not contiguous in aggregate because they have a different order from the corresponding data blocks in application memory 116. An example of such a implementation would be a vwrite command in which (block1, count1 ) is equal to (2,2) and (block2, count2 ) is equal to (0,2).
An example of a command issued by host 102 to read data from one or more persistent storage blocks, for invoking the read from persistent storage block function 142 in persistent storage device 106, is given by:
vread(buf, block1, count1, block2, count2, . . . )
where buf refers to a location in application memory 116 in memory 108 on host 102 into which the read data is to be stored, block1 refers to a starting position (e.g., a first logical block address) in persistent storage 150 from which count1 blocks of data is to be read into application memory 116 starting at location buf, and block2 refers to a starting position (e.g., a second logical block address) in persistent storage 150 from which count2 blocks of data is to be read into application memory 116 starting at a position that is count1 blocks of data after buf. The number of (block, count) pairs in the vwrite command has no specific limit, and can generally range from two pairs to several dozen pairs or, optionally, hundreds of pairs, depending on the implementation.
Similarly to the host write command issued by host 102 to write data to one or more persistent storage blocks, in some implementations, the buf parameter of the vread ( ) host read command indicates the starting location of read data block 120. In some implementations, the count1 blocks of data to be read from block1 and the count2 blocks of data to be read from block2 are stored in read data block 118, in a contiguous block starting at buf. In some implementations, the count1 blocks of data to be read from block1 and the count2 blocks of data to be read from block2 are only a portion of read data block 120. As with vwrite, in some implementations the starting locations, block1 and block2, are logical block addresses, and count1 and count2 refer to integer numbers of blocks of data to be read and conveyed to host 102. As described above with reference to specific examples of vwrite, in specific examples of vread given below, the values of the “block#” fields refer to logical block addresses.
Each of the above identified modules, applications or programs corresponds to a set of instructions, executable by the one or more processors of host 102 or persistent storage device 106, for performing a function described above. The above identified modules, applications or programs (i.e., sets of instructions) need not be implemented as separate software programs, procedures or modules, and thus various subsets of these modules may be combined or otherwise re-arranged in various embodiments. In some embodiments, memory 108 or memory 130 optionally stores a subset of the modules and data structures identified above. Furthermore, in some implementations, memory 108 or memory 130 optionally stores additional modules and data structures not described above.
Although FIG. 1 shows a system 100 including host 102 and persistent storage device 106, FIG. 1 is intended more as a functional description of the various features which may be present in a set of servers than as a structural schematic of the embodiments described herein. In practice, and as recognized by those of ordinary skill in the art, items shown separately could be combined and some items could be separated.
FIGS. 2A and 2B illustrate a schematic diagram of host device 102 and persistent storage 150, in accordance with some embodiments. As illustrated in FIGS. 2A and 2B, host 102 contains data that has been stored, starting at position “hostbuf,” in application memory 116 of memory 108. In some embodiments, with respect to FIG. 2A, data blocks 0-6 of application memory 116 form write data block 118. In some embodiments, with respect to FIG. 2B, data blocks 0-6 of application memory 116 form read data block 120. As mentioned above, in some embodiments, write data block 118 or read data block 120 is contiguous. In FIGS. 2A and 2B, persistent storage 150 maps persistent storage LBAs 202 to persistent storage blocks 204 via LBA to PHY mapping 206. As used herein, the term “persistent storage blocks” refers to the physical address blocks of persistent storage 150.
As described above with reference to FIG. 1, host 102 issues a write command (sometimes herein called a host write command) or a read command (sometimes herein called a host read command). In some embodiments, the write command results from an instance of a call by a host application to the vwrite function, as described above. In some embodiments, the read command results from an instance of a call by a host application to the vread function, as described above. In some embodiments, the read/write command is issued by one or more CPU(s) 104 of host 102 through memory interface 107 and received by storage controller 134 via host interface 126.
FIG. 2A shows an example a write command issued by host 102 via the function call vwrite (hostbuf, 2, 2, 0, 2, 7, 3). In this example, hostbuf represents a starting position in application memory 116. The write command specifies that two blocks of data, starting at block 2 of host application memory 116, be stored in the persistent storage blocks corresponding to logical block addresses starting at 0 (i.e., logical block address 0 and 1). The write command also specifies that two blocks of data, starting two blocks after the starting position of hostbuf in application memory 116, be stored in the persistent storage blocks corresponding to logical block addresses starting at 2 (i.e., logical block addresses 2-3). Last, the write command specifies that three blocks of data, starting four blocks after the starting position of hostbuf in host application memory 116, be stored in the persistent storage blocks corresponding to logical block addresses starting at 7 (i.e., logical block addresses 7-9).
When the persistent storage device 106 receives a write command, to write data into specified persistent storage blocks of persistent storage device 106 from a contiguous write data block 118 (e.g., a command that invokes the write to PS block function 140), storage controller 134 identifies the persistent storage blocks specified by the write command and stores the write data to the persistent storage blocks corresponding to the logical block address specified by the write command. As mentioned above, logical block addresses are mapped to physical addresses through LBA to PHY mapping 206, using address translation function(s) 146 and address translation table(s) 148.
FIG. 2B shows an example of a read command issued by host 102 via the function call vread (hostbuf, 2, 2, 0, 2, 7, 3). In this example, hostbuf represents a starting position in application memory 116. The read command specifies that two blocks of data, stored in the persistent storage blocks corresponding to the logical block addresses starting at 2, be stored in application memory 116 at position hostbuf in application memory 116. The read command also specifies that two blocks of data, stored in the persistent storage blocks corresponding to the logical block addresses starting at 0, be stored in application memory 116 at the position immediately following the two blocks of data stored in application memory 116 starting at position hostbuf. Last, the read command specifies that three blocks of data, stored in the persistent storage blocks corresponding to the logical block addresses starting at 7, be stored in application memory 116 at the position immediately following the four blocks of data stored in application memory 116 starting at position hostbuf.
In some implementations, the storing of data blocks into application memory 116 occurs in the order specified by the command. In some other implementations, the order in which data is stored into application memory can vary, as long as the resulting positions of the data blocks in application memory 116, after execution of the read command, match the positions of the data blocks specified by the host read command. For example, in some embodiments, in the example given above with reference to FIG. 2B, the data in the two persistent storage blocks corresponding to logical block addresses starting at 0 are read and stored in application memory 116 before the data in the two persistent storage blocks starting at logical block 2 are read and stored in application memory 116, as long as the two data blocks read from the persistent storage blocks starting at logical block 0 are stored at the position in application memory 116 two blocks after the starting position, hostbuf.
FIGS. 3A and 3B are flow diagrams illustrating the processing of host commands received from host 102 by persistent storage device 106, in accordance with some embodiments. As mentioned above, in some implementations, the host commands are received from host 102 by persistent storage device 106 via host interface 126. In some implementations, the host commands are function calls issued by host 102 when applications 114 invoke storage access functions 122 so as to read data from or write data to persistent storage device 106.
FIG. 3A illustrates the processing of a write command. Host 102 first issues (302) a write command to write data to one or more persistent storage blocks. In some embodiments, the write command, e.g., vwrite (buf, block1, count1, block2, count2, . . . ), is issued by host 102 when an application 114 executes a corresponding one of the storage access functions 122. Persistent storage device 106 receives the write command (304). In response, storage controller 134 of persistent storage device 106 stores (306) the write data to persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host write command. In some embodiments, storage controller 134 stores the write data by executing function 140 so as to write data the specified persistent storage blocks. In some embodiments, the data specified by the write command is stored in write data block 118 in application memory 116 on host 102. In some embodiments, write data block 118 is a contiguous data block.
FIG. 3B illustrates the processing of a read command. Host 102 issues (308) a read command to read data from one or more persistent storage blocks. In some embodiments, the read command is issued by host 102 when an application 114 executes a corresponding one of the storage access functions 122. Persistent storage device 106 receives (310) the read command. In response to the persistent storage read command, persistent storage device 106 retrieves (312) data stored in persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host read command. In some embodiments, the retrieved data corresponds to a read data contiguous data block. In some embodiments, the specified persistent storage blocks are identified using a logical block address to physical address mapping (e.g., mapping 206) to map logical addresses (e.g., logical block addresses) specified by the received read command to corresponding physical addresses. In some embodiments, storage controller 134 retrieves the read data from the specified persistent storage blocks and returns the data to host 102 via host interface 126. More specifically, in some embodiments, storage controller 134 of persistent storage device 106 reads the data from the specified persistent storage blocks and returns the read data to host 102, where the read data is received (316) by storage controller 134 and stored in read data block 120 in application memory 116 of memory 108. As with write data block 118, in some embodiments, read data block 120 is a contiguous data block.
FIGS. 4A-4C illustrate a flowchart representing a method 400 for managing a persistent storage device, such as persistent storage device 106 shown in FIG. 1, according to some embodiments. Method 400 includes operations for processing host read commands and host write commands. In some embodiments, method 400 is governed by instructions that are stored in a computer readable storage medium and that are executed by one or more processors of a device, such as the one or more processors 128 of storage controller 134 of persistent storage device 106, shown in FIG. 1.
In some embodiments, persistent storage device 106 receives (402) read and write commands from external host device 102. Examples of these commands are vwrite (buf, block1, count1, block2, count2, . . . ) and vread (buf, block1, count1, block2, count2, . . . ), as described above.
If host 102 issues a host write command, for example, vwrite (buf, block1, count1, block2, count2, . . . ), then in response to the host write command, persistent storage device 106 stores (404) data from a write data contiguous data block to persistent storage blocks. In some embodiments, operation 404 corresponds to operation 306 in FIG. 3A, as described above.
If host 102 issues a read command, for example, vread (buf, block1, count1, block2, count2, . . . ), then in response to the read command, persistent storage device 106 retrieves (414) data, corresponding to a read data contiguous data block, from persistent storage blocks. In some embodiments, operation 414 corresponds to operation 312 in FIG. 3B, as described above.
With regards to both operations 404 and 414, in some embodiments, the persistent storage blocks correspond (406/416) to two or more sets of logical address blocks specified by the host write/read command. In some embodiments, each set of logical address blocks specified by the host write/read command comprises (408/418) a set of contiguous logical address blocks, but the two or more sets of logical address blocks specified by the host write/read command, in aggregate, are not contiguous (410/420). As described above, in some implementations, the execution of the host write/read command is performed atomically (412/422). In some embodiments, the two or more sets of logical address blocks specified by the host write command comprise (434) logical block addresses, each associated with a corresponding persistent storage block.
In some embodiments, the host write command specifies (424) storage of a first block of data to a first persistent storage block corresponding to a first logical address block. The host write command also specifies (424) storage of a second block of data to a second persistent storage block corresponding to a second logical address block. In some embodiments, the first and second blocks of data are contiguously stored in the write data contiguous data block and the first and second logical address blocks are noncontiguous. In some embodiments, the write data contiguous data block corresponds (436) to a contiguous data block in memory 108 of external host device 102.
In some embodiments, the host read command specifies (426) retrieval of a first block of data from a first persistent storage block corresponding to a first logical address block. The host read command also specifies (426) retrieval of a second block of data from a second persistent storage block corresponding to a second logical address block. Similar to operation 424, in some embodiments, the first and second blocks of data are, after retrieval, contiguously stored in the read data contiguous data block and the first and second logical address blocks are noncontiguous. In some embodiments, the read data contiguous data block corresponds (436) to a contiguous data block in memory 108 of external host device 102.
In some embodiments, persistent storage device 106 is implemented (428) as a single, monolithic integrated circuit. In some embodiments, the persistent storage device includes (430) host interface 126 for interfacing persistent storage device 106 to memory controller 134 of external host device 102.
In some embodiments, storage controller 134 associates (432) logical block addresses, e.g., persistent storage LBAs 202, specified by the host write command and host read command, with persistent storage blocks 204 in persistent storage device 106 using LBA to PHY mapping 206, as described above. As described above, in some embodiments, a read or write command discussed above with reference to operations 404 or 414 specifies the persistent storage block to which data is to be written by specifying an associated logical block address. In such embodiments, the corresponding persistent storage block is identified (434) using a logical block address to physical block address mapping, e.g., LBA to PHY mapping 206.
Each of the host read commands described above can be viewed as a command for “gathering” data from disparate storage blocks in persistent storage and storing the gathered data in a single contiguous data block of the host 102 that issued the read command. Similarly, each of the host write commands described above can be viewed as a command for “scattering” data from a single contiguous data block of the host 102 to multiple disparate storage blocks in persistent storage. Further, use of the host read commands and host write commands described above can be used by a host application to avoid performing garbage collection operations, as such commands largely eliminate the need to move data stored in persistent storage to a set of persistent storage blocks having a contiguous set of logical block addresses.
Each of the operations shown in FIGS. 4A-4C optionally corresponds to instructions stored in a computer memory or computer readable storage medium, such as memory 130 of storage controller 134. The computer readable storage medium optionally includes a magnetic or optical disk storage device, solid state storage devices such as Flash memory, or other non-volatile memory device or devices. The computer readable instructions stored on the computer readable storage medium are in source code, assembly language code, object code, or other instruction format that is interpreted by one or more processors.
Although the terms “first,” “second,” etc. are used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first contact could be termed a second contact, and, similarly, a second contact could be termed a first contact, without changing the meaning of the description, so long as all occurrences of the “first contact” are renamed consistently and all occurrences of the second contact are renamed consistently. The first contact and the second contact are both contacts, but they are not the same contact.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the claims. As used in the description of the embodiments and the appended claims, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
As used herein, the term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in accordance with a determination” or “in response to detecting,” that a stated condition precedent is true, depending on the context. Similarly, the phrase “if it is determined [that a stated condition precedent is true]” or “if [a stated condition precedent is true]” or “when [a stated condition precedent is true]” may be construed to mean “upon determining” or “in response to determining” or “in accordance with a determination” or “upon detecting” or “in response to detecting” that the stated condition precedent is true, depending on the context.
The foregoing description, for purpose of explanation, has been described with reference to specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the disclosed embodiments to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain the principles of the present disclosure and its practical applications, to thereby enable others skilled in the art to best utilize the disclosed embodiments and various other embodiments with various modifications as are suited to the particular use contemplated.

## Claims

1. A persistent storage device, comprising:
persistent storage, comprising a set of persistent storage blocks; and
a storage controller configured to store and retrieve data in response to commands received from an external host device, the storage controller further configured to:
in response to a host write command, store all data from a single write data contiguous data block to persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host write command, each set of logical address blocks specified by the host write command comprising a set of contiguous logical address blocks, wherein the two or more sets of logical address blocks specified by the host write command, in aggregate, are not contiguous; and
in response to a host read command, retrieve data corresponding to all locations of a single read data contiguous data block from persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host read command, each set of logical address blocks specified by the host read command comprising a set of contiguous logical address blocks, wherein the two or more sets of logical address blocks specified by the host read command, in aggregate, are not contiguous.

2. The persistent storage device of claim 1, wherein the storage controller is further configured to execute the host write command atomically, such that failure of said host write command to execute results in none of said two or more sets of logical address blocks specified by the host write command being stored in said persistent storage, and successful execution of said host write command results in all of said two or more sets of logical address blocks specified by the host write command being stored in said persistent storage.

3. The persistent storage device of claim 1, wherein the storage controller is further configured to execute the host read command atomically, such that failure of said host read command to execute results in none of said two or more sets of logical address blocks specified by the host read command being read from said persistent storage into said read data contiguous data block, and successful execution of said host read command results in all of said two or more sets of logical address blocks specified by the host read command read from said persistent storage into said read data contiguous data block.

4. The persistent storage device of claim 1, wherein the host write command specifies storage of a first block of data to a first persistent storage block corresponding to a first logical address block and storage of a second block of data to a second persistent storage block corresponding to a second logical address block, wherein the first and second blocks of data are contiguously stored in the write data contiguous data block, and wherein the first and second logical address blocks are noncontiguous.

5. The persistent storage device of claim 1, wherein the host read command specifies retrieval of a first block of data from a first persistent storage block corresponding to a first logical address block and retrieval of a second block of data from a second persistent storage block corresponding to a second logical address block, wherein the first and second blocks of data are, after retrieval, contiguously stored in the read data contiguous data block, and wherein the first and second logical address blocks are noncontiguous.

6. The persistent storage device of claim 1, wherein the single write data contiguous data block is a contiguous data block in memory of the external host device.

7. The persistent storage device of claim 1, further comprising a host interface for interfacing the persistent storage device to a memory controller of the external host device.

8. The persistent storage device of claim 1, further comprising a logical address to physical address map for associating logical block addresses with persistent storage blocks in the persistent storage device.

9. The persistent storage device of claim 1, wherein the two or more sets of logical address blocks specified by the host read command comprise logical block addresses, each associated with a corresponding persistent storage block, and the corresponding persistent storage blocks are a noncontiguous set of storage blocks identified by the storage controller using a logical block address to physical address mapping.

10. The persistent storage device of claim 1, wherein the write data contiguous data block or the read data contiguous data block corresponds to a single contiguous data block in memory on the external host device.

11. A method for managing a persistent storage device, comprising:
at the persistent storage device comprising persistent storage and a storage controller, the persistent storage comprising a set of persistent storage blocks:
in response to a host write command received from an external host device, storing all data from a single write data contiguous data block to persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host write command, each set of logical address blocks specified by the host write command comprising a set of contiguous logical address blocks, wherein the two or more sets of logical address blocks specified by the host write command, in aggregate, are not contiguous; and
in response to a host read command, retrieving data corresponding to all locations of a single read data contiguous data block from persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host read command, each set of logical address blocks specified by the host read command comprising a set of contiguous logical address blocks, wherein the two or more sets of logical address blocks specified by the host read command, in aggregate, are not contiguous.

12. The method of claim 11, wherein execution of the host write command is performed atomically, such that failure of said host write command to execute results in none of said two or more sets of logical address blocks specified by the host write command being stored in said persistent storage, and successful execution of said host write command results in all of said two or more sets of logical address blocks specified by the host write command being stored in said persistent storage.

13. The method of claim 11, wherein execution of the host read command is performed atomically, such that failure of said host read command to execute results in none of said two or more sets of logical address blocks specified by the host read command being read from said persistent storage into said read data contiguous data block, and successful execution of said host read command results in all of said two or more sets of logical address blocks specified by the host read command read from said persistent storage into said read data contiguous data block.

14. The method of claim 11, wherein the host write command specifies storage of a first block of data to a first persistent storage block corresponding first logical address block and storage of a second block of data to a second persistent storage block corresponding to a second logical address block, wherein the first and second blocks of data are contiguously stored in the write data contiguous data block, and wherein the first and second logical address blocks are noncontiguous.

15. The method of claim 11, wherein the host read command specifies retrieval of a first block of data from a first persistent storage block corresponding first logical address block and retrieval of a second block of data from a second persistent storage block corresponding to a second logical address block, wherein the first and second blocks of data are then, after retrieval, contiguously stored in the read data contiguous data block, and wherein the first and second logical address blocks are noncontiguous.

16. The method of claim 11, wherein the single write data contiguous data block is a contiguous data block in memory of the external host device.

17. The method of claim 11, the persistent storage device further comprises a host interface for interfacing the persistent storage device to a memory controller of the external host device.

18. The method of claim 11, further comprising associating logical block addresses specified by the host write command and host read command with persistent storage blocks in the persistent storage device using a logical address to physical address map.

19. The method of claim 11, wherein the two or more sets of logical address blocks specified by the host read command comprise logical block addresses, each associated with a corresponding persistent storage block, and the corresponding persistent storage blocks are a noncontiguous set of storage blocks identified by the storage controller using a logical block address to physical address mapping.

20. The method of claim 11, wherein the write data contiguous data block or the read data contiguous data block corresponds to a single contiguous data block in memory on the external host device.

21. A non-transitory computer readable storage medium storing one or more programs for execution by a storage controller of a persistent storage device, the persistent storage device comprising persistent storage and the storage controller, the persistent storage comprising a set of persistent storage blocks, wherein the one or more programs, when executed by the storage controller of the persistent storage device, cause the persistent storage device to perform a method comprising:
in response to a host write command received from an external host device, storing all data from a single write data contiguous data block to persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host write command, each set of logical address blocks specified by the host write command comprising a set of contiguous logical address blocks, wherein the two or more sets of logical address blocks specified by the host write command, in aggregate, are not contiguous; and
in response to a host read command, retrieving data corresponding to all locations of a single read data contiguous data block from persistent storage blocks corresponding to two or more sets of logical address blocks specified by the host read command, each set of logical address blocks specified by the host read command comprising a set of contiguous logical address blocks, wherein the two or more sets of logical address blocks specified by the host read command, in aggregate, are not contiguous.