# Patent

## Title
Hybrid drive migrating high workload data from disk to non-volatile semiconductor memory

## Abstract

A hybrid drive is disclosed comprising a head actuated over a disk, and a non-volatile semiconductor memory (NVSM). Access commands are received from a host including disk read commands. When a high workload of disk access commands is detected, data of at least one disk read command is migrated to the NVSM.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
The present application claims priority from provisional U.S. Patent Application Ser. No. 61/373,729, filed on Aug. 13, 2010, the specification of which is incorporated herein by reference.


BACKGROUND
Hybrid drives are conventional disk drives augmented with a non-volatile semiconductor memory (NVSM) such as a flash which helps improve certain aspects of the disk drive. For example, the non-volatile semiconductor memory may store boot data in order to expedite the boot operation of a host computer. Another use of a NVSM may be to store frequently accessed data and/or non-sequential data for which the access time is typically much shorter than the disk (which suffers from mechanical latency including seek and rotational latency). Other policies may reduce write amplification of the NVSM in order to maximize its longevity, such as storing frequently written data to the disk (or data having a write/read ratio that exceeds a predetermined threshold).



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1A shows a hybrid drive according to an embodiment of the present invention comprising a head actuated over a disk, and a non-volatile semiconductor memory (NVSM).
FIG. 1B is a flow diagram according to an embodiment of the present invention wherein when a high workload of disk access commands is detected, data of at least one disk read command is migrated to the NVSM.
FIG. 2A shows an embodiment of the present invention wherein the high workload of disk access command is determined from the execution time of a disk command queue.
FIG. 2B shows an embodiment wherein after migrating disk read commands to the NVSM, the resulting execution time for the disk command queue is reduced when the command sequence is received again.
FIG. 3 is a flow diagram according to an embodiment of the present invention wherein data of disk read commands is migrated to the NVSM when the execution time of the disk command queue is greater than a threshold, and the execution time of an NVSM command queue is less than a threshold.
FIG. 4 is a flow diagram according to an embodiment of the present invention wherein data of a repeated command sequence is migrated to the NVSM.
FIG. 5 is a flow diagram according to an embodiment of the present invention wherein when a repeated command sequence is predicted, NVSM access commands are transferred to the disk command queue in order to facilitate the upcoming repeated command sequence.
FIG. 6 is a flow diagram according to an embodiment of the present invention wherein during an idle mode the read commands of infrequently received command sequences are migrated from the NVSM back to the disk in order to free up space in the NVSM.
FIG. 7 is a flow diagram according to an embodiment of the present invention wherein data of a disk read command is migrated to the NVSM based on a migration policy.



DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION
FIG. 1A shows a hybrid drive according to an embodiment of the present invention comprising a head 2 actuated over a disk 4, and a non-volatile semiconductor memory (NVSM) 6. The hybrid drive further comprises control circuitry 8 operable to execute the flow diagram of FIG. 1B, wherein a plurality of access commands are received from a host (step 10) and evaluated to detect a high workload of disk access commands (step 12). When the high workload of disk access commands is detected (step 14), data of at least one disk read command is migrated to the NVSM (step 16). In the embodiment of FIG. 1A, the disk 4 comprises embedded servo sectors 200-20N that define data tracks 18 each comprising a number of data sectors. The control circuitry 8 processes a read signal 22 emanating from the head 2 to demodulate the servo sectors 200-20N and generate a position error signal (PES) representing an error between the actual position of the head and a target position relative to a target track. The control circuitry 8 filters the PES using a suitable compensation filter to generate a control signal 24 applied to a voice coil motor (VCM) 26 which rotates an actuator arm 28 about a pivot in order to actuate the head 2 radially over the disk in a direction that reduces the PES.
Any suitable NVSM 6 may be employed in the embodiments of the present invention such as a suitable flash memory. In one embodiment, the NVSM 6 comprises a plurality of blocks, wherein each block comprises a plurality of memory segments referred to as pages, and each page may store one or more data sectors. The blocks are programmed a page at a time, and an entire block is erased in a unitary operation. In one embodiment, there is a limit to the number of times the blocks of the NVSM may be programmed and erased (referred to as endurance). When the NVSM reaches the limit of program/erase cycles it essentially reaches end of life (for subsequent write operations). Accordingly, in one embodiment of the present invention the NVSM is used sparingly to improve performance, such as when servicing non-sequential access commands, to store frequently read data, or to alleviate the workload on the disk in order to increase throughput.
In one embodiment, the data of access commands are originally mapped to either the NVSM or the disk based on a suitable migration policy. For example, the migration policy may originally map data of non-sequential commands to the NVSM and the data of sequential commands on the disk. When a high workload of disk access commands is detected, the data of one or more of the read commands originally mapped to the disk is migrated to the NVSM in order to alleviate the workload on the disk and increase throughput.
The high workload of disk access commands may be detected in any suitable manner. In one embodiment, the frequency of disk access commands may be used to detect a high workload, for example, when the frequency of disk access commands exceeds a threshold. The frequency may be of the disk access commands, or of the amount of data in the disk access commands. In another embodiment, the control circuitry may generate a NVSM command queue 30 (FIG. 1A) for storing NVSM access commands, and a disk command queue 32 for storing disk access commands. An execution time for the disk access commands in the disk command queue is determined, which may be based on the amount of data in the disk access commands as well as the mechanical latency (seek and rotational latency) required to execute the disk access commands. The high workload may be detected when the execution time for the disk command queue exceeds a threshold.
FIG. 2A shows an embodiment of the present invention wherein the execution time for the disk command queue indicates a high workload, and therefore a number of the disk read commands pending in the disk command queue are selected for migration to the NVSM. In one embodiment, the migration is carried out by reading the data from the disk, writing the data to the NVSM, and updating mapping information (logical block address (LBA) to physical block address (PBA)) so that the read commands are subsequently serviced by the NVSM. FIG. 2B illustrates the same command sequence received from the host at a later time, wherein the migrated read commands reduce the execution time for the disk command queue. Any number of read commands may be migrated from the disk command queue to the NVSM, and in one embodiment, a number of read commands is selected that balances the execution time for the disk command queue and the NVSM command queue. In one embodiment, the access commands in the disk command queue and the NVSM command queue are executed concurrently so that balancing the execution times maximizes the throughput of the hybrid drive.
FIG. 3 is a flow diagram according to an embodiment of the present invention wherein an execution time is estimated for the disk command queue and the NVSM command queue (step 34). If the execution time for the disk command queue is greater than a threshold (step 36), and the execution time for the NVSM command queue is less than a threshold (step 38), then the data for at least one read command in the disk command queue is migrated to the NVSM (step 40).
In one embodiment, after migrating the data of a disk read command to the NVSM, the data may be read from either the NVSM or the disk when servicing subsequent read commands. For example, reading the data from the disk may provide better performance if the NVSM is busy servicing other access commands. In another embodiment, the copy of the data stored on the disk can be used as a backup in the event the data stored in the NVSM is unrecoverable.
FIG. 4 is a flow diagram according to an embodiment of the present invention wherein the execution time for the disk command queue is estimated (step 42), and when it exceeds a threshold (step 44), the disk access commands in the disk command queue are evaluated to determine whether a command sequence has repeated at least once (step 46). When it is determined that the command sequence is a repeating command sequence (step 48), the command sequence is saved (step 50) and the data for at least one of the disk read commands within the command sequence is migrated to the NVSM (step 52). A repeating command sequence may be detected by evaluating the disk command queue each time the execution time exceeds a threshold, and identifying repeated disk access commands. A command sequence may be repeated, for example, each time a particular application is launched (e.g., in order to read configuration files). Migrating the data of read commands for repeated command sequences to the NVSM improves performance of the hybrid drive, for example, by decreasing application load time.
FIG. 5 is a flow diagram according to an embodiment of the present invention wherein access commands received from the host are stored in the NVSM command queue and the disk command queue (step 54). When a repeated command sequence is predicted to occur (step 56), at least one access command is transferred from the NVSM command queue to the disk command queue (step 58) in order to facilitate the upcoming repeated command sequence. The access commands transferred to the disk command queue may be write commands initially mapped to the NVSM, or read commands initially mapped to the NVSM (if the data is duplicated on the disk).
FIG. 6 is a flow diagram according to an embodiment of the present invention wherein when the hybrid drive is idle (step 60) (not servicing access commands) and/or when the remaining free space in the NVSM falls below a threshold, the saved command sequences are evaluated to select a command sequence that is infrequently repeated (step 62). The data of at least one read command in the command sequence is then migrated back to the disk (step 64) in order to free up space in the NVSM. In one embodiment, if a copy of the data is already on the disk, migrating the data from the NVSM to the disk involves merely updating the LBA to PBA mapping. In another embodiment, if the copy of data on the disk has become invalid (e.g., due to a write operation serviced by the NVSM), the valid data stored in the NVSM is copied to the disk in addition to updating the LBA to PBA mapping. In yet another embodiment, data may be migrated to the disk during write operations by writing new data to the disk and invalidating the corresponding old data stored in the NVSM.
FIG. 7 is a flow diagram according to an embodiment of the present invention wherein the execution time for the access commands in the command queue is estimated (step 66), and when it exceeds a threshold (step 68), the data of at least one disk read command is migrated to the NVSM based on a migration policy. In one embodiment, the migration policy is similar to the migration policy that initially maps data to either the NVSM or the disk based on parameters such as the sequential/non-sequential nature of the access commands and/or frequency of the access commands. When a high workload of disk access commands is detected, the migration policy parameters are biased so that at least one read command initially mapped to the disk is remapped to the NVSM in order to migrate the data to the NVSM. In another embodiment, the migration policy may be based on a proximity of the data on the disk. For example, near sequential data on the disk may be selected for migration to the NVSM so as to reduce the access latency to other data recorded on the disk. In another embodiment, the data selected for migration may correspond to read commands that minimize access time to other data based on a rotational position optimization (RPO) algorithm. An RPO algorithm attempts to execute the disk access commands in the disk command queue in a sequence that minimizes the access latency (seek and rotation latency). Accordingly, in one embodiment the disk read commands are selected from the disk command queue for migration to the NVSM so that the remaining sequence of disk access commands can be executed with minimal access latency. In yet another embodiment, the migration policy may select data to migrate to the NVSM based on a proximity of LBAs in the disk read commands. For example, sequential or near sequential LBAs may be selected for migration since they are typically associated with individual files accessed by the host.
Any suitable control circuitry may be employed to implement the flow diagrams in the embodiments of the present invention, such as any suitable integrated circuit or circuits. For example, the control circuitry may be implemented within a read channel integrated circuit, or in a component separate from the read channel, such as a disk controller and/or NVSM controller, or certain steps described above may be performed by a read channel and others by a disk controller and/or NVSM controller. In one embodiment, the read channel and controllers are implemented as separate integrated circuits, and in an alternative embodiment they are fabricated into a single integrated circuit or system on a chip (SOC). In addition, the control circuitry may include a suitable preamp circuit implemented as a separate integrated circuit, integrated into the read channel or disk controller circuit, or integrated into an SOC.
In one embodiment, the control circuitry comprises a microprocessor executing instructions, the instructions being operable to cause the microprocessor to perform the steps of the flow diagrams described herein. The instructions may be stored in any computer-readable medium. In one embodiment, they may be stored on a non-volatile semiconductor memory external to the microprocessor, or integrated with the microprocessor in a SOC. In another embodiment, the instructions are stored on the disk and read into a volatile semiconductor memory when the hybrid drive is powered on. In yet another embodiment, the control circuitry comprises suitable logic circuitry, such as state machine circuitry.

