Method, program product, device and medium for determining space requirements for read and write command operations
By determining the number of command units in the hardware Raid and the size of the data pointers in the linked list, combined with the low-bit selection logic and linked list boundary processing logic, the linked list and data space sizes are calculated, which solves the problems of slow operation space calculation and memory waste in hardware Raid, and improves improve computational efficiency.
Patent Information
- Application Number
- CN202410823754.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-25
AI Technical Summary
Hardware Raid makes it difficult for the operation space calculation speed to meet the requirements when using processor memory, and causes a waste of memory resources.
By determining the number of command units in the non-volatile memory interface protocol and the size of the data pointer in the linked list, combined with low-order selection logic and linked list boundary processing logic, the size of the linked list and data space is calculated, and coefficients and coding rules are used to optimize space allocation and reduce Processor memory load.
It improves the calculation speed, solves the problems of low efficiency and memory waste, and realizes fast and accurate calculation of linked lists and data space sizes.
Smart Images

Figure CN118377438B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a method for determining a read-write command operation space requirement, a program product, a device and a medium. Background Art
[0002] With the rapid development of storage technology, the use scenarios of NVMe (Nonvolatile Memory Express) disks are becoming more and more extensive. In order to improve the storage performance of NVMe disks, multiple independent NVMe disks are generally combined into a large disk system, namely Raid (Redundant Arrays of Independent Disks). Common Raid levels include Raid0, Raid1, Raid5, Raid6, Raid10, etc. Different levels of Raid have different storage solutions, which can effectively improve the system read and write performance and reliability.
[0003] After obtaining the non-volatile memory standard protocol command from the host, the command is converted into read and write operations on different disks according to the type of independent disk redundant array. This process generally has two methods, namely software Raid and hardware Raid, depending on the requirements of system performance, security, cost, etc. Software Raid is the operation of Raid tasks in the computer system processor, but this solution is more suitable for simple Raid0 / 1 / 10 scenarios. Hardware Raid runs Raid applications through dedicated chips, but this solution involves the use of processor memory, which makes it difficult for the operation space calculation speed to meet its requirements, and also causes a waste of memory resources. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a method, program product, device and medium for determining the space requirement of read and write command operations, which can reduce the memory load of the processor and solve the problems of low efficiency and memory waste. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a method for determining a read-write command operation space requirement, comprising:
[0006] Determine the number of command units corresponding to the target read and write command according to the non-volatile memory interface protocol, and determine the total size of the linked list according to the number of command units and the size of the data pointer in the linked list;
[0007] The total size of the linked list and the minimum space allocation granularity of the target redundant array of independent disks are calculated by low-order selection logic to obtain a low-order allocation granularity and a high-order allocation granularity;
[0008] According to the linked list boundary processing logic, the allocation granularity low bit and the allocation granularity high bit are operated to obtain corresponding operation results, and the size of the applied linked list space is calculated according to the operation results;
[0009] Determine a first coefficient of the number of command units and a second coefficient of the number of data blocks in a stripe according to the level type of the target redundant array of independent disks and the read and write characteristics of the target read and write commands;
[0010] The number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient are calculated according to a preset calculation rule to obtain the size of the applied data space.
[0011] Optionally, determining the total size of the linked list according to the number of command units and the size of data pointers in the linked list includes:
[0012] The first bit splicer is used to perform a bit splicing operation on the number of command units and the size of the data pointer in the linked list to obtain the total size of the linked list.
[0013] Optionally, the operation on the allocation granularity low bit and the allocation granularity high bit is performed according to the linked list boundary processing logic to obtain a corresponding operation result, including:
[0014] Performing a first bit OR logic operation on the low bit of the allocation granularity to obtain a first operation result;
[0015] A second bit OR logic operation is performed on the high bit of the allocation granularity to obtain a second operation result.
[0016] Optionally, the calculating the size of the applied linked list space according to the operation result includes:
[0017] Performing a logical AND-NOT operation on the first operation result and the second operation result to obtain a third operation result, and performing an addition operation on the third operation result and the high bit of the allocation granularity by using a first adder to obtain a fourth operation result;
[0018] A second bit splicer is used to perform a bit splicing operation on the fourth operation result and the minimum space allocation granularity to obtain the applied linked list space size.
[0019] Optionally, determining the first coefficient of the number of command units according to the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command includes:
[0020] determining a plurality of first candidate coefficients;
[0021] Encoding the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command to obtain a first encoding result;
[0022] The first coefficient is determined from the plurality of first candidate coefficients according to the first encoding result.
[0023] Optionally, determining a second coefficient of the number of data blocks in a stripe according to the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command includes:
[0024] determining a plurality of second candidate coefficients;
[0025] Encoding the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command to obtain a second encoding result;
[0026] The second coefficient is determined from the plurality of second candidate coefficients according to the second encoding result and the number of disks of the target redundant array of independent disks.
[0027] Optionally, the method for determining read and write command operation space requirements further includes:
[0028] The minimum space allocation granularity, the data pointer size in the linked list, the multiple first candidate coefficients, and the multiple second candidate coefficients are configured in a register.
[0029] Optionally, calculating the number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient according to a preset calculation rule to obtain the requested data space size includes:
[0030] Using a first multiplier to multiply the number of command units by the first coefficient to obtain a fifth operation result, and using a second multiplier to multiply the number of data blocks in the stripe by the second coefficient to obtain a sixth operation result;
[0031] The fifth operation result and the sixth operation result are added by a second adder to obtain a seventh operation result, and the seventh operation result and the minimum space allocation granularity are bit-joined by a third bit joiner to obtain the data space size applied for.
[0032] Optionally, the first multiplier and the second multiplier are connected in parallel.
[0033] Optionally, the read and write characteristics of the target read and write commands include the read and write type of the target read and write commands, the relationship between the number of command units and the number of data blocks in the stripe, and the target operation mode; wherein the read and write type includes a read operation or a write operation, and the target operation mode includes read-modify-write or read-reconstruct-write.
[0034] Optionally, the calculation process of the linked list space size and the calculation process of the data space size are parallel calculation processes.
[0035] Optionally, before calculating the number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient according to a preset calculation rule, the method further includes:
[0036] The preset calculation rule is determined according to the different levels of redundant arrays of independent disks and the read and write characteristics of the read and write commands corresponding to the different levels of redundant arrays of independent disks.
[0037] In a second aspect, the present application discloses a computer program product, which, when executed by a processor, implements the steps of the aforementioned method for determining the read and write command operation space requirements.
[0038] In a third aspect, the present application discloses an electronic device, comprising:
[0039] Memory, used to store computer programs;
[0040] The processor is used to execute the computer program to implement the aforementioned disclosed method for determining the read and write command operation space requirements.
[0041] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed method for determining the read and write command operation space requirements is implemented.
[0042] It can be seen that the present application proposes a method for determining the space requirement for read and write command operations, including: determining the number of command units corresponding to the target read and write command according to the non-volatile memory interface protocol, and determining the total size of the linked list according to the number of command units and the size of the data pointer in the linked list; calculating the total size of the linked list and the minimum space allocation granularity of the target independent disk redundant array through the low-order selection logic to obtain the low-order allocation granularity and the high-order allocation granularity; calculating the low-order allocation granularity and the high-order allocation granularity according to the linked list boundary processing logic to obtain the corresponding calculation result, and calculating the applied linked list space size according to the calculation result; determining the first coefficient of the number of command units and the second coefficient of the number of data blocks in the stripe according to the level type of the target independent disk redundant array and the read and write characteristics of the target read and write command; calculating the number of command units, the first coefficient, the number of data blocks in the stripe and the second coefficient according to the preset calculation rule to obtain the applied data space size.
[0043] Beneficial effects: The present application first determines the number of command units, the size of the data pointer in the linked list, the level type, the read-write characteristics, the first coefficient, the second coefficient, and the number of data blocks in the stripe, and calculates the above information through the pre-deployed low-order selection logic and the linked list boundary processing logic to obtain the requested linked list space size. Further, the above information is calculated through preset calculation rules to obtain the requested data space size. In summary, it can be seen that the present application uses simple input and output and control logic to quickly and accurately calculate the requested linked list space size and the requested data space size under different level types and different read-write characteristics. Compared with the traditional implementation plan that realizes memory demand calculation through processor memory, the present application effectively reduces the processor memory load, thereby improving the calculation speed and solving the problems of inefficiency and memory waste. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0045] Figure 1 Provides a traditional linked list memory usage mechanism;
[0046] Figure 2 Provides a traditional Raid5 memory usage mechanism in read-modify mode;
[0047] Figure 3 A logic diagram of a method for realizing read and write command operation space requirements disclosed in this application;
[0048] Figure 4 A flow chart of a method for determining space requirements for read and write command operations disclosed in this application;
[0049] Figure 5 A flowchart of a specific method for determining the space requirement for read and write command operations disclosed in this application;
[0050] Figure 6 A flowchart of another specific method for determining read and write command operation space requirements disclosed in this application;
[0051] Figure 7 A schematic diagram of the structure of a device for determining space requirements for read and write command operations disclosed in this application;
[0052] Figure 8 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] Software Raid is more suitable for simple Raid0 / 1 / 10 scenarios. Hardware Raid involves the use of processor memory, which makes it difficult for the operation space calculation speed to meet its requirements and causes a waste of memory resources.
[0055] To this end, an embodiment of the present application proposes a solution for determining the space requirement for read and write command operations, which can reduce the memory load of the processor and solve the problems of low efficiency and memory waste.
[0056] Figure 1 A traditional linked list memory usage mechanism is provided, that is, linked list 1 records the pointer of linked list 2. Figure 2 It provides a traditional Raid5 memory usage mechanism in read-modify mode, that is, the old data at the corresponding position in the disk is read out to the dedicated chip, and after calculating with the new data temporarily stored in the dedicated chip, the newly written data and the newly calculated verification data are written to the disk.
[0057] based on Figure 1 and Figure 2 , this application designs a read and write command operation space requirement calculation device, see Figure 3 As shown, the device includes linked list space calculation logic, data space configuration logic and data space calculation logic. The size of the applied linked list space is calculated by the linked list space calculation logic, and the size of the applied data space is calculated by the data space configuration logic and the data space calculation logic. The following will explain each part of the logic in detail.
[0058] The present application discloses a method for determining a read and write command operation space requirement. Figure 4 As shown, the method includes:
[0059] Step S11: determining the number of command units corresponding to the target read / write command according to the non-volatile memory interface protocol, and determining the total size of the linked list according to the number of command units and the size of the data pointer in the linked list.
[0060] See also Figure 3As shown, the first bit splicer is used to perform bit splicing operation on the number of command units and the size of the data pointer in the linked list to obtain the total size of the linked list. The number of command units is the NLB value (Number of Logic Block, the number of data blocks of a read or write command in the non-volatile memory interface protocol), and the size of the data pointer in the linked list is generally 2Byte, 4Byte, 8Byte, 16Byte, etc.
[0061] Step S12: calculating the total size of the linked list and the minimum space allocation granularity of the target redundant array of independent disks through low-order selection logic to obtain a low-order allocation granularity and a high-order allocation granularity.
[0062] See also Figure 3 As shown, the total size of the linked list and the minimum space allocation granularity of the target independent disk redundant array are input into the bit selector, and the low bit of the allocation granularity and the high bit of the allocation granularity are selected by the low bit selection logic in the bit selector. For example, if the total size of the linked list is 32 bits, the lower 2 bits are determined as the low bit of the allocation granularity, and the bits are determined as the high bit of the allocation granularity. In addition, the minimum space allocation granularity is the allocation granularity configured by the target independent disk redundant array, which is generally 4k, and can also be configured as other values.
[0063] Step S13: performing operations on the allocation granularity low bit and the allocation granularity high bit according to the linked list boundary processing logic to obtain corresponding operation results, and calculating the size of the applied linked list space according to the operation results.
[0064] See also Figure 3 As shown, after determining the low bit and high bit of the allocation granularity, the first bit or logic operation is performed on the low bit of the allocation granularity to obtain the first operation result, and the second bit or logic operation is performed on the high bit of the allocation granularity to obtain the second operation result. Further, the first operation result and the second operation result are subjected to a non-and logic operation to obtain a third operation result, and the third operation result and the high bit of the allocation granularity are added by the first adder to obtain a fourth operation result. Finally, the fourth operation result and the minimum space allocation granularity are subjected to a bit splicing operation by the second bit splicer to obtain the size of the linked list space applied for. Through the above-mentioned linked list boundary processing logic, when the data pointer size in the linked list just fills a minimum application space, there is no need to apply for another space. Further, the first adder in this embodiment calculates the number of minimum linked list spaces actually required to be applied for, and cooperates with the second bit splicer to generate the size of the linked list space that needs to be applied for in the end.
[0065] Step S14: determining a first coefficient of the number of command units and a second coefficient of the number of data blocks in a stripe according to the level type of the target redundant array of independent disks and the read and write characteristics of the target read and write commands.
[0066] In this embodiment, the read and write characteristics of the target read and write commands include the read and write type of the target read and write commands, the size relationship between the number of command units and the number of data blocks in the stripe, and the target operation mode, wherein the read and write type includes a read operation or a write operation, the target operation mode includes read modify write (RMW, Read Modify Write) or read reconstruct write (RCW, Read Construct Write), the number of data blocks in the stripe is the number of data blocks written to a disk each time a stripe is written, and the level type is the type of the Raid group, such as Raid0, Raid1, Raid5, Raid6, Raid10, etc.
[0067] The calculation method of data memory space of different levels of independent disk redundant arrays is shown in Table 1:
[0068] Table 1 Calculation method of data memory space of different types of independent disk redundant arrays
[0069]
[0070] Based on this, the data space size of this embodiment = a*number of command units + b*number of data blocks in the stripe, where a represents the first coefficient of the number of command units, and b represents the second coefficient of the number of data blocks in the stripe. The second coefficient of the number of data blocks in the stripe represents the number of Chunk units. For example, if the minimum space allocation granularity is 4KB and the data block in the stripe is 64KB, the number of data blocks in the stripe is 16.
[0071] This embodiment deploys the data space configuration logic generated according to the above data space calculation formula in a read-write command operation space requirement calculation device, and determines the first coefficient of the number of command units and the second coefficient of the number of data blocks in the stripe according to the level type of the target independent disk redundant array and the read-write characteristics of the target read-write commands. The detailed description will be reflected below.
[0072] Step S15: Calculate the number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient according to a preset calculation rule to obtain the size of the requested data space.
[0073] In this embodiment, the first multiplier is first used to multiply the number of command units and the first coefficient to obtain a fifth operation result, and the second multiplier is used to multiply the number of data blocks in the stripe and the second coefficient to obtain a sixth operation result. Further, the second adder is used to add the fifth operation result and the sixth operation result to obtain a seventh operation result, and then the third bit splicer is used to perform a bit splicing operation on the seventh operation result and the minimum space allocation granularity to obtain the size of the data space applied for. It should be noted that the first multiplier, the second multiplier and the second adder are used to calculate the number of minimum data spaces actually required to be applied for, and cooperate with the third bit splicer to generate the size of the data space that is finally required to be applied for. It should be further noted that the method of multiplying the number of command units, the number of data blocks in the stripe and their respective coefficients and then performing bit splicing can reduce the logic resources of the multiplier and the adder and improve the overall operation speed.
[0074] In this embodiment, the first multiplier and the second multiplier are connected in parallel, thereby improving the operation speed. Further, the calculation process of the linked list space size and the calculation process of the data space size of the present application are parallel calculation processes, that is, the linked list space size calculation and the data space size calculation in this embodiment can be performed simultaneously, thereby further improving the operation speed.
[0075] It can be seen that the present application proposes a method for determining the space requirement for read and write command operations, including: determining the number of command units corresponding to the target read and write command according to the non-volatile memory interface protocol, and determining the total size of the linked list according to the number of command units and the size of the data pointer in the linked list; calculating the total size of the linked list and the minimum space allocation granularity of the target independent disk redundant array through the low-order selection logic to obtain the low-order allocation granularity and the high-order allocation granularity; calculating the low-order allocation granularity and the high-order allocation granularity according to the linked list boundary processing logic to obtain the corresponding calculation result, and calculating the applied linked list space size according to the calculation result; determining the first coefficient of the number of command units and the second coefficient of the number of data blocks in the stripe according to the level type of the target independent disk redundant array and the read and write characteristics of the target read and write command; calculating the number of command units, the first coefficient, the number of data blocks in the stripe and the second coefficient according to the preset calculation rule to obtain the applied data space size.
[0076] Beneficial effects: The present application first determines the number of command units, the size of the data pointer in the linked list, the level type, the read-write characteristics, the first coefficient, the second coefficient, and the number of data blocks in the stripe, and calculates the above information through the pre-deployed low-order selection logic and the linked list boundary processing logic to obtain the requested linked list space size. Further, the above information is calculated through preset calculation rules to obtain the requested data space size. In summary, it can be seen that the present application uses simple input and output and control logic to quickly and accurately calculate the requested linked list space size and the requested data space size under different level types and different read-write characteristics. Compared with the traditional implementation plan that realizes memory demand calculation through processor memory, the present application effectively reduces the processor memory load, thereby improving the calculation speed and solving the problems of inefficiency and memory waste.
[0077] The embodiment of the present application discloses a specific method for determining the space requirement of read and write command operations. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Figure 5 As shown, specifically including:
[0078] Step S21: determining the number of command units corresponding to the target read / write command according to the non-volatile memory interface protocol, and determining the total size of the linked list according to the number of command units and the size of the data pointer in the linked list.
[0079] Step S22: calculating the total size of the linked list and the minimum space allocation granularity of the target redundant array of independent disks through low-order selection logic to obtain a low-order allocation granularity and a high-order allocation granularity.
[0080] Step S23: performing operations on the allocation granularity low bit and the allocation granularity high bit according to the linked list boundary processing logic to obtain corresponding operation results, and calculating the size of the applied linked list space according to the operation results.
[0081] Step S24: determine a plurality of first candidate coefficients, encode the level type of the target independent redundant array of disks and the read and write characteristics of the target read and write commands to obtain a first encoding result, and determine the first coefficient from the plurality of first candidate coefficients according to the first encoding result.
[0082] In this embodiment, the first candidate coefficient comes from the register configuration value, and the first candidate coefficient can have multiple values, and the first candidate coefficient can also be 0. After determining multiple first candidate coefficients, the level type of the target independent disk redundant array and the read / write characteristics of the target read / write command are encoded to obtain a first encoding result, and the first coefficient is determined from the multiple first candidate coefficients according to the first encoding result. That is, in this embodiment, the first coefficient is determined from multiple first candidate coefficients according to the level type of the independent disk redundant array and the read / write characteristics of the target read / write command. See Figure 3 As shown, this embodiment improves the input flexibility of the data space calculation logic by selecting the first coefficient through the multiplexer.
[0083] Step S25: Determine multiple second candidate coefficients, encode the level type of the target independent disk redundant array and the read and write characteristics of the target read and write commands to obtain a second encoding result, and determine the second coefficient from the multiple second candidate coefficients based on the second encoding result and the number of disks of the target independent disk redundant array.
[0084] In this embodiment, the second candidate coefficient comes from the register configuration value. The second candidate coefficient can have multiple values. After determining multiple second candidate coefficients, the level type of the target independent disk redundant array and the read and write characteristics of the target read and write commands are encoded to obtain a second encoding result, and the second coefficient is determined from the multiple second candidate coefficients according to the second encoding result and the number of disks of the target independent disk redundant array. For the number of disks, for example, Raid5 contains 3 data disks and 1 check disk, and the number of disks is 4. That is, this embodiment determines the first coefficient from multiple second candidate coefficients according to the level type of the independent disk redundant array, the read and write characteristics of the target read and write commands, and the number of disks. See. Figure 3 As shown, this embodiment improves the input flexibility of the data space calculation logic by selecting the second coefficient through the multiplexer.
[0085] Table 2 provides possible values of the first coefficient and the second coefficient:
[0086] Table 2 Possible values of the first coefficient and the second coefficient
[0087]
[0088] Step S26: determining the preset calculation rule according to the redundant arrays of independent disks of different levels and the read and write characteristics of the read and write commands corresponding to the redundant arrays of independent disks of different levels.
[0089] In this embodiment, the preset calculation rule is determined according to the read and write characteristics of the read and write commands corresponding to the independent disk redundant arrays of different levels and types. It should be pointed out that the preset calculation rule is data space size = a × number of command units + b × number of data blocks in the stripe, which will not be described in detail here.
[0090] Step S27: Calculate the number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient according to a preset calculation rule to obtain the requested data space size.
[0091] Among them, the more specific processes of step S21, step S22, step S23 and step S27 can be found in the embodiments disclosed above, and will not be described in detail here.
[0092] In summary, see Figure 6 As shown, in order to implement the method for determining the operation space requirements of the read-write command of the present application, the present application designs an operation resource application space calculation device, which includes multiple inputs: (1) determining the number of command units according to the target read-write command; (2) obtaining the read-write characteristics of the target read-write command according to the command read-write characteristic judgment unit; (3) obtaining the number of disks, level type, and number of data blocks in the stripe according to the Raid group information; (4) determining the minimum space allocation granularity, multiple first candidate coefficients, multiple second candidate coefficients, and the size of the data pointer in the linked list according to the register information. Further, the above information is input into the operation resource application space calculation device to determine the size of the data space applied for and the size of the linked list space applied for by the device, and the size of the data space and the size of the linked list space are sent to the space application unit to apply for the corresponding space.
[0093] It can be seen that the present application proposes a method for determining the space requirement for read and write command operations, including: determining the number of command units corresponding to the target read and write command according to the non-volatile memory interface protocol, and determining the total size of the linked list according to the number of command units and the size of the data pointer in the linked list; calculating the total size of the linked list and the minimum space allocation granularity of the target independent disk redundant array through the low-order selection logic to obtain the low-order allocation granularity and the high-order allocation granularity; calculating the low-order allocation granularity and the high-order allocation granularity according to the linked list boundary processing logic to obtain the corresponding calculation result, and calculating the applied linked list space size according to the calculation result; determining multiple first alternative coefficients, encoding the level type of the target independent disk redundant array and the read and write characteristics of the target read and write command, and obtaining the first encoding encoding result, determining the first coefficient from the multiple first candidate coefficients according to the first encoding result; determining multiple second candidate coefficients, encoding the level type of the target independent disk redundant array and the read and write characteristics of the target read and write commands to obtain a second encoding result, determining the second coefficient from the multiple second candidate coefficients according to the second encoding result and the number of disks of the target independent disk redundant array; determining the preset calculation rule according to independent disk redundant arrays of different levels and the read and write characteristics of the read and write commands corresponding to the independent disk redundant arrays of different levels; calculating the number of command units, the first coefficient, the number of data blocks in the stripe and the second coefficient according to the preset calculation rule to obtain the size of the data space applied for.
[0094] Beneficial effects: The present application first determines the number of command units, the size of the data pointer in the linked list, the level type, the read-write characteristics, the first coefficient, the second coefficient, and the number of data blocks in the stripe, and calculates the above information through the pre-deployed low-order selection logic and the linked list boundary processing logic to obtain the requested linked list space size. Further, the above information is calculated through preset calculation rules to obtain the requested data space size. In summary, it can be seen that the present application uses simple input and output and control logic to quickly and accurately calculate the requested linked list space size and the requested data space size under different level types and different read-write characteristics. Compared with the traditional implementation plan that realizes memory demand calculation through processor memory, the present application effectively reduces the processor memory load, thereby improving the calculation speed and solving the problems of inefficiency and memory waste.
[0095] The method described in this application is explained below by a specific embodiment:
[0096] In this embodiment, the first bit OR logic and the second bit OR logic are 12-bit bit OR logic, the NAND logic is 12-bit NAND logic, the first adder is a 12-bit adder, the first multiplier is a 16-bit multiplier, the second multiplier is a 4-bit multiplier, and the second adder is a 32-bit adder.
[0097] The level type (RaidType) of the disk array is defined in 2 bits:
[0098] RaidType=2'b00: Raid0;
[0099] RaidType=2'b01: Raid5;
[0100] RaidType=2'b10: Raid6;
[0101] Assume that the RaidType used in this embodiment is 2'b01, that is, Raid5.
[0102] Furthermore, the read and write characteristics (IOMode) define a 3-bit encoding:
[0103] IOMode[0]: 0 for write operation, 1 for read operation;
[0104] IOMode[1]: 0 means the number of command units is less than the number of data blocks in the stripe, 1 means the number of command units is greater than the number of data blocks in the stripe;
[0105] IOMode[2]: 0 is read-modify-write, 1 is read-reconstruct-write.
[0106] It is assumed that the read / write feature used in the embodiment is 3'b000, that is, the number of write operations and command units is less than the number of data blocks in the stripe, and the read-modify-write.
[0107] Furthermore, the data pointer size (LinkSize) in the linked list is defined as 1-bit encoding:
[0108] LinkSize = 0: The data pointer size in the linked list is 4 bytes;
[0109] LinkSize = 1: The data pointer size in the linked list is 8 Bytes;
[0110] Assume that the size of the data pointer in the linked list used in this embodiment is 8 Byte.
[0111] Assume that the number of disks used in this embodiment is 8, the number of command units is 3, and the minimum space allocation granularity is 4 KB, and the corresponding code is 16'h1000.
[0112] Furthermore, the first coefficient and the second coefficient are obtained through Table 3. In Table 3, the bit X indicates don't care:
[0113] Table 3 The first coefficient and second coefficient corresponding to different level types and different reading and writing characteristics
[0114]
[0115] The output calculation results are as follows:
[0116] The requested linked list space size is 4KB.
[0117] The application data space size is 36KB.
[0118] In summary, the technical solution of the present application proposes a computing device with a simple structure and a flexible and configurable input end. By inputting easily available information into the system, the device can quickly obtain the required linked list space size and data space size at the same time, which can quickly and effectively reduce the load on the central processing unit, improve the accuracy of space application, prevent waste of memory space, and improve system availability.
[0119] Correspondingly, the embodiment of the present application also discloses a device for determining the space requirement for read and write command operations, see Figure 7 As shown, the device comprises:
[0120] The linked list total size determination module 11 is used to determine the number of command units corresponding to the target read and write commands according to the non-volatile memory interface protocol, and determine the total size of the linked list according to the number of command units and the size of the data pointer in the linked list;
[0121] The high and low granularity determination module 12 is used to calculate the total size of the linked list and the minimum space allocation granularity of the target independent disk redundant array through the low-order selection logic to obtain the low-order allocation granularity and the high-order allocation granularity;
[0122] The linked list space application module 13 is used to operate the allocation granularity low bit and the allocation granularity high bit according to the linked list boundary processing logic to obtain a corresponding operation result, and calculate the size of the applied linked list space according to the operation result;
[0123] A coefficient determination module 14, configured to determine a first coefficient of the number of command units and a second coefficient of the number of data blocks in a stripe according to the level type of the target redundant array of independent disks and the read and write characteristics of the target read and write commands;
[0124] The data space application module 15 is used to calculate the number of command units, the first coefficient, the number of data blocks in the stripe and the second coefficient according to a preset calculation rule to obtain the size of the applied data space.
[0125] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0126] It can be seen that the present application proposes a method for determining the space requirement for read and write command operations, including: determining the number of command units corresponding to the target read and write command according to the non-volatile memory interface protocol, and determining the total size of the linked list according to the number of command units and the size of the data pointer in the linked list; calculating the total size of the linked list and the minimum space allocation granularity of the target independent disk redundant array through the low-order selection logic to obtain the low-order allocation granularity and the high-order allocation granularity; calculating the low-order allocation granularity and the high-order allocation granularity according to the linked list boundary processing logic to obtain the corresponding calculation result, and calculating the applied linked list space size according to the calculation result; determining the first coefficient of the number of command units and the second coefficient of the number of data blocks in the stripe according to the level type of the target independent disk redundant array and the read and write characteristics of the target read and write command; calculating the number of command units, the first coefficient, the number of data blocks in the stripe and the second coefficient according to the preset calculation rule to obtain the applied data space size.
[0127] Beneficial effects: The present application first determines the number of command units, the size of the data pointer in the linked list, the level type, the read-write characteristics, the first coefficient, the second coefficient, and the number of data blocks in the stripe, and calculates the above information through the pre-deployed low-order selection logic and the linked list boundary processing logic to obtain the requested linked list space size. Further, the above information is calculated through preset calculation rules to obtain the requested data space size. In summary, it can be seen that the present application uses simple input and output and control logic to quickly and accurately calculate the requested linked list space size and the requested data space size under different level types and different read-write characteristics. Compared with the traditional implementation plan that realizes memory demand calculation through processor memory, the present application effectively reduces the processor memory load, thereby improving the calculation speed and solving the problems of inefficiency and memory waste.
[0128] Furthermore, an embodiment of the present application also provides an electronic device. Figure 8 This is a structural diagram of an electronic device according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0129] Figure 8A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a display screen 23, an input / output interface 24, a communication interface 25, a power supply 26, and a communication bus 27. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the method for determining the space requirement for read / write command operations disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0130] In this embodiment, the power supply 26 is used to provide working voltage for each hardware device on the electronic device; the communication interface 25 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 24 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0131] In addition, the memory 22, as a carrier for storing resources, may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include a computer program 221, and the storage method may be temporary storage or permanent storage. In addition to including a computer program that can be used to complete the method for determining the space requirement for read and write command operations executed by an electronic device disclosed in any of the aforementioned embodiments, the computer program 221 may further include a computer program that can be used to complete other specific tasks.
[0132] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed method for determining the read and write command operation space requirements is implemented.
[0133] For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be described in detail here.
[0134] Furthermore, an embodiment of the present application also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the method for determining the read and write command operation space requirements as disclosed above.
[0135] The various embodiments in this application are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0136] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0137] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0138] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0139] The above is a detailed introduction to a method for determining the read and write command operation space requirements, program products, devices, and storage media provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for determining the space requirement for read and write command operations, It is characterized in that include: Determine the number of command units corresponding to the target read and write command according to the non-volatile memory interface protocol, and determine the total size of the linked list according to the number of command units and the size of the data pointer in the linked list; The total size of the linked list and the minimum space allocation granularity of the target independent redundant array of disks are calculated by low-order selection logic to obtain a low-order allocation granularity and a high-order allocation granularity; According to the linked list boundary processing logic, the allocation granularity low bit and the allocation granularity high bit are operated to obtain corresponding operation results, and the size of the applied linked list space is calculated according to the operation results; Determine a first coefficient of the number of command units and a second coefficient of the number of data blocks in a stripe according to the level type of the target redundant array of independent disks and the read and write characteristics of the target read and write commands; Calculate the number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient according to a preset calculation rule to obtain the size of the data space applied for; The operation of the low bit of the allocation granularity and the high bit of the allocation granularity according to the linked list boundary processing logic to obtain the corresponding operation result includes: Performing a first bit OR logic operation on the low bit of the allocation granularity to obtain a first operation result; Performing a second bit OR logic operation on the high bit of the allocation granularity to obtain a second operation result; The step of calculating the size of the applied linked list space according to the operation result includes: Performing a logical AND-NOT operation on the first operation result and the second operation result to obtain a third operation result, and performing an addition operation on the third operation result and the high bit of the allocation granularity by using a first adder to obtain a fourth operation result; Using a second bit splicer to perform a bit splicing operation on the fourth operation result and the minimum space allocation granularity to obtain the applied linked list space size; The step of calculating the number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient according to a preset calculation rule to obtain the size of the data space applied for includes: Using a first multiplier to multiply the number of command units by the first coefficient to obtain a fifth operation result, and using a second multiplier to multiply the number of data blocks in the stripe by the second coefficient to obtain a sixth operation result; The fifth operation result and the sixth operation result are added by a second adder to obtain a seventh operation result, and the seventh operation result and the minimum space allocation granularity are bit-joined by a third bit joiner to obtain the data space size applied for.
2. The method for determining the read and write command operation space requirement according to claim 1, It is characterized in that Determining the total size of the linked list according to the number of command units and the size of data pointers in the linked list includes: The first bit splicer is used to perform a bit splicing operation on the number of command units and the size of the data pointer in the linked list to obtain the total size of the linked list.
3. The method for determining the read and write command operation space requirement according to claim 1, It is characterized in that Determining a first coefficient of the number of command units according to the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command includes: determining a plurality of first candidate coefficients; Encoding the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command to obtain a first encoding result; The first coefficient is determined from the plurality of first candidate coefficients according to the first encoding result.
4. The method for determining the read and write command operation space requirement according to claim 3, It is characterized in that Determining a second coefficient of the number of data blocks in a stripe according to the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command includes: determining a plurality of second candidate coefficients; Encoding the level type of the target redundant array of independent disks and the read / write characteristics of the target read / write command to obtain a second encoding result; The second coefficient is determined from the plurality of second candidate coefficients according to the second encoding result and the number of disks of the target redundant array of independent disks.
5. The method for determining the read and write command operation space requirement according to claim 4, It is characterized in that Also includes: The minimum space allocation granularity, the data pointer size in the linked list, the multiple first candidate coefficients, and the multiple second candidate coefficients are configured in a register.
6. The method for determining the read and write command operation space requirement according to claim 1, It is characterized in that The first multiplier and the second multiplier are connected in parallel.
7. The method for determining the read and write command operation space requirement according to claim 1, It is characterized in that The read and write characteristics of the target read and write commands include the read and write type of the target read and write commands, the relationship between the number of command units and the number of data blocks in the stripe, and the target operation mode; wherein the read and write type includes a read operation or a write operation, and the target operation mode includes read-modify-write or read-reconstruct-write.
8. The method for determining the read and write command operation space requirement according to claim 1, It is characterized in that The calculation process of the linked list space size and the calculation process of the data space size are parallel calculation processes.
9. The method for determining the read / write command operation space requirement according to any one of claims 1 to 8, It is characterized in that Before calculating the number of command units, the first coefficient, the number of data blocks in the stripe, and the second coefficient according to a preset calculation rule, the method further includes: The preset calculation rule is determined according to the different levels of redundant arrays of independent disks and the read and write characteristics of the read and write commands corresponding to the different levels of redundant arrays of independent disks.
10. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the method for determining the read and write command operation space requirements as described in any one of claims 1 to 9 are implemented.
11. An electronic device, It is characterized in that include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the method for determining the read and write command operation space requirements as described in any one of claims 1 to 9.
12. A computer-readable storage medium, It is characterized in that Used to store computer programs; wherein, when the computer program is executed by a processor, the method for determining the read and write command operation space requirements as described in any one of claims 1 to 9 is implemented.
