# Patent

## Title
Staging sorted data in intermediate storage

## Abstract

A data storage system includes data storage and random access memory. A sorting module is communicatively coupled to the random access memory and is configured to sort data blocks of incoming write data received in the random access memory. A storage controller is communicatively coupled to the random access memory and the data storage and is configured to write the sorted data blocks as individually-sorted data block sets to a staging area of the data storage. A method and processor-implemented process provide for sorting data blocks of incoming write data received in a random access memory of data storage and writing the sorted data blocks as individually-sorted data block sets to a staging area of the data storage.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application relates to U.S. application Ser. No. 13/829,595, entitled “Dynamic Granule-Based Intermediate Storage” and filed currently herewith, which is specifically incorporated by reference for all that it discloses or teaches.
BACKGROUND
Some data storage systems, such as those containing rotating magnetic storage, magnetic tape, and/or rotating optical storage, suffer from relatively high latency times (e.g., in the milliseconds range or more) to reach a randomly-targeted location within physical storage. Once the targeted location is reached (e.g., via a seek operation), data can be transferred (read or written) relatively sequentially from the physical storage at a reasonably high rate. One of many challenges relating to improving data transfer rates is managing the transfer requests of a host within the constraints of physical location and logical ordering of the requested data within the data storage system.
SUMMARY
Embodiments described and claimed herein address the foregoing problems by efficiently segregating dynamically mapped data throughout multiple levels of physical storage within a data storage system. Such efficient data segregation can reduce deviation in the behavior of logically sequential data accesses to the physical storage media, especially in the presence of shingled magnetic recording regions.
A method and processor-implemented process provide for sorting data blocks of incoming write data received in a random access memory of data storage and writing the sorted data blocks as individually-sorted data block sets to a staging area of the data storage. A data storage system includes data storage and random access memory. A sorting module is communicatively coupled to the random access memory and is configured to sort data blocks of incoming write data received in the random access memory. A storage controller is communicatively coupled to the random access memory and the data storage and is configured to write the sorted data blocks as individually-sorted data block sets to a staging area of the data storage
Other embodiments are also described and recited herein.



BRIEF DESCRIPTIONS OF THE DRAWINGS
FIG. 1 illustrates an example data storage system for staging sorted data in a staging area of intermediate latency storage.
FIG. 2 illustrates an example storage medium with one or more staging areas for chunks of sorted data.
FIG. 3 illustrates an example data storage system with hierarchical storage based on varying levels of generally increasing data organization.
FIG. 4 illustrates an example staging area in which stale data is identified and marked as stale.
FIG. 5 illustrates an example generation of a chunk of sorted data in a staging area.
FIG. 6 illustrates an example sorting of a subset of data from a set of chunks for recording in a staging area.
FIG. 7 illustrates an example sorting of a subset of data from a set of chunks for use external to a staging area.
FIG. 8 illustrates example operations for chunking data blocks from a staging area.
FIG. 9 illustrates example operations for re-chunking data blocks from a staging area.
FIG. 10 illustrates example operations for re-sorting data blocks from a staging area to other intermediate storage.



