A power backup management method, device and equipment for a storage system
Patent Information
- Application Number
- CN202411998342.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2044-12-30
AI Technical Summary
然而,在存储系统的IO业务运行之后,可能会产生多达100GB的业务数据,而BBU能够提供的电量有限,若不能快速将缓存的业务数据落盘到系统盘内,会出现业务数据丢失情况
[0040]本发明所提供的一种存储系统的备电管理方法,包括:检测到系统掉电时,获取待转储内存页;其中,待转储内存页包括平台内存管理内存页和非平台内存管理内存页;确定各预设线程各自对应的待转储内存页;其中,预设线程的数量大于或等于2,不同的预设线程各自绑定1个不同的中央处理器核心;利用预设线程,将待转储内存页写入到预设转储文件,并将预设转储文件存储到非易失性存储器中;其中,预设转储文件包括文件头、各待转储内存页各自的数据、逻辑页号和虚拟内存地址信息。
Smart Images

Figure CN119718045B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage system technology, and in particular to a method, apparatus and equipment for backup power management of a storage system. Background Technology
[0002] Currently, when a storage system performs I / O (input / output) operations, the cached data is stored in the main memory of the storage device. However, main memory is volatile, meaning that data in main memory (i.e., RAM) will be lost during a sudden power outage. To ensure that I / O data is not lost, additional technical measures are needed to protect data during power outages so that services can continue upon the next power-on. Although non-volatile main memory technology exists, it is not yet widely adopted due to a combination of factors, including cost and technological maturity.
[0003] The current mainstream approach in storage systems is to utilize a Battery Backup Unit (BBU) for backup power. For example, after a power outage, the CPLD (Complex Programmable Logic Device) on the controller switches the combiner to the BBU, which then powers the system to back up the cached data in memory to the system disk for restoration upon power-up. However, after the storage system's I / O operations, up to 100GB of data may be generated. Since the power provided by the BBU is limited, if the cached data cannot be quickly written to the system disk, data loss may occur. Therefore, how to quickly and securely write data from the storage system's memory to non-volatile memory to avoid data loss and improve the reliability of the storage system is a pressing issue that needs to be addressed. Summary of the Invention
[0004] The purpose of this invention is to provide a power backup management method, apparatus, and device for a storage system, so as to quickly and safely transfer data in the memory of the storage system to non-volatile memory, avoid the loss of business data, and improve the reliability of the storage system.
[0005] To address the aforementioned technical problems, this invention provides a power backup management method for a storage system, comprising:
[0006] When a system power failure is detected, memory pages to be dumped are acquired; wherein, the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages;
[0007] Determine the memory page to be dumped for each preset thread; wherein the number of preset threads is greater than or equal to 2, and each preset thread is bound to a different central processing unit core;
[0008] Using the preset thread, the memory pages to be dumped are written to a preset dump file, and the preset dump file is stored in non-volatile memory; wherein, the preset dump file includes a file header, the data of each memory page to be dumped, the logical page number, and the virtual memory address information.
[0009] On the other hand, the absolute value of the difference between the number of memory pages to be dumped corresponding to any two preset threads is less than or equal to 1.
[0010] On the other hand, determining the memory page to be dumped corresponding to each preset thread includes:
[0011] Obtain the logical page number of each of the memory pages to be dumped; wherein, the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is a page number outside the range of the platform memory management page number;
[0012] Based on the order of the logical page numbers, each preset thread is allocated its corresponding memory page to be dumped.
[0013] On the other hand, the preset dump file includes a file header area, a memory page area, a logical page number area, and a virtual memory area. The step of using the preset thread to write the memory page to be dumped into the preset dump file and storing the preset dump file in non-volatile memory includes:
[0014] The preset dump file in the non-volatile memory is opened using the dump main thread;
[0015] The file header area of the preset dump file is written using the dump main thread; wherein, the file header area includes a header area and a tail area, and the header area and the tail area are used to store the same file header, and the file header includes the signature, type, number of memory page areas and number of virtual memory areas of the preset dump file;
[0016] Each of the preset threads writes its corresponding memory page region to the preset dump file; wherein each memory page region is used to store the data of its corresponding memory page to be dumped.
[0017] The main dump thread is used to write the logical page number area in the preset dump file; wherein, each logical page number area is used to store the logical page number and data check code of a corresponding memory page to be dumped;
[0018] The virtual memory region in the preset dump file is written using the dump main thread; wherein, each virtual memory region is used to store the virtual memory address information and virtual memory address check code of a corresponding memory page to be dumped;
[0019] The file header area is rewritten using the main dump thread, and the preset dump file is closed.
[0020] On the other hand, the step of using the preset thread to write the memory page to be dumped to a preset dump file and storing the preset dump file in non-volatile memory includes:
[0021] When writing data to the preset dump file, the kernel timer is started.
[0022] If the kernel timer reaches a time threshold, the storage system will be shut down.
[0023] On the other hand, when a system power failure is detected, acquiring the memory page to be dumped includes:
[0024] When the main business process of the storage system is detected to have exited, the main dump thread is used to lock the memory page to be dumped.
[0025] After using the preset thread to write the memory page to be dumped to a preset dump file and storing the preset dump file in non-volatile memory, the method further includes:
[0026] The main dump thread is used to unlock the memory page to be dumped.
[0027] On the other hand, after using the preset thread to write the memory page to be dumped to a preset dump file and storing the preset dump file in non-volatile memory, the method further includes:
[0028] After the system is detected to be powered on, the preset thread is used to restore the data of the memory pages to be dumped in the preset dump file to the memory of the storage system.
[0029] On the other hand, before acquiring the memory page to be dumped when the system power failure is detected, the process also includes:
[0030] The target quantity is determined based on the number of central processing unit cores of the storage system and the bandwidth of the non-volatile memory;
[0031] Create the target number of preset threads, and bind each preset thread to a corresponding central processing unit core;
[0032] Using thread-specific data, a preset size of space is reserved for each preset thread.
[0033] The present invention also provides a power backup management device for a storage system, comprising:
[0034] A power failure acquisition module is used to acquire memory pages to be dumped when a system power failure is detected; wherein, the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages;
[0035] A thread allocation module is used to determine the memory page to be dumped corresponding to each preset thread; wherein, the number of preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core;
[0036] The data write-to-disk module is used to write the memory pages to be dumped to a preset dump file using the preset thread, and store the preset dump file in non-volatile memory; wherein, the preset dump file includes a file header, the data of each memory page to be dumped, the logical page number and the virtual memory address information.
[0037] Furthermore, the present invention also provides a power backup management device for a storage system, comprising:
[0038] Memory, used to store computer programs;
[0039] A processor, used to execute the computer program to implement the steps of the power backup management method for the storage system as described above.
[0040] The present invention provides a power backup management method for a storage system, comprising: when a system power failure is detected, acquiring memory pages to be dumped; wherein the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages; determining the memory pages to be dumped corresponding to each preset thread; wherein the number of preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core; using the preset threads, writing the memory pages to be dumped to a preset dump file, and storing the preset dump file in non-volatile memory; wherein the preset dump file includes a file header, data of each memory page to be dumped, logical page number, and virtual memory address information.
[0041] As can be seen, this invention, through the setting of a preset dump file, can store cached business data of the storage system into the corresponding area of the preset dump file when the system loses power, facilitating rapid data writing and reading. Furthermore, by using multi-threaded core binding, it can maximize the computing power of the central processing unit and fully utilize the bandwidth of the non-volatile memory, thereby quickly and safely transferring data from the storage system's memory to the non-volatile memory, preventing business data loss and improving the reliability of the storage system. In addition, this invention also provides a power backup management device and equipment for a storage system, which also has the above-mentioned beneficial effects. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0043] Figure 1 A flowchart illustrating a power backup management method for a storage system provided in an embodiment of the present invention;
[0044] Figure 2 This is a schematic diagram of the architecture of another power backup management method for a storage system provided in an embodiment of the present invention;
[0045] Figure 3 This is a schematic diagram of a preset dump file format provided in an embodiment of the present invention;
[0046] Figure 4 This is a schematic diagram illustrating the mapping relationship between memory pages and threads provided in an embodiment of the present invention;
[0047] Figure 5 This is a structural block diagram of a power backup management device for a storage system provided in an embodiment of the present invention.
[0048] Figure 6 This is a simplified structural diagram of a power backup management device for a storage system provided in an embodiment of the present invention;
[0049] Figure 7 This is a schematic diagram of the specific structure of a backup power management device for a storage system provided in an embodiment of the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0051] Please refer to Figure 1 , Figure 1 A flowchart illustrating a power backup management method for a storage system provided in an embodiment of the present invention. The method may include:
[0052] Step 101: When a system power failure is detected, obtain the memory pages to be dumped; wherein, the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages.
[0053] It is understood that the memory page to be dumped in this embodiment can be a memory page (page) in the memory of a storage system (such as a storage device) that needs protection, such as a PLMM (Platform Memory Management) memory page (i.e., a PLMM memory page) and a general memory page outside of a PLMM memory page (i.e., a non-PLMM memory page). PLMM is mainly used to provide memory allocation, management, release, and copy operations for the storage system's services. In kernel mode, PLMM provides a PLMM Misc device, which locks a large segment of memory for PLMM module use during initialization. User mode uses PLMM functions provided by the kernel to interact with the PLMM device.
[0054] Correspondingly, the specific method by which the processor in the storage system obtains the memory pages to be dumped when it detects a system power failure in this embodiment can be set by the designer according to the practical scenario and user needs. For example, the processor can utilize the dumping main thread (e.g. Figure 2 The main Dump thread locks (pins) the memory pages to be dumped when it detects a system power failure (such as the exit of the main business process of the storage system) to prevent the loss of I / O business data. Correspondingly, the processor can use the main Dump thread to unlock (unpin) the memory pages to be dumped after writing them to the preset dump file. For example, since PLMM memory pages can achieve a similar locking effect through PLMM management, in this step, the main Dump thread can lock the memory pages used by the main business process (i.e., non-PLMM memory pages) when the main business process of the storage system exits, preventing the operating system from swapping out the process pages and causing the loss of I / O business data. That is, the main Dump thread can immediately lock the non-PLMM managed memory pages to be dumped when it detects a power failure, and the main Dump thread can also terminate or block other threads other than Dump management (such as the preset thread) to release computing resources and prepare for writing the preset dump file.
[0055] In this embodiment, the specific data content of the memory page to be dumped can be set according to the practical scenario and user needs. For example, it can be set in a way that is the same as or similar to the data content of memory pages managed by PLMM and memory pages not managed by PLMM in the storage system of related technologies. For example, the memory page to be dumped can be... Figure 3The data in the Pagecontent area shown is written to a preset dump file (such as a dump file) in units of memory pages (4k). For example, non-PLMM memory pages can represent general memory, which may include data segments, BSS segments (a memory area used to store uninitialized global variables in the program), stack, memory registered by the driver, memory allocated through the libc (Standard C library, a function library) interface, and memory allocated by third-party link libraries, etc.
[0056] Step 102: Determine the memory page to be dumped for each preset thread; wherein the number of preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core.
[0057] It is understood that the preset threads in this embodiment can be pre-set threads used to write their respective corresponding memory pages to be dumped into a preset dump file, such as... Figure 2 The example shows eight threads. In this embodiment, each preset thread can be bound to a different CPU (Central Processing Unit) core, that is, different command queues are assigned to different preset threads. Each command queue is bound to a specific CPU core, thereby reducing the overhead of cross-core scheduling. Different command queues can provide low-latency I / O paths, reducing the time between submitting a command and receiving a completion notification.
[0058] Correspondingly, the specific number of preset threads in this embodiment can be set by the designer or user according to the usage scenario and user needs. For example, the number of preset threads can be a value configured by the designer or user or a fixed value; the number of preset threads can also be a value calculated and determined by the processor of the storage system. This embodiment does not impose any restrictions on this.
[0059] The method provided in this embodiment may further include a process for creating preset threads. For example, the processor can determine the target number of preset threads based on the number of CPU cores and the bandwidth of non-volatile memory (such as data block size and the number of hard disk command queues); create the target number of preset threads and bind each preset thread to a corresponding CPU core; and reserve a preset size of space for each preset thread using thread-specific data. For instance, in a production environment, testing the optimal parameters for the data write rate of the system disk (i.e., non-volatile memory) on storage devices of different configurations mainly involves the number of dump read / write threads (i.e., preset threads), the size of the data block being written, and the number of hard disk command queues. These parameters are saved in a file, and are read before writing the preset dump file to create the target number of preset threads. The processor can periodically evaluate the performance of the system disk and adjust the parameters to achieve optimal write performance. If the time cost of the parameter adjustment algorithm is high, an additional command line can be provided to provide write parameter adjustments within a specified range, reducing the time cost of algorithm optimization. For example, the processor can select a target number from the preset thread range based on the size of the data block being written to the system disk and the number of hard disk command queues. Further, such as... Figure 2 As shown, the processor can also use the dump main thread to select a target number from the preset thread range based on the number of memory pages queried (i.e. the number of memory pages to be dumped), the size of the data blocks written to the system disk, and the number of disk command queues, and create preset threads with reference to the number of memory pages, thereby improving the accuracy of the number of preset threads.
[0060] Correspondingly, such as Figure 2 As shown, when the target number is 8, 8 different CPU cores can be bound to the 8 pre-defined threads for dump management. 1M (i.e. 1MB) space is reserved for each pre-defined thread using TSD (Thread-Specific Data). Up to 8 pre-defined threads can be used for parallel writing at the same time. This can reduce memory contention, improve thread switching efficiency, simplify memory management, enhance data security, and optimize cache performance.
[0061] It should be noted that in this embodiment, no two preset threads will correspond to the same memory page to be dumped. The specific method by which the processor determines the memory page to be dumped for each preset thread in this embodiment can be set by the designer according to the usage scenario and user needs. For example, to distribute the memory pages to be dumped as evenly as possible among each preset thread, the absolute value of the difference between the number of memory pages to be dumped for any two preset threads is less than or equal to 1; that is, the difference between the number of memory pages to be dumped for any two preset threads is at most 1, to ensure the balance of the memory pages to be dumped allocated to each preset thread. For example, in this step, the processor can allocate a corresponding memory page to be dumped for each preset thread based on the number of memory pages to be dumped and the number of preset threads. The processor can also obtain the logical page number of each memory page to be dumped; among them, the logical page number of the platform memory-managed memory page is the platform memory-managed page number, and the logical page number of the non-platform memory-managed memory page is the page number outside the range of the platform memory-managed page number, that is, the page number is allocated to the non-PLMM memory page from outside the range of page numbers used by PLMM; according to the order of the logical page numbers, the corresponding memory page to be dumped is allocated to each preset thread in turn.
[0062] For example, the dump main thread can determine the total number of memory pages (i.e., memory pages to be dumped) that need to be written to the preset dump file, and distribute these pages as evenly as possible to each preset thread according to the number of preset threads and in page number order, so that each preset thread writes the memory pages allocated to it to the specified preset dump file. Figure 4 As shown, when 20 memory pages to be dumped (memory pages 1-20) are allocated to 8 preset threads (threads 1-8), the first 4 preset threads (threads 1-4) can be allocated 3 memory pages to be dumped each, and the last 4 preset threads (threads 1-4) can be allocated 2 memory pages to be dumped each.
[0063] Step 103: Using a preset thread, write the memory pages to be dumped to a preset dump file, and store the preset dump file in non-volatile memory; wherein, the preset dump file includes a file header, the data of each memory page to be dumped, the logical page number and the virtual memory address information.
[0064] It is understood that the preset dump file in this embodiment can be a pre-set file for storing memory pages to be dumped, such as a dump file. By setting the preset dump file in this embodiment, the business data cached by the system can be stored in the corresponding area of the preset dump file when the system loses power, facilitating fast data writing and reading.
[0065] Correspondingly, the specific format of the preset dump file in this embodiment can be set by the designer according to the usage scenario and user needs. For example, the preset dump file includes a file header area for storing the file header (e.g., ...). Figure 3 (header in the text), and memory page areas used to store the data of each memory page to be dumped (such as...) Figure 3 The Page contentarea in the memory (e.g., the logical page number area used to store the logical page number of each memory page to be dumped) Figure 3 The page indexarea and the virtual memory area used to store the virtual memory address information of each memory page to be dumped (e.g., ...) Figure 3 The VMA area in the file header region (VMA area) can be further divided into a header region and a footer region. Both the header and footer regions store the same header, which includes the signature, type, number of memory page regions, and number of virtual memory regions of the pre-defined dump file. Each memory page region stores the data of its corresponding memory page to be dumped (e.g., ...). Figure 3 4K data in the middle), such as Figure 2 As shown, data in non-PLMM memory pages (general memory) may not include code segments.
[0066] Accordingly, each logical page number region is used to store the logical page number of its corresponding memory page to be dumped. To ensure the accuracy of the memory page recovery, each logical page number region can also be used to store the checksum (i.e., data checksum) of its corresponding memory page to be dumped, such as the LRC (Longitudinal Redundancy Check) checksum. For example, all logical page number regions in the preset dump file can be understood as an array, and each logical page number region can be understood as an element, carrying the logical page number and data checksum, used to describe the page number and 4k data checksum of the corresponding page (i.e., the memory page to be dumped). Each virtual memory region can be used to store the virtual memory address information of its corresponding memory page to be dumped. Correspondingly, it can also be used to store the check code of its virtual memory address information (i.e., virtual memory address check code), such as LRC (Longitudinal Redundancy Check) check code. The virtual memory address information can include the virtual address, length, and IOB number (i.e., the sequence number in the PLMM IOBtable), which respectively describe the starting address, length, and IOB number of the memory region.
[0067] In this embodiment, the specific number of preset dump files is not limited. For example, the number of preset dump files can be one, meaning that all memory pages to be dumped can be written to the same preset dump file; the number of preset dump files can also be greater than or equal to two. For example, the number of preset dump files can be the same as the number of preset threads, meaning that each preset thread can write all of its corresponding memory pages to be dumped into its corresponding one preset dump file. Figure 3 As shown, the 8 preset threads can correspond to 8 preset dump files.
[0068] Correspondingly, the specific method by which the processor uses a preset thread to write the memory pages to be dumped to a preset dump file and then stores the preset dump file in non-volatile memory in this step can be set by the designer. For example, the memory pages to be dumped can be directly written to the preset dump file in non-volatile memory (such as the system disk) to reduce the dumping process of the preset dump file.
[0069] Similarly, this embodiment does not limit the specific process of writing the memory page to be dumped to the preset dump file using a preset thread. For example, since the writing process of content other than the data of the memory page to be dumped occupies relatively limited space, it can be written by the dump main thread. In order to ensure the data integrity of the preset dump file, LRC can be used for verification to ensure that the complete memory page to be dumped can be read and restored during reading. In order to speed up the writing speed, timestamp updates can be disabled.
[0070] For example, such as Figure 2 As shown, in this step, the processor can use the dump main thread to open the preset dump file in non-volatile memory; use the dump main thread to write the file header area (dump header) of the preset dump file; the file header area includes a header area and a tail area, both of which store the same file header, which includes the signature, type, number of memory page areas, and number of virtual memory areas of the preset dump file; use each preset thread to write the corresponding memory page area in the preset dump file; each memory page area is used to store the data of its corresponding memory page to be dumped (requiring PLMM to manage memory pages and general memory); use the dump main thread to write the logical page number area (page index) in the preset dump file; each logical page number area is used to store the logical page number and data checksum of its corresponding memory page to be dumped; use the dump main thread to write the virtual memory area (VMA) in the preset dump file. (index); where each virtual memory region is used to store the virtual memory address information and virtual memory address check code of its corresponding memory page to be dumped; the dump main thread rewrites the file header region and closes the preset dump file.
[0071] Furthermore, to prevent accidental damage to the BBU of the storage system, in this embodiment, the processor can start a kernel timer when writing data to a preset dump file. If the kernel timer reaches a time threshold, the storage system will be shut down. In other words, this embodiment can start a kernel timer (such as a watchdog timer) when writing data to a preset dump file and register a response action after the kernel timer expires. If data writing to disk is completed before the kernel timer expires, the system will shut down normally. If data writing to disk is not completed after the kernel timer expires, a forced shutdown will also occur. Before shutdown, locked memory pages (such as non-PLMM memory pages) should be released. The watchdog is introduced to prevent accidental discharge of the BBU battery, which could damage the BBU. The kernel timer's time threshold can be 200 seconds or other times; this embodiment does not impose any restrictions on this.
[0072] It is understood that, in this embodiment, step 103 may further include a process of restoring the memory pages to be dumped using a preset dump file after the system is powered on. For example, the processor may detect that the system is powered on and use a preset thread to restore the data of the memory pages to be dumped in the preset dump file to the memory of the storage system.
[0073] Correspondingly, the specific method by which the data of the memory pages to be dumped in the preset dump file is restored to the memory of the storage system using a preset thread after the system is detected to be powered on in this embodiment can be set by the designer. For example, it can be set in a way that corresponds to the writing process of the preset dump file. For example, when the preset dump file sets a checksum (such as an LRC checksum), the memory pages in the preset dump file can be mapped to the corresponding process space address after the LRC check is passed, so as to realize the restoration of the cached data of the storage system. For example, during dump restoration, each preset thread reads the part it has written, and after passing the LRC check, maps the memory page to the corresponding process space address.
[0074] In this embodiment, the present invention, through the setting of a preset dump file, can store the business data cached by the storage system into the corresponding area of the preset dump file when the system loses power, facilitating fast data writing and reading; and through the multi-threaded core binding method, it can maximize the computing power of the central processing unit and fully utilize the bandwidth of the non-volatile memory, reducing the requirements for BBU battery capacity and reducing hardware costs, thereby quickly and safely transferring the data in the memory of the storage system to the non-volatile memory, avoiding the loss of business data and improving the reliability of the storage system.
[0075] Corresponding to the above method embodiments, this invention also provides a power backup management device for a storage system. The power backup management device for a storage system described below and the power backup management method for a storage system described above can be referred to in correspondence.
[0076] Please refer to Figure 5 , Figure 5 This is a structural block diagram of a power backup management device for a storage system provided in an embodiment of the present invention. The device may include:
[0077] The power failure acquisition module 10 is used to acquire memory pages to be dumped when the system power failure is detected; wherein, the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages;
[0078] The thread allocation module 20 is used to determine the memory page to be dumped for each preset thread; wherein the number of preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core.
[0079] The data write-to-disk module 30 is used to write the memory pages to be dumped to a preset dump file using a preset thread, and store the preset dump file in non-volatile memory; wherein, the preset dump file includes a file header, the data of each memory page to be dumped, the logical page number and the virtual memory address information.
[0080] On the other hand, the absolute value of the difference between the number of memory pages to be dumped for any two preset threads is less than or equal to 1.
[0081] On the other hand, the thread allocation module 20 may include:
[0082] The page number acquisition submodule is used to obtain the logical page number of each memory page to be dumped; among them, the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is the page number outside the range of the platform memory management page number;
[0083] The allocation submodule is used to allocate the corresponding memory pages to be dumped to each preset thread in order of logical page number.
[0084] On the other hand, the preset dump file includes a file header area, a memory page area, a logical page number area, and a virtual memory area, and the data write-to-disk module 30 may include:
[0085] The Open submodule is used to open a preset dump file in non-volatile memory using the dump main thread;
[0086] The file header submodule is used to write the file header area of the preset dump file using the dump main thread. The file header area includes a header area and a tail area. Both the header and tail areas are used to store the same file header, which includes the signature, type, number of memory page areas, and number of virtual memory areas of the preset dump file.
[0087] The memory page submodule is used to write the corresponding memory page regions in the preset dump file by each preset thread; each memory page region is used to store the data of its corresponding memory page to be dumped.
[0088] The page number submodule is used to write the logical page number area in the preset dump file using the dump main thread; each logical page number area is used to store the logical page number and data check code of a corresponding memory page to be dumped.
[0089] The virtual memory submodule is used to write virtual memory regions in a preset dump file using the dump main thread; each virtual memory region is used to store the virtual memory address information and virtual memory address check code of its corresponding memory page to be dumped.
[0090] The overwrite close submodule is used to rewrite the file header area using the dump main thread and close the default dump file.
[0091] On the other hand, the data write-to-disk module 30 may include:
[0092] The timing submodule is used to start the kernel timer when writing data to a preset dump file;
[0093] The forced shutdown submodule is used to control the storage system to shut down if the kernel timer reaches a time threshold.
[0094] On the other hand, the power failure acquisition module 10 may include:
[0095] The locking submodule is used to lock the memory pages to be dumped by utilizing the dumping main thread when the main business process of the storage system is detected to have exited.
[0096] The device may also include:
[0097] The unlock module is used to unlock the memory pages to be dumped after writing the memory pages to be dumped to a preset dump file using a preset thread and storing the preset dump file in non-volatile memory, using the dump main thread.
[0098] On the other hand, the device may also include:
[0099] The recovery module is used to restore the data of the memory pages to be dumped from the preset dump file to the memory of the storage system after the system is powered on, using a preset thread.
[0100] On the other hand, the device also includes:
[0101] The determination module is used to determine the target quantity based on the number of CPU cores and the bandwidth of non-volatile memory in the storage system.
[0102] Create a module to create a target number of preset threads and bind each preset thread to its corresponding central processing unit core;
[0103] The reserved module is used to reserve a preset size of space for each preset thread using thread-specific data.
[0104] In this embodiment, the present invention, through the setting of a preset dump file, can store the business data cached by the storage system into the corresponding area of the preset dump file when the system loses power, facilitating fast data writing and reading; and through the multi-threaded core binding method, it can maximize the computing power of the central processing unit and fully utilize the bandwidth of the non-volatile memory, thereby quickly and safely transferring the data in the memory of the storage system to the non-volatile memory, avoiding the loss of business data and improving the reliability of the storage system.
[0105] Corresponding to the above method embodiments, this invention also provides a backup power management device for a storage system. The backup power management device for a storage system described below and the backup power management method for a storage system described above can be referred to in correspondence.
[0106] Please refer to Figure 6 , Figure 6 This is a simplified structural diagram of a power backup management device for a storage system provided in an embodiment of the present invention. The device may include:
[0107] Memory D1 is used to store computer programs;
[0108] The processor D2 is used to implement the steps of the power backup management method for the storage system provided in the above method embodiments when executing a computer program.
[0109] Accordingly, please refer to Figure 7 , Figure 7This is a schematic diagram illustrating the specific structure of a backup power management device for a storage system provided in an embodiment of the present invention. The backup power management device 310 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) for storing application programs 342 or data 344. The memory 332 and storage media 330 can be temporary or persistent storage. The program stored in the storage media 330 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the host. Furthermore, the central processing unit 322 may be configured to communicate with the storage media 330 and execute the series of instruction operations in the storage media 330 on the backup power management device 310.
[0110] The backup power management device 310 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341, such as Linux systems.
[0111] In this embodiment, the backup power management device 310 can be specifically a storage device or a server.
[0112] The steps in the power backup management method for the storage system described above can be implemented by the structure of the power backup management device of the storage system.
[0113] Corresponding to the above method embodiments, this invention also provides a computer program product. The computer program product described below and the power backup management method for a storage system described above can be referred to in correspondence.
[0114] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the power backup management method for a storage system provided in the above-described method embodiments.
[0115] Corresponding to the above method embodiments, this invention also provides a computer-readable storage medium. The computer-readable storage medium described below and the power backup management method for a storage system described above can be referred to in correspondence.
[0116] A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the power backup management method of the storage system described in the above method embodiments.
[0117] The computer-readable storage medium can specifically be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other readable storage medium capable of storing program code.
[0118] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses, devices, computer program products, and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant details can be found in the method section.
[0119] The present invention has provided a detailed description of a power backup management method, apparatus, and device for a storage system. Specific examples have been used to illustrate the principles and implementation methods of the invention. The descriptions of these embodiments are merely illustrative of the method and its core concepts. It should be noted that those skilled in the art can make various improvements and modifications to the invention without departing from its principles, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A power backup management method for a storage system, characterized in that, include: When a system power failure is detected, memory pages to be dumped are acquired; wherein, the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages; Determine the memory page to be dumped for each preset thread; wherein the number of preset threads is greater than or equal to 2, and each preset thread is bound to a different central processing unit core; wherein each preset thread corresponds to a different memory page to be dumped. Using the preset thread, the memory pages to be dumped are written to a preset dump file, and the preset dump file is stored in non-volatile memory; wherein, the preset dump file includes a file header, data of each memory page to be dumped, logical page number, and virtual memory address information; the virtual memory address information includes virtual address, length, and IOB number, and the virtual address is used to describe the starting address of the memory region; Wherein, the absolute value of the difference between the number of memory pages to be dumped corresponding to any two preset threads is less than or equal to 1; The step of determining the memory page to be dumped for each preset thread includes: Obtain the logical page number of each of the memory pages to be dumped; wherein, the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is a page number outside the range of the platform memory management page number; According to the order of the logical page numbers, each preset thread is allocated its corresponding memory page to be dumped. The method further includes, after using the preset thread to write the memory page to be dumped to the preset dump file and storing the preset dump file in non-volatile memory: After the system is detected to be powered on, the preset thread is used to restore the data of the memory pages to be dumped in the preset dump file to the memory of the storage system. The process of detecting a system power failure and, before acquiring the memory page to be dumped, further includes: The target quantity is determined based on the number of central processing unit cores of the storage system and the bandwidth of the non-volatile memory; Create the target number of preset threads, and bind each preset thread to a corresponding central processing unit core; Using thread-specific data, a preset size of space is reserved for each of the preset threads; The preset dump file includes a file header area, a memory page area, a logical page number area, and a virtual memory area. The step of using the preset thread to write the memory page to be dumped into the preset dump file and storing the preset dump file in non-volatile memory includes: The preset dump file in the non-volatile memory is opened using the dump main thread; The file header area of the preset dump file is written using the dump main thread; wherein, the file header area includes a header area and a tail area, and the header area and the tail area are used to store the same file header, and the file header includes the signature, type, number of memory page areas and number of virtual memory areas of the preset dump file; Each of the preset threads writes its corresponding memory page region to the preset dump file; wherein each memory page region is used to store the data of its corresponding memory page to be dumped. The main dump thread is used to write the logical page number area in the preset dump file; wherein, each logical page number area is used to store the logical page number and data check code of a corresponding memory page to be dumped; The virtual memory region in the preset dump file is written using the dump main thread; wherein, each virtual memory region is used to store the virtual memory address information and virtual memory address check code of a corresponding memory page to be dumped; The file header area is rewritten using the dump main thread, and the preset dump file is closed. The step of acquiring the memory page to be dumped when a system power failure is detected includes: When the main business process of the storage system is detected to have exited, the main dump thread is used to lock the memory page to be dumped. After using the preset thread to write the memory page to be dumped to a preset dump file and storing the preset dump file in non-volatile memory, the method further includes: The main dump thread is used to unlock the memory page to be dumped.
2. The power backup management method for a storage system according to claim 1, characterized in that, The step of using the preset thread to write the memory page to be dumped to a preset dump file and storing the preset dump file in non-volatile memory includes: When writing data to the preset dump file, the kernel timer is started. If the kernel timer reaches a time threshold, the storage system will be shut down.
3. A backup power management device for a storage system, characterized in that, include: A power failure acquisition module is used to acquire memory pages to be dumped when a system power failure is detected; wherein, the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages; A thread allocation module is used to determine the memory page to be dumped for each preset thread; wherein the number of preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core; wherein each preset thread corresponds to a different memory page to be dumped. The data write-to-disk module is used to write the memory pages to be dumped to a preset dump file using the preset thread, and to store the preset dump file in non-volatile memory; wherein, the preset dump file includes a file header, data of each memory page to be dumped, logical page number, and virtual memory address information; the virtual memory address information includes a virtual address, length, and IOB number, and the virtual address is used to describe the starting address of the memory region; Wherein, the absolute value of the difference between the number of memory pages to be dumped corresponding to any two preset threads is less than or equal to 1; The thread allocation module includes: The page number acquisition submodule is used to obtain the logical page number of each memory page to be dumped; among them, the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is the page number outside the range of the platform memory management page number; The allocation submodule is used to allocate the corresponding memory pages to be dumped to each preset thread in the order of logical page numbers. The backup power management device of the storage system further includes: The recovery module is used to restore the data of the memory pages to be dumped in the preset dump file to the memory of the storage system after detecting that the system is powered on; The backup power management device of the storage system further includes: The determination module is used to determine the target quantity based on the number of CPU cores and the bandwidth of non-volatile memory in the storage system. Create a module to create a target number of preset threads and bind each preset thread to its corresponding central processing unit core; The reserved module is used to reserve a preset size of space for each preset thread using thread-specific data. The data write-to-disk module includes: The Open submodule is used to open a preset dump file in non-volatile memory using the dump main thread; The file header submodule is used to write the file header area of the preset dump file using the dump main thread. The file header area includes a header area and a tail area. Both the header and tail areas are used to store the same file header, which includes the signature, type, number of memory page areas, and number of virtual memory areas of the preset dump file. The memory page submodule is used to write the corresponding memory page regions in the preset dump file by each preset thread; each memory page region is used to store the data of its corresponding memory page to be dumped. The page number submodule is used to write the logical page number area in the preset dump file using the dump main thread; each logical page number area is used to store the logical page number and data check code of a corresponding memory page to be dumped. The virtual memory submodule is used to write virtual memory regions in a preset dump file using the dump main thread; each virtual memory region is used to store the virtual memory address information and virtual memory address check code of its corresponding memory page to be dumped. The overwrite close submodule is used to rewrite the file header area using the dump main thread and close the default dump file; The power failure acquisition module includes: The locking submodule is used to lock the memory pages to be dumped by utilizing the dumping main thread when the main business process of the storage system is detected to have exited. The device also includes: The unlock module is used to unlock the memory pages to be dumped after writing the memory pages to be dumped to a preset dump file using a preset thread and storing the preset dump file in non-volatile memory, using the dump main thread.
4. A power backup management device for a storage system, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the power backup management method for a storage system as described in any one of claims 1 or 2 when executing the computer program.
Citation Information
Patent Citations
Memory management method, device and equipment and medium
CN109597720A
Memory dump file generation method, device and equipment and readable storage medium
CN115407943A
Disk refreshing method and device based on nonvolatile memory, equipment and medium
CN119200990A