## Claims

1. A hybrid drive comprising:
a disk;
a head actuated over the disk;
a non-volatile semiconductor memory (NVSM); and
control circuitry operable to:
receive a plurality of access commands from a host including a plurality of disk access commands and a plurality of NVSM access commands, wherein the disk access commands include a disk read command;
generate a disk command queue operable to store the disk access commands;
estimate a first execution time needed to execute the disk access commands in the disk command queue;
detect a high workload of disk access commands when the first execution time exceeds a first threshold; and
when the high workload is detected, migrate data of the disk read command to the NVSM because the disk read command is in the disk command queue when the high workload of disk access commands is detected.

2. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to:
generate a NVSM command queue operable to store the NVSM access commands;
estimate a second execution time needed to execute the NVSM access commands in the NVSM command queue; and
when the first execution time is greater than the first threshold and the second execution time is less than a second threshold, migrate the data of the disk read command in the disk command queue to the NVSM.

3. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to:
evaluate the access commands to detect a command sequence executed at least twice when the high workload is detected; and
when the high workload is detected and the command sequence is detected, migrate the data of the disk read command to the NVSM.

4. The hybrid drive as recited in claim 3, wherein the control circuitry is further operable to:
evaluate the access commands to predict the command sequence is to occur; and
when the command sequence is predicted, transfer at least one NVSM access command from an NVSM command queue to the disk command queue.