DETAILED DESCRIPTIONS
FIG. 1 illustrates an example data storage system 100 for staging sorted data in a staging area 102 of intermediate latency storage. In the illustrated example, the data storage system 100 represents a hard disc drive having one or more magnetic storage discs 104, although other embodiments of such a storage medium may be in the form of an optical disc reader (e.g., a CD reader/writer or a DVD reader/writer), a tape drive, a solid state drive (SSD), etc. The data storage system 100 communicates with a host device 106, which sends write data to and receives read data from the data storage system 100.
For example, the host device 106 can write a data file to the data storage system 100, which records the data file on the magnetic storage disc 104 and can later read the data file from the data storage system 100. At the host level, user data is often structured in terms of variable length files, which can be constituted from one or more fixed length data blocks. The data blocks are addressable by the host device 106 using logical block addresses (LBAs). The data storage system 100 includes a write channel having data write circuitry 108, which encodes the data blocks according to an encoding scheme used by the data storage system 100. One or more data blocks may be combined with redundancy information to form self-contained codewords for error detection and/or correction.
The data write circuitry 108 writes the data blocks through a write controller 110, which determines the physical location and ordering of the data blocks written by the write controller 110 to one or more levels of data storage within the data storage system 100. When a data block is written to the storage disc 104, the data block is written to a physical block address (PBA) on the storage disc 104. The mapping between LBA and PBA can change over time and is referred to as “dynamic mapping.” The write controller 110 manages the dynamic mapping between LBA and PBA, even as the mapping changes over time. Memory 116 may store firmware instructions that are processed by the write controller 110 to implement dynamic mapping, sorting, relocation, overprovisioning, and other functions performed by the write controller 110.
In the data storage system 100, groups of data blocks having consecutive logical addresses can be recorded in approximately consecutive physical locations on the storage disc 104 to achieve a lower latency for successive data accesses after the seek operation for certain sets of data. In addition, dynamic mapping can be intelligently extended to support multiple levels of physical storage within the data storage system 100, wherein different levels of physical storage can provide different average access latencies.
As referenced above, the write controller 110 can write data blocks to one or more levels of data storage within the data storage system 100. For example, a data storage area 112 of the storage disc 104, referred to as “destination storage,” represents a physical storage area generally intended for long term storage. Although data in destination storage is intended for long term storage, such data may still be moved from destination storage locations to other destination storage locations over time. In addition, a data storage area 114 of the storage disc 104, referred to as “granule storage,” represents intermediate physical storage in which data stored in each dynamically-sizeable granule is constrained to a certain subset of logical block addresses (LBAs). An example granule size may be about 1 MB, although other sizes may be employed. In fact, granules may be of many different sizes on the same disc surface or even within the same SMR band.
Furthermore, a data storage area 102 of the storage disc 104, referred to as “a staging area,” represents a physical storage area in which groups of logical blocks can be incrementally written and rewritten in an increasingly contiguous LBA order. For example, data blocks can be initially received by the data storage system 100 from the host device 106 in an arbitrary or sparse LBA order (e.g., the data blocks are received from diverse areas in logical space). Such data blocks may be written to the staging area in a physically contiguous manner.
Random access memory 118 also represents a storage area of the data storage system 100. Its random access characteristics and low access latency provide a storage area appropriate for sorting data blocks according to certain constraints (e.g., LBA ordering, PBA ordering, most-frequently-accessed order, prioritized data order, etc.). In one embodiment, data is received into the random access memory 118, sorted according to an LBA order, and written to the staging area in groups of data called “chunks,” which are sized in association with the available amount of the random access memory 118. An example chuck size may be 64 MB, although other sizes may be employed.
Data read and recovery circuitry 120 can read the data (with appropriate error correction coding) from the magnetic storage disc 104 (or from the random access memory 118) and use the error correction coding to detect and/or correct errors (such as data errors caused by scratch damage on the magnetic storage disc 104). The data read and recovery circuitry 120 then transfers the read data (which may be corrected read data) to the host device 106.
The sorting of data blocks received in the random access memory 118 may be accomplished in a variety of ways. In one embodiment, the sorting may be accomplished by a processor or other control circuitry while the data blocks reside in the random access memory 118. In an alternative embodiment, the sorting may be accomplished during transfer of the data blocks to and/or from the random access memory 118, such as by using a scatter-gather DMA (direct memory access) transfer scheme. Other sorting techniques and configurations may be employed.
In a data storage system, such as data storage system 100 of FIG. 1, a staging area may be a non-shingled or shingled magnetic recording region. Magnetic media storage drives store data in polarized cells on one or more magnetized media within each storage drive. One example of a magnetic media storage drive is a magnetic disc drive, which includes a disc that has polarized cells arranged in concentric, generally circular data tracks. In operation, one or more of the discs rotate at a constant high speed within the storage drive while information is written to and read from the tracks on the disc(s) using an actuator assembly. The actuator assembly rotates during a seek operation about a bearing shaft assembly positioned adjacent the discs.
The actuator assembly includes one or more actuator arms that extend toward the discs. A head with a read pole and a write pole is mounted at the distal end of each of the actuator arms. The write pole generates a magnetic field that writes data to a disc by changing the magnetic polarization of the cells on the disc that rotates beneath the head. The read pole reads data from the disc by detecting the magnetic polarization of the cells on the disc.
In non-shingled magnetic media, each of the cells on a magnetized medium are of a sufficiently large size relative to the size of the write pole to allow the write pole to write data to the cells without overwriting data in any surrounding cells. As a result, data may be randomly written to available cells anywhere on the magnetic medium. However, as requirements for data storage density increase for magnetic media, cell size decreases. A commensurate decrease in the size of the write pole is difficult because a strong write field gradient provided by a larger write pole is often required to shift the polarity of the cells on the magnetized medium. As a result, writing data to smaller cells on the magnetized medium using the relatively larger write pole may affect the polarization of adjacent cells (i.e., overwriting the adjacent cells). One technique for adapting the magnetic medium to utilize smaller cells while preventing adjacent data being overwritten during a write operation is shingled magnetic recording (SMR).
SMR utilizes a large strong write field generated by the write pole. One constraint of shingled magnetic recording is that when data is written to the magnetic media, it is written in sequentially increasing or decreasing radius tracks. The strong write field affects two or more adjacent tracks including the track being written to and one or more previously-written tracks. As a result, in order to change any data cell within the shingled data, all of the shingled data is re-written in the selected sequential write order.
In order to achieve the increased cell density made possible by SMR while compensating for a lack of random write functionality in such a system, one or more isolation regions may be created within with shingled data. The isolation regions, also referred to as guard tracks, are groupings of one or more adjacent data tracks within the shingled data that are unavailable for recording. In operation, the isolation regions define separate data bands (i.e., groups of logical sectors bounded by guard tracks) of shingled data. Typically, each guard track is wide enough to prevent any overwriting across the guard track. As a result, the guard tracks create bands of shingled data, including one or more adjacent tracks, that are isolated from other bands. Consequently, a single band of shingled data is rewritten (rather than all of the shingled data on the disk) when one or more cells within the band are changed.
However, re-writing one or more cells of data in a data band still typically entails multiple steps, including: reading the entire data band, writing data of the data band into a media scratch pad (e.g., a temporary cache) on a disc, reading the data from the media scratch pad, and re-writing the data to the original data band with the one or more changed cells. Consequently, shingled data write operations are typically more time consuming and less power efficient than un-shingled data write operations.
Redundancy information can be interlaced with the written data to create multi-logical-block-sized codewords. The redundancy information could be included each time data is written to the staging area, or the redundancy information could be recorded at predictable intervals, such that incremental redundancy could be maintained if the staging area is appended a few times before receiving enough appended data to reach the predictable location where redundancy information is to reside. Furthermore, the writing of data to the staging area of FIG. 1 (or other staging area) can be paced to perform those processes that free staging area space before those processes that consume staging area space. In this manner, staging area space is more likely to be available for new write data blocks.
FIG. 2 illustrates an example storage medium 200 with one or more staging areas (such as staging area 202) for chunks of sorted data. In one embodiment, a surface of a data storage disc 204 includes a number of concentric tracks 206. The tracks 206 are distributed on the surface of the storage 204 and may take any number of different forms including without limitation conventional pre-shingled continuous recording, discrete track recording, and shingled magnetic recording. In some embodiments, a single storage disc surface may support both conventional pre-shingled continuous recording and shingled magnetic recording, for example. Further, the same area of a single disc surface may be used for both conventional pre-shingled continuous recording and shingled magnetic recording at different times. In other embodiments, different storage disc surfaces may be dedicated to different recording types (e.g., a surface of one storage disc may used for one type of recording and a surface of the same storage disc or another storage disc may be used for a different type of recording).
Different types of recording can contribute to different levels of access latency. A conventional continuous recording pattern is formed by the write head writing data along tracks designated by servo information stored in radial servo burst sectors (such as servo burst sectors 208). The write head re-writes portions of the track as it writes data to the storage medium, potentially resulting in slight variations in the bounds of individual tracks over time. In contrast, discrete track recording patterns include concentric discrete tracks with non-magnetic inter-track isolation, wherein data is recorded continuously along each isolated track. As such, the write head writes data in consistent sets of discrete target tracks during a write operation. Read and write access to these types of recording areas may differ between them, and further, the segregation and ordering of the data blocks along the tracks can also influence the access latency.
Shingled magnetic recording employs write poles that record wider tracks than that which is required by the read sensors. However, in shingled magnetic recording, a writing operation typically results in the overwriting of adjacent tracks in a given direction. Accordingly, the write tracks are written to overlap each other in the given direction, leaving narrow tracks of data that can be read correctly by the read heads. As such, the overlapping tracks are written in groups or bands of tracks, which are isolated or otherwise separate from other tracks.
When configured with radial servo burst sectors 208, each track 206 is divided into slices called data wedges or sectors 210 between the servo burst sectors 208. Servo burst sectors include data for maintaining accurate positioning of a read/write head over a target track and are positioned at predetermined spaced locations around the storage disc 204.
As the storage disc 204 rotates, the read/write head reads the servo information containing an address within the servo bursts sectors 208 and sends the servo information back to a servo control system. The servo control system checks whether the address in the servo information read from the servo burst sector 208 corresponds to the target track location. If the address does not correspond to the target track location, the servo control system adjusts the position of the read/write head to the correct track location as part of a seek operation.
As indicated above, each track 206 includes discrete data sectors 210 containing stored user information. The number of data sectors 210 contained on a particular track depends, in part, on the length (e.g., circumference) of the track. Besides containing user information, each data sector may also include other data to help identify and process the user information (e.g., error detection and correction coding).
In accordance with an embodiment, one or more portions of the storage disc 204 are reserved for use as a staging area 202, a type of intermediate storage. The staging area 202 is shown in FIG. 2 as being a circumferential grouping of tracks 206 located proximate to the outer diameter of 212 of the storage disc 204. The staging area 202 is shown in FIG. 2 as an example, and it should be understood that the staging area 202 may be written on any other area (radial or circumferential) of the storage disc 204. One characteristic of tracks proximate to the outer diameter 212 is that they can be read with a higher sequential data rate than tracks proximate to the inner diameter 214 of the storage disc 204.
In addition to the one or more staging areas 202, the storage disc 204 also includes one or more granule storage areas 216, a type of intermediate storage, wherein each dynamically-sizeable granule is constrained to a certain subset of logical block addresses (LBAs). The storage disc 204 also includes destination storage areas 218, where data blocks are typically recorded for longer term storage than the other areas of the storage disc 204. In one embodiment, the destination storage areas 218 are characterized by a non-dynamic LBA-to-PBA mapping, at least for certain confined address ranges, although other embodiments may include destination storage areas with some use of dynamic mapping. It should be understood that the illustrated placement of various intermediate and destination storage areas are merely examples, and that such areas may be located at any location on the storage disc 204. Furthermore, one or more of the staging areas 202, the granule storage areas 216, and the destinations storage areas 218 may be shingled magnetic recording regions, non-shingled magnetic recording regions, or regions of other recording formats.
First, as a general comment, it should be understood that write data may take a variety of paths to the various storage areas (e.g., to random access memory, to a staging area, to a granule storage area, to a destination storage area, etc.). In one embodiment, a host device writes data blocks to a random access memory, where the data blocks may or may not be initially sorted. If the random access memory is non-volatile, the data blocks may accumulate in the random access memory to service host device read requests, without being written to other non-volatile storage media. Alternatively, data blocks may be written from the random access memory to a staging area (in individual sorted sets or as unsorted data blocks) or to other storage. Even when the data blocks are written to the staging area or other storage, the same data blocks may also be retained in the random access memory, which can avoid a possible media read operation in the future. Furthermore, it is typically desirable to maintain at least copy of write data in a nonvolatile storage (e.g., NVRAM or another non-volatile storage medium) because of the possibility of power loss.
FIG. 3 illustrates an example data storage system 300 with hierarchical storage based on varying levels of generally increasing data organization. A storage controller 302 manages reading and writing of data blocks to various storage areas, whether to random access memory 304, to intermediate storage (e.g., a staging area 306 or a granule storage area 308) of data storage 310, or to destination storage (e.g., a destination storage area 312) of data storage 310. It should be understood that there may be multiple staging areas, multiple granule storage areas, and multiple destination storage areas on a single storage disc. Furthermore, the storage controller 302 may dynamically adjust the role of a given storage area over time. For example, a staging area may be used as a destination storage area at various times of operation.
In one embodiment, the storage controller 302 receives data blocks of new write data, responsive to one or more write commands from a host device. The received data blocks may be received in arbitrary LBA-order—some write commands may be more LBA-ordered while other write commands may be less LBA-ordered, and some combinations of write commands may be targeted at substantially diverse areas of the logical address space. Nevertheless, in this embodiment, the storage controller 302 receives the data blocks into random access memory 304, sorts the data blocks, and writes the sorted data blocks to the staging area 306 in a relatively contiguous physical space in the staging area 306. The term “relatively contiguous” refers to a read/write operation, potentially associated with multiple read/write commands, from/to a physical storage area in which a single seek operation (or few seek operations) are used to complete the read/write operation and data blocks are read from/written to sequential PBAs on one or more tracks. It should be understood that the skipping of damaged, stale, or otherwise “bad” PBAs in the data storage 310 or the reading/writing of data across nearby multiple tracks of the data storage 310 does not preclude a read/write operation from being considered “relatively contiguous.”
At any time, but typically during periods of low storage activity, the storage controller 302 can read data stored in the staging area 306 using a relatively contiguous read operation. The read data is transferred to the random access memory 304, sorted in random access memory 304 in a predefined order (e.g., in LBA order, in most-frequently-accessed order, etc.), and then written to the staging area 306 or to another storage area or the host device. In one embodiment, the amount of data read, sorted, and written to the staging area 306 is referred to as a “chunk” and is the same as the size of the random access memory 304, although other sizes may be used (e.g., different portions of the random access memory 304 may be used for different purposes or for different “chunks”). In another embodiment, the read and sorted data may alternatively be transferred to a host device in response to a read command or transferred to another storage area (e.g., flash memory, a granule storage area 308 or a destination storage area 312).
When the storage controller 302 writes the sorted data to the staging area 306, the storage controller 302 typically writes the sorted data to a new location in the staging area 306, rather than overwriting the physical storage of the previously read data with the newly sorted copy of the data. Once the newly sorted data is written to the staging area 306 (or to another storage area), the physical storage containing the previously read data may be marked as stale and reclaimed for use with new write data. The reclamation operation may be referred to as “garbage collection” and may allow for multiple sorted and unsorted versions of the same data to reside in the staging area 306 or other storage areas of the data storage 310 at the same time. In an alternative embodiment, the previous read PBAs may be overwritten with the newly sorted copy of the data. It should also be understood that the reading, sorting, and writing of data recorded in the staging area 306 (or other storage areas) may be repeated multiple times (e.g., to increase the correlation between logical and physical ordering for a particular chunk of data).
It should also be understood that the processing of write operations by the storage controller 302 may be performed in an order that favors creating more room within the staging area to receive new write data. For example, host commands or data storage system operations that generate more stale PBAs in the staging area or that generate more regions of relatively contiguous stale PBAs in the staging area may be performed before host commands or data storage system operations that consume PBAs in the staging area. For example, host commands to delete data blocks may be prioritized ahead of new data write commands. Likewise, data storage system operations that transfer data blocks from a staging area to a granule storage area or a destination storage area may be prioritized ahead of new data write commands. In this manner, the data storage system can prevent or reduce the likelihood that a staging area is too full to accept new write data.
FIG. 4 illustrates an example staging area 400 in which stale data is identified and marked as stale. In one embodiment, stale data is “marked” as stale because there is no longer an LBA that translates to the corresponding PBA storing the stale data. FIG. 4 depicts a stale data marking module 406 for illustrative purposes. However, the stale data marking module 406 is typically a functional component of the dynamic mapping subsystem that re-maps the LBA to the PBA containing the fresh data and deletes the mapping of the same LBA to the stale PBA. Another aspect of the stale data marking module 406 may include a counter that records the number of stale locations in a physical subdivision.
The staging area 400 receives data blocks from a storage controller, which records the blocks in a relatively contiguous manner. In FIG. 4, the data is shown as written to the staging area 400 in ten successive write operations 402, from write operation 1 to write operation 10. The write operations 402 designate separate media accesses resulting in the recording of individual data blocks 404 (each marked in FIG. 4 with a corresponding LBA). For example, the write operation 1 writes data blocks associated with LBAs 73, 21, and 94 to the staging area 400 in a relatively contiguous (e.g., physically sequential) manner, and the write operation 2 writes data blocks associated with LBAs 24 and 92 to the staging area 400 in a relatively contiguous (e.g., physically sequential) manner. Responsive to each write operation, the storage controller records an LBA-to-PBA mapping for each data block. In this manner, the storage controller can retrieve a data block requested by the host device from its PBA according to its corresponding LBA. The associated dynamic mapping information may be stored in a storage controller-accessible dynamic mapping table (not shown).
As shown with regard to write operations 4 and 5, a data block associated with LBA 46 is written twice, once in write operation 4 and again in write operation 5. Accordingly, the data block storing the data written in the write operation 4 is now stale, as a more up-to-date data block has been written by the write operation 5. Further, the storage controller updates the dynamic mapping between LBA 46 and the new PBA associated with the write operation 5.
A stale data marking module 406 detects the new write of LBA 46 and therefore marks the data block from the write operation 4 as stale (e.g., LBA 46 no longer maps to the PBA storing the stale data block). Write operations 7 and 8 are also shown as writing the same LBA 17. Accordingly, the stale data marking module 406 marks the data block for LBA 17 written by write operation 7 as stale and updates the dynamic mapping between LBA 17 and the new PBA associated with the write operation 8.
As the storage controller reads the relatively contiguous data from the staging area 400, stale data blocks are ignored or otherwise managed to preclude their transfer to random access memory for sorting and subsequent re-writing to the host device or the storage media. As physical data blocks are marked as stale, the physical data blocks can be reclaimed and reused for new data blocks, including for newly sorted chunks.
It should be understood that all of the write data or one or more portions of the write data shown in the staging area 400 may also be retained in a random access memory (not shown in FIG. 4). As such, copies of the most recently written data from the host device may be maintained in the random access memory as well as the staging area. In this manner, it is unnecessary for the storage controller to read from the staging area in order to gain access to the most recently written data in the random access memory.
FIG. 5 illustrates an example generation of a chunk 500 of sorted data in a staging area 502. In one embodiment, when the host device writes data blocks to the storage controller, the storage controller writes the data blocks directly to the random access memory 504, as shown at 503, where it can be sorted and copied to the staging area 502 while still maintaining a sorted copy in the random access memory. In an alternative embodiment, the storage controller can read an unsorted sequence 501 of data blocks from the staging area 502 into random access memory 504, shown as data blocks at 506, as shown at 505.
A sorting module 508 sorts the data according to LBA order, shown as data blocks at 510, although it should be understood that the sorting module 508 may sort the data blocks according to other ordering preferences, including most-frequently-accessed, most-recently-accessed, etc. Various sorting methods may be used to sort the data blocks within the random access memory 504. The sorted data (“the chunk”) is then written in a relatively contiguous manner to another location within the staging area 502, to the host device, or to other intermediate or destination storage areas of the storage media. As previously discussed, in an alternative embodiment, the sorted chunk may be re-written over the previously read data, although FIG. 5 shows the chunk 500 as written to a separate location in the same staging area 502.
Responsive to the writing of the new chunk 500 to the staging area 502, the storage controller updates the dynamic mapping information to reflect the new relationships between the LBAs (21, 24, 73, and 94) and their new PBAs within the staging area 502. In addition, a stale data marking module marks the previous PBAs that stored the previous data blocks for the same LBAs (i.e., the PBAs at 501) as stale. In this manner, those PBAs may be reclaimed to be re-used for new write data. Typically, each time a set of data blocks is sorted and “chunked,” the average access latency of those data blocks is reduced because, in the case of LBA ordering, the subsequent read operations are accessing data with a better LBA-to-PBA mapping. In one perspective, the transfer of multiple, sorted data blocks per media access to/from the staging area amortizes the latencies between relatively contiguous physical media accesses across a larger number of data blocks.
FIG. 6 illustrates an example sorting of a subset of data 600 from a set of chunks 602 for recording in a staging area 604. A storage controller reads multiple sorted sets of data blocks (e.g., multiple chunks via multiple read accesses) from the staging area 604 into random access memory 606 (e.g., the entire memory 606 or a portion thereof). Note: Multiple extents of data may be read per media access to amortize the latencies between media accesses across multiple extents.
A sorting module 608 sorts the read data blocks received in the random access memory 606 according to a predefined order (e.g., in LBA order in FIG. 6). Various sorting methods, such as an N-ary merge sort that reads from the head of each sorted chunk, may be used to sort the data blocks received within the random access memory 606. The newly sorted chunk at 610 is written to the staging area 604 at 612. Responsive to the writing of the new chunk 612 to the staging area 604, the storage controller updates the dynamic mapping information to reflect the new relationships between the LBAs (1, 2, 11, and 16) and their new PBAs within the staging area 604. In addition, a stale data marking module marks the previous PBAs that stored the previous data blocks for the same LBAs as stale. In this manner, those PBAs may be reclaimed to be reused for new write data. The data blocks at 614 represent unsorted, un-chunked data blocks that are still recorded in the staging area 604.
In one embodiment, data is read from the staging area 604 by the application of disc scheduling logic. For example, read requests are queued up and scheduled for execution based on seek times, latency times, etc. In some embodiments, disc scheduling logic may also be used for write operations, such as a write to a granule storage area or a destination storage area.
FIG. 7 illustrates an example sorting of a subset of data 700 from a set of chunks 702 for use external to a staging area 704. A storage controller reads multiple sorted sets of data blocks (e.g., multiple chunks via multiple read accesses) from the staging area 704 into random access memory 706 (e.g., the entire memory 706 or a portion thereof). Note: Multiple extents of data may be read per media access to amortize the latencies between media accesses across multiple extents.
A sorting module 708 sorts the read data blocks in the random access memory 706 according to a predefined order (e.g., in LBA order in FIG. 7). Various sorting methods, such as an N-ary merge sort that reads from the head of each sorted chunk, may be used to sort the data blocks within the random access memory 706. The newly sorted chunk at 710 is written to other storage (e.g., to other intermediate storage, such as another staging area or a granule storage area, or to destination storage area) or to a host device. Responsive to the writing of the new chunk 712 to other storage, the storage controller updates the dynamic mapping information to reflect the new relationships between the LBAs (1, 2, 11, and 16) and their new PBAs within the other storage. The data blocks at 714 represent unsorted, un-chunked data blocks that are still recorded in the staging area 704.
In addition, in one embodiment, a stale data marking module marks the previous PBAs that stored the previous data blocks for the same LBAs as stale. In this manner, those PBAs may be reclaimed to be reused for new write data. In an alternative embodiment, however, data blocks in the staging area 704 corresponding to data blocks written to other storage need not be marked as stale. In such an embodiment, multiple copies of the data blocks may be recorded in multiple physical locations within the data storage system (e.g., within a staging area, within a flash memory cache, within random access memory, within a granule storage area, within a destination storage area) and the storage controller can determine the physical location presenting the lowest latency for accessing a host-requested set of data blocks, whether for read or write operations. The dynamic mapping of the data blocks can manage the multiple physical locations for the same data blocks in combination with the expected latency associated with access at each physical location to reduce the average access latency for a given read or write command for the data blocks.
FIG. 8 illustrates example operations 800 for chunking data blocks from a staging area. A receiving operation 802 receives logical-block-addressed data blocks from a host device or other storage into random access memory. A sorting operation 804 sorts the received data blocks into a predefined order. Example ordering may include without limitation LBA-order, most-frequently-accessed order, most-recently-accessed order, etc.
A writing operation 806 writes the sorted data blocks to the staging area as a set of sorted data blocks (e.g., referred to as sorted chunks). A dynamic mapping operation 808 dynamically maps the LBAs of the data blocks to the corresponding PBAs in the staging area of the data storage.
FIG. 9 illustrates example operations 900 for re-chunking data blocks from a staging area. A reading operation 902 reads a relatively contiguous set of data blocks from different sets of sorted data blocks (e.g., chunks) in the staging area of the data storage. A transfer operation 904 transfers the read data blocks into a random access memory. A sorting operation 906 sorts the transferred data blocks into a predefined order. Example ordering may include without limitation LBA-order, most-frequently-accessed order, most-recently-accessed order, etc.
A writing operation 908 writes the sorted data blocks back to the staging area as a new set of sorted data blocks (e.g., a new chunk). A dynamic re-mapping operation 910 dynamically re-maps the LBAs of the data blocks to the new corresponding physical block addresses in the staging area of the data storage. A marking operation 912 marks the PBAs from which the data blocks were read in the reading operation 902 as stale. A reclamation operation 914 reclaims stale PBAs in the staging area, for example, by re-using the stale PBAs in the staging area to recording other data blocks.
FIG. 10 illustrates example operations 1000 for re-sorting data blocks from a staging area to other intermediate storage. A reading operation 1002 reads a relatively contiguous set of data blocks from different sets of sorted data blocks (e.g., chunks) in the staging area of the data storage. A transfer operation 1004 transfers the read data blocks into a random access memory. A sorting operation 1006 sorts the transferred data blocks into a predefined order. Example ordering may include without limitation LBA-order, most-frequently-accessed order, most-recently-accessed order, etc.
A writing operation 1008 writes the sorted data blocks to another intermediate storage area, to a destination storage area, or to a host device. For example, the sorted data blocks may be written to a different staging area in chunks or to a granule storage area. In another example, the sorted data blocks may be written to a destination storage area of data storage for longer term storage. In yet another example, the sorted data blocks may be transferred to the host device in response to a read command. If the data blocks are re-written to the data storage, a dynamic re-mapping operation 1010 dynamically re-maps the LBAs of the data blocks to the new corresponding physical block addresses in the staging area of the data storage. The operations 1000 may also be supplemented by marking and reclamation operations in appropriate circumstances. For example, if the data blocks are moved to a destination storage area, the PBAs in the staging area previously storing those data blocks may be marked as stale and reclaimed for use with new data blocks. However, in an overprovisioning circumstance, the storage controller may maintain copies of the same data blocks in the storage area, in other intermediate storage areas, and/or in a destination storage area. In this manner, the storage controller can read requested data blocks from storage providing the lowest average access latency. Dynamic mapping maintains the mappings for each LBA-to-PBA relationship and may provide information assisting in the determination of the lowest average access latency for each relationship for a certain read command.
The embodiments of the technology described herein are implemented as logical steps in one or more computer systems. The logical operations of the present technology are implemented (1) as a sequence of processor-implemented steps executing in one or more computer systems and (2) as interconnected machine or circuit modules within one or more computer systems. The embodiment is a matter of choice, dependent on the performance requirements of the computer system implementing the technology. Accordingly, the logical operations making up the embodiments of the technology described herein are referred to variously as operations, steps, objects, or modules. Furthermore, it should be understood that logical operations may be performed in any order, unless explicitly claimed otherwise or a specific order is inherently necessitated by the claim language.
The data storage and/or memory may be embodied by various types of storage, such as hard disc media, a storage array containing multiple storage devices, optical media, solid-state drive technology, ROM, RAM, and other technology. The operations may be implemented in firmware, software, hard-wired circuitry, gate array technology and other technologies, whether executed or assisted by a microprocessor, a microprocessor core, a microcontroller, special purpose circuitry, or other processing technologies. It should be understood that a write controller, a storage controller, data write circuitry, data read and recovery circuitry, a stale data marking module, a sorting module, and other functional modules of a data storage system may include or work in concert with a processor for processing processor-readable instructions for performing a system-implemented process.
The above specification, examples, and data provide a complete description of the structure and use of exemplary embodiments of the technology. Since many embodiments of the technology can be made without departing from the spirit and scope of the technology, the invention resides in the claims hereinafter appended. Furthermore, structural features of the different embodiments may be combined in yet another embodiment without departing from the recited claims.

