Disclosure of Invention
In view of the above, the present invention is to provide a storage space allocation method, system, storage medium and device, so as to solve the problem in the prior art that a storage utilization rate is low when a file system in a network-attached storage system applies for a storage space.
Based on the above purpose, the present invention provides a storage space allocation method, which comprises the following steps:
creating a file system, setting a total storage capacity for the file system, and allocating a storage space with a first fixed storage capacity for the file system in advance;
responding to the file system receiving a data writing request, and judging whether the residual storage capacity in the total storage capacity meets the storage capacity required by the data writing request;
responding to the storage capacity required by the data writing request, and judging whether the storage space allocated to the file system meets the storage capacity required by the data writing request;
in response to the allocated storage space not satisfying the storage capacity required by the write data request, the file system applies for allocation of the storage space to the storage pool so that the storage space of the file system satisfies the storage capacity required by the write data request.
In some embodiments, allocating, by the file system, storage space to the storage pool application such that the storage space of the file system satisfies the storage capacity required by the write data request comprises:
the file system applies for allocation of a storage space with a second fixed storage capacity to the storage pool, and judges whether the storage space of the file system meets the storage capacity required by the data writing request or not in response to successful allocation application;
and in response to the storage space of the file system not meeting the storage capacity required by the write data request, continuing to apply for allocation of a storage space of the second fixed storage capacity to the storage pool until the storage space of the file system meets the storage capacity required by the write data request.
In some embodiments, the method further comprises:
and sending out prompt information of insufficient storage space of the storage pool in response to the failure of allocation application.
In some embodiments, the method further comprises:
and responding to the allocated storage space to meet the storage capacity required by the data writing request, and writing the data corresponding to the data writing request into the file system.
In some embodiments, the method further comprises:
and responding to the residual storage capacity not meeting the storage capacity required by the data writing request, and sending out prompt information of insufficient file system space.
In some embodiments, the file system receiving the write data request includes:
the file system receives a write data request sent through the sharing service.
In some embodiments, allocating storage space to the storage pool application by the file system comprises:
the storage pool is applied for allocation of storage space by the file system through the logical volume.
In another aspect of the present invention, a storage space allocation system is further provided, including:
the pre-allocation module is configured for creating a file system, setting the total storage capacity for the file system and pre-allocating a storage space with a first fixed storage capacity for the file system;
the first judgment module is configured to respond to the fact that the file system receives a data writing request, and judge whether the residual storage capacity in the total storage capacity meets the storage capacity required by the data writing request;
the second judgment module is configured to respond to the fact that the residual storage capacity meets the storage capacity needed by the data writing request, and judge whether the storage space allocated to the file system meets the storage capacity needed by the data writing request; and
and the storage space allocation module is configured to respond to the allocated storage space not meeting the storage capacity required by the data writing request, and the file system applies for allocating the storage space to the storage pool so that the storage space of the file system meets the storage capacity required by the data writing request.
In yet another aspect of the present invention, a computer-readable storage medium is also provided, storing computer program instructions, which when executed by a processor, implement the above-described method.
In yet another aspect of the present invention, a computer device is further provided, which includes a memory and a processor, the memory storing a computer program, which when executed by the processor performs the above method.
The invention has at least the following beneficial technical effects:
according to the storage space allocation method, the physical storage space is applied for allocation according to the requirement of the file system on the actual storage capacity, so that a large amount of storage space is prevented from being idle, and the utilization rate of the storage space is effectively improved; and when more storage capacity is actually needed, more disks can be purchased by adopting capacity expansion, so that the investment cost of the storage equipment at the early stage is effectively reduced, and budget control is facilitated.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two non-identical entities with the same name or different parameters, and it is understood that "first" and "second" are only used for convenience of expression and should not be construed as limiting the embodiments of the present invention. Furthermore, the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements does not include all of the other steps or elements inherent in the list.
In view of the above object, a first aspect of the embodiments of the present invention provides an embodiment of a method for allocating a storage space. Fig. 1 is a schematic diagram illustrating an embodiment of a storage space allocation method provided by the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
step S10, creating a file system, setting total storage capacity for the file system, and allocating a storage space with first fixed storage capacity for the file system in advance;
step S20, responding to the file system receiving the data writing request, judging whether the residual storage capacity in the total storage capacity meets the storage capacity required by the data writing request;
step S30, responding to the residual storage capacity meeting the storage capacity needed by the data writing request, and judging whether the storage space allocated by the file system meets the storage capacity needed by the data writing request;
step S40, in response to the allocated storage space not satisfying the storage capacity required by the write data request, the file system applies for allocation of the storage space to the storage pool so that the storage space of the file system satisfies the storage capacity required by the write data request.
In the embodiment of the invention, when a user creates a file system, a simplified allocation strategy is used for allocating the storage space, the strategy does not allocate enough storage space at one time, but initially allocates a part of the storage space, and then allocates the part of the storage space to the file system for multiple times and a small amount each time according to the actual required capacity of the file system; when the amount of data stored by the file system increases, resulting in insufficient allocated storage space, the system may again reallocate a portion of the storage space from the storage pool. The file system created using the thin allocation strategy contains real storage space and virtual storage capacity. Assuming that 100G of total storage capacity is set for the file system when the file system is initially created, and 2% (i.e. 2G) of actual physical storage space is allocated in advance, the other 98% (i.e. 98G) is the storage capacity virtually given to the user, and no physical storage space is actually allocated yet. The pre-allocated real storage space may have a small amount of capacity for storing initialization metadata. If the actual storage space does not need to be allocated in advance in actual situations, it may not be allocated in advance, that is, the first fixed storage capacity is 0.
According to the storage space allocation method, the physical storage space is applied for allocation according to the requirement of the file system on the actual storage capacity, so that a large amount of storage space is prevented from being idle, and the utilization rate of the storage space is effectively improved; and when more storage capacity is actually needed, more disks can be purchased by adopting capacity expansion, so that the investment cost of the storage equipment at the early stage is effectively reduced, and budget control is facilitated.
In some embodiments, allocating, by the file system, storage space to the storage pool application such that the storage space of the file system satisfies the storage capacity required by the write data request comprises: the file system applies for allocation of a storage space with a second fixed storage capacity to the storage pool, and judges whether the storage space of the file system meets the storage capacity required by the data writing request or not in response to successful allocation application; and in response to the storage space of the file system not meeting the storage capacity required by the write data request, continuing to apply for allocation of a storage space of the second fixed storage capacity to the storage pool until the storage space of the file system meets the storage capacity required by the write data request.
Specifically, when the remaining storage capacity meets the storage capacity required by the write data request, if the storage space allocated by the file system does not meet the storage capacity required by the write data request, the file system applies for allocation of the storage space to the storage pool. In this embodiment, the file system may apply for allocation of storage space to the storage pool multiple times, and allocate storage space of the second fixed storage capacity each time. After the file system applies for allocation of a storage space with a second fixed storage capacity to the storage pool for the first time, judging that the storage space of the file system does not meet the storage capacity required by the data writing request, and applying for allocation of the storage space with the second fixed storage capacity to the storage pool for the second time; if the second application is successfully distributed, the application is stopped when the storage space of the file system at the moment is judged to meet the storage capacity required by the data writing request; if the second application distribution is successful, judging that the storage space of the file system cannot meet the storage capacity required by the data writing request at the moment, and then applying for distribution again; in the case of sufficient storage pool storage space, the application is not stopped until the storage space of the file system meets the storage capacity required for the write data request.
In some embodiments, the method further comprises: and sending out prompt information of insufficient storage space of the storage pool in response to the failure of allocation application.
Specifically, when the file system applies for allocation of a storage space with a second fixed storage capacity to the storage pool, if the application fails to allocate, a notification message indicating that the storage space in the storage pool is insufficient is issued. In this embodiment, if the storage capacity required by the write data request exceeds the second fixed storage capacity, the file system may apply for allocation of a storage space of the second fixed storage capacity to the storage pool multiple times. If the first application distribution is successful, judging whether the storage space of the file system at the moment meets the storage capacity required by the data writing request; if not, the file system applies for allocating the storage space with the second fixed storage capacity again; and if the storage pool can provide the remaining storage space for the file system less than the second fixed storage capacity, reporting a prompt message that the storage pool space is insufficient.
In some embodiments, the method further comprises: and responding to the allocated storage space to meet the storage capacity required by the data writing request, and writing the data corresponding to the data writing request into the file system.
Specifically, if the file system receives a write data request, whether the remaining storage capacity in the total storage capacity meets the storage capacity required by the write data request is judged; if the residual storage capacity meets the storage capacity required by the data writing request, judging whether the storage space allocated by the file system meets the storage capacity required by the data writing request; and if the allocated storage space meets the storage capacity required by the data writing request, writing the data corresponding to the data writing request into the file system.
In some embodiments, the method further comprises: and responding to the residual storage capacity not meeting the storage capacity required by the data writing request, and sending out prompt information of insufficient file system space.
Specifically, if the file system receives a write data request, whether the remaining storage capacity in the total storage capacity meets the storage capacity required by the write data request is judged; and if the residual storage capacity does not meet the storage capacity required by the data writing request, sending out prompt information of insufficient file system space. At this point, it is indicated that the total storage capacity of the file system has been used more, and the remaining storage capacity has been less than the storage capacity required for the write data request.
In some embodiments, the file system receiving the write data request includes: the file system receives a write data request sent through the sharing service.
In this embodiment, the sharing service includes CIFS sharing service, NFS sharing service, and the like. CIFS (Common Internet File System) allows programs to access files on remote Internet computers and requires that the computer provide services. The NFS (Network File System) mainly functions to enable sharing of files or directories between different host systems through a Network (typically, a local area Network). Comparison of CIFS and NFS: (1) the CIFS is oriented to a network connection sharing protocol, has high requirement on the reliability of network transmission, and often uses TCP/IP; NFS is transport independent and may use TCP or UDP; (2) one of the NFS drawbacks is that the client is required to install special software; the CIFS is integrated in the operating system, so that additional software is not required to be added; (3) NFS belongs to a stateless protocol, and CIFS belongs to a stateful protocol; NFS is little affected by faults, and can self-recover an interaction process, and CIFS is not available; from the transmission efficiency, CIFS is superior to NFS, and does not use too much redundant information for transmission; (4) both protocols require file format conversion, and the NFS retains the file format characteristics of unix, such as owners, groups, and the like; CIFS is done exactly in the win style.
In some embodiments, allocating storage space to the storage pool application by the file system comprises: the storage pool is applied for allocation of storage space by the file system through the logical volume.
In this embodiment, a Logical Volume (Logical Volume) is a virtual disk formed by Logical disks, and may also be referred to as a disk partition. The logical volume is a disk management mode, and aims to jump the hard disk space from the management mode of a physical hard disk so as to carry out more convenient unified management and distribution. The storage pool is composed of a plurality of physical hard disks.
In a second aspect of the embodiments of the present invention, a storage space allocation system is further provided. Fig. 2 is a schematic diagram illustrating an embodiment of a storage space allocation system provided in the present invention. As shown in fig. 2, a storage space allocation system includes: thepre-allocation module 10 is configured to create a file system, set a total storage capacity for the file system, and pre-allocate a storage space with a first fixed storage capacity for the file system; a first judgingmodule 20, configured to, in response to the file system receiving the write data request, judge whether a remaining storage capacity in the total storage capacity satisfies a storage capacity required by the write data request; a second judgingmodule 30, configured to respond to the remaining storage capacity meeting the storage capacity required by the write data request, and judge whether the storage space allocated to the file system meets the storage capacity required by the write data request; and a storagespace allocation module 40 configured to respond to that the allocated storage space does not satisfy the storage capacity required by the write data request, and apply for allocation of the storage space to the storage pool by the file system so that the storage space of the file system satisfies the storage capacity required by the write data request.
In some embodiments, the storagespace allocation module 40 includes an application allocation module configured to apply for allocation of a storage space of a second fixed storage capacity from the file system to the storage pool, and in response to successful application allocation, determine whether the storage space of the file system satisfies a storage capacity required for the write data request; and in response to the storage space of the file system not meeting the storage capacity required by the write data request, continuing to apply for allocation of a storage space of the second fixed storage capacity to the storage pool until the storage space of the file system meets the storage capacity required by the write data request.
In some embodiments, the system further comprises a first prompting module configured to issue a notification that the storage space of the storage pool is insufficient in response to applying for allocation failure.
In some embodiments, the system further includes a data writing module configured to write data corresponding to the write data request into the file system in response to the allocated storage space satisfying a storage capacity required by the write data request.
In some embodiments, the system further comprises a second hint module configured to issue a hint that file system space is insufficient in response to the remaining storage capacity not meeting the storage capacity required for the write data request.
In some embodiments, the first determiningmodule 20 comprises a write data request receiving module configured for the file system to receive a write data request sent through the sharing service.
In some embodiments, the storagespace allocation module 40 further comprises an application module configured to apply for allocation of storage space to storage pools by the file system through logical volumes.
According to the storage space distribution system, the physical storage space is applied to be distributed according to the requirement of the file system on the actual storage capacity, so that a large amount of storage space is prevented from being idle, and the utilization rate of the storage space is effectively improved; and when more storage capacity is actually needed, more disks can be purchased by adopting capacity expansion, so that the investment cost of the storage equipment at the early stage is effectively reduced, and budget control is facilitated.
In a third aspect of the embodiment of the present invention, a computer-readable storage medium is further provided, and fig. 3 is a schematic diagram illustrating a computer-readable storage medium implementing a storage space allocation method according to an embodiment of the present invention. As shown in fig. 3, the computer-readable storage medium 3 storescomputer program instructions 31. Thecomputer program instructions 31 when executed by a processor implement the steps of:
creating a file system, setting a total storage capacity for the file system, and allocating a storage space with a first fixed storage capacity for the file system in advance;
responding to the file system receiving a data writing request, and judging whether the residual storage capacity in the total storage capacity meets the storage capacity required by the data writing request;
responding to the storage capacity required by the data writing request, and judging whether the storage space allocated to the file system meets the storage capacity required by the data writing request;
in response to the allocated storage space not satisfying the storage capacity required by the write data request, the file system applies for allocation of the storage space to the storage pool so that the storage space of the file system satisfies the storage capacity required by the write data request.
In some embodiments, allocating, by the file system, storage space to the storage pool application such that the storage space of the file system satisfies the storage capacity required by the write data request comprises: the file system applies for allocation of a storage space with a second fixed storage capacity to the storage pool, and judges whether the storage space of the file system meets the storage capacity required by the data writing request or not in response to successful allocation application; and in response to the storage space of the file system not meeting the storage capacity required by the write data request, continuing to apply for allocation of a storage space of the second fixed storage capacity to the storage pool until the storage space of the file system meets the storage capacity required by the write data request.
In some embodiments, the steps further comprise: and sending out prompt information of insufficient storage space of the storage pool in response to the failure of allocation application.
In some embodiments, the steps further comprise: and responding to the allocated storage space to meet the storage capacity required by the data writing request, and writing the data corresponding to the data writing request into the file system.
In some embodiments, the steps further comprise: and responding to the residual storage capacity not meeting the storage capacity required by the data writing request, and sending out prompt information of insufficient file system space.
In some embodiments, the file system receiving the write data request includes: the file system receives a write data request sent through the sharing service.
In some embodiments, allocating storage space to the storage pool application by the file system comprises: the storage pool is applied for allocation of storage space by the file system through the logical volume.
It is to be understood that all embodiments, features and advantages set forth above with respect to the storage space allocation method according to the invention apply equally, without conflict with one another, to the storage space allocation system and to the storage medium according to the invention.
In a fourth aspect of the embodiments of the present invention, there is further provided a computer device, including amemory 402 and aprocessor 401 as shown in fig. 4, where thememory 402 stores therein a computer program, and the computer program, when executed by theprocessor 401, implements the method of any one of the above embodiments.
Fig. 4 is a schematic hardware structure diagram of an embodiment of a computer device for executing the storage space allocation method according to the present invention. Taking the computer device shown in fig. 4 as an example, the computer device includes aprocessor 401 and amemory 402, and may further include: aninput device 403 and anoutput device 404. Theprocessor 401, thememory 402, theinput device 403 and theoutput device 404 may be connected by a bus or other means, and fig. 4 illustrates an example of a connection by a bus. Theinput device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the storage space allocation system. Theoutput device 404 may include a display device such as a display screen.
Thememory 402, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the storage space allocation method in the embodiments of the present application. Thememory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by use of the storage space allocation method, and the like. Further, thememory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments,memory 402 may optionally include memory located remotely fromprocessor 401, which may be connected to local modules via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Theprocessor 401 executes various functional applications of the server and data processing by running nonvolatile software programs, instructions, and modules stored in thememory 402, that is, implements the storage space allocation method of the above-described method embodiment.
Finally, it should be noted that the computer-readable storage medium (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein may be implemented or performed with the following components designed to perform the functions herein: a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items. The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.