Method for managing a metadata storage unit, electronic device, and computer program product
By dynamically managing the allocation of metadata storage units, the problem of the storage system entering write-protected mode when metadata is insufficient is solved, and the system availability and performance are improved.
Patent Information
- Application Number
- CN202110090582.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-22
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2041-01-22
AI Technical Summary
The storage system enters write-protected mode when the metadata storage space is insufficient, affecting the storage of user data and system availability, resulting in the inability to exit write-protected mode in time.
By dynamically adjusting the reserved metadata storage space, the allocation of metadata storage units is managed according to the usage of metadata storage units in the storage system to prevent the storage system from entering write-protected mode.
Improves the availability and stability of the storage system, prevents frequent entry of write-protected mode, and improves system performance and user experience.
Smart Images

Figure CN114780014B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure generally relate to methods, electronic devices, and computer program products for managing metadata storage units. Background Art
[0002] In a storage system, when writing user data, it is necessary to write the corresponding metadata accordingly. The performance of metadata input / output (I / O) is crucial for system performance. Usually, the storage system needs to reserve a certain amount of metadata storage space. When the metadata storage space in the storage system is about to be exhausted, the storage system may enter a write protection mode. In the write protection mode, the storage system only allows read operations and some other limited operations. After the storage system enters the write protection mode, user data may not be stored in the backend storage device in a timely manner. This may hinder the execution of some subsequent operations, causing the storage system to be unable to exit the write protection mode, thereby affecting the availability of the storage system. Summary of the Invention
[0003] Embodiments of the present disclosure provide methods, electronic devices, and computer program products for managing metadata storage units.
[0004] In a first aspect of the present disclosure, a method for managing metadata storage units is provided. The method includes: in response to a request received from a client to allocate a target number of metadata storage units, determining a first number of available metadata storage units remaining in the metadata storage space of the storage system after the allocation; and if the first number is not less than a reserved number, allocating the target number of metadata storage units from the metadata storage space for use by the client, where the reserved number is associated with the usage of metadata storage units in the storage system.
[0005] In a second aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit and at least one memory. The at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. The instructions, when executed by the at least one processing unit, cause the device to perform actions, the actions including: in response to a request received from a client to allocate a target number of metadata storage units, determining a first number of available metadata storage units remaining in the metadata storage space of the storage system after the allocation; and if the first number is not less than a reserved number, allocating the target number of metadata storage units from the metadata storage space for use by the client, where the reserved number is associated with the usage of metadata storage units in the storage system.
[0006] In a third aspect of the present disclosure, there is provided a computer program product. The computer program product is tangibly stored on a non-transitory computer-readable medium and includes machine-executable instructions that, when executed, cause the machine to implement any of the steps of the method described in the first aspect of the present disclosure.
[0007] The summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. The summary is not intended to identify key features or essential features of the present disclosure, nor is it intended to limit the scope of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] The above and other objects, features, and advantages of the present disclosure will become more apparent from the following more detailed description of exemplary embodiments of the present disclosure when taken in conjunction with the accompanying drawings, in which like reference numerals generally represent like components in the exemplary embodiments of the present disclosure. In the drawings:
[0009] Figure 1 A schematic diagram of an example environment in which embodiments of the present disclosure may be implemented is shown;
[0010] Figure 2 A flowchart of a method for allocating metadata storage units according to an embodiment of the present disclosure is shown;
[0011] Figure 3 A flowchart of a method for determining the reserved number of metadata storage units according to an embodiment of the present disclosure is shown;
[0012] Figure 4 A flowchart of a method for exiting the write protection mode according to an embodiment of the present disclosure is shown; and
[0013] Figure 5 A block diagram of an example device that may be used to implement embodiments of the present disclosure is shown.
[0014] In the various drawings, the same or corresponding reference numerals indicate the same or corresponding parts. DETAILED DESCRIPTION
[0015] Preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure will be more thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
[0016] As used herein, the term "comprising" and its variations denote open-ended inclusion, i.e., "including but not limited to". Unless specifically stated otherwise, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included hereinafter.
[0017] Traditionally, in a storage system, metadata is typically allocated to available metadata storage units, such as leaf indirect pointer block (IDP) pages, which occupy 4KB of storage space and are associated with a contiguous 2MB logical storage space for writing user data. In the above case, the traditional scheme usually has a fixed-size (e.g., 1GB) metadata storage space. However, in the worst case, only 4KB of user data is written in the contiguous 2M logical storage space, that is, the ratio of user data to metadata is 1:1. In this worst case, the 1GB metadata storage space is significantly insufficient and the storage system is easily put into the write protection mode. When the storage system enters the write protection mode, user data cannot be flushed to the backend storage device in a timely manner. This may hinder the execution of some subsequent operations, causing the storage system to be unable to exit the write protection mode, thereby affecting the availability of the storage system.
[0018] To at least partially address one or more of the above problems and other potential problems, example embodiments of the present disclosure propose a scheme for managing metadata storage units. This scheme dynamically adjusts the size of the reserved metadata storage space (i.e., the number of reserved metadata storage units available for allocation) according to the usage of metadata storage units in the storage system. When receiving a request to allocate a target number of metadata storage units, this scheme determines the number of available metadata storage units remaining in the metadata storage space after the allocation. If this number is not less than the reserved number, the allocation is performed; otherwise, the allocation is performed after expanding the metadata storage space. In this way, this scheme can effectively manage the metadata storage space of the storage system, thereby improving the availability of the storage system.
[0019] Hereinafter, in combination with Figures 1 to 5 specific examples of this scheme will be described in more detail. Figure 1 FIG. shows a schematic diagram of an example of a storage system 100 according to an embodiment of the present disclosure. Figure 1 FIG. shows a block diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. As Figure 1As shown, environment 100 includes storage clients 110-1 and 110-2, storage managers 120-1 and 120-2, and a persistent storage device 130. It should be understood that the structure and functions of environment 100 are described only for exemplary purposes, without implying any limitation on the scope of the present disclosure. For example, embodiments of the present disclosure can also be applied to environments different from environment 100. The functions of storage client 110-1 and storage client 110-2 (hereinafter collectively referred to as storage client 110) are similar, and the functions of storage manager 120-1 and 120-2 (hereinafter collectively referred to as storage manager 120) are similar. Hereinafter, only storage client 110-1 and storage manager 120-1 will be described as examples of their functions.
[0020] The persistent storage device 130 may include a disk, an optical disc, a hard disk drive (HDD), or a solid state drive (SSD), etc. According to the type of data stored, the persistent storage device 130 may include different storage spaces, such as a user data storage space for storing user data and a metadata storage space for storing metadata. Each storage space may include multiple storage units. For example, each storage unit may have the same size. That is, according to the different types of data stored or according to the divided logical layers, the storage device 130 may include various types of storage units, such as storage units for storing user data (also referred to as "user data storage units"), storage units for storing metadata (also referred to as "metadata storage units"), etc. The metadata storage unit may store mapping information, index information, status information, etc. related to the user data, such as the mapping information from the storage unit to the physical disk, the status of the storage unit (such as, normal status or faulty status), etc. The data stored in the multiple storage units in the persistent storage device 130 may be interrelated.
[0021] The storage manager 120-1 may receive data read / write requests from the storage client 110-1. When receiving a user data read request, the storage manager 120-1 may read the user data from the persistent storage device 130 and return it to the storage client 110-1. When receiving a user data write request, the storage manager 120-1 needs to allocate a metadata storage unit of an appropriate size to write the metadata corresponding to the user data. For the user data to be written, the storage manager 120-1 may first write the user data to be written into the cache at the storage manager 120-1. The data in the cache is also referred to as "dirty data". The storage manager 120-1 may use a background process to flush the dirty data to the persistent storage device 130.
[0022] In the above example, for instance, a user data write request may trigger a request to allocate one or more metadata storage units. In such a case, the storage manager 120-1 may determine the number of remaining available metadata storage units after allocating the one or more metadata storage units in the metadata storage space of the persistent storage device 130. The storage manager 120-1 may compare the number of remaining available metadata storage units with the number of reserved metadata storage units, and perform subsequent operations based on the comparison result. The number of reserved metadata storage units may be dynamically adjusted based on the usage of the metadata storage units. In this way, the possibility of the storage system 100 entering the write protection mode can be reduced. Additionally, in the case where the storage system 100 enters the write protection mode, the storage manager 120-1 may determine when to exit the write protection mode.
[0023] The operations of the storage manager 120-2 are similar. The storage managers 120-1 and 120-2 may independently process data read / write requests from the storage clients 110-1 and 110-2 respectively. The storage managers 120-1 and 120-2 may each have their own cache for caching dirty data, and may periodically flush the dirty data to the persistent storage device 130. Additionally, there may be a communication interface between the storage managers 120-1 and 120-2 for synchronizing data and / or status information.
[0024] It should be understood that although two storage clients and two storage managers are illustrated, this is merely exemplary, and any number of storage clients and storage managers may exist. The illustrated numbers are not intended to limit the scope of the present disclosure. The various embodiments of the present disclosure will be described in further detail below in conjunction with Figures 2 to 4 to further describe the various embodiments of the present disclosure in detail.
[0025] Figure 2 A flowchart of an example method 200 for allocating metadata storage units according to an embodiment of the present disclosure is shown. The method 200 may be performed, for example, by a storage manager 120 (such as the storage manager 120-1 or 120-2) as Figure 1 shown. It should be understood that the method 200 may also include additional actions not shown and / or may omit the actions shown, and the scope of the present disclosure is not limited in this regard. The method 200 will be described in detail below in conjunction with Figures 1 to 4 to describe the method 200 in detail.
[0026] As Figure 2As shown, at block 210, in response to a request received from a client to allocate a target number of metadata storage units, the storage manager 120 determines a first number of available metadata storage units remaining in the metadata storage space of the storage system after the allocation is performed. For example, after the storage manager 120 receives a request from the storage client 110 to allocate metadata storage units, the storage manager 120 may determine the number of available metadata storage units remaining in the metadata storage space in the persistent storage device 130 after the allocation is performed (also referred to herein as the "first number").
[0027] In one embodiment, when the storage manager 120 receives a request to allocate N metadata storage units, the storage manager 120 may determine the number L of available metadata storage units remaining in the metadata storage space after the allocation is performed. For example, the storage manager 120 determines that the capacity of the metadata storage space is T, that is, the total number of metadata storage units therein is T. The storage manager 120 queries that the last configured logical block address (LBA) is X, which indicates the number of allocated metadata storage units in the metadata storage space. The storage manager may determine that the number of metadata storage units available for allocation in the metadata storage space is T - X. Then, the storage manager 120 may determine that the first number of available metadata storage units remaining in the metadata storage space after the allocation is performed is L = T - X - N.
[0028] Note that the above embodiments for calculating the first number are merely exemplary. Depending on different storage structures, different methods may be used to determine the number of available metadata storage units remaining in the metadata storage space after allocating the requested metadata storage units.
[0029] At block 220, if the storage manager 120 determines that the first number is not less than the reserved number, it allocates a target number of metadata storage units from the metadata storage space for use by the client 110. The reserved number is associated with the usage of the metadata storage units in the storage system. Specifically, the reserved number may be dynamically adjusted according to the number of user data storage units flushed in the storage system during a historical time period, the number of used metadata storage units, and the number of user data storage units to be flushed. The following is described in further detail in conjunction with Figure 3 Further details are provided.
[0030] Figure 3 FIG. shows a flowchart of an example method 300 for determining a reserved number according to an embodiment of the present disclosure. As described above, a certain number of metadata storage units (hereinafter referred to as the reserved number) need to be reserved to reduce the likelihood of the storage system 100 entering the write protection mode. The following describes how to dynamically determine the reserved number according to the usage of the metadata storage units in the storage system.
[0031] At block 310, the storage manager 120 determines a third number of metadata storage units that have been used during a historical time period.
[0032] Taking the storage manager 120-1 as an example, the storage manager 120-1 may determine the number F1 of locally released metadata storage units at time T. For example, the released metadata storage units may be stored in the storage space to be recycled associated with the storage manager 120-1 in the storage device 130. The storage manager 120-1 may obtain, at time T, the number PF1 of metadata storage units released at the storage manager 120-2, for example, through the communication interface between the storage managers 120-1 and 120-2. For example, the released metadata storage units may be stored in the storage space to be recycled associated with the storage manager 120-2 in the storage device 130. The storage manager 120-1 may also determine that the last configured logical block address in the metadata storage space of the persistent storage device 130 at time T is LBA1, which indicates the number of allocated metadata storage units in the metadata storage space at time T. Then, the storage manager 120 may determine the number F2 of locally released metadata storage units at time T+20s, and the number PF2 of metadata storage units released at the storage manager 120-2. The storage manager 120 may also determine that the last configured logical block address in the metadata storage space of the persistent storage device 130 at time T+20s is LBA2, which indicates the number of allocated metadata storage units in the metadata storage space at time T+20s. Then, the storage manager 120 may determine that the third number M of metadata storage units used in the storage system during the 20s historical time period is M=(LBA2-LBA2)+(F1-F2)+(PF2-PF1). The above 20s historical time period is merely exemplary, and other time intervals may also be configured according to the needs of the storage system to determine the used metadata storage units.
[0033] Alternatively, in some embodiments, if the storage manager 120 determines that the above third number M is negative, it means that no metadata storage units have been consumed during this historical time period, and some metadata storage units have been released. Then the storage manager 120 may no longer adjust the previously set reserved number of metadata storage units.
[0034] At block 320, the storage manager 120 determines a fourth number of user data storage units that have been flushed to the persistent storage device 130 of the storage system during this historical time period. For example, the number of user data storage units flushed to the persistent storage device 130 may be determined according to the data structure in which the user data is stored.
[0035] In some embodiments, the user data in the storage system 100 can be stored in the form of a data ring, that is, it can be stored in the chronological order of being added to the data ring. Specifically, the data ring can include two ends (e.g., a head and a tail). When a write request processed by the storage manager 120 generates dirty data in the storage system 100, the generated data can be added to the first end (e.g., the head) of the two ends. Each time dirty data is generated, the head of the data ring will move forward one unit.
[0036] In some embodiments, the data can be flushed from the second end (e.g., the tail) of the data ring in the order in which the dirty data is added to the data ring. Specifically, the dirty data located at the tail can be flushed into the persistent storage device 130 of the storage system 100 each time. At this time, the tail of the data ring will move forward one unit, and the flushed dirty data is no longer included in the data ring.
[0037] In some embodiments, the storage manager 120 can determine that the tail index of the user data ring is T1 at time T, and determine that the tail index of the user data ring is T2 at time T + 20s. In this way, the storage manager 120 can determine that the fourth number of user data storage units flushed into the persistent storage device 130 of the storage system 100 within a historical time period of 20s is U = (T2 - T1).
[0038] The above embodiments for calculating user data are merely exemplary, and appropriate methods can also be applied according to different data storage methods to determine the number of user data, and the present disclosure does not limit this here.
[0039] At block 330, the storage manager 120 determines a reserved number based on the ratio of the third number to the fourth number and the seventh number of user data storage units to be flushed into the persistent storage device. For example, the storage manager 120 can determine the number of metadata storage units to be reserved according to the ratio of metadata to user data within the above historical time period and the user data to be stored.
[0040] Continuing with the above example of a 20s historical time period for description. If the storage manager 120 determines that the tail index of the user data ring is T2 and the head index is H at time T + 20s, then the storage manager 120 can determine that the seventh number of user data storage units to be flushed into the persistent storage device is (H - T2). Then the storage manager 120 determines the ratio C = M / U of the third number to the fourth number according to the determined M and U. Finally, the storage manager 120 determines that the reserved number is R = C * (H - T2).
[0041] In some embodiments, the storage manager 120 may preset the above ratio C, for example, classify it as 1, 1 / 2, 1 / 4, 1 / 8, etc. When the storage manager 120 determines that the above C is, for example, 0.35, since 0.35 is between 1 / 2 and 1 / 4, the storage manager 120 may determine that the ratio is 1 / 2 or 1 / 4. For example, for different storage system configurations and different scenarios, in order to efficiently utilize the metadata space, less metadata space may be reserved, for example, determine C as 1 / 4. Or, in the case of preventing the system from entering the write protection mode to the greatest extent, C may be determined as 1 / 2 to reserve more metadata space. By using the preset ratio, the accurately calculated ratio can be selected to be more aggressive or more conservative according to the scenario, so as to meet the needs of different data storage scenarios.
[0042] Alternatively, in some embodiments, the storage manager 120 compares the calculated R with, for example, a predetermined number (1GB). When it is determined that R is greater than the predetermined number, R is selected as the reserved number of metadata storage units, otherwise the predetermined number (1GB) is determined as the reserved number of metadata storage units.
[0043] Additionally or alternatively, the storage manager 120 may periodically determine and update the reserved number according to the usage of the metadata storage units in the storage system 100. For example, determine and update the reserved number once every day. The frequency of this period is only exemplary and is not intended to limit the scope of the present disclosure.
[0044] By dynamically determining the number of metadata storage units to be reserved according to the information of historical metadata, while maintaining the efficient utilization of the metadata storage space, it can prevent the storage system from exhausting all metadata storage units and entering the write protection mode to the greatest extent. The above solution improves the stability and performance of the storage system, thereby improving the user experience.
[0045] In some embodiments, the storage manager 120 may compare the L determined at block 210 with the R determined by method 400. In some cases, if it is determined that L≥R, the storage manager 120 may grant the requested allocation and may return a response indicating successful allocation to the client 110. The case where L < R is discussed below.
[0046] In some embodiments, if the storage manager 120 determines that the first number is less than the determined reserved number, the storage manager 120 may expand the metadata storage space unit. In some embodiments, if the expansion is successful, the storage manager 120 may allocate a target number of metadata storage units from the expanded metadata storage space for the client 110 to use. For example, if the expansion is successful, the storage manager 120 may continue to perform the requested allocation and return a response indicating successful allocation to the client 110. The RAID storage system in the embodiments is merely exemplary. It will be understood that any known or future-developed means may be used to expand the metadata storage space, and the present disclosure places no limitations herein.
[0047] Alternatively, in some embodiments, if the expansion fails, the storage manager 120 may determine a second number of released metadata storage units in the storage system 100 and, if the storage manager 120 determines that the sum of the first number and the second number is less than a first predetermined threshold associated with the reserved number, put the storage system 100 into a write protection mode, in which the storage system 100 does not respond to write requests.
[0048] Taking the storage manager 120-1 as an example, if the expansion fails (for example, there is no storage space available for expanding the metadata storage space), the storage manager 120-1 may determine a second number F of released metadata storage units. For example, the second number F may be only the number of locally released metadata storage units, or may be the sum of the number of locally released metadata storage units and those released by the peer storage manager 120-2. Then, the storage manager 120 determines whether the sum F+L of the first number L determined at block 210 and the second number F is greater than a first predetermined threshold associated with the reserved number. In some embodiments, the first predetermined threshold may be a value greater than R, such as 1.5*R, 1.3*R, 1.1*R, etc. In some cases, for example, if the storage manager 120 determines that F+L≥1.5*R, the allocation of metadata storage units is performed and a response indicating successful allocation is returned to the client 110. In some other cases, if the storage manager 120 determines that F+L<1.5*R, the storage manager 120 puts the storage system 100 into a write protection mode, in which the storage system 100 only allows read operations and some other limited operations. The following will be combined with Figure 3 A detailed description of how to exit the write protection mode will be given.
[0049] Figure 4 FIG. shows a flowchart of a method 400 for exiting the write protection mode according to an embodiment of the present disclosure. For example, the method 400 may be executed in response to the storage system 100 entering the write protection mode.
[0050] At block 410, the storage manager 120 determines a fifth number of available metadata storage units remaining in the metadata storage space. For example, the storage manager 120 determines that the capacity of the metadata storage space is T, that is, the total number of metadata storage units therein is T. The storage manager 120 queries that the last configured LBA is X, which indicates the number of allocated metadata storage units in the metadata storage space. In this case, the storage manager 120 may determine that the fifth number of available metadata storage units remaining in the storage space is T - X.
[0051] At block 420, the storage manager 120 determines a sixth number of metadata storage units released in the storage system. Taking the storage manager 120-1 as an example, the sixth number may be the number F of locally released metadata storage units and / or the number PF of metadata storage units released by the peer storage manager 120-2.
[0052] At block 430, if the storage manager 120 determines that the sum of the fifth number and the sixth number exceeds a second predetermined threshold associated with the reserved number, the storage manager 120 causes the storage system 100 to exit the write protection mode, where the second predetermined threshold exceeds the first predetermined threshold.
[0053] Taking the storage manager 120-1 as an example, the storage manager 120-1 may determine whether the sum LL = T – X + F or PL = T – X + PF of the fifth number and the sixth number is greater than the second predetermined threshold associated with the reserved number. Here, the second predetermined threshold associated with the reserved number is a value greater than the above-mentioned first predetermined threshold. For example, the reserved number is R, the first predetermined threshold is 1.5R, and the second predetermined value is 2R. As long as the relationship of the second predetermined value > the first predetermined value > R is satisfied, the present disclosure does not limit its specific value. In some embodiments, if the storage manager 120-1 determines that both LL>2R and PL>2R are satisfied, the storage system 100 is caused to exit the write protection mode.
[0054] Alternatively, in some embodiments, if the storage manager 120-1 determines that the above conditions are not satisfied, it may trigger a rebalancing between the storage space to be recycled associated with the storage manager 120-1 and the storage space to be recycled associated with the storage manager 120-2, thereby promoting the satisfaction of the above conditions. Then, the storage manager 120-1 may wait for a period of time and then perform a new round of checks to determine whether the conditions for exiting the write protection mode are satisfied.
[0055] By associating the condition for exiting the write protection mode with the above-mentioned dynamically determined reserved number, it can be ensured that there are enough available metadata storage units remaining in the storage system when exiting the write protection mode, thereby improving the availability of the storage system.
[0056] Figure 5 FIG. 500 schematically illustrates an example device that can be used to implement embodiments of the present disclosure. For example, as Figure 1 shown, a storage manager 120 (e.g., storage managers 120-1 and / or 120-2) can be implemented by device 500. As shown, device 500 includes a central processing unit (CPU) 501 that can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 502 or computer program instructions loaded from a storage space 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of device 500 can also be stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0057] A plurality of components in device 500 are connected to the I / O interface 550, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage space 508, such as a magnetic disk, an optical disc, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0058] The various processes and treatments described above, such as methods 200, 300, and 400, can be executed by the processing unit 501. For example, in some embodiments, methods 200, 300, and 400 can be implemented as computer software programs that are tangibly included in a machine-readable medium, such as storage space 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the CPU 501, one or more actions of methods 200, 300, and 400 described above can be performed.
[0059] The present disclosure can be a method, an apparatus, a system, and / or a computer program product. The computer program product can include a computer-readable storage medium having thereon computer-readable program instructions for performing various aspects of the present disclosure.
[0060] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium may be, for example—but not limited to—an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device such as a punch card or raised structures in grooves having instructions stored thereon, and any suitable combination of the foregoing. The computer-readable storage medium as used herein is not construed as being a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., an optical pulse through an optical fiber cable), or an electrical signal transmitted through a wire.
[0061] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to respective computing / processing devices, or can be downloaded to an external computer or an external storage device through a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include a copper transmission cable, an optical fiber transmission, a wireless transmission, a router, a firewall, a switch, a gateway computer, and / or an edge server. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.
[0062] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine - related instructions, microcode, firmware instructions, state - setting data, or source code or object code written in any combination of one or more programming languages, including object - oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer - readable program instructions may be executed entirely on the user's computer, partially on the user's computer, executed as a stand - alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider). In some embodiments, by using the state information of the computer - readable program instructions to customize an electronic circuit, such as a programmable logic circuit, a field - programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer - readable program instructions to implement various aspects of the present disclosure.
[0063] Aspects of the present disclosure are described herein with reference to the flowchart and / or block diagram of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowchart and / or block diagram, and the combinations of blocks in the flowchart and / or block diagram, can be implemented by computer - readable program instructions.
[0064] These computer - readable program instructions can be provided to a processing unit of a general - purpose computer, a special - purpose computer, or other programmable data - processing apparatus to produce a machine such that, when the instructions are executed by the processing unit of the computer or other programmable data - processing apparatus, a device is produced that implements the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer - readable program instructions can also be stored in a computer - readable storage medium, and these instructions cause a computer, a programmable data - processing apparatus, and / or other devices to operate in a particular manner. Thus, the computer - readable medium storing the instructions includes a manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0065] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device, causing a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process such that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in one or more boxes of the flowchart and / or block diagram.
[0066] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two consecutive blocks may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block of the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or acts, or by a combination of dedicated hardware and computer instructions.
[0067] The embodiments of the present disclosure have been described above. The above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, the practical application, or the technical improvement of the technology in the market, or to enable other ordinary skilled persons in the art to understand the embodiments disclosed herein.
Claims
1. A method for managing metadata storage units in a storage system, comprising: generating metadata corresponding to user data to be written to a user data storage space of the storage system, the metadata to be stored in a target number of metadata storage units; in response to generating the metadata, receiving a request from a client to allocate the target number of metadata storage units; in response to receiving the request from the client to allocate the target number of metadata storage units, determining a first number of available metadata storage units remaining in the metadata storage space of the storage system after performing the allocation, the first number being not less than a reserved number; if the first number is not less than the reserved number, allocating the target number of metadata storage units from the metadata storage space in the storage system for use by the client, wherein the reserved number is associated with the usage of the metadata storage units in the storage system; and adjusting the reserved number based on the number of user data storage units flushed to the user data storage space during a historical time period, the reserved number being the number of metadata storage units reserved in the metadata storage space.
2. The method according to claim 1, further comprising: receiving a second request from the client to allocate a second target number of metadata storage units; if allocating the second target number of metadata storage units from the metadata storage space, generating a number of available metadata storage units, the generated number being less than the reserved number; if the generated number is less than the reserved number, expanding the metadata storage space; and if the expansion is successful, allocating the second target number of metadata storage units from the expanded metadata storage space for use by the client.
3. The method according to claim 2, further comprising: performing an expansion operation that attempts to expand the metadata storage space, the expansion operation failing; if the expansion operation fails, determining a second number of released metadata storage units in the storage system, the sum of the first number and the second number being less than a first predetermined threshold associated with the reserved number; and if the sum of the first number and the second number is less than the first predetermined threshold associated with the reserved number, putting the storage system into a write protection mode, wherein in the write protection mode the storage system does not respond to write requests.
4. The method according to claim 3, further comprising: in response to the storage system entering the write protection mode, determining a fifth number of available metadata storage units remaining in the metadata storage space; determining a sixth number of released metadata storage units in the storage system, the sum of the fifth number and the sixth number exceeding a second predetermined threshold associated with the reserved number; and if the sum of the fifth number and the sixth number exceeds the second predetermined threshold associated with the reserved number, exiting the storage system from the write protection mode, wherein the second predetermined threshold exceeds the first predetermined threshold.
5. The method according to claim 1 further comprises: Determining the reservation number based on the usage of the metadata storage units in the storage system.
6. The method according to claim 5, wherein determining the reservation number comprises: Determining a third number of metadata storage units that have been used during a historical time period; Determining a fourth number of user data storage units that have been flushed to the persistent storage device of the storage system during the historical time period; And Determining the reservation number based on a ratio of the third number and the fourth number and a seventh number of user data storage units to be flushed to the persistent storage device.
7. The method according to claim 5, wherein determining the reservation number comprises: Periodically determining the reservation number.
8. An electronic device, comprising: At least one processing unit; At least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions when executed by the at least one processing unit cause the device to perform actions, the actions comprising: Generating metadata corresponding to user data for a user data storage space to be written to a storage system, the metadata to be stored in a target number of metadata storage units; In response to generating the metadata, receiving from a client a request to allocate the target number of metadata storage units; In response to receiving the request to allocate the target number of metadata storage units from the client, determining a first number of available metadata storage units remaining in the metadata storage space of the storage system after the allocation, the first number being not less than a reservation number; If the first number is not less than the reservation number, allocating the target number of metadata storage units from the metadata storage space within the storage system for use by the client, wherein the reservation number is associated with the usage of the metadata storage units in the storage system; and Adjusting the reservation number based on the number of user data storage units that have been flushed to the user data storage space during a historical time period, the reservation number being the number of metadata storage units reserved in the metadata storage space.
9. The electronic device according to claim 8, wherein the actions further comprise: Receiving from the client a second request to allocate a second target number of metadata storage units; If the second target number of metadata storage units is allocated from the metadata storage space, generating a number of available metadata storage units, the generated number being less than the reservation number; If the generated number is less than the reservation number, expanding the metadata storage space; And If the expansion is successful, allocating the second target number of metadata storage units from the expanded metadata storage space for use by the client.
10. The electronic device according to claim 9, wherein the actions further comprise: Performing an expansion operation that attempts to expand the metadata storage space, and the expansion operation fails. If the expansion operation fails, determine a second number of metadata storage units released in the storage system, where the sum of the first number and the second number is less than a first predetermined threshold associated with the reserved number; And If the sum of the first number and the second number is less than the first predetermined threshold associated with the reserved number, put the storage system into a write protection mode, in which the storage system does not respond to write requests.
11. The electronic device according to claim 10, wherein the action further comprises: In response to the storage system entering the write protection mode, Determine a fifth number of available metadata storage units remaining in the metadata storage space; Determine a sixth number of metadata storage units released in the storage system, where the sum of the fifth number and the sixth number exceeds a second predetermined threshold associated with the reserved number; And If the sum of the fifth number and the sixth number exceeds the second predetermined threshold associated with the reserved number, cause the storage system to exit the write protection mode, where the second predetermined threshold exceeds the first predetermined threshold.
12. The electronic device according to claim 8, wherein the action further comprises: Determine the reserved number based on the usage of the metadata storage units in the storage system.
13. The electronic device according to claim 12, wherein determining the reserved number comprises: Determine a third number of metadata storage units used during a historical time period; Determine a fourth number of user data storage units flushed to the persistent storage device in the storage system during the historical time period; And Determine the reserved number based on the ratio of the third number and the fourth number and a seventh number of user data storage units to be flushed to the persistent storage device.
14. The electronic device according to claim 12, wherein determining the reserved number comprises: Periodically determine the reserved number.
15. A computer program product, the computer program product being tangibly stored on a non-transitory computer-readable medium and comprising machine-executable instructions that, when executed, cause the machine to perform the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Metadata server and disk volume selecting method thereof
US20100161897A1