## Claims

1. A method comprising:
sorting, at a processing node, data blocks of incoming write data received in a random access memory of data storage to generate individually-sorted data block sets, each of the individually-sorted data block sets including data blocks sorted according to a logical block address (LBA) order in a sorting operation of the processing node independent of a separate sorting operation of the processing node for data blocks in any other one of the individually-sorted data block sets; and
writing the individually-sorted data block sets to a staging area of a storage medium included in the data storage.

2. The method of claim 1 further comprising:
dynamically mapping logical block addresses of the written data blocks to new physical block addresses in the staging area of the data storage.

3. The method of claim 1 wherein the writing operation is performed on a number of data blocks constrained by a size of a sortable portion of the random access memory.

4. The method of claim 1 further comprising:
reading into the random access memory the individually-sorted data block sets recorded in the staging area of the data storage;
re-sorting individual data blocks from the individually-sorted data block sets in the random access memory, the re-sorted individual data blocks being grouped in individually-re-sorted data block sets; and
writing the individually-re-sorted data block sets to the staging area.

5. The method of claim 1 further comprising:
reading into the random access memory the individually-sorted data block sets recorded in the staging area of the data storage;
re-sorting individual data blocks from the individually-sorted data block sets in the random-access memory to form individually-re-sorted data block sets; and
writing the individually-re-sorted data block sets to another intermediate storage area.

