Magnetic disk device
By employing a B+ tree structure in the disk device to manage unprocessed commands and selecting the command closest to the currently accessed region, the problem of long command search time is solved, achieving efficient data writing and reading.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2026-03-13
AI Technical Summary
Existing disk devices may experience long command search times when reordering commands, resulting in low data writing and reading efficiency.
The database uses a B+ tree structure to store unprocessed commands. Commands are managed through the tree-structured nodes, and the command closest to the currently accessed region is selected as the candidate command, thereby improving command search efficiency.
By optimizing the command search process, the data writing and reading efficiency of the disk device has been improved, ensuring data integration and high-speed operation.
Smart Images

Figure CN121662093A_ABST
Abstract
Description
[0001] This application enjoys priority based on Japanese Patent Application No. 2024-158116 (filed on September 12, 2024). This application incorporates the entire contents of the basic application by reference to that basic application. Technical Field
[0002] Embodiments of the present invention relate to disk drives. Background Technology
[0003] Examples of disk devices include HDDs (Hard Disk Drives). During the writing and reading of data from the disk, disk devices also receive commands from external sources. From the perspective of maintaining data integrity, these commands can be managed using queues; that is, they can be managed according to the order in which they are received.
[0004] On the other hand, to improve the speed of disk device operations, efficient data writing and reading are required. For this purpose, there exists a technique that selects the command indicating access to a region on the disk closer to the currently accessed region as the next command to be executed. This technique is called reordering. To perform reordering, commands in the queue are searched. Command searching can take time. Summary of the Invention
[0005] Embodiments of the present invention provide a disk device capable of efficiently searching commands.
[0006] According to this embodiment, the disk device includes a disk, a memory, and a controller. The disk includes multiple regions, each assigned a unique address. The memory stores multiple unprocessed commands. The controller stores a tree-structured database in the memory. The structure includes multiple nodes associated with multiple addresses specified by each of the multiple unprocessed commands, and two nodes are associated with each other. The controller selects candidate commands from commands associated with addresses greater than and closest to the start address and commands associated with addresses less than and closest to the start address, the candidate commands being the next to be executed among the multiple unprocessed commands. Attached Figure Description
[0007] Figure 1 The hardware configuration of the disk device according to the first embodiment is shown.
[0008] Figure 2 An example of a region of the disk drive of the disk drive according to the first embodiment is shown.
[0009] Figure 3An example of the address of a region of the disk in the disk device according to the first embodiment is shown.
[0010] Figure 4 The functional configuration of the disk device according to the first embodiment is shown.
[0011] Figure 5 An example of a data structure used in the disk device according to the first embodiment is shown.
[0012] Figure 6 An example of a state of a database in a disk device according to the first embodiment is shown.
[0013] Figure 7 An example of a state of a database in a disk device according to the first embodiment is shown.
[0014] Figure 8 An example of a state of a database in a disk device according to the first embodiment is shown.
[0015] Figure 9 The flow chart illustrates a certain operation in the disk device according to the first embodiment.
[0016] Figure 10 The flow chart illustrates a certain operation in the disk device according to the first embodiment.
[0017] Figure 11 An example of the execution cost at a certain point in time in the disk device according to the first embodiment is shown.
[0018] Figure 12 The functional configuration of the disk device according to the second embodiment is shown.
[0019] Figure 13 An example of data obtained from a disk device according to the second embodiment is shown.
[0020] Figure 14 An example of a filter used in the disk device according to the second embodiment is shown.
[0021] Figure 15 An example of data obtained from a disk device according to the second embodiment is shown.
[0022] Figure 16 The flowchart of a certain operation of the disk device according to the second embodiment is shown.
[0023] Figure 17 The flow chart illustrates a certain operation in the disk device according to the second embodiment.
[0024] Explanation of reference numerals in the attached figures
[0025] 1…Disk drive, 2…Host device, 11…Disk, 12…Spindle motor, 13…Arm, 14…Head, 15…Voice coil motor, 16…Motor driver, 17…Head amplifier, 18…RW channel, 21…CPU, 22…ROM, 23…RAM, 24…Buffer memory, 25…HDD controller, 31…RW control unit, 32…Database, 33…Database operation unit, 34…Command search unit, 35…Command selection unit Detailed Implementation
[0026] Hereinafter, embodiments will be described with reference to the accompanying drawings. In subsequent embodiments of a previously described embodiment, the differences from the previously described embodiment will be mainly described. All descriptions of a particular embodiment, unless explicitly or obviously excluded, also apply to the descriptions of other embodiments.
[0027] 1. First Implementation Method
[0028] Figure 1 The hardware configuration of the disk drive according to the first embodiment is shown. The disk drive 1 is a device for storing data based on the magnetization of a magnetic material. The disk drive 1 communicates with a host device 2 via a communication method based on any standard. Examples of the host device 2 include a personal computer. The disk drive 1 is connected to the host device 2 via wiring based on the communication method followed by the disk drive. Examples of the communication method include SATA (Serial Advanced Technology Attachment). The disk drive 1 receives commands from the host device 2 and performs actions based on the commands. Based on the commands, the disk drive 1 stores data supplied from the host device 2. Additionally, based on the commands, the disk drive 1 sends the data stored on the disk drive 1 to the host device 2.
[0029] like Figure 1 As shown, the disk drive 1 includes components such as a disk 11, a spindle motor 12, an arm 13, a read / write head 14, a voice coil motor 15, a motor driver 16, a head amplifier 17, an RW channel 18, a CPU 21, a ROM 22, a RAM 23, a buffer memory 24, and an HDD controller 25.
[0030] Disk 11 is a disk-shaped storage medium for storing data. Disk 11 uses magnetic material to store data on its recording surface. Disk device 1 may include two or more disks 11.
[0031] The spindle motor 12 is a device that rotates the disk 11. The spindle motor 12 has a rotating shaft and a drive unit. The spindle motor 12 holds the disk 11 via the rotating shaft. The rotating shaft is connected to the center of the disk 11, and the disk 11 rotates around the rotating shaft as it rotates. The drive unit drives the rotating shaft, causing it to rotate.
[0032] Arm 13 is a component that holds the magnetic head 14. Arm 13 has a rod-like shape and holds the magnetic head 14 at its front end.
[0033] The read / write head 14 is a component used for writing data to and reading data from the disk 11. The read / write head 14 is mounted at the front end of the arm. The read / write head 14 contains magnetic material. The read / write head 14 is located slightly separated from the recording surface of the disk 11 by the arm 13. The read / write head 14 includes a write element 14w and a read element 14r.
[0034] The write element 14w writes data by changing the magnetization state of the area to be written to on the disk 11. The write data is the data to be stored in the area to be written. The write element 14w receives a write current and, based on the write current, changes the magnetization of the area to be written.
[0035] The reading element 14r generates a reading signal based on the data stored in the area to be read, based on the magnetization state of the reading element 14r and the magnetization state of the area to be read from the disk 11.
[0036] The voice coil motor 15 is a motor that mechanically drives an object based on an electrical signal. The voice coil motor 15 causes the arm 13 to move along the radius of the disk 11. The radius direction is the direction along the radius of the disk 11.
[0037] Motor driver 16 is a circuit that controls the drive of spindle motor 12 and voice coil motor 15. Motor driver 16 receives electrical signals and generates control signals based on the received signals. The generated control signals include information for controlling the drive of spindle motor 12 and information for controlling the drive of voice coil motor 15. Motor driver 16 is controlled by CPU 21, which executes the program. In one example, motor driver 16 has the form of an integrated circuit (IC) chip.
[0038] The head amplifier 17 is a circuit that performs processes for writing data to and reading data from the disk 11. The head amplifier 17 includes a read amplifier and a write driver. The read amplifier receives a read signal from the read element 14r and amplifies the read signal. The write driver receives a signal based on the write data stored in the disk 11 and generates a write current based on the received signal. The write current is provided to the write element 14w. In one example, the head amplifier 17 has the form of an IC chip.
[0039] RW channel 18 is a signal processing circuit. RW channel 18 receives write data from HDD controller 25 or buffer memory 24, modulates (or converts to analog form) the write data, and generates a signal based on the write data. RW channel 18 supplies the generated signal to the write driver of head amplifier 17. RW channel 18 receives the amplified read signal from head amplifier 17. RW channel 18 demodulates (or converts to digital form) the received read signal to generate read data. The read data is then supplied to HDD controller 25 or buffer memory 24.
[0040] CPU 21 is an integrated circuit capable of executing various programs. Through program execution, CPU 21 controls and executes the overall operation of disk drive 1. By executing programs (or firmware) stored in ROM 22 and loaded into RAM 23, CPU 21 performs various actions, functioning as various functional blocks (described later). Furthermore, by executing programs stored in ROM 22 and loaded into RAM 23, CPU 21 controls motor driver 16 and head amplifier 17.
[0041] ROM22 is a non-volatile memory that stores programs (or firmware) and control data for implementing a portion of the functions of disk device 1 and controlling disk device 1.
[0042] RAM23 is volatile memory used to temporarily store data. RAM23 also functions as the working area of CPU21. Examples of RAM23 include DRAM (Dynamic Random Access Memory) and SRAM (Static Random Access Memory).
[0043] Buffer memory 24 is a semiconductor memory that temporarily stores data and commands transmitted and received between disk device 1 and host device 2. Examples of buffer memory 24 include DRAM and SRAM. Buffer memory 24 and RAM 23 can be integrated. That is, a portion of the storage area of RAM 23 can be used as buffer memory 24. Buffer memory 24 includes an area that functions as a command queue 241.
[0044] Command queue 241 temporarily stores commands received by disk device 1 from host device 2. Command queue 241 outputs commands received by disk device 1 in the order of receipt. Commands include write commands and read commands. A write command specifies the area of data to be written on disk 11 by its starting address and size. Based on read commands, disk device 1 sends the data stored on disk device 1 to host device 2. A read command specifies the area of data to be read on disk 11 by its starting address and size. Commands stored in command queue 241 are unprocessed (or, not executed) commands, hereinafter sometimes referred to as unprocessed commands.
[0045] HDD controller 25 is an interface for controlling the transmission and reception of signals between disk drive 1 and host device 2. HDD controller 25 includes circuitry and terminals (or connectors) for wiring connections to enable communication with host device 2. HDD controller 25 supplies write data received from host device 2 to buffer memory 24 and / or RAM 23. HDD controller 25 receives read data from buffer memory 24 and / or RAM 23 and sends the read data to host device 2. HDD controller 25 supplies commands received from host device 2 to buffer memory 24. Part of the functionality of HDD controller 25 can be implemented by CPU 21 executing a program loaded onto RAM 23.
[0046] Figure 2 An example of a region of the disk drive in the disk device according to the first embodiment is shown. For example... Figure 2 As shown, the recording surface of disk 11 contains multiple tracks TR. Figure 2 Examples of six tracks (TRs) are shown: TR_1, TR_2, TR_3, TR_4, TR_5, and TR_6. Tracks TR are loops with different radii. The centers of the tracks TR are common. Figure 2 In the example, tracks TR_1, TR_2, TR_3, TR_4, TR_5, and TR_6 are located further away from the center in this order. Two tracks TR are adjacent.
[0047] In one example, disk 11 rotates clockwise in one of two directions along its circumference. As disk 11 rotates, read / write head 14 moves relative to disk 11. The direction of disk 11's rotation is sometimes referred to as the rotation direction.
[0048] Figure 3 An example of the address of a region of the disk in the disk device according to the first embodiment is shown. For example... Figure 3As shown, each track TR is further divided into multiple unit regions UA. Each unit region UA can store data of the same size. Examples of unit regions UA contain one or more sectors. Each unit region UA is assigned a unique address. Examples of addresses include LBA (Logical Block Address). In one example, on each track TR, addresses are assigned to the unit regions UA arranged in the rotation direction in ascending order. That is, in Figure 3 In the example, the unit regions UA of track TR_1 arranged in the rotational direction have any address greater than 0 and less than n, with the larger address value in that order. n is a positive integer. The unit regions UA of track TR_2 arranged in the rotational direction have any address greater than n+1 and less than m, with the larger address value in that order. m is a positive integer greater than n+1. The same applies to other tracks TR, such as TR_3. Figure 3 The servo area is omitted here. The servo area is the area extending radially from the center of disk 11, used for positioning the read / write head 14 relative to disk 11, and not used for data storage.
[0049] Figure 4 The functional configuration (functional blocks) of the disk device according to the first embodiment is shown. During operation, the disk device 1 has components consisting of… Figure 4 The functions performed by the functional blocks shown and described below are as follows. The functional blocks in each embodiment do not necessarily need to be distinguished as in the examples below. A portion of the function may be performed by a different functional block than the illustrated functional block, or it may be divided into smaller functional sub-blocks.
[0050] like Figure 4 As shown, the disk drive 1 includes a motor driver 16, a head amplifier 17, an RW channel 18, an HDD controller 25, an RW control unit 31, a database 32, a database operation unit 33, a command search unit 34, and a command selection unit 35. In one example, the database 32 is implemented using the storage space of RAM 23. In another example, the database operation unit 33, the command search unit 34, and the command selection unit 35 are implemented by the CPU 21 executing a program loaded from ROM 22 onto RAM 23.
[0051] RW control unit 31 is a functional block that controls the overall reading and writing of data in disk device 1. RW control unit 31 controls motor driver 16 and head amplifier 17 based on the executing read or write commands. RW control unit 31 controls RW channel 18 based on the read or write commands. RW control unit 31 also controls reordering processing. That is, RW control unit 31 selects unprocessed commands from the unprocessed commands stored in command queue 241 that are considered efficient to execute next, and executes those unprocessed commands. Details regarding the selection of unprocessed commands will be described later. RW control unit 31 initiates reordering processing under arbitrary program-based conditions.
[0052] Database 32 is management data used to manage unprocessed commands in command queue 241.
[0053] The database operation unit 33 is a function block that operates and updates the database based on appending and deleting commands to the command queue 241. As an unprocessed command is appended to the command queue 241, the database operation unit 33 appends data about the appended unprocessed command to the database 32. As the unprocessed command is deleted from the command queue 241 due to execution, the database operation unit 33 deletes data about the deleted command from the database 32.
[0054] Command search unit 34 is a function block that uses database 32 to search for unprocessed commands that meet certain conditions. Command search unit 34 receives command selection requests from RW control unit 31. Command selection requests request the selection of unprocessed commands based on a certain condition. Command search unit 34 outputs unprocessed commands found based on the specified condition as candidate commands from command queue 241.
[0055] The command selection unit 35 is a function block that selects the predetermined command to be executed next after the currently executing command. Hereinafter, the command to be executed next after the currently executing command is sometimes referred to as the next command. The command selection unit 35 receives candidate commands. The command selection unit 35 compares the candidate commands with the current next command and selects the latest next command based on the comparison result. The latest next command is received by the RW control unit 31. When the RW control unit 31 becomes capable of executing new unprocessed commands, it executes the current next command.
[0056] One or more or all of the HDD controller 25, RW control unit 31, database operation unit 33, command search unit 34, and command selection unit 35 can be understood as a control unit or controller.
[0057] Figure 5An example of a data structure used in the disk device according to the first embodiment is shown. The data in database 32 is structured in the form of a B+ tree extension. The B+ tree is a data structure widely used in the field of databases. Figure 5 An example of the data structure in database 32 is shown.
[0058] In database 32, multiple nodes are structured in a tree (or hierarchical) form. Node types include leaf nodes (NL) and parent nodes (NP). Leaf nodes (NL) are nodes that can be associated with unprocessed commands (CMD). Parent nodes (NP) are nodes that are not associated with unprocessed commands (CMD) and are nodes located at a higher level than leaf nodes (NL). Parent nodes (NP) can span more than two levels.
[0059] Each parent node NP includes one or more keys K and two branches BR associated with one key K. In the diagram, the two branches BR are shown to the lower left and lower right of the associated key K. Branch BR may contain pointers P. The lower left pointer P of the two pointers P associated with a key K of a parent node NP has a value that refers to the parent node NP or leaf node NL containing a key K with a value smaller than that key K. The lower right pointer P of the two pointers P associated with a key K of a parent node NP has a value that refers to the parent node NP or leaf node NL containing a key K with a value greater than that key K. In the case where a parent node NP contains two keys K, the lower right pointer P of the key K with the smaller value and the lower left pointer P of the key K with the larger value are shared.
[0060] exist Figure 5 In the example, the branch BR associated with the key K of parent node NP_1 ("33") contains pointer P_1 to its lower left. Pointer P_1 refers to the parent node NP_2, which contains a key K with a value less than "33". The branch BR associated with the key K of "33", which contains pointer P_2 to its lower right. Pointer P_2 refers to the parent node NP_3, which contains a key K with a value greater than "33". Figure 5 In the example, parent node NP_2 contains key K with "10" and key K with "27", and parent node NP_3 contains key K with "40".
[0061] Leaf nodes NL also contain keys KE. Each leaf node NL contains the same number of keys KE as the number of keys K. Each key KE is associated with one key K and one branch BR. A branch BR may contain a pointer P that refers to an unprocessed command CMD, and thus can be associated with an unprocessed command CMD. Thus, in a leaf node NL, one key KE, one key K, and one pointer P (and consequently, the unprocessed command CMD referenced by pointer P) are associated with each other. Each key K has a start address as its value, specified by the unprocessed command CMD associated with that key K. Each key KE has a terminal address as its value, specified by the unprocessed command CMD associated with that key KE. The terminal address of a command is the address of the unit area UA of the terminal that contains the area specified by that command. As described above, the command CMD specifies the target area to be processed by its start address and size. Thus, the terminal address can be known based on the start address and size.
[0062] exist Figure 5 In the example, the key K and key KE of "10" are associated with the unprocessed command CMD2 via pointer P_3. The key K of "27" and key KE of "28" are associated with the unprocessed command CMD3. The key K of "33" and key KE of "33" are associated with the unprocessed command CMD4. The key K of "40" and key KE of "40" are associated with the unprocessed command CMD5.
[0063] Each leaf node NL is associated with one or two other leaf nodes NL via a pointer Pb. More specifically, a first leaf node NL is associated via pointer Pb with a second leaf node NL containing a key K that is greater than or equal to the minimum value of the key K contained in the first leaf node NL. Additionally, a first leaf node NL is associated via pointer Pb with a second leaf node NL containing a key K that is less than or equal to the maximum value of the key K contained in the first leaf node NL.
[0064] A branch BR of a leaf node NL can contain a pointer P that references an extended node NE. Regarding the extended node NE, when a leaf node NL containing a certain key K and key KE exists, it is created along with pointer P when a command is received via disk device 1 specifying an address within a range above the value of key K and below the value of key KE. That is, the extended node NE referenced from a leaf node NL is created later than the creation of that leaf node NL. Figure 5 In the example, leaf node NL_1 contains a pointer P_4 that points to the extended node NE_1.
[0065] The extended node NE contains a pointer P, which points to the leaf node NL containing values of key K that are above the value of key K and below the value of key KE contained in the leaf node NL that references the extended node NE. Figure 5 In the example, the extended node NE_1 contains a pointer P_5 to the leaf node NL_2. The leaf node NL_2 contains the key K for "0" and the key KE for "3", and also contains a pointer to the unprocessed command CMD1 specifying addresses from "0" to "3". Figure 5 In the example, the extended node NE_1 also contains a pointer P_6 to the leaf node NL_3. Leaf node NL_3 contains the key K for "5" and the key KE for "7", and a pointer to the unprocessed command CMD6 specifying addresses from "5" to "7". Leaf node NL_3 also contains the key K for "8" and the key KE for "9", and a pointer to the unprocessed command CMD7 specifying addresses from "8" to "9".
[0066] As described above, an extended node NE referenced from a first leaf node NL is created after the first leaf node NL is created. Furthermore, a second leaf node NL referenced from the extended node NE is created either together with the extended node NE or after the extended node NE is created. Therefore, an unprocessed command CMD associated with the second leaf node NL referenced from the extended node NE is received after an unprocessed command CMD associated with the first leaf node NL referencing the extended node NE.
[0067] When a leaf node NL, which references an extended node NE and contains a key K and a key KE, exists, and a command is received via disk device 1 specifying an address within a range above the value of key K and below the value of key KE, a further extended node NE is created along with a pointer P. Figure 5 In the example, with leaf node NL_2 containing key K with "0" and key KE with "3" and leaf node NL_3 containing key K with "5" and key KE with "7", an unprocessed command CMD8 specifying start address "4" and end address "5" is received. Therefore, based on the received unprocessed command CMD8, an extended node NE_2 referenced from extended node NE_1 is created. Extended node NE_2 references leaf node NL_4 through pointer P_7. Leaf node NL_4 contains key K with "4" and key KE with "5". The key K with "4" in leaf node NL_4 contains a pointer to command CMD8 specifying start address "4" and end address "5".
[0068] As described above, an unprocessed command (e.g., unprocessed command CMD8) associated with a leaf node NL referenced from a second extended node NE that references a first extended node NE is received after an unprocessed command (e.g., unprocessed commands CMD6 and CMD7) associated with a leaf node NL referenced from an extended node NE.
[0069] When a further command CMD is received via disk device 1 while unprocessed command CMDs are stored in command queue 241, the B+ tree of database 32 is modified by database operation unit 33. If the received command CMD specifies an address that does not overlap with the address portion specified by the unprocessed command CMD associated with leaf node NL, leaf node NL is appended. The appending of leaf node NL is the same as the appending of leaf node NL in a normal B+ tree.
[0070] When an unprocessed command CMD stored in command queue 241 is executed, the B+ tree of database 32 is modified by database operation unit 33. If the executed command CMD is associated with a leaf node NL that is not associated with the extended node NE, the leaf node NL is deleted. The deletion of leaf node NL is the same as the deletion of leaf node NL in a normal B+ tree.
[0071] Next, refer to Figures 5-7 This describes an example of adding leaf node NL and extension node NE in disk device 1. Figure 6 and Figure 7 An example of a state of a database in a disk device according to the first embodiment is shown.
[0072] Figure 6 Show Figure 5 The state shown is the state before leaf nodes NL_2, NL3, and NL4 were created, and the state before leaf node NL_1 was created. Figure 5 The difference lies in the fact that leaf node NL_1 contains a key K of "0" and a key KE of "3", and is associated with the unprocessed command CMD1, which specifies the start address "0" and the end address "3". Figure 6 In the indicated state, commands CMD6 and CMD7 are stored in command queue 241. (See reference...) Figure 5 As previously described, the unprocessed command CMD6 specifies the start address "5" and the end address "7", and the unprocessed command CMD7 specifies the start address "8" and the end address "9". A portion of the specified address range at least partially overlaps with the range from the start address represented by key K of leaf node NL_1 to the end address represented by key KE. Based on this, database 32 is changed to... Figure 7 The state shown.
[0073] That is, a pointer P_4 is created in leaf node NL_1, which is associated with unprocessed command CMD1, whose address range partially overlaps with the address range specified by unprocessed commands CMD6 and CMD7. Pointer P_4 references extended node NE_1. Additionally, a pointer P_5 is created in extended node NE_1, and a leaf node NL_2 is created that is referenced by pointer P_5. Furthermore, a pointer P_6 is created from extended node NE_1, and a leaf node NL_3 is created that is referenced by pointer P_6. (See reference...) Figure 5 As previously described, leaf node NL_2 contains the key K of "0", the key KE of "3", and a pointer to the unprocessed command CMD1 specifying the start address "0" and the end address "3". Leaf node NL_3 contains the key K of "5", the key KE of "7", and a pointer to the unprocessed command CMD6 specifying the start address "5" and the end address "7". Leaf node NL3 also includes the key K of "8", the key KE of "9", and a pointer to the unprocessed command CMD6 specifying the start address "8" and the end address "9".
[0074] exist Figure 6 In the indicated state, the command CMD8 is stored in command queue 241. (See reference...) Figure 5 As described previously, the unprocessed command CMD8 specifies a start address "4" and a stop address "5". A portion of the specified address range at least partially overlaps with the range from the start address represented by key K of leaf node NL_1 to the stop address represented by key KE. Furthermore, a portion of the specified address range at least partially overlaps with the range from the start address represented by key K of leaf node NL_3 to the stop address represented by key KE. Based on this, database 32 is changed to... Figure 5 The state shown.
[0075] That is, an extended node NE_2, referenced by an extended node NE_1, is created via a pointer. This extended node NE_1 references a leaf node NL_1 associated with an unprocessed command CMD1 that specifies an address range partially overlapping with the address range specified by the unprocessed command CMD8. Furthermore, a pointer P_7 is created within extended node NE_2, and a leaf node NL_4, referenced by pointer P_7, is created. (See reference...) Figure 5 As described, leaf node NL_4 contains key K for “4”, key KE for “5”, and a pointer to an unprocessed command CMD8 that specifies the start address “4” and the end address “5”.
[0076] Unprocessed commands (CMDs) associated with the higher-level leaf node (NL) are executed first. Therefore, even if more than two unprocessed commands (CMDs) specifying the same starting address are stored in command queue 241, the first unprocessed command (CMD) received is executed first. That is, in Figure 5 In the example, address "5" is specified by both unprocessed commands CMD6 and CMD8. However, the unprocessed command CMD associated with the higher-level leaf node NL is executed first. Figure 5 In the example, unprocessed command CMD6 is executed before unprocessed command CMD8. This ensures that even if commands specifying the same address are received consecutively, they are executed in the order they were received. This guarantees data integrity.
[0077] Reference Figure 8 and Figure 6 This describes an example of deleting the leaf node NL and the extended node NE in disk device 1. Figure 8 An example of a state of a database in a disk device according to the first embodiment is shown.
[0078] Figure 8 Showing with Figure 5 A continuous state. When in Figure 5 In the state shown, when the unprocessed command CMD1 is executed, leaf node NL_2 is deleted, and pointer P_5 is changed to refer to leaf node NL_3. When in Figure 5 In the state shown, when an unprocessed command CMD6 or CMD7 is executed, the key K, key KE, and pointer P associated with the unprocessed command CMD of the executed party are deleted. Furthermore, when an unprocessed command CMD7 is executed after CMD6 is executed, or when an unprocessed command CMD6 is executed after CMD7 is executed, the leaf node NL_3 is deleted.
[0079] Set as from Figure 5 Starting from the state shown, unprocessed commands CMD1, CMD6, and CMD7 are executed in any order. As a result, leaf nodes NL_2 and NL_3 are deleted. When the latter of leaf nodes NL_2 and NL_3 is deleted, there are no longer any leaf nodes NL referenced from the extended node NE_1. Based on this situation, all leaf nodes NL at levels lower than the extended node NE_1 are moved to the next higher level. That is, in Figure 8 In the example, leaf node NL_4 is moved to the layer referenced from extended node NE_1. Specifically, pointer P_5 changes to reference leaf node NL_4. Furthermore, with this change, leaf node NL_4 no longer referenced from extended node NE_2. Based on this, extended node NE_2 is deleted. Specifically, when from... Figure 8 The state shown indicates that the unprocessed command CMD8 was executed, such as Figure 6 As shown, the extended node NE_1 and the leaf node NL_4 were deleted.
[0080] Figure 9 The flow chart illustrates a certain operation in the disk device according to the first embodiment. When, as part of a reordering process, the RW control unit 31 initiates a process to determine which commands are considered efficient to execute after the currently executing command, Figure 9 The process begins. More specifically, when the RW control unit 31 sends a command selection request to the command search unit 34 as part of the reordering process, Figure 9 The process begins.
[0081] like Figure 9 As shown, when the command search unit 34 receives a command selection request, it selects candidate commands (step ST1). Candidate commands are unprocessed commands that serve as comparison objects for determining the next command, which is related to more efficient execution. Details regarding the selection of candidate commands will be provided in [reference needed]. Figure 10 As will be described later. Candidate commands are received by command selection unit 35.
[0082] When the command selection unit 35 receives a candidate command, it compares the execution cost of the next command with the execution cost of the candidate command. The execution cost can be calculated using any method. An example of execution cost is the time required to move from the current position of the head 14 to the starting address specified by the command whose execution cost is calculated. The shorter the time, the lower the execution cost. A detailed example of calculating the execution cost will be provided in [reference needed]. Figure 11 As will be described later. If the execution cost of the next command is less than the execution cost of the candidate command (step ST2_No), the command selection unit 35 continues to select the current next command as the next command (step ST3).
[0083] If the execution cost of the next command is greater than the execution cost of the candidate command (step ST2_Yes), the command selection unit 35 selects the candidate command as the new (or latest) next command (step ST4).
[0084] Figure 9 The process can be repeated during the reordering process. Furthermore, when disk device 1 reaches a state where it can execute new unprocessed commands, the next command after the reordering process has ended is executed.
[0085] Figure 10 The flow chart illustrates a certain operation in the disk device according to the first embodiment. Specifically, Figure 10 Show Figure 9The sub-process of selecting candidate commands (step ST1).
[0086] like Figure 10 As shown, the command search unit 34 searches the database 32 for the key K that is closest to the address where the read / write head 14 is currently located on the disk 11 (step ST11). The value of the discovered key Ks_c functions as the starting position (search start position) for the candidate command search.
[0087] Command search unit 34 searches the database 32 for the smallest value of key K that is greater than the value of key Ks_c (the value closest to key Ks_c) (step ST12). Step ST12 is equivalent to searching for the address closest to the address of key Ks_c, starting from the address of the value of key Ks_c. The discovered key K is called key Ks_L.
[0088] The command search unit 34 calculates the difference D_L between the value of key Ks_c and the value of key Ks_L (step ST13).
[0089] Command search unit 34 searches the database 32 for the key K that is the largest value smaller than the value of key Ks_c (the closest value to key Ks_c) (step ST14). Step ST14 is equivalent to searching for the address closest to the address of key Ks_c, starting from the address of the key Ks_c value in descending order. The discovered key K is called key Ks_S.
[0090] The command search unit 34 calculates the difference D_S between the value of key Ks_c and the value of key Ks_S (step ST15).
[0091] Step ST13 is performed after step ST12, and step ST15 is performed after step ST14. Steps ST12, ST13, ST14, and ST15 can be performed in any order. In one example, the group of steps ST14 and ST15 is performed before the group of steps ST12 and ST13. In another example, the group of steps ST13 and ST15 is performed after the group of steps ST12 and ST14 (either step ST12 or ST14 can be performed first).
[0092] If the difference D_L is less than the difference D_S (step ST16_Yes), the command search unit 34 selects the unprocessed command whose starting address is the value of the specified key Ks_L as a candidate command (step ST17). When step ST17 ends, Figure 10 The process is complete.
[0093] If the difference D_L is greater than the difference D_S (step ST16_No), the command search unit 34 selects the unprocessed command whose starting address is the value of the specified key Ks_S as the candidate command (step ST18). When step ST18 ends, Figure 10 The process is complete.
[0094] If the difference D_S and the difference D_L are the same, either step ST17 or ST18 can be executed.
[0095] Figure 11 An example of the execution cost at a certain point in time in the disk device according to the first embodiment is shown. For example... Figure 11 As shown, the read / write head 14 of disk 11 is currently located at address A. Address A is a region within the outermost track TR_1. Furthermore, the next command at this stage is an unprocessed command C, which specifies address C. Address C is a region within track TR_1. Address C is located at a position where the distance along the rotational direction of disk 11 from address A is shorter than the distance along the reverse rotational direction. The reverse rotational direction is towards the opposite side of the rotational direction.
[0096] Let unprocessed command B be selected as a candidate command. Unprocessed command B specifies address B. Address B is a region in track TR_2, which is inside track TR_1 and adjacent to track TR_1. Based on the positions of address B and address C, the command selection unit 35 determines that the cost (execution cost) for the head 14 to move from its current position to address C is less than the cost for the head 14 to move from its current position to address B. Therefore, the command selection unit 35 allows unprocessed command C to continue as the next command.
[0097] Next, an unprocessed command T is selected as a candidate command. The unprocessed command T specifies an address T. Address T is a region in track TR_2, and specifically a region in track TR_2 that is adjacent to the region connected to address A. Based on the positions of address C and address T, the command selection unit 35 determines that the cost of moving the head 14 from its current position to address T is less than the cost of moving the head 14 from its current position to address C. Therefore, the command selection unit 35 selects the unprocessed command T as the new next command.
[0098] According to the first embodiment, as described below, a disk drive capable of high-speed operation is provided.
[0099] Commands received by disk device 1 can be stored in a queue, i.e., as a linear list. In this case, during the search of unprocessed commands as part of a reordering process, the search is performed according to the order in which the unprocessed commands are arranged (i.e., the order in which they were received). Therefore, even if a command considered optimal is found in the early stages of the search, it is unknown whether the found command is truly optimal if the linear list has not been searched to its end. Thus, finding the truly optimal command may take a long time. If all unprocessed commands are searched along the linear list, the search time may sometimes end midway through the search. In this case, no optimal command is found.
[0100] In disk device 1, unprocessed commands are managed using a B+ tree structure with the value of the starting address specified by the unprocessed command as the key K. The B+ tree allows for searching nodes in both the forward and reverse directions of the key K value (i.e., the starting address). Furthermore, to select a candidate for the next command, the search begins with the starting address closest to the current position of the read / write head 14, progressing forward and backward. The closer of the found starting address on the forward side and the found starting address on the reverse side is selected as the candidate command. Therefore, even in a short time, a candidate command specifying the address closest to the current position of the read / write head 14 can be found.
[0101] 2. Second Implementation Method
[0102] The second embodiment can be implemented in addition to the first embodiment, or it can be implemented independently of the first embodiment.
[0103] Figure 12 The functional configuration (functional blocks) of the disk device according to the second embodiment is shown. For example... Figure 12 As shown, the disk device 1 also includes a command address resolution unit 37. The command address resolution unit 37 can be understood as part of the control unit.
[0104] The command address resolution unit 37 determines the search start position for the next reordering process based on the density of addresses specified by the command. The command address resolution unit 37 stores a command address distribution (command address distribution data). The command address distribution indicates the number of received commands specified at each address by the commands received from disk device 1 up to this point (received commands). In one example, the received commands are write commands and read commands received from the moment disk device 1 begins operation after receiving power. Figure 13 This example illustrates a command address distribution. The value A in the diagram has an arbitrary size.
[0105] The command address resolution unit 37 stores the range of addresses searched during a certain reordering process. That is, during the reordering process, starting the search at the address closest to the current address of the read / write head 14, the unit repeatedly searches for candidate commands for the next command. Furthermore, the execution cost of each found candidate command is compared with the execution cost of the next command. The command address resolution unit 37 stores addresses specified by candidate commands whose execution costs have been compared with the execution cost of the next command in such a manner. Therefore, at the end of the reordering process, the range of addresses of the candidate commands found during that reordering process can be determined.
[0106] At the end of a reordering process, the command address resolution unit 37 calculates the density of received commands (command density) within the address range of candidate commands based on the command address distribution. A low command density indicates that fewer commands have been received within the address range specified by candidate commands discovered in the most recent reordering process. Figure 13 In one example, during a reordering process, candidate commands are found within an address range enclosed by a dashed line, and the number of received commands specifying addresses within this range is currently 24A. The command density within this address range is less than a baseline value. Based on this situation, the command address resolution unit 37 determines that the search start position for the next reordering process will not be determined from the address where the head 14 was located at the start of the reordering process, but rather from a range of addresses specified by more received commands.
[0107] It can use command address distribution and filters together to determine the range of addresses specified by more commands. In one example, the command address resolution unit 37 uses... Figure 14 A linear filter as shown. A linear filter has a width spanning a range of addresses, with the largest coefficient at the center of the address range. The coefficients of a linear filter decrease linearly from the center towards both sides. Figure 14 The values B and C in the equation are values of arbitrary magnitude and expressed in arbitrary units.
[0108] Figure 15 Showing the Figure 13 The command address distribution shown applies Figure 14 Examples of the results of the filter are shown. Figure 15 The value D in the algorithm can be any size. By applying a filter, the number of received commands in the command address distribution is converted into an evaluation value by multiplying it by a coefficient. Address ranges with a large number of received commands in surrounding addresses have higher evaluation values. Address ranges with dense high evaluation values are selected as the search targets for the next reordering process. Figure 15In the example, the address range enclosed by the dashed line is selected. Furthermore, the address at or near the center of the address range is used as the starting position for the next reordering process. Hereinafter, the address at or near the center of the address range is sometimes referred to as a dense area address.
[0109] Figure 16 The flowchart illustrates a certain operation of the disk device according to the second embodiment. Specifically, Figure 16 This illustrates the process for determining the starting position of the search in the next reordering process. Figure 16 The process begins when the command address resolution unit 37 receives a notification that the reordering process has ended. In one example, the notification of the reordering process ending is sent from the command search unit 34 or the RW control unit 31.
[0110] like Figure 16 As shown, the command address resolution unit 37 calculates the received command density (candidate commands found within the address range) based on the address range of candidate commands discovered during this reordering process (step ST21).
[0111] If the received command density is greater than the baseline value (step ST22_Yes), Figure 16 The process is complete.
[0112] If the received command density is below the baseline value (step ST22_No), the command address parsing unit 37 instructs the RW control unit 31 to use a specified position (step ST23). The instruction to use a specified position indicates that the dense region address will be used as the search start position at the beginning of the next reordering process. With the end of step ST23, Figure 16 The process is complete.
[0113] Figure 17 The flow chart illustrates a certain operation in the disk device according to the second embodiment. Specifically, Figure 17 Show Figure 9 The sub-process of selecting candidate commands (step ST1).
[0114] like Figure 17 As shown, the command search unit 34 determines whether an instruction to use the specified location has been received (step ST31). If no instruction has been received (step ST31_No), the process moves to step ST11. That is, the command search unit 34 uses the address closest to the current address of the read / write head 14 as the search start position to search for candidate commands. The process after step ST11 is the same as... Figure 10 same.
[0115] Upon receiving an instruction (step ST31_Yes), the command search unit 34 sets the key K closest to the address of the specified location indicated as the key Ks_c (step ST32). That is, the command search unit 34 uses the address of the specified location as the search start position to search for candidate commands. Step ST32 follows step ST11.
[0116] The disk device 1 of the second embodiment calculates the density of received commands within the address range of candidate commands discovered during a certain reordering process. When the command density is low, addresses in regions with high received command density are used as the search start position for the next reordering process. Therefore, it is possible to suppress the search range for unprocessed commands from being biased towards a specific range, and to efficiently discover candidate commands.
[0117] When the second embodiment is applied to the first embodiment, as described below, candidate commands can be discovered more efficiently compared to implementing either the first or second embodiment alone. That is, the first embodiment can efficiently discover unprocessed commands at addresses surrounding the current address of the specified head 14. However, depending on the address specified by the unprocessed command, it is sometimes more efficient to process multiple unprocessed commands within an address range outside the current address's perimeter. Therefore, the second embodiment, when the density of received commands within the address range of candidate commands is low, sets the search start position for the next reordering process to an address within a region with high command density, rather than setting it to the address of the head 14 at the start of the next reordering process. Therefore, search start position bias can be suppressed, preventing inefficient result searches.
[0118] Several embodiments of the present invention have been described, but these embodiments are provided as examples and are not intended to limit the scope of the invention. These embodiments can be implemented in various other ways, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and / or variations thereof are included in the scope and spirit of the invention, and are included in the scope of the invention as set forth in the claims and its equivalents.
Claims
1. A disk drive, comprising: A disk comprises multiple regions, each assigned a unique address. The memory stores multiple unprocessed commands; as well as A controller stores a tree-structured database in the memory, the structure comprising multiple nodes associated with multiple addresses specified by multiple unprocessed commands, two of the multiple nodes being associated with each other, the controller selecting candidate commands from commands associated with addresses greater than and closest to the start address and commands associated with addresses less than and closest to the start address, the candidate commands being candidates to be executed next among the multiple unprocessed commands.
2. The disk drive according to claim 1, The controller selects, from the commands associated with the address that is greater than and closest to the start address and the commands associated with the address that is less than and closest to the start address, the command associated with the address that is even closer to the start address, as the candidate command.
3. The disk drive according to claim 2, The controller selects the command with the lower execution cost from the candidate commands and the next command to be executed as the latest command.
4. The disk drive according to claim 3, It also has a magnetic head. The starting address is the address among the plurality of addresses that is closest to the position of the read / write head.
5. The disk drive according to claim 3, The starting address is an address within a range selected based on the density of received commands.
6. The disk drive according to claim 3, In the first reordering process of the plurality of unprocessed commands, the selection of candidate commands and the comparison of the execution cost of the candidate commands with the execution cost of the next command to be executed are performed repeatedly. After the first reordering process, a second reordering process is performed on the multiple unprocessed commands in the memory. If the number of received commands in the first address range is less than a first value, in the second reordering process, candidate commands are searched using addresses in the address range selected based on the density of received commands. The first address range includes the addresses of multiple candidate commands whose execution costs were compared with the execution costs of the next command to be executed during the first reordering process.
7. A disk drive, comprising: A disk comprises multiple regions, each assigned a unique address. Memory that stores multiple unprocessed commands; and Controller The controller A database storing multiple unprocessed commands in the memory. In each of the first and second reordering processes, the selection of candidate commands and the comparison between the execution cost of the candidate commands and the execution cost of the next command to be executed are performed repeatedly. The candidate commands are the next unprocessed commands to be executed from among a plurality of unprocessed commands in the memory. If the number of received commands in the first address range is less than a first value, in the second reordering process, addresses in the address range selected based on the density of received commands are used to search for candidates for the next command to be executed from among a plurality of unprocessed commands in the memory. The first address range includes the addresses of multiple candidate commands whose execution costs were compared with the execution costs of the next command to be executed during the first reordering process.
8. The disk drive according to any one of claims 1 to 6, The plurality of nodes includes a parent node, a first leaf node, and a second leaf node. The parent node contains a first key associated with the first address, a first pointer to a node containing an address smaller than the first address, and a second pointer to a node containing an address larger than the first address. The first leaf node, referenced by the first pointer, contains a second key associated with the second address and is associated with a first command specifying the second address. The second leaf node is referenced by the second pointer and contains a third key associated with the third address, which is associated with a second command specifying the third address.
9. The disk drive according to any one of claims 1 to 6, The database contains a B+ tree structure of the multiple nodes.
Citation Information
Patent Citations
Imaging apparatus and imaging method
JP2024158116A