CN114153610A - User quota method, device and storage medium based on threads - Google Patents

User quota method, device and storage medium based on threads Download PDF

Info

Publication number
CN114153610A
CN114153610A CN202111451186.9A CN202111451186A CN114153610A CN 114153610 A CN114153610 A CN 114153610A CN 202111451186 A CN202111451186 A CN 202111451186A CN 114153610 A CN114153610 A CN 114153610A
Authority
CN
China
Prior art keywords
thread
quota
kernel
write
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202111451186.9A
Other languages
Chinese (zh)
Inventor
刘欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202111451186.9A priority Critical patent/CN114153610A/en
Publication of CN114153610A publication Critical patent/CN114153610A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a method, a device and a storage medium for user quota based on thread, wherein the method comprises the following steps: when a current write-in thread of the kernel-state client executes file write-in operation, judging whether the kernel-state client sends a thread quota request, if the kernel-state client sends the thread quota request, adding the current write-in thread into a waiting queue, and sending the thread quota request to the metadata server after waiting for the previous write-in thread to write in a file; if the kernel-state client does not send the thread quota request, sending the thread quota request to the metadata server; and after receiving the thread quota request, the metadata server executes thread quota operation and allocates storage space to the user. The thread-based user quota method, the thread-based user quota device and the storage medium reduce interaction between the kernel-mode client and the metadata server, improve the efficiency of file writing and improve the available space of a storage system.

Description