6. The method of claim 1 further comprising:
reading into the random access memory the individually-sorted data block sets of recorded in the staging area of the data storage;
re-sorting individual data blocks from the individually-sorted data block sets in the random access memory to form individually-re-sorted data block sets; and
writing the individually-re-sorted data block sets to a host device.

7. The method of claim 1 further comprising:
reading into random access memory the individually-sorted data block sets recorded in the staging area of the data storage;
re-sorting the individual data blocks from individually-sorted data block sets in the random access memory to form individually-re-sorted data block sets; and
writing the individually-re-sorted data block sets to a destination storage area.

8. A data storage system comprising:
a data storage medium;
random access memory;
a sorting module communicatively coupled to the random access memory and executable by a single processing node to sort data blocks of incoming write data received in the random access memory to generate individually-sorted data block sets, each of the individually-sorted data block sets including data blocks sorted according to a LBA order in a sorting operation independent of a sorting operation for data blocks in any other one of the individually-sorted data block sets;
a storage controller communicatively coupled to the random access memory and the data storage medium and being configured to write the individually-sorted data block sets to a staging area of the data storage medium.

9. The data storage system of claim 8 wherein the storage controller is further configured to read into the random access memory the individually-sorted data block sets recorded in the staging area of the data storage medium, to re-sort individual data blocks from the individually-sorted data block sets in the random access memory to form individually-re-sorted data block sets.

