Volume formatting method and device, computer device and storage medium
By allocating the volume to nodes in multiple domains for parallel formatting, the problem of long volume formatting time is solved, and efficient formatting operations are achieved.
Patent Information
- Application Number
- CN202311090040.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-08-28
AI Technical Summary
In related technologies, volume formatting operations are time-consuming, especially when the volume capacity is large, resulting in low efficiency.
The volume to be formatted is configured as an unowned volume, divided into multiple segments and assigned to multiple domains of the input/output group. Each domain is formatted by an owner node, and the formatting state is managed at the granularity through a bitmap. The formatting process is executed in parallel by multiple nodes.
By using multi-node parallel processing, the volume formatting time is significantly shortened, achieving load balancing and efficient formatting operations.
Smart Images

Figure CN117170583B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a volume formatting method, apparatus, computer device, and storage medium. Background Technology
[0002] When backing up data, the volume needs to be formatted to clear its file system structure and mark it as usable for data storage before backup. In related technologies, the volume formatting operation is performed by a node belonging to the input / output group, and the formatting process can be very time-consuming when the volume is large. Summary of the Invention
[0003] To address the aforementioned deficiencies or disadvantages, this application provides a volume formatting method, apparatus, computer device, and storage medium. Embodiments of this application can shorten the formatting time of volumes.
[0004] This application provides a volume formatting method according to a first aspect, wherein in some embodiments the method includes:
[0005] Configure the volume to be formatted as an unowned volume; the unowned volume is divided into multiple segments of the same size, each segment is composed of multiple granularities of the same size, and the above segments are assigned to multiple domains belonging to the input / output group; the above domains are configured from multiple nodes of the input / output group, and each domain includes the owner node;
[0006] Assign a bitmap for volume formatting to each node of the input / output group; the bitmap consists of multiple pages of equal capacity, each page consists of multiple bits, and each bit corresponds to a granularity; the value of each bit is used to indicate whether the granularity corresponding to that bit has been formatted;
[0007] The first processing logic is executed by the owner node of each domain. The first processing logic includes: taking all segments belonging to this domain among the above multiple segments as target segments, determining the target bit space in the bitmap of this node according to the target segments, and formatting the granularity in the target segments according to the target bit space.
[0008] In some embodiments, before assigning a bitmap for volume formatting to each node of the input / output group, the method further includes:
[0009] The bitmap capacity is determined based on the number of segments, segment capacity, granular capacity, and page capacity.
[0010] In some embodiments, formatting the target segment according to the target bit space includes:
[0011] Identify all target bits in the target bit space; a target bit is an unformatted bit whose corresponding value represents the granularity of the bit.
[0012] Format the granularity corresponding to each target bit;
[0013] After formatting the granularity corresponding to any target bit, the value of that target bit is modified to indicate that the corresponding granularity has been formatted.
[0014] In some embodiments, the first processing logic further includes:
[0015] Create a first quantity representing the number of unformatted granularities of this field based on the total number of target bits;
[0016] After formatting the granularity corresponding to any target bit, update the first number of values;
[0017] Domain progress information, representing the formatting progress of this domain, is calculated based on the updated first quantity and the pre-created second quantity, which represents the total number of granularities included in this domain.
[0018] In some embodiments, the above method further includes:
[0019] Get the third quantity representing the total number of granularities included in the pre-created unowned volumes;
[0020] Get the current domain progress information and the second quantity for each domain;
[0021] Based on the third quantity and the current domain progress information for each domain, the second quantity is used to calculate the volume progress information representing the formatted progress of the unowned volume;
[0022] Displays volume progress information.
[0023] In some embodiments, each domain further includes a backup node for taking over the execution of the first processing logic when the owner node of the domain fails; the owner node and the backup node in any domain are respectively configured on different nodes of the input / output group; the first processing logic further includes: after modifying the value of one or more target bits, sending the identifier and value of the one or more target bits in a specific message to the backup node of the domain;
[0024] Accordingly, the above method also includes: executing the second processing logic via backup nodes in each domain;
[0025] The second processing logic includes: in response to receiving a specific message sent by the owner node of this domain, extracting a bit identifier and the corresponding bit value from the specific message, replacing the value of the bit corresponding to the bit identifier in the bitmap of this node with the aforementioned bit value; and in response to a failure of the owner node of this domain, switching the role of this node to the owner node, and executing the first processing logic according to the current bitmap of this node.
[0026] In some embodiments, the above method further includes:
[0027] Get the number of faulty nodes in the input / output group;
[0028] If the number of faulty nodes exceeds a preset threshold, the remaining nodes in the input / output group will be configured as multiple new domains.
[0029] The first processing logic is executed through the owner node of each new domain;
[0030] When backup nodes are also included in each domain, the second processing logic is executed via the backup nodes in each domain.
[0031] This application provides a volume formatting apparatus according to a second aspect, wherein in some embodiments, the apparatus includes:
[0032] The volume configuration module is used to configure the volume to be formatted as an unowned volume. The unowned volume is divided into multiple segments of the same capacity. Each segment consists of multiple granularities of the same capacity. These multiple segments are assigned to multiple domains belonging to the input / output group. These multiple domains are configured from multiple nodes of the input / output group, and each domain includes the owner node.
[0033] The bitmap allocation module is used to allocate bitmaps for volume formatting to each node of the input / output group; the bitmap consists of multiple pages of the same capacity, each page consists of multiple bits, and each bit corresponds to a granularity; the value of each bit is used to indicate whether the granularity corresponding to that bit has been formatted.
[0034] The formatting module is used to execute first processing logic via the owner node of each domain. The first processing logic includes: taking all segments belonging to this domain among the above multiple segments as target segments, determining the target bit space in the bitmap of this node according to the target segments, and performing granularity formatting processing on the target segments according to the target bit space.
[0035] According to a third aspect, this application provides a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the volume formatting method provided in any of the above embodiments.
[0036] According to a fourth aspect, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the volume formatting method provided in any of the above embodiments.
[0037] In the above embodiments of this application, the volume to be formatted is configured as an unowned volume, such that each segment of the volume is evenly distributed to multiple fields obtained by configuring multiple nodes of the input / output group. Then, a bitmap for volume formatting is allocated to each node of the input / output group, and the first processing logic that can realize the formatting operation is executed through the owner node in each field. Compared with the related technology, which can only use one node of the input / output group to perform the volume formatting operation, the embodiments of this application can use multiple nodes of the input / output group to perform the formatting operation simultaneously, thereby achieving the purpose of shortening the formatting time of the volume. Attached Figure Description
[0038] Figure 1 This is a flowchart illustrating a volume formatting method provided in one or more embodiments of this application;
[0039] Figure 2 This is a flowchart illustrating the computational domain progress information provided in one or more embodiments of this application;
[0040] Figure 3 This is a flowchart illustrating the calculation of volume progress information provided in one or more embodiments of this application;
[0041] Figure 4 This is a schematic diagram illustrating the hierarchical relationship between the various segments in the volume and the various fields of the input / output groups in some examples of this application;
[0042] Figure 5 This is a schematic diagram of the target bit space corresponding to each field provided in some examples of this application;
[0043] Figure 6 This is a schematic diagram of the target bit space corresponding to each field provided in other examples of this application;
[0044] Figure 7 This is a structural block diagram of a volume formatting apparatus provided in one or more embodiments of this application;
[0045] Figure 8 This is an internal structural diagram of a computer device provided in one or more embodiments of this application. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the described embodiments are merely some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0047] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0048] In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0049] To address the time-consuming nature of related technologies when performing volume formatting operations, this application provides a volume formatting method. In some embodiments, the method includes, for example: Figure 1 The steps shown are described below, and the method will be explained in detail below.
[0050] S110: Configure the volume to be formatted as an unowned volume; the unowned volume is divided into multiple segments of the same size, each segment is composed of multiple granularities of the same size, and the above segments are assigned to multiple domains belonging to the input / output group; the above multiple domains are configured from multiple nodes of the input / output group, and each domain includes the owner node.
[0051] A volume refers to a storage area on a hard drive. Drives use file systems such as FAT (File Allocation Table) or NTFS (New Technology File System) to format volumes and assign them a drive letter. For example, in a Windows operating system, clicking the corresponding icon in "Windows Explorer" or "Computer" will display the drive's contents. Typically, a hard drive contains multiple volumes, and a volume can span multiple disks. A volume consists of multiple segments of the same size, and each segment consists of multiple units of the same size. The term "segment" in this context refers to a storage space composed of multiple consecutive logical block addresses (LBAs) in data backup. The size of a segment can be set according to specific needs, such as 32MB, 64MB, 128MB, etc. Furthermore, segments can be pre-assigned identifiers, such as numbers, based on the size of their corresponding addresses. The granularity mentioned above, known as grain in English, refers to the smallest manageable granularity in data backup functions, consisting of multiple consecutive logical block addresses. The size of the granularity can also be set according to the actual situation, such as 32KB, 64KB, 128KB, 256KB, etc.
[0052] Input / output groups, or IOGROUPs, are used in data backup to indicate a set of backup operations or tasks that can be executed in parallel to improve efficiency. Each IOGROUP typically contains one or more input / output operations that can read or write data simultaneously. By dividing backup operations into multiple IOGROUPs, better parallel processing and optimized input / output performance can be achieved.
[0053] An input / output group consists of multiple nodes. In related technologies, a volume belongs to only one node in the input / output group (this node can be called the volume's owner node), and IO (IN / OUT) processing for that volume can only be performed by its owner node. However, in this application, the volume is configured as an unowned volume, meaning the volume does not belong to any single node in the input / output group. Instead, the volume's segments are evenly distributed among the various domains belonging to the input / output group. The various domains belonging to the input / output group are obtained by configuring multiple nodes in the input / output group (which can be all or some of the nodes). There are several configuration methods; several examples are provided below.
[0054] In one implementation, each domain has only one type of node, namely the owner node (or owner node). The owner node is used to handle transactions and I / O processing within the domain. During volume formatting operations, the owner node in each domain initiates the formatting processing for each granularity belonging to its domain. The number of owner nodes in each domain can be one or more, and the specific number can be configured according to actual needs. In this implementation, each node of the input / output group is configured as an owner node in one or more domains. In one example, if the number of nodes in the input / output group is the same as the number of domains to be configured, then each node in the input / output group can be configured as the owner node of its respective domain. For example, if the input / output group has two nodes, Node_0 and Node_1, and two domains, Domain_0 and Domain_1, need to be configured, then Node_0 and Node_1 can be configured as owner nodes in Domain_0 and Domain_1, respectively. In another example, if the number of nodes in the input / output group is less than the number of domains that need to be configured, some nodes in the input / output group can be configured as owner nodes of multiple domains. For example, if the number of domains that need to be configured in the above example is not 2 but 4, namely Domain_0, Domain_1, Domain_2, and Domain_3, then Node_0 can be configured as the owner node of Domain_0 and Domain_1, and Node_1 can be configured as the owner node of Domain_2 and Domain_3. Understandably, in this case, Node_0 and Node_1 will both execute the formatting operations corresponding to the two domains in parallel.
[0055] In one implementation, each domain has two types of nodes: the owner node and the backup node (also called a Backup node). The backup node is used to take over the formatting operation when the owner node of the domain fails. This implementation configures each node of the input / output group as either an owner node or a backup node in one or more domains. In one example, if the number of nodes in the input / output group is not less than twice the number of domains to be configured, each node in the input / output group can be configured as either an owner node or a backup node for each domain. That is, in this example, any node in the input / output group only acts as an owner node or a backup node for a specific domain. For example, assuming the input / output group has four nodes, namely Node_0, Node_1, Node_2, and Node_3, and two domains, Domain_0 and Domain_1, need to be configured, then Node_0 and Node_1 can be configured as the owner nodes of Domain_0 and Domain_1, respectively, and Node_2 and Node_3 can be configured as backup nodes of Domain_0 and Domain_1, respectively. In another example, if the number of nodes in the input / output group is less than twice the number of domains to be configured, then at least some of the nodes in the input / output group need to be configured as both owner nodes and backup nodes for one or more domains. That is, in this example, one or more nodes in the input / output group will simultaneously be owner nodes and backup nodes, and the owner nodes and backup nodes do not belong to the same domain. For example, assuming that the number of domains to be configured in the above example is 4, namely Domain_0, Domain_1, Domain_2, and Domain_3, then during configuration, Node_0, Node_1, Node_2, and Node_3 can be configured as owner nodes for Domain_0, Domain_1, Domain_2, and Domain_3, respectively, and Node_0, Node_1, Node_2, and Node_3 can be configured as backup nodes for Domain_3, Domain_0, Domain_1, and Domain_2, respectively. In this example, any node in the input / output group is both an owner node of one domain and a backup node of another domain.
[0056] S120: Assign a bitmap for volume formatting to each node of the input / output group; the bitmap consists of multiple pages of equal capacity, each page consists of multiple bits, and each bit corresponds to a granularity; the value of each bit is used to indicate whether the granularity corresponding to that bit has been formatted.
[0057] When allocating bitmaps, a full bitmap needs to be allocated to each node of the input / output group. This bitmap must represent the formatting status of all grains (granularities) of the volume. The bitmap mentioned above is composed of multiple bits, each with a value that can only be 0 or 1. Each bit corresponds to a grain within the volume, and its value indicates whether that grain has been formatted. Specifically, if the value indicating a formatted grain is set to 0 (or can be set to 1), the value indicating an unformatted grain must be set to 1 (or 0). For ease of management, this embodiment uses pages as the unit of management for the bitmap. The page size can be set according to actual needs, such as 4KB, 8KB, etc. This embodiment does not impose any special restrictions.
[0058] In some embodiments, before allocating a bitmap for volume formatting to each node of the input / output group, the method further includes determining the capacity of the bitmap based on the number of segments, the capacity of the segments, the capacity of the granularity, and the capacity of the page.
[0059] The following example illustrates how the size of a bitmap is determined. In this example, assume each granularity has a size of 256KB, each segment has a size of 32MB, and each page has a size of 4KB (enough to represent a format of 256 segments). If the volume to be formatted contains n segments, the size of the bitmap can be determined as follows:
[0060] The number of pages contained in the bitmap = ((n-1) / 4 / 256+1)*4
[0061] S130: The first processing logic is executed by the owner node of each domain. The first processing logic includes: taking all segments belonging to this domain among the above multiple segments as target segments, determining the target bit space in the bitmap of this node according to the target segments, and formatting the granularity in the target segments according to the target bit space.
[0062] In this embodiment, the formatting operation of the entire volume is achieved by the owner nodes of each domain jointly executing the first processing logic.
[0063] When a volume is configured as an unowned volume, all segments in the volume are divided into domains. Therefore, in the first processing logic, the owner node of each domain only needs to format the granularity of the target segment, i.e., the segment allocated to its own node. Before or during the formatting process, each owner node determines whether the granularity has been formatted by checking the value of the bit corresponding to that granularity in the bitmap. As can be seen from the above description of step S120, the bitmap allocated to each node is complete, that is, it records the formatting status of all granularities in the volume. Therefore, when performing the formatting operation, each owner node only needs to use the bit space corresponding to the target segment in the bitmap (i.e., the target bit space).
[0064] The operation of the owner node of each domain to format the target segment according to the target bit space may include: determining all target bits in the target bit space; formatting the granularity corresponding to each target bit; and after formatting the granularity corresponding to any target bit, modifying the value of that target bit to a value indicating that the corresponding granularity has been formatted.
[0065] The target bit mentioned above represents the corresponding granularity of the unformatted bit. For example, assuming 1 represents formatted and 0 represents unformatted, if the value of a bit is 0, then that bit is the target bit. After formatting the granularity corresponding to that bit, the value of that bit will be modified to 1.
[0066] In the above embodiments, the method provided by this application configures the volume to be formatted as an unowned volume, so that each segment of the volume is evenly distributed to multiple domains obtained by configuring multiple nodes of the input / output group. Then, a bitmap for volume formatting is allocated to each node of the input / output group, and the first processing logic that can realize the formatting operation is executed by the owner node in each domain. Compared with the related technology, which can only use one node of the input / output group to perform the volume formatting operation, this method uses multiple nodes of the input / output group to perform the formatting operation simultaneously, thereby achieving load balancing of each node in the input / output group during volume formatting, and thus significantly shortening the formatting time of the entire volume.
[0067] In some embodiments, such as Figure 2 As shown, the first processing logic also includes:
[0068] S210: Create a first quantity representing the number of unformatted granularities of this domain based on the total number of all target bits;
[0069] S220: After formatting the granularity corresponding to any target bit, update the first number of values;
[0070] S230: Calculate the domain progress information representing the formatting progress of this domain based on the updated first quantity and the pre-created second quantity representing the total number of granularities included in this domain.
[0071] Domain progress information can be calculated in several ways. For example, the domain progress information mentioned above is calculated as: (100 * (second quantity - first quantity)) / second quantity.
[0072] In this embodiment, the owner node of each domain can calculate its own formatting progress. Understandably, as the formatting operation continues, the aforementioned first quantity and domain progress information will be continuously updated until all granularities in the target segment have been formatted, at which point the first quantity is 0 and the domain progress information is 100.
[0073] In some embodiments, such as Figure 3 As shown, the above method also includes:
[0074] S310: Get the third quantity representing the total number of granularities included in the pre-created unowned volume;
[0075] S320: Obtain the current domain progress information and second quantity for each domain;
[0076] S330: Calculate the volume progress information representing the formatted progress of the unowned volume based on the third quantity and the current domain progress information of each domain, and the second quantity;
[0077] S340: Displays volume progress information.
[0078] There are multiple ways to calculate volume progress information. For example, the above-mentioned method for calculating volume progress information can be to calculate the product of the domain progress information of each domain and the second quantity, then sum all the products, and finally divide the summed value by the third quantity to obtain the volume progress information.
[0079] This embodiment can calculate the formatting progress of the entire volume, i.e., the volume progress information, based on the domain progress information calculated by the owner nodes of each domain. Understandably, as the formatting operations of the owner nodes of each domain continue, the aforementioned domain progress information and volume progress information will be continuously updated until all granularities of the entire volume have been formatted. At this point, the domain progress information of each domain is 100, and the volume progress information is 100.
[0080] The above embodiments are applicable to situations where there is only an owner node or both an owner node and a backup node in each domain.
[0081] This application also provides other embodiments in which each domain has both an owner node and a backup node. In this embodiment, the first processing logic further includes: after modifying the value of one or more target bits, sending the identifier and value of the one or more target bits in a specific message to the backup node of the domain.
[0082] Accordingly, the above method further includes: executing a second processing logic via backup nodes of each domain. The second processing logic includes: in response to receiving a specific message sent by the owner node of the domain, extracting a bit identifier and its corresponding bit value from the specific message, and replacing the value of the bit corresponding to the bit identifier in the bitmap of the current node with the aforementioned bit value.
[0083] Furthermore, the second processing logic also includes: in response to a failure of the owner node of this domain, switching the role of this node to the owner node, and executing the first processing logic according to the current bitmap of this node.
[0084] In this embodiment, each domain has a backup node. When the bitmap changes, the owner node of each domain synchronizes relevant change information (such as the identifier and value of the target bit that has been modified) to the backup node. Therefore, when the owner node of a domain fails, the backup node can promptly switch to become the owner node of that domain and execute the first processing logic to continue the formatting operation, thereby improving the reliability of this method. In some other embodiments, the above method further includes:
[0085] Get the number of faulty nodes in the input / output group;
[0086] If the number of faulty nodes exceeds a preset threshold, the remaining nodes in the input / output group will be configured as multiple new domains.
[0087] The first processing logic is executed through the owner node of each new domain;
[0088] When backup nodes are also included in each new domain, the second processing logic is executed via the backup nodes in each domain.
[0089] In this embodiment, when too many nodes in the input / output group fail (i.e., the number of failed nodes exceeds a preset threshold, which can be set according to actual conditions), the remaining nodes are automatically configured into multiple domains. If each domain contains only an owner node, the owner node in each new domain will continue to execute the first processing logic. If each domain contains both an owner node and a backup node, both the owner node and the backup node in each new domain will continue to execute the first and second processing logics, ensuring that the volume formatting operation can continue. Since the first and second processing logics have been described in detail in the above embodiment, they will not be repeated in this embodiment. It should also be noted that the number of domains obtained through reconfiguration can be the same as or different from the number of domains obtained through previous configuration.
[0090] To facilitate understanding of the first processing logic, some examples will be used to illustrate it in detail below.
[0091] In this example, the input / output group has four nodes: Node0, Node1, Node2, and Node3. These four nodes are configured as four domains: domain0, domain1, domain2, and domain3. The nodes in each domain are composed as follows:
[0092] domain0: Node0 (owner node), Node1 (backup node);
[0093] domain1: Node1 (owner node), Node2 (backup node);
[0094] domain2: Node2 (owner node), Node3 (backup node);
[0095] domain3: Node3 (owner node), Node0 (backup node).
[0096] In this example, the volume to be formatted is divided into 16 segments, each 32MB in size. These segments are numbered s1 to s16 according to their addresses in ascending order. These segments are then evenly distributed among the four fields mentioned above. The relationship between the 16 segments and the four fields can be found in [reference needed]. Figure 4 As shown, s1, s5, s9, and s13 belong to domain0, s2, s6, s10, and s14 belong to domain1, s3, s7, s11, and s15 belong to domain2, and s4, s8, s12, and s16 belong to domain3.
[0097] In this example, each node in the input / output group is assigned a bitmap. Each bitmap can be divided into four parts, each corresponding to a field. This example uses a page size of 4KB. The correspondence between the parts and fields can be found in [reference needed]. Figure 5 As shown, the segments corresponding to domain 0 occupy 0–1 / 4 of the entire bitmap space, arranged from smallest to largest logical block address; the segments corresponding to domain 1 occupy 1 / 4–1 / 2 of the entire bitmap space, arranged from smallest to largest logical block address; the segments corresponding to domain 2 occupy 1 / 2–3 / 4 of the entire bitmap space, arranged from smallest to largest logical block address; and the segments corresponding to domain 3 occupy 3 / 4–1 of the entire bitmap space, arranged from smallest to largest logical block address. Generally, the capacity of the bitmap corresponding to each domain is an integer multiple of the capacity of the managed unit of that bitmap. The capacity of the bitmap required for the entire volume is an integer multiple of the product of the managed unit capacity of the bitmap and the number of domains. Assuming a page size of 4KB, the capacity of the bitmap corresponding to each domain is an integer multiple of 4KB, and the capacity of the bitmap required for the entire volume is an integer multiple of 16KB.
[0098] Furthermore, when formatting a volume, a bitmap scan is required to determine whether the granularity corresponding to a bit has been formatted based on its value. It's important to note that in this example, each node in the input / output group is allocated a full bitmap. Although each node is both the owner of one domain and a backup node for another, the bitmap operated on by each node when executing the first or second processing logic is the bitmap allocated to that node, not the bitmaps allocated to other nodes. For example, Node0 is both the owner of domain0 and a backup node for domain3. The bitmap operated on by Node0 when executing the corresponding first processing logic as the owner of domain0, and the bitmap operated on by Node0 when executing the corresponding second processing logic as the backup node for domain3, are the same. Figure 1 Similarly, they are all bitmaps allocated to Node0.
[0099] The formatting process performed by the owner nodes of each domain based on the target bit space is similar, and the specific process can be seen in the following example:
[0100] In this example, assume that in the bitmap of each node, the target bit space corresponding to each field is as follows: Figure 6 As shown, the target bit spaces corresponding to domain0, domain1, domain2, and domain3 are p1 to p4, p5 to p8, p9 to p12, and p13 to p16, respectively.
[0101] When formatting the granularity in the target segment belonging to domain0, the owner node Node0 of domain0 will execute the processing logic corresponding to the owner node of domain0. Specifically, it will perform a bitmap scan, that is, scan p1, p2, p3, p4 (p is an abbreviation for page, p1 represents the first page in the bitmap, and p2 represents the second page in the bitmap), and count the number of unformatted bits as the DomainStaleGrainCount[0] of domain0 (that is, the first count of domain0); then, according to the correspondence between the scanned bits and granularity, the granularity corresponding to each target bit will be formatted; after the formatting is completed, the DomainStaleGrainCount[0] corresponding to domain0 will be modified (specifically, it will be decremented by 1), and the value of the relevant target bit will also be modified so that the modified value indicates that the corresponding granularity has been formatted; after modifying the value of the target bit, the modification status of the bit will be sent to the backup node (Node1) of domain0 through a message. Node1 will execute the processing logic corresponding to the backup node of domain0, that is, modify the value of the bit corresponding to the bit in the bitmap allocated to Node1 to indicate that the corresponding granularity has been formatted.
[0102] When formatting the granularity in the target segment belonging to domain1, the owner node Node1 of domain1 will execute the processing logic corresponding to the owner node of domain1. Specifically, it will perform bitmap scanning, that is, scan p5, p6, p7, p8, and count the number of unformatted bits as the DomainStaleGrainCount[1] of domain1 (that is, the first count of domain1); then, according to the correspondence between the scanned bits and granularity, it will format the granularity corresponding to each target bit; after the formatting is completed, it will modify the DomainStaleGrainCount[1] corresponding to domain1 (specifically, it will decrement the value of the target bit), and also modify the value of the target bit so that the modified value indicates that the corresponding granularity has been formatted; after modifying the value of the target bit, it will send the modification status of the bit to the backup node (Node2) of domain1 through a message. Node2 will execute the processing logic corresponding to the backup node of domain1, that is, modify the value of the bit in the bitmap allocated to Node2 to indicate that the corresponding granularity has been formatted.
[0103] When formatting the granularity of the target segment belonging to domain2, the Node2, the owner node of domain2, will execute the processing logic corresponding to the owner node of domain1. Specifically, it will perform a bitmap scan, that is, scan p9, p10, p11, p12, and count the number of unformatted bits as the DomainStaleGrainCount[2] of domain2 (that is, the first count of domain2); then, according to the correspondence between the scanned bits and the granularity, it will format the granularity corresponding to each target bit; after the formatting is completed, it will modify the DomainStaleGrainCount[2] corresponding to domain2 (specifically, it will decrement the value of the target bit), and at the same time, it will also modify the value of the target bit so that the modified value indicates that the corresponding granularity has been formatted; after modifying the value of the target bit, it will send the modification status of the bit to the backup node (Node3) of domain2 through a message. Node3 will execute the processing logic corresponding to the backup node of domain2, that is, modify the value of the bit in the bitmap allocated to Node3 to indicate that the corresponding granularity has been formatted.
[0104] When formatting the granularity in the target segment belonging to domain3, the owner node Node3 of domain3 will execute the processing logic corresponding to the owner node of domain3. Specifically, it will perform bitmap scanning, that is, scan p13, p14, p15, p16, and count the number of unformatted bits as the DomainStaleGrainCount[3] of domain3 (that is, the first count of domain3); then, according to the correspondence between the scanned bits and granularity, it will format the granularity corresponding to each target bit; after the formatting is completed, it will modify the DomainStaleGrainCount[3] corresponding to domain3 (specifically, it will decrement the value of the target bit), and also modify the value of the target bit so that the modified value indicates that the corresponding granularity has been formatted; after modifying the value of the target bit, it will send the modification status of the bit to the backup node (Node0) of domain3 through a message. Node0 will execute the processing logic corresponding to the backup node of domain3, that is, modify the value of the bit corresponding to the bit in the bitmap allocated to Node0 to indicate that the corresponding granularity has been formatted.
[0105] Furthermore, regarding the management of volume formatting progress, this example provides the following procedure:
[0106] Based on the volume size, record the first number of each domain, that is, the number of unformatted granularities, such as DomainStaleGrainCount[0] to DomainStaleGrainCount[3], and record the number of unformatted granularities of the entire volume as TotalStaleGrainCount. The value of TotalStaleGrainCount is the sum of DomainStaleGrainCount[0] to DomainStaleGrainCount[3]. Understandably, as the volume formatting operation continues, the values of these counts will change continuously.
[0107] When creating a volume, the total number of granularities for each domain is recorded as DomainGrainCount[0] to DomainGrainCount[3], and the total number of granularities for the volume is recorded as TotalGrainCount. The value of TotalGrainCount is the sum of DomainGrainCount[0] to DomainGrainCount[3]. Understandably, these counts are fixed.
[0108] After the volume is created and before formatting begins, the values of DomainStaleGrainCount[0] to DomainStaleGrainCount[3] and DomainGrainCount[0] to DomainGrainCount[3] are equal, while TotalStaleGrainCount and TotalGrainCount are equal.
[0109] Once the volume begins to be formatted, as the formatting operation continues, the values of DomainStaleGrainCount[0] to DomainStaleGrainCount[3] will gradually decrease until they finally decrease to 0, which means that the formatting operation of the relevant domain has been completed. TotalStaleGrainCount will also gradually decrease, and when all domains have been formatted, TotalStaleGrainCount will also decrease to 0.
[0110] The formatting progress of each domain is calculated separately. The formatting progress of each domain can be denoted as DomainPercent[0] to DomainPercent[3], with a value range of 0-100. The formatting progress of each domain can be calculated using the following formula:
[0111] DomainPercent=(100*((DomainGrainCount–DomainStaleGrainCount))) / DomainGrainCount
[0112] When the DomainPercent of any domain is 100, the corresponding DomainStaleGrainCount will also be reduced to 0, indicating that all granularities in the target segment of that domain have been formatted.
[0113] The formatting progress of the entire volume can be represented as a percent, with a value ranging from 0 to 100; it can be calculated using the following formula:
[0114] Percent=((DomainPercent[0]*DomainGrainCount[0])+(DomainPercent[1]*DomainGrainCount[1])+(DomainPercent[2]*DomainGrainCount[2])+(DomainPercent[3]*DomainGrainCount[3])) / TotalGrainCount
[0115] Once the percentage is calculated, it can be presented to the user so that they can understand the volume formatting progress.
[0116] It should be noted that, unless otherwise expressly stated herein, the execution order of the steps included in the volume formatting method provided in any of the above embodiments is not strictly limited, and these steps can be executed in other orders. Moreover, at least some of these steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0117] Based on the same inventive concept, this application also provides a volume formatting apparatus. In some embodiments, such as Figure 7 As shown, the volume formatting device includes the following modules:
[0118] Volume configuration module 110 is used to configure the volume to be formatted as an unowned volume; the unowned volume is divided into multiple segments of the same capacity, each segment is composed of multiple granularities of the same capacity, and the above multiple segments are assigned to multiple domains belonging to the input / output group; the above multiple domains are configured from multiple nodes of the input / output group, and each domain includes the owner node.
[0119] Bitmap allocation module 120 is used to allocate bitmaps for volume formatting to each node of the input / output group; the bitmap includes multiple pages of the same capacity, each page includes multiple bits, each bit corresponds to a granularity; the value of each bit is used to indicate whether the granularity corresponding to that bit has been formatted.
[0120] The formatting module 130 is used to execute a first processing logic via the owner node of each domain. The first processing logic includes: taking all segments belonging to this domain among the above multiple segments as target segments, determining the target bit space in the bitmap of this node according to the target segments, and performing granularity formatting processing on the target segments according to the target bit space.
[0121] In some embodiments, before the bitmap allocation module 120 allocates a bitmap for volume formatting to each node of the input / output group, it is also used to determine the capacity of the bitmap based on the number of the plurality of segments, the capacity of the segments, the capacity of the granularity, and the capacity of the page.
[0122] In some embodiments, the operation of formatting the target segment according to the target bit space in the first processing logic specifically includes:
[0123] Identify all target bits in the target bit space; a target bit is an unformatted bit whose corresponding value represents the granularity of the bit.
[0124] Format the granularity corresponding to each target bit;
[0125] After formatting the granularity corresponding to any target bit, the value of that target bit is modified to indicate that the corresponding granularity has been formatted.
[0126] In some embodiments, the first processing logic further includes:
[0127] Create a first quantity representing the number of unformatted granularities of this field based on the total number of target bits;
[0128] After formatting the granularity corresponding to any target bit, update the first number of values;
[0129] Domain progress information, representing the formatting progress of this domain, is calculated based on the updated first quantity and the pre-created second quantity, which represents the total number of granularities included in this domain.
[0130] In some embodiments, the above-described apparatus further includes a roll progress display module (not shown in the figure).
[0131] The volume progress display module is used for:
[0132] Get the third quantity representing the total number of granularities included in the pre-created unowned volumes;
[0133] Get the current domain progress information and the second quantity for each domain;
[0134] Based on the third quantity and the current domain progress information for each domain, the second quantity is used to calculate the volume progress information representing the formatted progress of the unowned volume;
[0135] Displays volume progress information.
[0136] In some embodiments, each domain further includes a backup node; correspondingly, the first processing logic further includes: after modifying the value of one or more target bits, sending the identifier and value of the one or more target bits in a specific message to the backup node of the domain;
[0137] Accordingly, the formatting module 130 is further configured to: execute a second processing logic via backup nodes of each domain; the second processing logic includes: in response to receiving a specific message sent by the owner node of the domain, extracting a bit identifier and a corresponding bit value from the specific message, replacing the value of the bit corresponding to the bit identifier in the bitmap of the current node with the aforementioned bit value, and in response to a failure of the owner node of the domain, switching the role of the current node to the owner node, and executing the first processing logic according to the current bitmap of the current node.
[0138] In some embodiments, the above-described apparatus further includes:
[0139] The fault node count acquisition module (not shown in the figure) is used to acquire the number of faulty nodes in the input / output group;
[0140] The node configuration module (not shown in the figure) is used to configure the remaining nodes of the input / output group as multiple new domains when the number of faulty nodes exceeds a preset threshold.
[0141] The formatting module 130 is also configured to execute first processing logic via the owner node in each new domain; and, when the new domain also includes a backup node, execute second processing logic via the backup node in each domain.
[0142] For specific limitations regarding the volume formatting device, please refer to the limitations on the volume formatting method above, which will not be repeated here. Each module in the aforementioned volume formatting device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0143] This application provides a computer device in some embodiments, the internal structure of which can be shown as follows: Figure 8As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores configuration information for multiple domains of the input / output group, the correspondence between these domains and multiple segments of the unowned volume, and other data. Specific data stored may also be defined in the above method embodiments. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a volume formatting method.
[0144] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0145] This embodiment also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement the steps of the volume formatting method provided in any of the above embodiments.
[0146] In some embodiments, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the volume formatting method provided in any of the above embodiments.
[0147] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0148] Those skilled in the art will understand that implementing all or part of the processes in the above method embodiments can be accomplished by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink, DRAM (SLDRAM), RAMbus, direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0149] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0150] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A volume formatting method, characterized in that, The method includes: The volume to be formatted is configured as an unowned volume; the unowned volume is divided into multiple segments of the same capacity, each segment is composed of multiple granularities of the same capacity, and the multiple segments are assigned to multiple domains belonging to the input / output group; the multiple domains are configured from multiple nodes of the input / output group, and each domain includes an owner node; A bitmap for volume formatting is assigned to each node of the input / output group; the bitmap includes multiple pages of equal capacity, each page includes multiple bits, each bit corresponds to a granularity; the value of each bit is used to indicate whether the granularity corresponding to that bit has been formatted; The first processing logic is executed via the owner node of each of the domains. The first processing logic includes: taking all segments belonging to this domain among the plurality of segments as target segments, determining the target bit space in the bitmap of this node according to the target segments, and formatting the granularity in the target segments according to the target bit space.
2. The method as described in claim 1, characterized in that, Before assigning a bitmap for volume formatting to each node of the input / output group, the method further includes: The capacity of the bitmap is determined based on the number of segments, the capacity of the segments, the capacity of the granularity, and the capacity of the page.
3. The method as described in claim 1, characterized in that, The target segment is formatted according to the target bit space, including: Identify all target bits in the target bit space; the target bit is the corresponding value representing the corresponding granularity of the unformatted bit; Format the granularity corresponding to each target bit; After formatting the granularity corresponding to any target bit, the value of that target bit is modified to indicate that the corresponding granularity has been formatted.
4. The method according to any one of claims 1-3, characterized in that, The first processing logic further includes: A first quantity representing the number of unformatted granularities of this domain is created based on the total number of all target bits. After formatting the granularity corresponding to any target bit, update the first number of values; Domain progress information, representing the formatting progress of this domain, is calculated based on the updated first quantity and the pre-created second quantity, which represents the total number of granularities included in this domain.
5. The method as described in claim 4, characterized in that, The method further includes: Obtain a pre-created third quantity representing the total number of granularities included in the unowned volume; Obtain the current domain progress information and the second quantity for each of the domains; Based on the third quantity and the current domain progress information of each domain, and the second quantity, calculate the volume progress information representing the formatting progress of the unowned volume; The volume progress information is displayed.
6. The method as described in claim 3, characterized in that, Each of the domains also includes a backup node for taking over the execution of the first processing logic when the owner node of the domain fails; the owner node and the backup node in any of the domains are respectively configured on different nodes of the input / output group; The first processing logic further includes: after modifying the value of one or more target bits, sending the identifier and value of the one or more target bits in a specific message to the backup node of this domain; The method further includes: executing a second processing logic via backup nodes of each of the domains; The second processing logic includes: in response to receiving a specific message sent by the owner node of this domain, extracting a bit identifier and a corresponding bit value from the specific message, and replacing the value of the bit corresponding to the bit identifier in the bitmap of this node with the bit value; and in response to a failure of the owner node of this domain, switching the role of this node to the owner node, and executing the first processing logic according to the current bitmap of this node.
7. The method as described in claim 6, characterized in that, The method further includes: Obtain the number of faulty nodes in the input / output group; If the number of faulty nodes exceeds a preset threshold, the remaining nodes in the input / output group will be configured as multiple new domains. The first processing logic is executed via the owner node of each new domain; When backup nodes are also included in each new domain, the second processing logic is executed via the backup nodes in each domain.
8. A volume formatting device, characterized in that, The device includes: The volume configuration module is used to configure the volume to be formatted as an unowned volume; the unowned volume is divided into multiple segments of the same capacity, each segment is composed of multiple granularities of the same capacity, and the multiple segments are assigned to multiple domains belonging to the input / output group; the multiple domains are configured from multiple nodes of the input / output group, and each domain includes an owner node. The bitmap allocation module is used to allocate a bitmap for volume formatting to each node of the input / output group; the bitmap includes multiple pages of the same capacity, each page includes multiple bits, each bit corresponds to a granularity; the value of each bit is used to indicate whether the granularity corresponding to the bit has been formatted. A formatting module is configured to execute a first processing logic via the owner node of each of the domains, the first processing logic comprising: taking all segments belonging to the domain among the plurality of segments as target segments, determining a target bit space in the bitmap of the current node based on the target segments, and formatting the granularity of the target segments based on the target bit space.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Formatting scheduling method and device for redundant array of independent disks, equipment and medium
CN114995771A
Thick standby volume processing method, device and equipment and readable storage medium
CN115454700A