User quota method, device and storage medium based on threads
Technical Field
The present invention relates to the field of thread processing technologies, and in particular, to a method and an apparatus for user quota based on a thread, and a storage medium.
Background
In the distributed storage system, the use and the remaining conditions of the user quota are stored in the metadata server side, and the user sends a request to apply for the quota to the metadata server when writing data through the kernel-state client side. If a quota is applied, the writing can be completed; and if the available space of the user quota of the metadata server end is zero, the client end cannot complete the writing.
The request processing of the kernel-mode client side by the metadata server side is not strictly processed in sequence, if available space exists, data is destaged, and when the server side does not have the available space, the client side can be immediately responded; when the client side performs parallel writing, the problem of writing failure can be caused when the user quota is not used up. For example, a user writes a first file and a second file at the same time, the written files request available space from a metadata server at the first time, the metadata server allocates the remaining available space to the first file, and then data is landed; when the write file requests available space from the metadata server, the client side can immediately return that the client side has no available space due to the fact that no available space exists, so that the write file two fails, the request for writing the file one returns success, and the file one continues to be written. In summary, when the kernel-mode client operates the file in parallel, the problem that the user quota still has available space but cannot continue to write is caused, and the available capacity of the storage system is smaller than the actual available capacity.
Disclosure of Invention
In order to solve the technical problems, the invention provides a user quota method, a user quota device and a storage medium based on a thread, which can reduce the interaction between a kernel-mode client and a metadata server, improve the efficiency of file writing and improve the available space of a storage system.
In order to achieve the above object, the present application proposes a first technical solution:
a thread-based user quota method, comprising the steps of:
when a current write-in thread of the kernel-mode client executes file write-in operation, firstly judging whether the kernel-mode client sends a thread quota request;
if the kernel-mode client has sent a thread quota request, adding the current write-in thread into a waiting queue, and sending the thread quota request to the metadata server after waiting for the end of the file written by the previous write-in thread;
if the kernel-state client does not send the thread quota request, sending the thread quota request to the metadata server;
and after receiving the thread quota request, the metadata server executes thread quota operation and allocates storage space to the user.
In an embodiment of the present invention, the determining whether the kernel-mode client has sent the thread quota request through a quota flag specifically includes:
the quota mark comprises an application state and a non-application state, and when the quota mark is in the application state, the quota mark indicates that a written-in thread exists and a thread quota request is sent to the metadata server through the kernel state client; and when the quota mark is in a non-application state, the fact that no write thread sends a thread quota request to the metadata server through the kernel-state client side is indicated.
In an embodiment of the present invention, before the kernel-state client sends the thread quota request to the metadata server, the method specifically includes:
judging whether the kernel-mode client locally has an available space, if so, directly executing the file writing operation by the writing thread of the kernel-mode client without sending a thread quota request to the metadata server through the kernel-mode client; and if no available space exists, judging whether the quota mark is in an application state.
In an embodiment of the present invention, if the quota flag is in an application state, adding a current write thread to a wait queue; and if the quota mark is in a non-application state, the kernel-state client sends a thread quota request to the metadata server.
In an embodiment of the present invention, the quota applying, by the metadata server, to each write-in thread according to the order rule in the wait queue specifically includes:
when a current write-in thread sends a thread quota request through a kernel state client, setting the state of a quota flag as an application state;
and after the current write-in thread completes the file write-in operation and sets the state of the quota flag to be in a non-application state, allowing the next write-in thread to send a thread quota request through the kernel-state client.
In an embodiment of the present invention, after the write thread of the kernel mode client performs the file writing operation, the method specifically includes:
setting the state of the quota flag to be a non-application state;
and waking up the write thread in the waiting queue.
In one embodiment of the invention, the ordering rules are arranged in a first-come-last order.
In order to achieve the above object, the present application further provides a second technical solution:
a thread-based user quota device, the device comprising:
the quota request judging module is used for judging whether the kernel-state client sends a thread quota request or not;
the queue configuration module is used for adding the write-in thread needing waiting into a waiting queue;
the quota request sending module is used for sending a thread quota request to the metadata server by the kernel-state client;
and the quota operation execution module is used for executing quota operation on the kernel-state client.
In one embodiment of the invention, the apparatus further comprises:
the state configuration module is used for configuring the state of the quota mark;
the thread awakening module is used for putting the write-in thread in the waiting queue into an awakening state;
the rule sorting module is used for sequentially arranging the write-in threads according to rules;
and the file writing module is used for executing the file writing operation of the writing thread.
In order to achieve the above object, the present application proposes a third technical solution:
a computer-readable storage medium storing a program which, when executed by a processor, causes the processor to perform the steps of the method.
Compared with the prior art, the technical scheme of the invention has the following advantages:
according to the user quota method, the user quota device and the storage medium based on the threads, when a write-in thread performs write-in operation and needs thread quota, whether a kernel-mode client sends a thread quota request is judged at first; if the kernel-state client has sent the thread quota request, adding the current write-in thread into a waiting queue, and sending the thread quota request to the metadata server through the kernel-state client after waiting for the end of the file written by the previous write-in thread; if the kernel-state client does not send the thread quota request, sending the thread quota request to the metadata server; and after receiving the thread quota request, the metadata server executes thread quota operation and allocates storage space to the user. If the kernel-state client sends a thread quota request, the previous write-in thread applies for a quota and the file is written in, the current write-in thread added into the waiting queue is allowed to send a thread quota request through the kernel-state client, and the file writing operation is performed after the thread quota of the metadata server is obtained, so that the data is landed, the interaction between the kernel-state client and the metadata server is reduced, the file writing efficiency is improved, and the available space of the storage system is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow diagram of a first method of a thread-based user quota method of the present invention;
FIG. 2 is a flow diagram of a second method of the thread-based user quota method of the present invention;
fig. 3 is a device configuration diagram of a thread-based user quota device according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
referring to fig. 1, fig. 1 is a flowchart illustrating a first method of a thread-based user quota method according to the present invention.
The thread-based user quota method of the embodiment includes the following steps:
before a current write-in thread of the kernel-mode client executes file write-in operation, firstly judging whether the kernel-mode client sends a thread quota request;
if the kernel-mode client has sent a thread quota request, adding the current write-in thread into a waiting queue, and sending the thread quota request to the metadata server after waiting for the end of the file written by the previous write-in thread;
if the kernel-state client does not send the thread quota request, sending the thread quota request to the metadata server;
and after receiving the thread quota request, the metadata server executes thread quota operation and allocates storage space to the user.
Before a write-in thread of the kernel-mode client executes a write-in file operation and when the kernel-mode client does not have an available space locally, the kernel-mode client needs to send a thread quota request to the metadata server, so that the metadata server performs a thread quota operation on a user to complete a data-dropping action of the write-in thread. If the kernel-mode client sends the thread quota request, which indicates that the previous write-in thread is executing the file write-in operation, the current write-in thread needs to send the thread quota request after the previous thread executes the file write-in operation, and at this time, the current write-in thread needs to be added into the waiting queue for waiting; if the kernel-mode client does not send the thread quota request, the previous write-in thread is indicated to finish the file write-in operation, or the current write-in thread is the first write-in thread applying for the thread quota, and the kernel-mode client sends the thread quota request to the metadata server. After receiving a thread quota request of the kernel-state client, the metadata executes thread quota operation and allocates available storage space to a user, so that the user can conveniently write a file of a write-in thread through the kernel-state client and can place data on a disk.
In one embodiment, the determining whether the kernel-mode client has sent the thread quota request through the quota flag specifically includes:
the quota mark comprises an application state and a non-application state, and when the quota mark is in the application state, the quota mark indicates that a written-in thread exists and sends a thread quota request to the metadata server through the kernel-state client; when the quota flag is in a non-application state, it indicates that no write thread sends a thread quota request to the metadata server through the kernel-state client.
In order to enable a plurality of write-in threads to carry out thread quota application through the kernel state client according to a regular sequence, the state of a quota flag is utilized to judge whether the previous write-in thread finishes writing a file, so that the file write-in operation of the next write-in thread is facilitated. When a current write-in thread executes a thread quota application through a kernel-state client, setting a quota flag to be in an application state, and at the moment, a next write-in thread cannot send a thread quota application to a metadata server through the kernel-state client when the quota flag is in the application state; after the current write-in thread finishes the file writing operation, the quota mark is set in a non-application state, and at the moment, the next thread sends a thread quota request to the metadata server through the kernel state client when the quota mark is in the non-application state, so that the thread quota application is sequentially executed, and the parallel operation of the write-in threads is avoided.
In one embodiment, before the kernel-mode client sends the thread quota request to the metadata server, the method specifically includes:
judging whether the kernel-mode client locally has an available storage space, if so, directly executing file writing operation by a writing thread of the kernel-mode client without sending a thread quota request to a metadata server through the kernel-mode client; and if the available storage space does not exist, judging whether the quota mark is in an application state.
Generally, when a write-in thread of a kernel-mode client executes a file write-in operation, it is first determined whether a local available storage space exists in the kernel-mode client, and if the local available storage space exists in the kernel-mode client, a configuration application does not need to be sent to a metadata server through the kernel-mode client, and the file write-in operation of the write-in thread is directly performed; if the kernel-mode client does not have available storage space locally, the kernel-mode client needs to send a thread quota application to the metadata server.
In one embodiment, if the quota flag is in an application state, adding the current write-in thread into a waiting queue; and if the quota mark is in a non-application state, the kernel-state client sends a thread quota request to the metadata server.
And if the kernel client does not have available storage space locally, a thread quota application needs to be sent to the metadata server. Before a current write-in thread of the kernel-state client sends a thread quota request to the metadata server through the kernel-state client, whether a quota flag is in an application state is judged, if the quota flag is not in the application state, namely the quota flag is in a non-application state, the fact that the last write-in thread has already executed file write-in operation is completed and the quota flag is placed in the non-application state is indicated, or the current write-in thread is the first write-in thread executing write-in file operation, and the current write-in thread directly sends a quota application through the kernel-state client; and if the quota mark is in the application state, the last thread sends a quota request through the kernel state client, the current write-in thread is added into the waiting queue, and the thread quota request is sent through the kernel state client when the quota mark is placed in the non-application state.
In one embodiment, the quota allocating, by the metadata server, each write-in thread according to the order rule in the wait queue specifically includes:
when a current write-in thread sends a thread quota request through a kernel state client, setting the state of a quota flag as an application state;
in order that the multiple write-in threads of the kernel-mode client cannot generate parallel operation, when the current write-in thread executes quota operation, the state of the quota flag is set to be an application state, so that the phenomenon that the next write-in thread and the current thread simultaneously send a quota request to the metadata server through the kernel-mode client is avoided.
And after the current write-in thread completes the file write-in operation and sets the state of the quota flag to be a non-application state, allowing the next write-in thread to send a quota request through the kernel-state client.
When a current write-in thread executes thread quota operation, the state of the quota flag is set to be an application state, after the current write-in thread applies for thread quota and file write operation is completed, the state of the quota flag is set to be a non-application state, and after a next write-in thread receives a signal that the state of the quota flag is the non-application state, the next write-in thread is allowed to send a thread quota request through a kernel state client, so that the condition that a plurality of threads perform thread quota requests in parallel is avoided.
In one embodiment, after the write thread of the kernel-mode client performs the file writing operation, the method specifically includes:
setting the state of the quota flag to be a non-application state;
after a current write thread executes a file write operation, in order to facilitate a next write thread to send a thread quota request through a kernel-state client, a signal that the thread quota request can be sent through the kernel-state client is sent to the next write thread, that is, a state of a quota flag is used as a signal that the thread quota request can be sent, so that the state of the quota flag is set to a non-application state after the current write thread executes the file write operation, and when the next write thread receives the signal that the quota flag is in the non-application state, the thread quota request is sent to a metadata server through the kernel-state client.
And waking up the write thread in the waiting queue.
When the current write-in thread finishes file write-in operation and sets the state of the quota flag to be a non-application state, the write-in thread in the waiting queue needs to be awakened. In order to avoid occupying more resources of the CPU and maximize the efficiency of the CPU, the write-in thread added to the wait queue is put into a sleep state, so that the write-in thread in the sleep state does not occupy the resources of the CPU, and the work efficiency of the CPU can be improved to the maximum. Preferably, the first two write threads may be set to be in the wake state all the time, and the following write threads may be set to be in the sleep state. That is to say, when one write-in thread finishes executing the file write-in operation and the state of the quota flag is set in the non-application state, the first two threads in the wait queue are awakened, and the latter thread is always in the sleep state, so as to ensure that the write-in thread in the wait queue can send a thread quota request through the kernel state client in time, wherein the write-in thread which does not enter the wait queue is always in the awakened state.
In one embodiment, the ordering rules are arranged in a first-come-last order.
The write threads in the wait queue are ordered according to a certain order, or if the file write operation is executed all the time, there is a possibility that some write thread has no chance to send a thread quota request through the kernel-state client all the time, so the write threads in the wait queue are ordered according to an order rule, that is, ordered according to a first-come-to-last order.
Example two:
referring to fig. 2, fig. 2 is a flowchart illustrating a second method of the thread-based user quota method according to the present invention.
The thread-based user quota method of the embodiment includes the following steps:
s10, the superior sends the instruction of the file writing operation to the kernel-mode client;
when the kernel-mode client receives a command of a file writing operation issued by the upper level of the kernel-mode client, the kernel-mode client starts to execute the file writing operation; when the superior of the kernel-mode client receives an instruction for stopping the file writing operation; and the kernel-mode client stops executing the file writing operation.
S20, judging whether the kernel-mode client has available storage space locally, if so, executing step S60 directly; if there is no available storage space, step S30 is performed.
When the kernel-state client receives a file write-in operation instruction issued by the upper level of the kernel-state client, the kernel-state client starts to execute the file write-in operation, at this time, whether the kernel-state client has an available storage space locally is judged, if the kernel-state client has the available storage space locally, a thread quota application does not need to be sent to the metadata server through the kernel-state client, and the file write-in operation of a write-in thread can be directly carried out; if no storage space is locally available for the kernel-mode client, step S30 is performed.
S30, judging whether the quota flag is in an application state, if the quota flag is in the application state, adding the current write-in thread into the waiting queue, and returning to the step S20; if the quota flag is in the non-application state, executing step S40;
when the kernel-state client does not have available space locally, whether the state of the quota flag is in an application state is further judged, if the quota flag is in the application state and indicates that a last write-in thread sends a thread quota request to the metadata server through the kernel-state client, the current write-in thread is added into a waiting queue, and the step S20 is returned, so that the current write-in thread is always in the process of judging whether the quota flag is in the application state, and once the current write-in thread receives a signal that the quota flag is in a non-application state, the current write-in thread can send the thread quota request to the metadata server through the kernel-state client; if the quota flag is in the non-application state, step S40 is executed.
S40, the kernel client sends a thread quota request to the metadata server, and sets the state of the quota flag as an application state;
when the current write-in thread receives the message that the quota flag is in the non-application state, the current write-in thread sends a thread quota request to the metadata server through the kernel state client, and the quota flag is set to the application state, and at the moment, the next write-in thread cannot send a thread quota application to the metadata server through the kernel state client when the quota flag is in the application state.
S50, the metadata server executes quota operation;
after receiving a thread quota request of the kernel-state client, the metadata server executes thread quota operation and allocates available storage space to a user, so that the user can conveniently perform file write-in operation of a write-in thread through the kernel-state client.
S60, the write-in thread of the kernel mode client executes the operation of writing in the file;
and after the kernel-state client obtains the thread quota of the metadata server, the write-in thread of the kernel-state client executes the file write-in operation.
S70, the quota flag is set to non-application state, and the write-in thread in the waiting queue is waken up, and the step returns to the step S20.
And after the write-in thread of the kernel-state client executes the write-in file operation, setting the quota flag to be in a non-application state so as to prevent the next write-in thread and the current thread from sending a quota request to the metadata server through the kernel-state client at the same time. In order to avoid occupying more resources of the CPU and maximize the efficiency of the CPU, the write-in thread added to the wait queue is put into a sleep state, so that the write-in thread in the sleep state does not occupy the resources of the CPU, and the work efficiency of the CPU can be improved to the maximum.
Example three:
referring to fig. 3, fig. 3 is a device structure diagram of a thread-based user quota device according to the present invention.
The invention discloses a user quota device based on a thread, which comprises:
the quota request judging module is used for judging whether the kernel-state client sends a thread quota request or not;
when a current write-in thread sends a thread quota request through a kernel-state client, firstly, a quota request judgment module judges whether a write-in thread sends the thread quota request through the kernel-state client. If the existing write-in thread sends a thread quota request through the kernel-mode client, adding the current write-in thread into a waiting queue; if no write thread sends a thread quota request through the kernel-mode client, the current write thread may send a thread quota request.
The queue configuration module is used for adding the write-in thread needing waiting into a waiting queue;
when a plurality of threads send quota requests to the metadata server through the kernel-mode client, all write-in threads behind the write-in threads which are executing write-in file operation are added into a waiting queue through the queue configuration module, and the write-in threads added into the waiting queue sequentially carry out thread quota requests through the kernel-mode client under the condition that the kernel-mode client does not have available storage space locally.
The quota request sending module is used for sending a quota request to the metadata server by the kernel-state client;
when the write-in thread of the kernel-mode client executes the write-in file operation and the kernel-mode client does not have an available storage space locally, the kernel-mode client needs to send a thread quota request to the metadata server through the quota request sending module, so that the metadata server performs quota operation on a user and completes a data-dropping action of the write-in thread.
The quota operation execution module is used for executing quota operation on the user;
when a plurality of write-in threads perform write-in operation and need quotas, the metadata server sequences the threads according to rules, preferentially performs quotas on the write-in threads arranged at the front, allows the write-in threads arranged at the back to send quota requests and perform file write-in operation after obtaining the quotas of the metadata server after the write-in threads arranged at the front apply for the quotas and write in files, and drops data. Therefore, the metadata server performs quota operation on each thread in sequence through the quota operation execution module under the limitation of the sequence rule.
In one embodiment, the apparatus further comprises:
the state configuration module is used for configuring the state of the quota mark;
if the quota mark is in an application state, adding the current thread into a waiting queue; if the quota flag is in a non-application state, the kernel-state client sends a thread quota request to the metadata server, so that the state of the quota flag is configured through the state configuration module.
The thread awakening module is used for putting the write-in thread in the waiting queue into an awakening state;
in order to avoid occupying more resources of the CPU and maximize the efficiency of the CPU, the write-in thread added into the waiting queue is put into a sleep state, so that the write-in thread in the sleep state does not occupy the resources of the CPU, and the working efficiency of the CPU can be improved to the maximum extent.
And the rule sorting module is used for sequentially arranging the write-in threads according to rules.
The write threads in the waiting queue need to be sorted according to a certain order, or if the file write operation is executed all the time, there is a possibility that some write thread has no chance to send a quota request through the kernel-state client all the time, so the threads in the waiting queue need to be sorted by the order rule through the rule sorting module, that is, sorted according to the order from the beginning to the end.
And the file writing module is used for executing the file writing operation of the writing thread.
And after the write-in thread obtains the quota of the metadata server, the write-in thread executes file write-in operation through the file write-in module to complete data destage.
Example four:
the present embodiment provides a computer-readable storage medium storing a program, which, when executed by a processor, causes the processor to perform the steps of the thread-based user quota method in the above-described embodiments.
As will be appreciated by one of skill in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for thread-based user quota, the method comprising the steps of:
before a current write-in thread of the kernel-mode client executes file write-in operation, firstly judging whether the kernel-mode client sends a thread quota request;
if the kernel-mode client has sent a thread quota request, adding the current write-in thread into a waiting queue, and sending the thread quota request to the metadata server after waiting for the end of the file written by the previous write-in thread;
if the kernel-state client does not send the thread quota request, sending the thread quota request to the metadata server;
and after receiving the thread quota request, the metadata server executes thread quota operation and allocates storage space to the user.
2. The thread-based user quota method of claim 1, wherein: the determining whether the kernel-state client has sent the thread quota request is determined by a quota flag, and specifically includes:
the quota mark comprises an application state and a non-application state, and when the quota mark is in the application state, the quota mark indicates that a written-in thread exists and a thread quota request is sent to the metadata server through the kernel state client; and when the quota mark is in a non-application state, the fact that no write thread sends a thread quota request to the metadata server through the kernel-state client side is indicated.
3. The thread-based user quota method of claim 2, wherein: before the kernel-state client sends the thread quota request to the metadata server, the method specifically includes:
judging whether the kernel-mode client locally has an available storage space, if so, directly executing file writing operation by a writing thread of the kernel-mode client without sending a thread quota request to a metadata server through the kernel-mode client; and if the available storage space does not exist, judging whether the quota mark is in an application state.
4. The thread-based user quota method of claim 3, wherein: if the quota mark is in an application state, adding the current write-in thread into a waiting queue; and if the quota mark is in a non-application state, the kernel-state client sends a thread quota request to the metadata server.
5. The thread-based user quota method of claim 4, wherein: the method for performing quota on each write-in thread by the metadata server according to the sequence rule in the waiting queue specifically includes:
when a current write-in thread sends a thread quota request through a kernel state client, setting the state of a quota flag as an application state;
and after the current write-in thread completes the operation of executing the write-in file and sets the state of the quota flag to be a non-application state, allowing the next write-in thread to send a thread quota request through the kernel-state client.
6. The thread-based user quota method of claim 1, wherein: after the write-in thread of the kernel-mode client executes the file write-in operation, the method specifically includes:
setting the state of the quota flag to be a non-application state;
and waking up the write thread in the waiting queue.
7. The thread-based user quota method of claim 5, wherein: the order rules are arranged in a first-come-last order.
8. A thread-based user quota device, characterized in that: the device comprises:
the quota request judging module is used for judging whether the kernel-state client sends a thread quota request or not;
the queue configuration module is used for adding the write-in thread needing waiting into a waiting queue;
the quota request sending module is used for sending a thread quota request to the metadata server by the kernel-state client;
and the quota operation execution module is used for executing quota operation on the kernel-state client.
9. The thread-based user quota device of claim 8, wherein: the device further comprises:
the state configuration module is used for configuring the state of the quota mark;
the thread awakening module is used for putting the write-in thread in the waiting queue into an awakening state;
the rule sorting module is used for sequentially arranging the write-in threads according to rules;
and the file writing module is used for executing the file writing operation of the writing thread.
10. A computer-readable storage medium characterized by: the computer readable storage medium stores a program which, when executed by a processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.
CN202111451186.9A 2021-12-01 2021-12-01 User quota method, device and storage medium based on threads Withdrawn CN114153610A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111451186.9A CN114153610A (en) 2021-12-01 2021-12-01 User quota method, device and storage medium based on threads

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111451186.9A CN114153610A (en) 2021-12-01 2021-12-01 User quota method, device and storage medium based on threads