5. The hybrid drive as recited in claim 3, wherein the control circuitry is further operable to:
track a frequency that the command sequence is received from the host; and
when the frequency falls below a threshold, migrate data associated with the command sequence from the NVSM to the disk.

6. The hybrid drive as recited in claim 1, wherein the control circuitry is further operable to migrate the data of the disk read command based on a migration policy.

7. The hybrid drive as recited in claim 6, wherein the migration policy is based on a proximity of the data recorded on the disk.

8. The hybrid drive as recited in claim 6, wherein the migration policy is based on a proximity of logical block addresses (LBAs) in the access commands.

9. A method of operating a hybrid drive comprising a head actuated over a disk, and a non-volatile semiconductor memory (NVSM), the method comprising:
receiving a plurality of access commands from a host including a plurality of disk access commands and a plurality of NVSM access commands, wherein the disk access commands include a disk read command;
generating a disk command queue operable to store the disk access commands;
estimating a first execution time needed to execute the disk access commands in the disk command queue;
detecting a high workload of disk access commands when the first execution time exceeds a first threshold; and
when the high workload is detected, migrating data of the disk read command to the NVSM because the disk read command is in the disk command queue when the high workload of disk access commands is detected.

10. The method as recited in claim 9, further comprising:
generating a NVSM command queue operable to store the NVSM access commands;
estimating a second execution time needed to execute the NVSM access commands in the NVSM command queue; and
when the first execution time is greater than the first threshold and the second execution time is less than a second threshold, migrating the data of the disk read command in the disk command queue to the NVSM.

11. The method as recited in claim 9, further comprising:
evaluating the access commands to detect a command sequence executed at least twice when the high workload is detected; and
when the high workload is detected and the command sequence is detected, migrating the data of the disk read command to the NVSM.

12. The method as recited in claim 11, further comprising:
evaluating the access commands to predict the command sequence is to occur; and
when the command sequence is predicted, transferring at least one NVSM access command from an NVSM command queue to the disk command queue.

13. The method as recited in claim 12, further comprising:
tracking a frequency that the command sequence is received from the host; and
when the frequency falls below a threshold, migrating data associated with the command sequence from the NVSM to the disk.

14. The method as recited in claim 9, further comprising migrating the data of the disk read command based on a migration policy.

15. The method as recited in claim 14, wherein the migration policy is based on a proximity of the data recorded on the disk.

16. The method as recited in claim 14, wherein the migration policy is based on a proximity of logical block addresses (LBAs) in the access commands.