10. The data storage system of claim 9 wherein the storage controller is further configured to write the individually-re-sorted data block sets to another intermediate storage area.

11. The data storage system of claim 9 wherein the storage controller is further configured to write the individually-re-sorted data block sets to a destination storage area.

12. One or more non-transitory processor-readable storage media storing processor-readable instructions for performing a system-implemented process in a data storage system the process comprises:
sorting data blocks of incoming write data received in a random access memory of data storage to generate individually-sorted data block sets, each of the individually-sorted data block sets including data blocks sorted according to a LBA order in a sorting operation of a processing node independent of a sorting operation of the processing node for data blocks in any other one of the individually-sorted data block sets; and
writing the individually-sorted data block sets to a staging area of a storage medium included in the data storage.

13. The one or more non-transitory processor readable storage media of claim 12 wherein the process further comprises:
dynamically mapping logical block addresses of the written data blocks to new physical block addresses in the staging area of the data storage.

14. The one or more non-transitory processor readable storage media of claim 12 further comprising:
reading into the random access memory the individually-sorted data block sets recorded in the staging area of the data storage;
re-sorting individual data blocks from the individually-sorted data block sets in the random access memory to form individually-re-sorted data block sets; and
writing the individually-re-sorted data block sets to another intermediate storage area.

15. The one or more non-transitory processor readable storage media of claim 12 further comprising:
reading into random access memory the individually-sorted data block sets recorded in the staging area of the data storage;
re-sorting individual data blocks from the individually-sorted data block sets in the random access memory to form individually-re-sorted data block sets; and
writing the individually-re-sorted data block sets to a destination storage area.