Publications (1)

Publication Number Publication Date
CN114153610A true CN114153610A (en) 2022-03-08

Family

ID=80455219

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111451186.9A Withdrawn CN114153610A (en) 2021-12-01 2021-12-01 User quota method, device and storage medium based on threads

Country Status (1)

Country Link
CN (1) CN114153610A (en)

Similar Documents

Publication Publication Date Title
US9100293B2 (en) High availability system allowing conditionally reserved computing resource use and reclamation upon a failover
JP7087029B2 (en) Improved functional callback mechanism between the central processing unit (CPU) and the auxiliary processor
US9335998B2 (en) Multi-core processor system, monitoring control method, and computer product
JP2016541056A5 (en)
US10067793B2 (en) Data processing method and apparatus for executing task code using reservation instruction and release instruction
CN111897558A (en) Kubernets upgrading method and device for container cluster management system
US9933953B1 (en) Managing copy sessions in a data storage system to control resource consumption
US20150242275A1 (en) Power efficient distribution and execution of tasks upon hardware fault with multiple processors
CN112965783A (en) System and method for using storage snapshot backup virtual machine
US10599530B2 (en) Method and apparatus for recovering in-memory data processing system
US20200371882A1 (en) Method, Apparatus, Device and Medium for Starting Virtual Machine
CN114153610A (en) User quota method, device and storage medium based on threads
CN114756355B (en) Method and device for automatically and quickly recovering process of computer operating system
CN107422990B (en) Dynamic migration method and device
CN109189615A (en) A kind of delay machine treating method and apparatus
WO2017107828A1 (en) Method and device for processing data after restart of node
CN110716944B (en) Data truncation method and device
CN110908821A (en) Method, device, equipment and storage medium for task failure management
CN112162833B (en) Transaction log processing method, device and system
CN114510490B (en) Method and device for improving data insertion performance of database
CN107315624B (en) Information processing method and virtualization manager
CN116820715A (en) Job restarting method, apparatus, computer device and readable storage medium
CN113641466A (en) Memory allocation method and system for XEN platform and computer readable storage medium
CN113641464A (en) Memory configuration method and system of XEN platform and computer readable storage medium
CN117707735A (en) Reconstruction resource scheduling method, medical image reconstruction method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20220308

WW01 Invention patent application withdrawn after publication