Storage space management methods, devices, storage media, and electronic devices
By configuring storage space for each channel and deleting historical data as needed, the problem of a single storage device management method is solved, flexible storage space management is achieved, accidental data deletion is avoided, and management efficiency and user experience are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies for storage devices employ a single method of storage space management, which is insufficient to meet the needs of different application scenarios. This can lead to the accidental deletion of important data and a lack of flexibility in management.
Flexible storage space management is achieved by pre-configuring storage space for each channel and deleting historical data as needed when storage space is insufficient to ensure that the remaining capacity meets the demand.
It improves the management flexibility of storage devices, avoids accidental data deletion, and enhances management efficiency and user experience.
Smart Images

Figure CN115963992B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and more specifically, to a storage space management method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the advent of the big data era, higher demands have been placed on data storage technology. Therefore, it is necessary to strengthen the management of storage media such as disks used for data storage. In recent years, the European GDPR has protected personal privacy, stipulating that video surveillance equipment cannot store videos of people in public areas for more than a certain period. Meanwhile, in practical applications, the importance of the surveillance video sources pointed to by different channels on the same device varies. Customers may want important scenes to be stored for a longer period, while less important scenes can be stored for a shorter period. The main approach in related technologies is to allocate a fixed amount of storage space to all storage resources in the storage device according to each channel, and to manage the storage space of the storage device as a whole. For example, all channels compete for storage space, and data will not be actively deleted as long as the overall storage space of the device is not full. When the device's storage space is full, the oldest data is found and deleted to free up space. However, some data that users want to retain may be accidentally deleted. The storage space management in these technologies is relatively simple and difficult to meet the needs of users in different application scenarios.
[0003] There is currently no effective solution to the problem that the management methods for storage space of storage devices in related technologies are relatively simple. Summary of the Invention
[0004] This invention provides a storage space management method, apparatus, storage medium, and electronic device to at least solve the problem of relatively simple management methods for storage space of storage devices in related technologies.
[0005] According to an embodiment of the present invention, a method for managing storage space is provided, comprising: obtaining a first data set to be stored on a first channel; obtaining the remaining storage capacity of a first storage space configured for the first channel, wherein the first storage space is one of a plurality of storage spaces in a first disk group, each of the plurality of storage spaces is pre-configured to one of a plurality of channels, the plurality of channels including the first channel, and each storage space being used to store data on the channel to which it is configured; deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the storage spaces other than the first storage space among the plurality of storage spaces still have remaining storage capacity, wherein the remaining storage capacity of the first storage space after deleting the portion of data is greater than or equal to the first storage capacity; and storing the first data set in the first storage space.
[0006] In one exemplary embodiment, deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, includes: deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and when the total remaining storage capacity in the plurality of storage spaces is greater than or equal to the first storage capacity.
[0007] In one exemplary embodiment, before obtaining the remaining storage capacity of the first storage space configured for the first channel, the method further includes: obtaining a first configuration instruction, wherein the first configuration instruction is used to request the configuration of a corresponding storage space for the first channel and indicates that the storage capacity of the storage space configured for the first channel is a target storage capacity; in response to the first configuration instruction, configuring the first storage space with a storage capacity of the target storage capacity in the first disk group to the first channel; or, obtaining a second configuration instruction, wherein the second configuration instruction is used to request the configuration of a corresponding storage space for each of the plurality of channels and indicates the storage capacity of the storage space configured for each of the channels; in response to the second configuration instruction, configuring a corresponding storage space for each of the plurality of channels in the first disk group, wherein the storage capacity of the storage space configured for each of the channels is the corresponding storage capacity indicated in the second configuration instruction.
[0008] In one exemplary embodiment, the method further includes: obtaining a third configuration instruction, wherein the third configuration instruction is used to request that the total storage capacity of the storage space configured for the first channel be adjusted from a second storage capacity to a third storage capacity; deleting a portion of the data already stored in the first storage space when the third storage capacity is less than the second storage capacity and the capacity difference between the second storage capacity and the third storage capacity is greater than the remaining storage capacity of the first storage space, wherein the remaining storage capacity of the first storage space after deleting the portion of data is equal to or greater than the capacity difference; adjusting the storage space configured for the first channel from the first storage space to the second storage space, wherein the total storage capacity of the second storage space is the third storage capacity, and the second storage space includes the storage space in the first storage space where data has been stored.
[0009] In one exemplary embodiment, after storing the first data set into the first storage space, the method further includes: obtaining the occupied storage capacity of the first storage space; and deleting a portion of the data already stored in the first storage space if the ratio between the occupied storage capacity and the total storage capacity of the first storage space is greater than or equal to a predetermined ratio threshold.
[0010] In an exemplary embodiment, obtaining the remaining storage capacity of the first storage space configured for the first channel includes: when the data type in the first data set is a first type, obtaining the remaining storage capacity of a first sub-storage space corresponding to the first type in the first storage space, wherein the first storage space includes multiple sub-storage spaces, the multiple sub-storage spaces include the first sub-storage space, each sub-storage space is pre-configured to correspond to one of the multiple types, and each sub-storage space is used to store data of the corresponding type on the first channel; deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the multiple storage spaces other than the first storage space still have remaining storage capacity, includes: deleting a portion of the data already stored in the first sub-storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first sub-storage space, and the multiple storage spaces other than the first storage space still have remaining storage capacity; storing the first data set in the first storage space includes: storing the first data set in the first sub-storage space.
[0011] In one exemplary embodiment, deleting a portion of the data already stored in the first sub-storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first sub-storage space, and when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, includes: deleting a portion of the data already stored in the first sub-storage space when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, and when the total remaining storage capacity in the plurality of storage spaces is greater than or equal to the first storage capacity; or deleting a portion of the data already stored in the first sub-storage space when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, and when the total remaining storage capacity in the plurality of sub-storage spaces is greater than or equal to the first storage capacity.
[0012] According to another embodiment of the present invention, a storage space management device is also provided, comprising: a first acquisition module, configured to acquire a first data set to be stored on a first channel; a second acquisition module, configured to acquire the remaining storage capacity of a first storage space configured for the first channel, wherein the first storage space is one of a plurality of storage spaces in a first disk group, each of the plurality of storage spaces being pre-configured to one of a plurality of channels, the plurality of channels including the first channel, and each storage space being used to store data on the channel to which it is configured; a first deletion module, configured to delete a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the storage spaces other than the first storage space among the plurality of storage spaces still have remaining storage capacity, wherein the remaining storage capacity of the first storage space after deleting the portion of data is greater than or equal to the first storage capacity; and a storage module, configured to store the first data set into the first storage space.
[0013] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0014] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0015] This invention pre-configures a first storage space for a first channel in a first disk group. This first storage space stores data from the first channel. After obtaining a first data set to be stored from the first channel, and if the required storage capacity for the first data set is greater than the remaining storage capacity of the first storage space, and other storage spaces in the first disk group besides the first storage space still have remaining storage capacity, a deletion operation is performed on a portion of the data already stored in the first storage space. After deleting this portion of data, the remaining storage capacity of the first storage space is greater than or equal to the aforementioned first storage capacity. Then, the first data set is stored in the first storage space. In other words, by configuring a corresponding first storage space for the first channel, when the remaining storage capacity of the first storage space is insufficient, a deletion operation is performed on the historical data in the first storage space. This avoids the problem in related technologies where data is not actively deleted as long as the overall storage space of the storage device is not full, but is easily mistakenly deleted when the device's storage space is full. Therefore, this invention solves the problem of a relatively simple management method for the storage space of storage devices in related technologies, achieving the effect of improving management flexibility. Attached Figure Description
[0016] Figure 1 This is a block diagram of the hardware structure of a mobile terminal for a storage space management method according to an embodiment of the present invention.
[0017] Figure 2 This is a flowchart of a storage space management method according to an embodiment of the present invention;
[0018] Figure 3 This is a diagram of the storage space management architecture according to a specific embodiment of the present invention;
[0019] Figure 4 This is a schematic diagram of capacity configuration management according to a specific embodiment of the present invention;
[0020] Figure 5 This is a schematic diagram of disk group channel management according to a specific embodiment of the present invention;
[0021] Figure 6 This is a schematic diagram of capacity statistics management according to a specific embodiment of the present invention;
[0022] Figure 7 This is a schematic diagram of capacity control management according to a specific embodiment of the present invention;
[0023] Figure 8 This is a structural block diagram of a storage space management device according to an embodiment of the present invention. Detailed Implementation
[0024] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0026] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a block diagram of the mobile terminal hardware structure of the storage space management method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0027] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the storage space management method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0028] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0029] This embodiment provides a method for managing storage space. Figure 2 This is a flowchart of a storage space management method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0030] Step S202: Obtain the first data set to be stored on the first channel;
[0031] Step S204: Obtain the remaining storage capacity of the first storage space configured for the first channel, wherein the first storage space is one of a plurality of storage spaces in the first disk group, each of the plurality of storage spaces is pre-configured to one of the plurality of channels, the plurality of channels including the first channel, and each storage space is used to store the data configured on the one channel.
[0032] Step S206: If the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, delete part of the data already stored in the first storage space, wherein the remaining storage capacity of the first storage space after deleting the part of the data is greater than or equal to the first storage capacity.
[0033] Step S208: Store the first data set in the first storage space.
[0034] Through the above steps, by pre-configuring a first storage space for the first channel in the first disk group, where the first storage space is used to store data on the first channel, after obtaining the first data set to be stored from the first channel, if it is determined that the first storage capacity required for the first data set is greater than the remaining storage capacity of the first storage space, and other storage spaces in the first disk group besides the first storage space still have remaining storage capacity, a deletion operation is performed on the data already stored in the first storage space. After deleting the partial data, the remaining storage capacity of the first storage space is greater than or equal to the aforementioned first storage capacity, and then the first data set is stored in the first storage space. That is, by configuring a corresponding first storage space for the first channel, when the remaining storage capacity of the first storage space is insufficient, a deletion operation is performed on the historical data in the first storage space. This avoids the problem of data being accidentally deleted by the method used in related technologies, which only actively deletes data in the device as long as the overall storage space of the storage device is not full, and then deletes data from the entire storage space of the device after the device's storage space is full. Therefore, it solves the problem of the relatively simple management method of storage space of storage devices in related technologies, and achieves the effect of improving management flexibility.
[0035] The entity executing the above steps can be a device, such as a storage device, a server, or a storage management device, such as a controller or processor in the storage management device, or an application control program in the device, or a processor with human-computer interaction capabilities configured on the storage device, or a processing device or processing unit with similar processing capabilities, etc., but not limited to these. The following explanation uses a processor in a storage management device (hereinafter referred to as "processor") to perform the above operations as an example (this is only an illustrative example; in actual operation, other devices or modules can also perform the above operations):
[0036] In the above embodiments, a first data set to be stored on the first channel is obtained. For example, the first channel corresponds to a data set collected by a certain camera device, and the data set may include videos and / or images, etc.; the remaining storage capacity of the first storage space configured for the first channel is obtained, wherein the first storage space is one of a plurality of storage spaces in the first disk group, each of the plurality of storage spaces is pre-configured for one of the plurality of channels, the plurality of channels including the first channel, and each storage space is used to store the data on the channel configured to it. For example, a corresponding storage space is pre-configured for each of the plurality of channels in the first disk group, wherein... The storage space configured for the first channel is called the first storage space. This first storage space is used to store the data on the first channel. In practical applications, the storage capacity of the first storage space corresponding to the first channel can be configured as needed (e.g., 100GB, 120GB, or others). The storage capacity can also be adjusted according to the actual application scenario, for example, from 100GB to 150GB, or from 100GB to 80GB, etc. Optionally, there may be some storage spaces in the first disk group that are not allocated to any particular channel; for example, multiple channels can occupy the space. The aforementioned first disk group can be composed of one or more storage spaces. Logical storage resources composed of multiple hard drives. In practical applications, the entire storage device includes multiple hard drives. To improve the management efficiency of the entire storage device, the hard drives in the entire storage device can be divided into multiple disk groups. For example, in addition to the first disk group mentioned above, it may also include a second disk group, etc. When the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and there is still remaining storage capacity in the storage spaces other than the first storage space, some data already stored in the first storage space is deleted. After deleting some data, the remaining storage capacity of the first storage space is greater than or equal to the first storage capacity. For example, if the first storage capacity required to store the first data set is 1GB, and the remaining storage capacity of the first storage space is 500MB, and other storage spaces in the first disk group still have remaining storage capacity (such as 2GB, 10GB, or others), a deletion operation will still be performed on the first storage space, that is, the historical data in the first storage space will be deleted. For example, in practical applications, the earliest part of the historical data can be deleted in chronological order until the remaining storage capacity of the first storage space after deleting some data is greater than or equal to the aforementioned first storage capacity; then, the first data set can be stored in the first storage space.In this embodiment, by configuring a corresponding first storage space for the first channel, when the remaining storage capacity of the first storage space is insufficient, a deletion operation is performed on the historical data in the first storage space. This avoids the problem in related technologies where data in the device is not actively deleted as long as the overall storage space of the storage device is not full, and data is easily deleted accidentally when the device storage space is full. Therefore, this solves the problem of the relatively simple management method of the storage space of the storage device in related technologies, and achieves the effect of improving the flexibility of management.
[0037] In an optional embodiment, deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, includes: deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the total remaining storage capacity in the plurality of storage spaces is greater than or equal to the first storage capacity. For example, if the first storage capacity required to store the first data set is 1GB, and the remaining storage capacity of the first storage space is 500MB, and the total remaining storage capacity of the plurality of storage spaces in the first disk group (e.g., 2GB, 10GB, or other), a deletion operation will still be performed on the first storage space, that is, historical data in the first storage space will be deleted. For example, in practical applications, the earliest historical data can be deleted in chronological order until the remaining storage capacity of the first storage space after deleting some data is greater than or equal to the aforementioned first storage capacity. In this embodiment, by configuring a corresponding first storage space for the first channel, when the storage capacity of the first storage space is insufficient, it can be promptly cleared without affecting other storage spaces. Furthermore, even when there is sufficient storage space in the entire disk group or the entire storage device, the data for the first channel will only be stored in its corresponding first storage space. This effectively improves the flexibility and efficiency of storage space management. Optionally, in practical applications, the storage capacity of the first storage space corresponding to the first channel can be configured or modified as needed to further enhance management flexibility.
[0038] In an optional embodiment, before obtaining the remaining storage capacity of the first storage space configured for the first channel, the method further includes: obtaining a first configuration instruction, wherein the first configuration instruction is used to request the configuration of a corresponding storage space for the first channel and indicates that the storage capacity of the storage space configured for the first channel is a target storage capacity; in response to the first configuration instruction, configuring the first storage space with a storage capacity of the target storage capacity in the first disk group to the first channel; or, obtaining a second configuration instruction, wherein the second configuration instruction is used to request the configuration of a corresponding storage space for each of the plurality of channels and indicates that the storage capacity of the storage space configured for each of the channels is the corresponding storage capacity indicated in the second configuration instruction. In response to the second configuration instruction, configuring a corresponding storage space for each of the plurality of channels in the first disk group, wherein the storage capacity of the storage space configured for each of the channels is the corresponding storage capacity indicated in the second configuration instruction. In this embodiment, by obtaining a first configuration instruction and configuring the target storage capacity of the storage space corresponding to the first channel (i.e., the first storage space) as indicated by the first configuration instruction, the first storage space of the target storage capacity is configured to the first channel in the first disk group. Therefore, the required storage capacity of the storage space can be configured for the first channel, that is, the storage capacity of the first storage space corresponding to the first channel is configurable. In practical applications, the target storage capacity of the first channel is also adjustable. Optionally, by obtaining a second configuration instruction and configuring the corresponding storage capacity of the storage space corresponding to each channel in the multiple channels as indicated by the second configuration instruction, the storage space corresponding to each channel is configured in the first disk group. This achieves the purpose of configuring the corresponding storage space for multiple channels at the same time. Of course, in practical applications, the storage capacity corresponding to each channel is also adjustable, for example, by increasing or decreasing the storage capacity.
[0039] In an optional embodiment, the method further includes: obtaining a third configuration instruction, wherein the third configuration instruction is used to request that the total storage capacity of the storage space configured for the first channel be adjusted from a second storage capacity to a third storage capacity; deleting a portion of the data already stored in the first storage space when the third storage capacity is less than the second storage capacity and the capacity difference between the second storage capacity and the third storage capacity is greater than the remaining storage capacity of the first storage space, wherein the remaining storage capacity of the first storage space after deleting the portion of data is equal to or greater than the capacity difference; adjusting the storage space configured for the first channel from the first storage space to the second storage space, wherein the total storage capacity of the second storage space is the third storage capacity, and the second storage space includes the storage space in the first storage space where data has already been stored. In this embodiment, by obtaining a third configuration instruction, the total storage capacity of the storage space corresponding to the first channel is adjusted from the second storage capacity to the third storage capacity. This means lowering or reducing the total storage capacity of the storage space corresponding to the first channel. For example, if the current total storage capacity of the first channel is the second storage capacity (e.g., 100GB, or others), then the total storage capacity of the storage space configured for the first channel is 100GB (i.e., the aforementioned second storage capacity). When it is necessary to reduce the total storage capacity of the storage space corresponding to the first channel to 80GB (i.e., the aforementioned third storage capacity), the corresponding capacity difference is 20GB. If the remaining storage space of the first channel... If the storage capacity is 5GB (less than the 20GB capacity difference), then some data already stored in the first storage space is deleted until the remaining storage capacity of the first storage space after deleting some data is greater than or equal to the capacity difference (such as 20GB as mentioned above). Then, the storage space allocated to the first channel is changed from the first storage space to the second storage space. The second storage space includes some data already stored in the first storage space (referring to the data remaining after the aforementioned deletion). This achieves the purpose of reducing the storage capacity of the first channel's storage space. Of course, in practical applications, the storage capacity of each channel's storage space can also be increased or adjusted as needed. This embodiment achieves the purpose of adjusting the storage capacity of the storage space allocated to the first channel.
[0040] In an optional embodiment, after storing the first data set in the first storage space, the method further includes: obtaining the occupied storage capacity of the first storage space; and deleting a portion of the data already stored in the first storage space if the ratio between the occupied storage capacity and the total storage capacity of the first storage space is greater than or equal to a predetermined ratio threshold. In this embodiment, the occupied storage capacity of the first storage space can be obtained. When the ratio between the occupied storage capacity and the total storage capacity of the first storage space is greater than or equal to a predetermined ratio threshold (e.g., 96%, or others), a deletion operation is performed on the first storage space. For example, if the total storage capacity of the first storage space is 100GB, and the occupied storage capacity of the first storage space is 98GB (greater than the predetermined ratio threshold), then historical data in the first storage space will be deleted. In practical applications, the occupied capacity (or remaining capacity) of each disk group or each hard drive can be monitored (or statistically analyzed), and the used (or remaining) status of the storage space corresponding to each disk group, each hard drive, or each channel can also be displayed. This embodiment achieves the goal of monitoring the storage space usage of each channel and cleaning up the storage space in a timely manner, thereby improving the management efficiency of storage space.
[0041] In an optional embodiment, obtaining the remaining storage capacity of the first storage space configured for the first channel includes: when the data type in the first data set is a first type, obtaining the remaining storage capacity of the first sub-storage space corresponding to the first type in the first storage space, wherein the first storage space includes multiple sub-storage spaces, the multiple sub-storage spaces include the first sub-storage space, each sub-storage space is pre-configured to correspond to one of the multiple types, and each sub-storage space is used to store data of the corresponding type on the first channel; deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the multiple storage spaces other than the first storage space still have remaining storage capacity, includes: deleting a portion of the data already stored in the first sub-storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first sub-storage space, and the multiple storage spaces other than the first storage space still have remaining storage capacity; storing the first data set in the first storage space includes: storing the first data set in the first sub-storage space. In this embodiment, the first storage space may include multiple sub-storage spaces, each corresponding to the storage of different types of data. For example, the first sub-storage space is used to store data of a first type (e.g., video), the second sub-storage space is used to store data of a second type (e.g., images), or other sub-storage spaces are used to store other types of data. When the data type in the first data set is the first type, the remaining storage capacity of the first sub-storage space is obtained. When the required first storage capacity of the first data set is greater than the remaining storage capacity of the first sub-storage space, and other storage spaces besides the first storage space still have remaining storage capacity, then the data already stored in the first sub-storage space will be deleted. When the data type to be stored is of type one and the required first storage capacity is greater than the remaining storage capacity of the first sub-storage space, the first sub-storage space is promptly cleaned up without affecting other sub-storage spaces, other storage spaces, or storage spaces in other disk groups. Then, the data is stored in the first sub-storage space. Similarly, if the data type in the aforementioned first data set is type two, when the storage capacity in the second sub-storage space is insufficient, only the historical data in the second sub-storage space is cleaned up. This avoids the problem of accidental data deletion that can easily occur with the method in related technologies where the entire storage device is deleted only when the storage capacity of the entire storage device is insufficient. This can effectively improve the flexibility and efficiency of storage space management.This embodiment enables the independent configuration of storage space capacity for different storage services, improving the flexibility and efficiency of storage space management and enhancing the user experience.
[0042] In an optional embodiment, deleting a portion of the data already stored in the first sub-storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first sub-storage space, and when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, includes: deleting a portion of the data already stored in the first sub-storage space when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, and when the total remaining storage capacity in the plurality of storage spaces is greater than or equal to the first storage capacity; or deleting a portion of the data already stored in the first sub-storage space when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, and when the total remaining storage capacity in the plurality of sub-storage spaces is greater than or equal to the first storage capacity. In this embodiment, when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, and the total remaining storage capacity of the multiple storage spaces is greater than or equal to the first storage capacity, only the data already stored in the first sub-storage space is deleted; or, when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, and other storage spaces besides the first storage space still have remaining storage capacity, and the total remaining storage capacity of the multiple sub-storage spaces is greater than or equal to the first storage capacity, only the data already stored in the first sub-storage space is deleted. By configuring a corresponding first sub-storage space for the first type of data, when the storage capacity of the first sub-storage space is insufficient, the first sub-storage space is cleaned up in a timely manner without affecting other storage spaces. In addition, even when there is still sufficient storage space in the entire disk group or the entire storage device, the data of the first type will only be stored in its corresponding first sub-storage space. Through this embodiment, the management efficiency of storage space can be effectively improved.
[0043] Obviously, the embodiments described above are only some embodiments of the present invention, and not all embodiments. The present invention will be specifically described below with reference to the embodiments.
[0044] In related technologies, customers may want to retain important scene recordings for a longer period and less important scene recordings for a shorter period. This requirement can be met by allocating different capacities to each channel, and the quota function arose in this context. This invention provides a disk group-based quota management method.
[0045] 1. Main Modules
[0046] Figure 3 This is a management architecture diagram of storage space according to a specific embodiment of the present invention, which mainly includes: a quota configuration management module, a disk group channel management module, a quota used capacity management module, and a quota recording overlay management module. The functions of each module are described below.
[0047] Quota configuration management module: responsible for the management and configuration of recording and image capacity for each channel, including capacity settings and capacity display;
[0048] Disk Group Channel Management Module: Each disk group is responsible for managing all image channels and video channels under that disk group;
[0049] Quota Used Capacity Management Module: This module is mainly responsible for calculating the capacity space occupied by each channel of video recording and images on each hard drive. This function is the most critical part of implementing quota management. The efficiency of this module in calculating the used capacity of each channel will affect the correctness of the entire quota management.
[0050] Quota recording overlay management module: The main task of this module is to control the total capacity occupied by the channel with the configured quota during storage during device operation so that it does not exceed the quota capacity. When the occupied capacity is greater than or equal to the quota capacity, the space exceeding the capacity needs to be released in a timely manner.
[0051] 2. Capacity configuration management (or quota configuration management)
[0052] Figure 4 This is a schematic diagram of capacity configuration management according to a specific embodiment of the present invention. Figure 4 As you can see, quota settings are associated with disk groups. Since the current storage policy allows only one storage device to be written to in each disk group, and the storage performance of a single storage device is limited, and the Elastic Volume Service (EVS) itself has a large number of channels, it is impossible to write data to the same storage device through all channels. Therefore, when designing the quota management function (corresponding to the aforementioned quota configuration management module function), we still need to implement the quota function based on disk groups.
[0053] After enabling quotas, it is necessary to support configuring quota capacity individually for each channel's recording and image; it should also support operations such as increasing, decreasing, and deleting quota capacity.
[0054] 3. Panel channel management
[0055] Figure 5 This is a schematic diagram of disk group channel management according to a specific embodiment of the present invention. The relationship between channels and disk groups was originally maintained by the record and snap side, with each channel corresponding to a disk group. However, because the storage system needs to ensure that the used capacity of each channel does not exceed the quota capacity, the disk group module of the storage system needs to add corresponding channel number maintenance, mainly to identify which channel numbers require quota management. For example, Figure 5 In disk group 1, the channels corresponding to dav0-dav2 and jpg0-jpg2 are defined; in disk group 2, the channels corresponding to dav4-dav6 and jpg4-jpg6 are defined. The disk group module also needs to filter out logical channel numbers that are not configured with remote channels, for example... Figure 5 The channels corresponding to dav3 and jpg3 in disk group 1, and the channels corresponding to dav7 and jpg7 in disk group 2.
[0056] 4. Quota usage capacity management
[0057] Figure 6 This is a schematic diagram of capacity statistics management according to a specific embodiment of the present invention. The used capacity statistics module is responsible for the fine management of the space usage in each hard drive and needs to be able to update the capacity occupied by each channel of video and image in each hard drive in real time.
[0058] Capacity statistics management involves multiple aspects, such as Figure 6 As shown, during the startup phase, it is necessary to calculate the capacity occupied by each channel of each hard drive. During the operation of the device, data storage and data deletion operations are involved, which require updating the storage capacity occupied by each channel. During operation, hard drive failure (or invalidation), hard drive removal and hard drive connection will also be involved, which will again involve changes in the total capacity of each channel.
[0059] 5. Capacity control management
[0060] Figure 7This is a schematic diagram of capacity control management according to a specific embodiment of the present invention. In quota mode, some channels are configured with quota capacity, while others may not be configured with quota capacity. During device operation, both channels with and without quotas may be continuously storing data. The capacity occupied by the stored channels is constantly increasing, so the capacity occupied by the channels with quotas may exceed the configured quota capacity. At the same time, the channels without quotas may fill up the disk group's capacity, or both channels with and without quotas may use up the entire disk group's capacity. In this situation, the capacity control management module needs to monitor the capacity occupied by each channel in real time and monitor the remaining capacity of the entire disk group. When the capacity occupied by a channel exceeds the quota capacity, the oldest data of the corresponding channel should be deleted in a timely manner. And when the capacity occupied by the unquota channels is too large, the capacity occupied by the unquota channels can be deleted first to ensure that the space usage of the quota channels is met. Capacity control management corresponds to the aforementioned quota recording overlay management.
[0061] Through the above embodiments, customers can configure the available capacity of each channel according to their own needs. During the operation of the device, the storage space occupied by the channel with the configured capacity cannot exceed the configured capacity. At the same time, the video recordings and pictures of each channel can be configured with different capacities.
[0062] After configuring a quota capacity for a channel, the storage mode changes. If the storage space occupied by a channel with a configured quota is greater than or equal to the configured quota capacity before the device's storage space is full, a deletion operation will be triggered, deleting the oldest data in the channel, freeing up space, and then continuing to store data. During device operation, the total capacity occupied by channels with configured quota capacity will not exceed the configured quota capacity.
[0063] Through the embodiments of the present invention, different quota spaces can be allocated according to different video recording image services; the quota allocation is based on the disk group, which solves the problem of hard disk performance limiting multi-channel video recording image storage services, that is, it realizes the problem of hard disk performance limiting multi-channel storage in multi-channel storage devices; in addition, it can also realize the purpose of dynamically increasing and deleting quota space.
[0064] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0065] This embodiment also provides a storage space management device. Figure 8 This is a structural block diagram of a storage space management device according to an embodiment of the present invention, such as... Figure 8 As shown, the device includes:
[0066] The first acquisition module 802 is used to acquire the first data set to be stored on the first channel;
[0067] The second acquisition module 804 is used to acquire the remaining storage capacity of the first storage space configured for the first channel, wherein the first storage space is one of a plurality of storage spaces in the first disk group, each of the plurality of storage spaces is pre-configured to one of the plurality of channels, the plurality of channels including the first channel, and each storage space is used to store data configured on the one channel.
[0068] The first deletion module 806 is used to delete a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space and there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, wherein the remaining storage capacity of the first storage space after deleting the portion of data is greater than or equal to the first storage capacity.
[0069] Storage module 808 is used to store the first data set into the first storage space.
[0070] In an optional embodiment, the first deletion module 806 includes: a first deletion unit, configured to delete a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the total remaining storage capacity in the plurality of storage spaces is greater than or equal to the first storage capacity.
[0071] In an optional embodiment, the apparatus further includes: a third acquisition module, configured to acquire a first configuration instruction before acquiring the remaining storage capacity of the first storage space configured for the first channel, wherein the first configuration instruction is configured to request the configuration of a corresponding storage space for the first channel and indicates that the storage capacity of the storage space configured for the first channel is a target storage capacity; a first response module, configured to, in response to the first configuration instruction, configure the first storage space with a storage capacity of the target storage capacity in the first disk group to the first channel; or, a fourth acquisition module, configured to acquire a second configuration instruction, wherein the second configuration instruction is configured to request the configuration of a corresponding storage space for each of the plurality of channels and indicates that the storage capacity of the storage space configured for each of the channels is the corresponding storage capacity indicated in the second configuration instruction; a second response module, configured to, in response to the second configuration instruction, configure a corresponding storage space for each of the plurality of channels in the first disk group, wherein the storage capacity of the corresponding storage space configured for each channel is the corresponding storage capacity indicated in the second configuration instruction.
[0072] In an optional embodiment, the above apparatus further includes: a fifth acquisition module, configured to acquire a third configuration instruction, wherein the third configuration instruction is configured to request that the total storage capacity of the storage space configured for the first channel be adjusted from the second storage capacity to the third storage capacity; a second deletion module, configured to delete a portion of the data already stored in the first storage space when the third storage capacity is less than the second storage capacity and the capacity difference between the second storage capacity and the third storage capacity is greater than the remaining storage capacity of the first storage space, wherein the remaining storage capacity of the first storage space after deleting the portion of data is equal to or greater than the capacity difference; and an adjustment module, configured to adjust the storage space configured for the first channel from the first storage space to the second storage space, wherein the total storage capacity of the second storage space is the third storage capacity, and the second storage space includes the storage space in the first storage space where data has already been stored.
[0073] In an optional embodiment, the above apparatus further includes: a sixth acquisition module, configured to acquire the occupied storage capacity of the first storage space after storing the first data set into the first storage space; and a third deletion module, configured to delete a portion of the data already stored in the first storage space if the ratio between the occupied storage capacity and the total storage capacity of the first storage space is greater than or equal to a predetermined ratio threshold.
[0074] In an optional embodiment, the second acquisition module 804 includes: a first acquisition unit, configured to acquire the remaining storage capacity of a first sub-storage space corresponding to the first type in the first storage space when the data type in the first data set is a first type, wherein the first storage space includes multiple sub-storage spaces, the multiple sub-storage spaces include the first sub-storage space, each sub-storage space is pre-configured to correspond to one of the multiple types, and each sub-storage space is used to store data of the corresponding type on the first channel; the first deletion module 806 includes: a second deletion unit, configured to delete a portion of the data already stored in the first sub-storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first sub-storage space, and the multiple storage spaces other than the first storage space still have remaining storage capacity; the storage module 808 includes: a first storage unit, configured to store the first data set into the first sub-storage space.
[0075] In an optional embodiment, the second deletion unit includes: a first deletion subunit, configured to delete a portion of the data already stored in the first sub-storage space when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space and the total remaining storage capacity of the plurality of storage spaces is greater than or equal to the first storage capacity; or a second deletion subunit, configured to delete a portion of the data already stored in the first sub-storage space when the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, the plurality of storage spaces other than the first storage space still have remaining storage capacity, and the total remaining storage capacity of the plurality of sub-storage spaces is greater than or equal to the first storage capacity.
[0076] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0077] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0078] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0079] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0080] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0081] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0082] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0083] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for managing storage space, characterized in that, include: Obtain the first set of data to be stored on the first channel; Obtain the remaining storage capacity of the first storage space configured for the first channel, wherein the first storage space is one of a plurality of storage spaces in the first disk group, each of the plurality of storage spaces is pre-configured to one of a plurality of channels, the plurality of channels including the first channel, and each storage space is used to store data configured on the one channel; In the case where the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, deleting a portion of the data already stored in the first storage space includes: deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the total remaining storage capacity in the plurality of storage spaces is greater than or equal to the first storage capacity, wherein the remaining storage capacity of the first storage space after deleting the portion of data is greater than or equal to the first storage capacity; Store the first data set in the first storage space.
2. The method according to claim 1, characterized in that, Before obtaining the remaining storage capacity of the first storage space configured for the first channel, the method further includes: Obtain a first configuration instruction, wherein the first configuration instruction is used to request the configuration of corresponding storage space for the first channel, and indicates that the storage capacity of the storage space configured for the first channel is a target storage capacity; in response to the first configuration instruction, configure the first storage space with a storage capacity of the target storage capacity in the first disk group to the first channel; or... Obtain a second configuration instruction, wherein the second configuration instruction is used to request the configuration of corresponding storage space for each of the plurality of channels and indicates the storage capacity of the storage space configured for each of the channels; in response to the second configuration instruction, configure corresponding storage space for each of the plurality of channels in the first disk group, wherein the storage capacity of the storage space configured for each of the channels is the corresponding storage capacity indicated in the second configuration instruction.
3. The method according to claim 1, characterized in that, The method further includes: Obtain a third configuration instruction, wherein the third configuration instruction is used to request that the total storage capacity of the storage space configured for the first channel be adjusted from the second storage capacity to the third storage capacity; If the third storage capacity is less than the second storage capacity, and the capacity difference between the second storage capacity and the third storage capacity is greater than the remaining storage capacity of the first storage space, delete a portion of the data already stored in the first storage space, wherein the remaining storage capacity of the first storage space after deleting the portion of data is equal to or greater than the capacity difference. The storage space configured for the first channel is adjusted from the first storage space to the second storage space, wherein the total storage capacity of the second storage space is the third storage capacity, and the second storage space includes the storage space in the first storage space that already contains data.
4. The method according to claim 1, characterized in that, After storing the first data set into the first storage space, the method further includes: Obtain the occupied storage capacity of the first storage space; If the ratio between the occupied storage capacity and the total storage capacity of the first storage space is greater than or equal to a predetermined ratio threshold, the portion of data already stored in the first storage space is deleted.
5. The method according to claim 1, characterized in that, The step of obtaining the remaining storage capacity of the first storage space configured for the first channel includes: when the data type in the first data set is a first type, obtaining the remaining storage capacity of the first sub-storage space corresponding to the first type in the first storage space, wherein the first storage space includes multiple sub-storage spaces, the multiple sub-storage spaces include the first sub-storage space, each sub-storage space is pre-configured to correspond to one of the multiple types, and each sub-storage space is used to store data of the corresponding type on the first channel; Deleting a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, includes: deleting a portion of the data already stored in the first sub-storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first sub-storage space, and when there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces; The step of storing the first data set in the first storage space includes: storing the first data set in the first sub-storage space.
6. The method according to claim 5, characterized in that, When the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first sub-storage space, and there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, the data already stored in the first sub-storage space is deleted, including: If the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, and the total remaining storage capacity of the plurality of storage spaces is greater than or equal to the first storage capacity, delete a portion of the data already stored in the first sub-storage space; or If the first storage capacity is greater than the remaining storage capacity of the first sub-storage space, there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, and the total remaining storage capacity in the plurality of sub-storage spaces is greater than or equal to the first storage capacity, then delete the portion of data already stored in the first sub-storage space.
7. A storage space management device, characterized in that, include: The first acquisition module is used to acquire the first data set to be stored on the first channel; The second acquisition module is used to acquire the remaining storage capacity of the first storage space configured for the first channel, wherein the first storage space is one of a plurality of storage spaces in the first disk group, each of the plurality of storage spaces is pre-configured to one of a plurality of channels, the plurality of channels including the first channel, and each storage space is used to store data configured on the one channel. The first deletion module is used to delete a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space and there is still remaining storage capacity in the storage spaces other than the first storage space among the plurality of storage spaces, wherein the remaining storage capacity of the first storage space after deleting the portion of data is greater than or equal to the first storage capacity. A storage module is used to store the first data set into the first storage space; The device is further configured to delete a portion of the data already stored in the first storage space when the first storage capacity required to store the first data set is greater than the remaining storage capacity of the first storage space, and the total remaining storage capacity in the plurality of storage spaces is greater than or equal to the first storage capacity.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 6.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Video data storage method and system and video access method and node
CN108076317A