Method and device for limiting data storage space and electronic equipment

By capturing file change events in the file system and using metadata information to efficiently determine and limit the data storage space of user folders, the problem of difficulty in effectively restricting user write operations in the prior art is solved, and the fair use of multiple users under the established quota is achieved.

CN120067057APending Publication Date: 2025-05-30SF TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311653948.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-30
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In artificial intelligence technology, how to efficiently determine and limit the data storage space used by each user folder, especially when large-scale data storage is required, it is difficult for the prior art to effectively limit the user's write operations.

Method used

By capturing file change events in the file system, metadata information is used to efficiently determine the data storage space of each user folder, and when the space reaches the quota, the storage space limiting action is performed.

Benefits of technology

It realizes efficient space limitations on user folders, ensures that multiple users use computing resources fairly under the storage space of the established quota, and avoids the normal use of other users due to the single user occupying too much space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067057A_ABST
    Figure CN120067057A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data storage space limiting method and device and electronic equipment, and relates to the technical field of data storage. The data storage space limiting method comprises the steps that when a data file triggers a file change event, the data file is determined as a target file, metadata reading is conducted on the target file, and first metadata information is obtained; after metadata updating is carried out on the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event, metadata reading is carried out on the target folder, and second metadata information is obtained; and when the current occupied space of the folder exceeds a preset folder space distribution threshold value, executing a storage space limiting action. By capturing a file change event in a file system, when it is efficiently determined that a data storage space used by each user folder reaches a quota by utilizing metadata information, a limiting action is executed on the user folder in time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data storage, and particularly to a method and apparatus for restricting data storage space, an electronic device, and a storage medium. Background Art

[0002] In the field of artificial intelligence technology, the required data storage space is often used to store training data and model files. With the development of artificial intelligence technology, the occupancy rate of storage space has become increasingly large. It should be noted that multiple users of the same file system may all need to use the data storage space of this file system to train artificial intelligence models. In order to enable each user to use the file system fairly, it is necessary to limit the space of the user folder corresponding to each user to prevent the unreasonable storage operations of a certain user from affecting the normal use of the data storage space by other users.

[0003] In related technologies, the data storage space of user folders in the file system is often statistically analyzed through one or more scheduled tasks. When the data storage space exceeds a certain threshold, the user's writing is restricted. When there are tens of millions of small files in a certain user folder, the time-consuming for statistically analyzing the size of this user folder often takes several hours or even longer. At this time, it is difficult to effectively restrict the user's writing operation through the above method. Therefore, in the case of large-scale data storage, how to efficiently determine and limit the data storage space used by each user folder has become an urgent problem in the industry. Summary of the Invention

[0004] The main purpose of the embodiments of this application is to propose a method and apparatus for restricting data storage space, an electronic device, and a storage medium. The aim is to efficiently determine that the data storage space used by each user folder in the file system reaches the quota by capturing file change events in the file system, and then execute restriction actions in a timely manner. Multiple users in the same file system in artificial intelligence technology can then fairly use computing resources under the established quota of storage space.

[0005] To achieve the above object, the first aspect of the embodiments of this application proposes a method for restricting data storage space, which is characterized in that it is applied to a file system, the file system includes multiple user folders, and each user folder is used to store the data files of a corresponding user. The method includes:

[0006] When a data file triggers a file change event, determine the data file as a target file, and perform metadata reading on the target file to obtain first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event;

[0007] Update the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event.

[0008] Read the metadata of the target folder after metadata update to obtain second metadata information; wherein, the second metadata information includes the current occupied space of the folder of the target folder after metadata update.

[0009] When the current occupied space of the folder exceeds the preset folder space allocation threshold, perform a storage space limit action matching the file change event.

[0010] In some embodiments of the present application, the file change event includes at least one of a file write event and a file removal event; before the step of when the data file triggers a file change event, determining the data file as the target file, and reading the metadata of the target file to obtain first metadata information, the method further includes at least one of the following:

[0011] When a write operation of the data file occurs in the user folder, trigger the file write event.

[0012] When a removal operation of the data file occurs in the user folder, trigger the file removal event.

[0013] In some embodiments of the present application, the data file is configured with first update status information, and the step of when the data file triggers a file change event, determining the data file as the target file, and reading the metadata of the target file to obtain first metadata information includes:

[0014] When a preset first scanning condition is met, perform an update status scan on the file system to obtain first update status information corresponding to each data file.

[0015] When the first update status information indicates that the data file is in a non-up-to-date state, detect the trigger status of the file change event corresponding to the data file.

[0016] When the data file triggers the file change event, determine the data file as the target file, and read the metadata of the target file to obtain the first metadata information.

[0017] In some embodiments of the present application, the user folder includes at least one user subfolder, and before the step of reading the metadata of the target folder after metadata update to obtain second metadata information, it further includes:

[0018] When the user sub - folder triggers a folder change event, determine the user sub - folder as the target sub - folder, and perform metadata reading on the target sub - folder to obtain third - party metadata information; wherein, the third - party metadata information includes the current occupied space of the sub - folders in the target sub - folder and the historical occupied space of the sub - folders corresponding to the file change event.

[0019] Update the metadata of the target folder according to the current occupied space of the sub - folder and the historical occupied space of the sub - folder corresponding to the file change event.

[0020] In some embodiments of the present application, the folder change event includes at least one of a folder write event and a folder removal event. Before the step of "when the user sub - folder triggers a folder change event, determine the user sub - folder as the target sub - folder, and perform metadata reading on the target sub - folder to obtain third - party metadata information", the method further includes at least one of the following:

[0021] When a write operation of the user sub - folder occurs in the user folder, trigger the folder write event;

[0022] When a removal operation of the user sub - folder occurs in the user folder, trigger the folder removal event.

[0023] In some embodiments of the present application, the user sub - folder is configured with second update status information. The step of "when the user sub - folder triggers a folder change event, determine the user sub - folder as the target sub - folder, and perform metadata reading on the target sub - folder to obtain third - party metadata information" includes:

[0024] When a preset second scanning condition is met, perform an update status scan on the file system to obtain the second update status information corresponding to each user sub - folder;

[0025] When the second update status information indicates that the user sub - folder is in a non - up - to - date state, detect the trigger status of the folder change event corresponding to the user sub - folder in the user folder;

[0026] When the user sub - folder in the user folder triggers the folder change event, determine the user sub - folder as the target sub - folder, and perform metadata reading on the target sub - folder to obtain the third - party metadata information.

[0027] In some embodiments of the present application, when the target file triggers a file change event in the target subfolder, updating the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event includes:

[0028] Updating the metadata of the target subfolder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event;

[0029] Based on the target subfolder after metadata update, updating the metadata of the target folder.

[0030] In some embodiments of the present application, the target folder includes multiple levels of user subfolders. Based on the target subfolder after metadata update, updating the metadata of the target folder includes:

[0031] Based on the target subfolder after metadata update, hierarchically updating the metadata of the user subfolder to which the target subfolder belongs;

[0032] Based on the multiple levels of user subfolders after hierarchical metadata update, updating the metadata of the target folder.

[0033] In some embodiments of the present application, the target subfolder includes a first subfolder and a second subfolder. When the data file triggers a file change event, determining the data file as the target file and performing metadata reading on the target file to obtain first metadata information includes:

[0034] When an operation of transferring the data file from the first subfolder to the second subfolder occurs in the user folder, determining that the file change event is triggered and determining the data file as the target file;

[0035] Performing metadata reading on the target file to obtain the first metadata information.

[0036] In some embodiments of the present application, updating the metadata of the target subfolder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event includes:

[0037] Determining the change amount of the storage space according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event;

[0038] Subtracting the change amount of the storage space from the current occupied space of the folder in the first subfolder to update the metadata of the first subfolder;

[0039] Add the storage space change amount to the current occupied space of the folder in the second sub-folder to update the metadata of the second sub-folder.

[0040] To achieve the above object, a second aspect of the embodiments of the present application provides a device for restricting data storage space, the device includes:

[0041] A first metadata reading module, configured to, when the data file triggers a file change event, determine the data file as a target file, and perform metadata reading on the target file to obtain first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event;

[0042] A folder metadata update module, configured to update the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event;

[0043] A second metadata reading module, configured to, after updating the metadata of the target folder, perform metadata reading on the target folder to obtain second metadata information; wherein, the second metadata information includes the current occupied space of the target folder;

[0044] A storage space restriction module, configured to, when the current occupied space of the folder exceeds a preset folder space allocation threshold, perform a storage space restriction action matching the file change event.

[0045] To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect above is implemented.

[0046] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect above is implemented.

[0047] The method and device for limiting data storage space, electronic device, and storage medium proposed in this application, when a data file triggers a file change event, determine the data file as the target file, and perform metadata reading on the target file to obtain the first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event; update the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event; after updating the metadata of the target folder, perform metadata reading on the target folder to obtain the second metadata information; wherein, the second metadata information includes the current occupied space of the folder; when the current occupied space of the folder exceeds the preset folder space allocation threshold, perform a storage space limiting action matching the file change event. Under the combined action of the first metadata and the second metadata, if the current occupied space of the target folder exceeds the preset folder space allocation threshold, a storage space limiting action matching the file change event is performed. In this way, the embodiments of this application can capture file change events in the file system and use metadata information to efficiently determine when the data storage space used by each user folder reaches the quota and then perform a limiting action on it in a timely manner. Multiple users in the same file system in artificial intelligence technology can fairly use computing power resources under the established quota of storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 is a flowchart of the method for limiting data storage space provided by an embodiment of this application;

[0049] Figure 2 is Figure 1 a flowchart of step S101 in

[0050] Figure 3 is Figure 1 another flowchart of step S101 in

[0051] Figure 4 is Figure 1 another flowchart of step S101 in

[0052] Figure 5 is Figure 1 another flowchart of step S101 in

[0053] Figure 6 is Figure 1 a flowchart of step S102 in

[0054] Figure 7 is Figure 6 a flowchart of step S601 in

[0055] Figure 8 It is a schematic flowchart of a specific embodiment of the method for restricting the data storage space of the present application;

[0056] Figure 9 It is a schematic structural diagram of the device for restricting the data storage space provided by the embodiment of the present application;

[0057] Figure 10 It is a schematic hardware structure diagram of the electronic device provided by the embodiment of the present application. Detailed implementation manners

[0058] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0059] It should be noted that although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order from the module division in the device or the order in the flowchart. Terms such as "first" and "second" in the specification, claims and the above-mentioned drawings are used to distinguish similar objects and do not necessarily need to be used to describe a specific order or sequence.

[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application. In addition, the identification of specific steps below does not represent a limitation on the step order and execution logic. The execution order and execution logic between each step should be understood and inferred with reference to the content described in the embodiments.

[0061] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0062] A file system is a method and data structure used by an operating system to organize files on a storage device (commonly a disk, or a solid-state drive based on NAND Flash); that is, a method of organizing files on a storage device. The software mechanism in the operating system responsible for managing and storing file information is called a file management system, abbreviated as a file system. A file system consists of three parts: the interface of the file system, a software collection for manipulating and managing objects, and the objects and their attributes. From a system perspective, a file system is a system that organizes and allocates the space of a file storage device, is responsible for file storage, and protects and retrieves the stored files. Specifically, it is responsible for creating files for users, storing, reading, modifying, and dumping files for users, controlling file access, and deleting files when users no longer need them, etc.

[0063] In the field of artificial intelligence technology, the required data storage space is often used to store training data and model files. With the development of artificial intelligence technology, the occupancy rate of the storage space has become larger and larger. It should be noted that multiple users of the same file system may all need to use the data storage space of this file system to train artificial intelligence models. In order to enable each user to use the file system fairly, it is necessary to limit the space of the user folder corresponding to each user to prevent the unreasonable storage operations of a certain user from affecting the normal use of the data storage space by other users.

[0064] In related technologies, the data storage space of user folders in a file system is often statistically analyzed through one or more scheduled tasks. When the data storage space exceeds a certain threshold, the user's writing is restricted. When the data storage space occupied by a user folder is small, there will be no problem. However, when there are tens of millions of small files in a certain user folder, the time-consuming for statistically analyzing the size of this user folder often takes several hours or even longer. At this time, it is difficult to effectively restrict the user's writing operation through the above method. Therefore, in the case of large-scale data storage, how to efficiently determine and limit the data storage space used by each user folder has become an urgent problem in the industry.

[0065] The main purpose of the embodiments of this application is to propose a method and device for restricting data storage space, an electronic device, and a storage medium, aiming to efficiently determine the data storage space used by each subfolder by capturing file change events in the file system and using metadata information.

[0066] An embodiment of the present application proposes a method for restricting data storage space, which is applied to a file system. The file system includes multiple user folders, and each user folder is used to store the data files of a corresponding user. It should be noted that in order to enable each user to use the file system fairly, it is necessary to restrict the space of the user folder corresponding to each user to prevent the unreasonable storage operations of a certain user from affecting the normal use of the data storage space by other users.

[0067] The following is a further description based on the accompanying drawings.

[0068] Refer to Figure 1 , to achieve the above object, the method for restricting the data storage space of the present application may include, but is not limited to, the following steps S101 to step S104.

[0069] Step S101, when a data file triggers a file change event, determine the data file as the target file, and perform metadata reading on the target file to obtain the first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event;

[0070] Step S102, update the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event;

[0071] Step S103, after updating the metadata of the target folder, perform metadata reading on the target folder to obtain the second metadata information; wherein, the second metadata information includes the current occupied space of the target folder;

[0072] Step S104, when the current occupied space of the folder exceeds the preset folder space allocation threshold, perform a storage space restriction action matching the file change event.

[0073] Through the method for restricting data storage space proposed in steps S101 to S104 of this application, when a data file triggers a file change event, the data file is determined as the target file, and metadata reading is performed on the target file to obtain the first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event; the metadata of the target folder is updated according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event; after updating the metadata of the target folder, metadata reading is performed on the target folder to obtain the second metadata information; wherein, the second metadata information includes the current occupied space of the folder; when the current occupied space of the folder exceeds the preset folder space allocation threshold, a storage space restriction action matching the file change event is executed. Under the combined action of the first metadata and the second metadata, if the current occupied space of the target folder exceeds the preset folder space allocation threshold, a storage space restriction action matching the file change event is executed. In this way, the embodiment of this application can capture file change events in the file system, use metadata information to efficiently determine when the data storage space used by each user folder reaches the quota, and timely execute restriction actions on it. Multiple users in the same file system in artificial intelligence technology can fairly use computing power resources under the storage space with a given quota.

[0074] In step S101 of some embodiments, when a data file triggers a file change event, the data file is determined as the target file, and metadata reading is performed on the target file to obtain the first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event. It should be noted that the file change event refers to an event that affects the storage space, such as writing, deleting, modifying, or moving a data file in a user folder. It should be understood that when a data file triggers a file change event, the data file is determined as the target file, aiming to perform metadata reading on the data file that has undergone operations such as writing, deleting, modifying, or moving to obtain the first metadata information. It should be clear that the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event.

[0075] In some embodiments of the present application, an extended metadata file will be configured for each data file in the file system. When file change events such as writing, deleting, modifying, and moving occur to the data file, the current occupied space of the corresponding file and the historical occupied space of the file corresponding to the file change event will be recorded in this extended metadata file. It should be noted that the extended metadata file may also include various metadata for describing the details of file changes, such as historical update time, first update status information, etc. Among them, the first update status information is used to reflect whether the current storage status of the corresponding data file is the latest.

[0076] It should be understood that the first update status information and the second update status information can be identified by encoding, text, or other means, not limited to the above examples.

[0077] Refer to Figure 2 , in some embodiments of the present application, the file change event includes at least one of a file writing event and a file removal event. Step S101 may include at least one of the following steps S201 and step S202.

[0078] Step S201, when a write operation of a data file occurs in the user folder, a file writing event is triggered;

[0079] Step S202, when a removal operation of a data file occurs in the user folder, a file removal event is triggered.

[0080] In step S201 of some embodiments, when a write operation of a data file occurs in the user folder, a file writing event is triggered. It should be noted that the reading and writing of files can be completed through byte stream, character stream interfaces, or other means. Generally, it is necessary to first obtain a file object, and through the file object, obtain an object of a byte stream or character stream interface for reading and writing operations. If the above process occurs in the user folder, it can be determined that a write operation of a data file has occurred in the user folder, and a file writing event is triggered.

[0081] It should be noted that a write operation of a data file occurring in the user folder may specifically be that a file is generated from scratch in the user folder, or a file is transferred from the outside to the user folder, or other types of write operations, which are not listed one by one here.

[0082] In step S202 of some embodiments, when a removal operation of a data file occurs in the user folder, a file removal event is triggered. In some embodiments, the user folder can be scanned regularly to determine whether a removal operation of a data file has occurred before and after the scan. It should be understood that there are various implementation manners for detecting a removal operation of a data file in the user folder, not limited to the above examples.

[0083] It should be noted that the removal operation of data files in the user folder can specifically be the deletion of files from the user folder from existing to non - existent, or the transfer of files from the user folder to the outside, or other types of removal operations, which will not be listed one by one here.

[0084] When a file write event or a file removal event is detected and triggered, it is determined that a file change event is triggered. The data file is determined as the target file, and metadata reading is performed on the target file to obtain the first metadata information. It should be emphasized that the file change event refers to events such as writing, deleting, modifying, and moving data files in the user folder that affect the storage space. When a data file write operation occurs in the user folder, or a data file removal operation occurs in the user folder, it means that the storage space of the user folder will be changed. At this time, the file change event can be triggered. Then, the data file that triggers the file change event is determined as the target file, and metadata reading is performed on the target file to obtain the first metadata information.

[0085] In the embodiments of the present application shown by steps S201 to S202, when a data file write operation occurs in the user folder, a file write event is triggered. When a data file removal operation occurs in the user folder, a file removal event is triggered. When a file write event or a file removal event is detected and triggered, it is determined that a file change event is triggered. The data file is determined as the target file, and metadata reading is performed on the target file to obtain the first metadata information. In this way, it is possible to capture the write and removal operations that cause changes in the storage space of the user folder, so as to trigger the file change event, so as to efficiently determine when the data storage space used by each user folder reaches the quota and perform restriction actions on it in a timely manner.

[0086] Refer to Figure 3 , in some embodiments of the present application, the data file is configured with first update status information. Step S101 may include, but is not limited to, the following steps S301 to S302.

[0087] Step S301, when a preset first scanning condition is met, perform an update status scan on the file system to obtain the first update status information corresponding to each data file;

[0088] Step S302, when the first update status information indicates that the data file is in a non - latest state, detect the trigger status of the file change event corresponding to the data file;

[0089] Step S303, when the data file triggers a file change event, determine the data file as the target file, and perform metadata reading on the target file to obtain the first metadata information.

[0090] In step S301 of some embodiments, when a preset first scanning condition is met, a status scan for updating is performed on the file system to obtain first update status information corresponding to each data file. It should be noted that the preset first scanning condition refers to a condition that is pre-set and used to define whether to perform a status scan for updating on each data file in the file system. Since the first update status information is used to reflect whether the current storage status of the corresponding data file is the latest, when the first scanning condition is met, it means that it is necessary to perform a scan on the update status of each data file in the file system to check whether there are data files that are not in the latest state.

[0091] In some more specific embodiments, the first scanning condition may be a timing condition, that is, a status scan for updating is performed on the file system every first time interval to obtain first update status information corresponding to each data file. In this way, the real-time nature of the first update status information of the data file can be ensured.

[0092] In some other more specific embodiments, the first scanning condition may be an event-triggered condition, that is, when a certain preset event occurs, a status scan for updating is immediately performed on the file system to obtain first update status information corresponding to each data file. For example, after a version update of the file system, a status scan for updating can be performed on the file system. In this way, the first update status information of the data file can be ensured to flexibly adapt to various application requirements.

[0093] In steps S302 to S303 of some embodiments, when the first update status information reflects that the data file is in a non-latest state, the triggering status of the file change event corresponding to the data file is detected; when the data file triggers a file change event, the data file is determined as the target file, and first metadata information is obtained by performing metadata reading on the target file. It should be noted that when the first update status information reflects that the data file is in a non-latest state, it is necessary to further detect the triggering status of the file change event corresponding to the data file to determine whether operations such as writing, deletion, modification, and movement have occurred to the data file. If the data file triggers a file change event, the data file is then determined as the target file, and first metadata information is obtained by performing metadata reading on the target file.

[0094] In the embodiments of the present application shown in steps S301 to S303, when a preset first scanning condition is met, a status scan of the update is performed on the file system to obtain first update status information corresponding to each data file; when the first update status information indicates that the data file is not in the latest state, the trigger status of the file change event corresponding to the data file is detected; when the data file triggers a file change event, the data file is determined as the target file, and metadata reading is performed on the target file to obtain first metadata information. In this way, various possible application requirements can be flexibly met according to the preset first scanning condition.

[0095] According to some embodiments provided by the present application, the user folder includes at least one user subfolder. Before performing metadata reading on the target folder after metadata update to obtain second metadata information, it further includes:

[0096] When the user subfolder triggers a folder change event, the user subfolder is determined as the target subfolder, and metadata reading is performed on the target subfolder to obtain third metadata information;

[0097] Perform metadata update on the target folder according to the current occupied space of the subfolder and the historical occupied space of the subfolder corresponding to the file change event.

[0098] It should be noted that in some embodiments of the present application, the user folder may also include at least one user subfolder. In the embodiments of the present application, an extended metadata folder can also be configured for each folder in the file system. When a folder change event such as writing, deletion, modification, or movement occurs in the folder, the current occupied space of the corresponding folder and the historical occupied space of the folder corresponding to the folder change event will be recorded in this extended metadata folder. It should be pointed out that the extended metadata folder may also include various metadata for describing the details of folder changes, such as the historical update time, second update status information, etc. Among them, the second update status information can reflect whether the current storage status of the corresponding folder is the latest.

[0099] In some more specific embodiments, when a folder writing event or a folder removal event is detected and triggered, it is determined that a folder change event is triggered. The user sub-folder is determined as the target folder, and metadata reading is performed on the target folder to obtain the third metadata information. It should be emphasized that the folder change event refers to events that affect the storage space, such as the writing, deletion, modification, and movement of user sub-folders within the user folder. When a user sub-folder is written in the user folder, or a user sub-folder is removed from the user folder, it means that the storage space of the user folder will be changed, and at this time, the folder change event can be triggered. Then, the user sub-folder that triggers the folder change event is determined as the target folder, and metadata reading is performed on the target folder to obtain the third metadata information. Among them, the third metadata information includes the current occupied space of the sub-folder of the target sub-folder and the historical occupied space of the sub-folder corresponding to the file change event.

[0100] It should be noted that the writing operation of the user sub-folder in the user folder can specifically be that the user folder generates a sub-folder from scratch, or a sub-folder is transferred from the outside to the user folder, or other types of writing operations, which are not listed one by one here.

[0101] It should be noted that the removal operation of the user sub-folder in the user folder can specifically be that the user folder deletes the sub-folder from existing to non-existent, or a sub-folder is transferred from the user folder to the outside, or other types of removal operations, which are not listed one by one here.

[0102] Refer to Figure 4 In some embodiments of the present application, the user sub-folder is configured with second update status information. Step S101 may include, but is not limited to, the following steps S401 to S403.

[0103] Step S401, when a preset second scanning condition is met, perform an update status scan on the file system to obtain the second update status information corresponding to each user sub-folder;

[0104] Step S402, when the second update status information reflects that the user sub-folder is in a non-up-to-date state, detect the trigger status of the folder change event corresponding to the user sub-folder in the user folder;

[0105] Step S403, when the folder change event is triggered for the user sub-folder in the user folder, determine the user sub-folder as the target sub-folder, and perform metadata reading on the target sub-folder to obtain the third metadata information.

[0106] In step S401 of some embodiments, when a preset second scanning condition is met, a status update scan is performed on the file system to obtain second status update information corresponding to each user subfolder. It should be noted that the preset second scanning condition refers to a condition set in advance for defining whether to perform a status update scan on each folder of the file system. Since the second status update information is used to reflect whether the current storage status of the corresponding folder is the latest, when the second scanning condition is met, it means that it is necessary to scan the update status of each folder of the file system to check whether there are any folders that are not in the latest state.

[0107] In some more specific embodiments, the second scanning condition may be a timing condition, that is, a status update scan is performed on the file system every second time interval to obtain second status update information corresponding to each folder. In this way, the real-time nature of the second status update information of the folder can be ensured.

[0108] In some other more specific embodiments, the second scanning condition may be an event-triggered condition, that is, when a preset event occurs, a status update scan is immediately performed on the file system to obtain second status update information corresponding to each folder. For example, after a version update of the file system, a status update scan can be performed on the file system. In this way, the second status update information of the folder can be ensured to flexibly adapt to various application requirements.

[0109] It should be understood that the first scanning condition and the second scanning condition may be the same or different. For example, in a file system, the number of folders is much smaller than the number of files. In the case where the scanning condition is a timed scan, scanning the update status of all files frequently is less efficient, while scanning the update status of folders is more efficient; therefore, the time interval for scanning files in the first scanning condition can be set longer than the time interval for scanning folders in the second scanning condition.

[0110] In steps S402 to S403 of some embodiments, when the second update status information reflects that the user subfolder is in a non-up-to-date state, detect the trigger status of the folder change event corresponding to the user subfolder in the user folder; when the user subfolder in the user folder triggers a folder change event, determine the user subfolder as the target subfolder, and perform metadata reading on the target subfolder to obtain the third metadata information. It should be noted that when the second update status information reflects that the user subfolder is in a non-up-to-date state, it is necessary to further detect the trigger status of the folder change event corresponding to the user subfolder in the user folder to determine whether there are write, deletion / modification, or movement of the user subfolder in the user folder. If the user subfolder in the user folder triggers a folder change event, determine the user subfolder as the target subfolder, and perform metadata reading on the target subfolder to obtain the third metadata information. It should be emphasized that the third metadata information includes the current occupied space of the subfolder of the target subfolder and the historical occupied space of the subfolder corresponding to the file change event

[0111] In the embodiments of the present application illustrated by steps S401 to S403, when the preset second scanning condition is met, perform an update status scan on the file system to obtain the second update status information corresponding to each user subfolder; when the second update status information reflects that the user subfolder is in a non-up-to-date state, detect the trigger status of the folder change event corresponding to the user subfolder in the user folder; when the user subfolder in the user folder triggers a folder change event, determine the user subfolder as the target subfolder, and perform metadata reading on the target subfolder to obtain the third metadata information. It should be noted that a file refers to a piece of data stored in a computer system, and they have their own file types and sizes; a folder is a virtual container used to store files. Therefore, in some embodiments, not only can the first update status information of each data file in the file system be obtained by directly performing an update status scan on the file system, but also the second update status information of each folder in the file system can be obtained by performing an update status scan on the file system. According to the preset of the second scanning condition, various possible application requirements can also be flexibly met

[0112] Refer to Figure 5 , in some embodiments of the present application, the user folder includes multiple user subfolders, and step S101 may include, but is not limited to, the following steps S501 to S502

[0113] Step S501, when an operation of transferring a data file from a first subfolder to a second subfolder occurs in the user folder, determine that a file change event is triggered, and determine the data file as the target file

[0114] Step S502: Read metadata for the target file to obtain the first metadata information. The first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event.

[0115] It should be noted that a folder is a virtual container for storing files. They have their own file type, that is, folder type. The size of a folder depends on the total size of the files it contains. Folders can be nested, that is, a folder can contain one or more folders, and these folders can in turn contain one or more folders. Based on this, in the embodiments of the present application, a user folder can include multiple user sub-folders.

[0116] In step S501 of some embodiments, when an operation of transferring a data file from a first sub-folder to a second sub-folder occurs in a user folder, it is determined that a file change event is triggered, and the data file is determined as the target file. It should be noted that the target sub-folders include the first sub-folder and the second sub-folder, where the first sub-folder and the second sub-folder can be user sub-folders of different user folders. When the target file is moved between user sub-folders of different user folders, it may cause the storage space occupied by a certain user folder to reach the corresponding quota. Therefore, on the premise that the first sub-folder and the second sub-folder belong to user sub-folders of different user folders, if the data file is transferred from the first sub-folder to the second sub-folder, a file change event needs to be triggered, and the data file is determined as the target file.

[0117] In step S502 of some embodiments, read metadata for the target file to obtain the first metadata information. The first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event. It should be noted that after determining that a file change event is triggered and determining the data file as the target file in the operation of transferring the data file from the first sub-folder to the second sub-folder, metadata can be read for the target file to obtain the first metadata information.

[0118] In the embodiments of the present application shown in steps S501 to S502, when an operation of transferring a data file from a first subfolder to a second subfolder occurs in a user folder, it is determined that a file change event is triggered, and the data file is determined as the target file; wherein, the first subfolder and the second subfolder are user subfolders of different user folders; metadata of the target file is read to obtain first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event. In this way, it is possible to capture the moving operation that causes the change of the storage space of the user folder, so as to trigger the file change event, so as to efficiently determine and perform a restriction action in time when the data storage space used by each user folder reaches the quota.

[0119] In steps S102 to S103 of some embodiments, metadata of the target folder is updated according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event; after updating the metadata of the target folder, metadata of the target folder is read to obtain second metadata information; wherein, the second metadata information includes the current occupied space of the target folder. It should be noted that since the target folder is the user folder that triggers the file change event, during the process of triggering the file change event by the target file, it will inevitably affect the storage space of the target folder. Based on this, the current occupied space of the file and the historical occupied space of the file corresponding to the file change event in the first metadata information will update the metadata of the target folder, so that the second metadata information read after the target folder is updated can reflect the impact of the file change event on the storage space of the target folder. It should be pointed out that the second metadata information includes the current occupied space of the target folder.

[0120] According to some more specific embodiments provided by the present application, updating the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event may specifically be to first determine the difference between the current occupied space of the file and the historical occupied space of the file corresponding to the file change event, and then transfer this difference to the target folder to update the second metadata information of the target folder and determine the current occupied space of the target folder after the file change event is triggered.

[0121] Refer to Figure 6 , in some embodiments of the present application, when the target file triggers a file change event in the target subfolder, step S102 may include, but is not limited to, the following steps S601 to S602.

[0122] Step S601: Update the metadata of the target subfolder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event;

[0123] Step S602: Update the metadata of the target folder based on the target subfolder with updated metadata.

[0124] For steps S601 to S602 of some embodiments, update the metadata of the target subfolder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; update the metadata of the target folder based on the target subfolder with updated metadata. It should be noted that the user folder may include multiple user subfolders, and the target subfolder is the user subfolder that triggers the file change event. Among them, when the target file is written to a certain user subfolder, this user subfolder may be the target subfolder; when the target file is removed from a certain user subfolder, this user subfolder may be the target subfolder; when the target file is transferred from a certain user subfolder to another user subfolder, both of these user subfolders may be the target subfolder. Since the target file can be stored in the target subfolder under the target folder, in this case, it is necessary to update the metadata of the target subfolder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event. In this way, it is possible to update the metadata of the target folder for the case where there are nested relationships among the folders in the file system, which helps to more efficiently determine when the data storage space used by each user folder reaches the quota and perform restriction actions on it in a timely manner.

[0125] In some more specific embodiments, the target folder includes multiple levels of user subfolders. Updating the metadata of the target folder based on the target subfolder with updated metadata includes:

[0126] Based on the target subfolder with updated metadata, update the metadata of the user subfolder to which the target subfolder belongs level by level;

[0127] Based on the multiple levels of user subfolders with metadata updated level by level, update the metadata of the target folder.

[0128] It should be emphasized that a folder is a virtual container for storing files. They have their own file type, namely the folder type, and the size of a folder depends on the total size of the files it contains. Folders can be nested, that is, a folder can contain one or more folders, and these folders can in turn contain one or more folders. Based on this, in the embodiments of the present application, a user folder can include multiple user sub-folders. Based on the nesting of the user sub-folders in the target folder, it can be determined that the target folder includes multiple levels of user sub-folders. It should be noted that the top-level user sub-folder in the multiple levels of user sub-folders is the user sub-folder directly stored in the target folder directory; the bottom-level user sub-folder in the multiple levels of user sub-folders is the user sub-folder directly storing the target file, that is, the target sub-folder. Therefore, when a file change event corresponding to the target file is triggered in a certain user sub-folder, it is necessary to update the metadata of the target sub-folder based on the target file, and then, based on the target sub-folder after metadata update, update the metadata of the user sub-folders to which the target sub-folder belongs level by level until the metadata of the upper folders of the target sub-folder are all updated. Only then can the metadata of the target folder be updated based on the multiple levels of user sub-folders after metadata update level by level. In this way, it is possible to update the metadata of the target folder in the case where there is a nesting relationship between each folder, which helps to more efficiently determine and perform a restriction action in a timely manner when the data storage space used by each user folder reaches the quota.

[0129] Referring to Figure 7 , in some embodiments of the present application, step S601 may include, but is not limited to, the following steps S701 to S703.

[0130] Step S701, determine the storage space change amount according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event;

[0131] Step S702, subtract the storage space change amount from the current occupied space of the folder of the first sub-folder to update the metadata of the first sub-folder;

[0132] Step S703, add the storage space change amount to the current occupied space of the folder of the second sub-folder to update the metadata of the second sub-folder.

[0133] It should be emphasized that a user folder can include multiple user sub-folders, and the first sub-folder and the second sub-folder are user sub-folders of different user folders.

[0134] In step S701 of some embodiments, the storage space change amount is determined based on the current occupied space of the file and the historical occupied space of the file corresponding to the file change event. It should be noted that since the data file triggering the file change event is the target file, the current occupied space of the file and the historical occupied space of the file corresponding to the file change event can be used to determine the storage space change amount corresponding to the target file in the file change event. The storage space change amount is used to reflect the change in the storage space size of the target file before and after the file change event.

[0135] In step S702 of some embodiments, the storage space change amount is subtracted from the current occupied space of the first subfolder to update the metadata of the first subfolder. It should be noted that a part or all of the target file is transferred from the first subfolder to the second subfolder, thus triggering a file change event. During the triggering process of the file change event, the storage space corresponding to the first subfolder decreases by the storage space change amount. Therefore, the storage space change amount needs to be subtracted from the current occupied space of the first subfolder to update the metadata of the first subfolder. It should be understood that after the metadata of the first subfolder is updated, the metadata of the upper-level folder of the first subfolder will also be updated accordingly, until the corresponding target folder updates the second metadata, and then the metadata of the target folder can be read to obtain the updated second metadata information.

[0136] In step S703 of some embodiments, the storage space change amount is added to the current occupied space of the second subfolder to update the metadata of the second subfolder. It should be noted that a part or all of the target file is transferred from the first subfolder to the second subfolder, thus triggering a file change event. During the triggering process of the file change event, the storage space corresponding to the second subfolder increases by the storage space change amount. Therefore, the storage space change amount needs to be added to the current occupied space of the second subfolder to update the metadata of the second subfolder. It should be understood that after the metadata of the second subfolder is updated, the metadata of the upper-level folder of the second subfolder will also be updated accordingly, until the corresponding target folder updates the second metadata, and then the metadata of the target folder can be read to obtain the updated second metadata information.

[0137] The implementation of this application shown in steps S701 to S703 determines the change amount of the storage space according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; subtracts the change amount of the storage space from the current occupied space of the folder in the first subfolder to update the metadata of the first subfolder; adds the change amount of the storage space to the current occupied space of the folder in the second subfolder to update the metadata of the second subfolder. In this way, for the case where there are nested relationships among folders in the file system, metadata update of the target folder can be achieved, which helps to further efficiently determine and perform restriction actions in a timely manner when the data storage space used by each user folder reaches the quota.

[0138] In step S104 of some embodiments, when the current occupied space of the folder exceeds the preset folder space allocation threshold, a storage space restriction action matching the file change event is executed. It should be noted that the preset folder space allocation threshold refers to the threshold preset for defining whether the user folder reaches the upper limit of the allocated storage space. Since the second metadata information includes the current occupied space of the target folder, when the file change event triggered by the target file causes the storage space of the target folder to reach the upper limit of the allocated storage space, the current occupied space of the folder will exceed the preset folder space allocation threshold. On this basis, a storage space restriction action matching the file change event is required to prevent the target folder with excessive storage space from affecting the normal use of the data storage space by other user folders.

[0139] In some more specific embodiments, the storage space restriction action needs to match the file change event. For example, when the file change event is specifically the writing of the target file, the storage space restriction action matching it can be to return the target file to the original storage path; another example is that when the file change event is specifically the deletion or modification of the target file, the storage space restriction action matching it can be to prompt the user that this deletion or modification will exceed the storage space allocated to this user folder and prompt the user to operate again. It should be understood that there are various types of file change events, and there will also be various types of storage space restriction actions matching them, which can include, but are not limited to, the specific embodiments listed above.

[0140] Refer to Figure 8 , in some more specific embodiments of this application, file change event detection can be performed on user subfolders or data files under each user folder in the file system.

[0141] During the process of detecting file change events, if a data file triggers a file change event, the data file is determined as the target file, and metadata reading is performed on the target file to obtain the first metadata information. The first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event. It should be noted that the current occupied space of the target file is the Figure 8 current file size in Figure 8 , and the historical occupied space of the file corresponding to the file change event can be obtained from the first metadata information of the target file in Figure 8 . The first metadata information may include the file size, the last update time, and an indication of whether it is the latest size. When the target file has not been updated with metadata, the file size stored in the target file is the historical occupied space of the file corresponding to the file change event. Further, based on the current file size and the historical occupied space of the file corresponding to the file change event, the file size change increment is further obtained. It should be understood that when a file change event is triggered in a certain user subfolder, this user subfolder is the target subfolder, and the file size change increment will be used to update the metadata of the target subfolder, thereby obtaining the folder size change increment of the target subfolder.

[0142] During the process of detecting file change events, if a user subfolder triggers a folder change event, the user subfolder is determined as the target subfolder, and metadata reading is performed on the target subfolder to obtain the third metadata information. The third metadata information includes the current occupied space of the target subfolder and the historical occupied space of the subfolder corresponding to the file change event. It should be noted that further, based on the current occupied space of the subfolder and the historical occupied space of the subfolder corresponding to the file change event, the folder size change increment is further obtained. The current occupied space of the subfolder and the historical occupied space of the subfolder corresponding to the file change event can be obtained from the second metadata information before the metadata of the target subfolder is updated in Figure 8 . The second metadata information includes the folder size, the upload update time, and an indication of whether it is the latest size. It should be noted that when the target subfolder has not been updated with metadata, the folder size of the target subfolder is the historical occupied space of the subfolder corresponding to the file change event. Based on this, the folder size change increment of the target subfolder can be further determined and used to update the upper-level user subfolder of the target subfolder.

[0143] In some embodiments, the current file size of each data file in the file system can also be determined by means of regular scanning. When it is found during a certain scan that the current file size of a data file has changed, the file size change increment between this scan and the previous scan is further determined.

[0144] It should be noted that after obtaining the increment of the file size change of the target file, the increment of the file size change can be traced back to the target subfolder to which the target file belongs to update the third metadata information of the target subfolder. Similarly, the target subfolder can trace back the increment of the folder size change to the upper-level user subfolder to update the metadata of the upper-level user subfolder. Following this principle, the metadata of the higher-level user subfolders can be updated step by step until the metadata of the target folder is updated. After updating the metadata of the target folder, metadata reading is performed on the target folder to obtain the second metadata information. When the current occupied space of the folder exceeds the preset folder space allocation threshold, a storage space limit action matching the file change event is executed. In this way, the embodiments of the present application can efficiently determine that when the data storage space used by each user folder reaches the quota by capturing file change events in the file system and then perform a limit action on it in a timely manner. Multiple users of the same file system in artificial intelligence technology can then fairly use computing resources within the established quota of storage space.

[0145] Referring to Figure 9 , to achieve the above object, a second aspect of the embodiments of the present application proposes a data storage space limiting device 900, and the data storage space limiting device 900 includes:

[0146] A first metadata reading module 901, configured to, when a data file triggers a file change event, determine the data file as a target file and perform metadata reading on the target file to obtain first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event;

[0147] A folder metadata update module 902, configured to update the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event;

[0148] A second metadata reading module 903, configured to, after updating the metadata of the target folder, perform metadata reading on the target folder to obtain second metadata information; wherein, the second metadata information includes the current occupied space of the target folder;

[0149] A storage space limiting module 904, configured to execute a storage space limiting action matching the file change event when the current occupied space of the folder exceeds the preset folder space allocation threshold.

[0150] It can be seen that the content in the above embodiments of the method for restricting data storage space is applicable to the embodiments of the apparatus for restricting data storage space. The functions specifically implemented by the embodiments of the apparatus for restricting data storage space are the same as those of the above embodiments of the method for restricting data storage space, and the beneficial effects achieved are also the same as those of the above embodiments of the method for restricting data storage space.

[0151] An embodiment of the present application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above method for restricting data storage space is implemented. The electronic device can be any intelligent terminal including a tablet computer, an in-vehicle computer, etc.

[0152] Referring to Figure 10 , Figure 10 FIG. schematically shows the hardware structure of an electronic device according to another embodiment. The electronic device includes:

[0153] A processor 1001, which can be implemented by using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided by the embodiments of the present application;

[0154] A memory 1002, which can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), etc. The memory 1002 can store an operating system and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1002, and the processor 1001 is called to execute the method for restricting data storage space in the embodiments of the present application;

[0155] An input / output interface 1003, which is used to implement information input and output;

[0156] A communication interface 1004, which is used to implement communication interaction between this device and other devices, and can implement communication through a wired method (such as USB, network cable, etc.) or through a wireless method (such as a mobile network, WIFI, Bluetooth, etc.);

[0157] A bus 1005, which transmits information between various components of the device (such as the processor 1001, the memory 1002, the input / output interface 1003, and the communication interface 1004);

[0158] Among them, the processor 1001, the memory 1002, the input / output interface 1003, and the communication interface 1004 are communicatively connected to each other inside the device through the bus 1005.

[0159] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above method for restricting the data storage space is implemented.

[0160] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0161] The method and device for restricting the data storage space, the electronic device, and the storage medium provided by the embodiments of the present application capture file change events in the file system, and use metadata information to efficiently determine that when the data storage space used by each user folder reaches the quota, a restriction action is performed in a timely manner. Multiple users of the same file system in artificial intelligence technology can fairly use computing power resources under the established quota of storage space.

[0162] The embodiments described in the embodiments of the present application are for more clearly explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0163] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or combine certain steps, or different steps.

[0164] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0165] Those of ordinary skill in the art will understand that all or some of the steps in the methods disclosed above, and the functional modules / units in systems and devices, can be implemented as software, firmware, hardware, or a suitable combination thereof.

[0166] As used in the description of the present application and the above drawings, the terms "first", "second", "third", "fourth", etc. (if any) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data may be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0167] It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist simultaneously. Here, A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (one)" or a similar expression thereof refers to any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0168] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the above division of units is only a logical functional division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling, direct coupling, or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be in an electrical, mechanical, or other form.

[0169] The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0170] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0171] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs and other various media that can store programs.

[0172] The preferred embodiments of the embodiments of the present application have been described above with reference to the accompanying drawings, and thus do not limit the scope of the rights of the embodiments of the present application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the rights of the embodiments of the present application.

Claims

1. A method for restricting data storage space, characterized in that, it is applied to a file system, the file system includes a plurality of user folders, and each user folder is used to store data files of a corresponding user. The method includes: When a data file triggers a file change event, determining the data file as a target file and performing metadata reading on the target file to obtain first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event; Updating the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event; Performing metadata reading on the target folder after metadata update to obtain second metadata information; wherein, the second metadata information includes the current occupied space of the folder after metadata update; When the current occupied space of the folder exceeds a preset folder space allocation threshold, perform a storage space restriction action matching the file change event.

2. The method for restricting data storage space according to claim 1, characterized in that, the file change event includes at least one of a file write event and a file removal event; before the step of when the data file triggers a file change event, determining the data file as a target file, and performing metadata reading on the target file to obtain first metadata information, the method further includes at least one of the following: When a write operation of the data file occurs in the user folder, triggering the file write event; When a removal operation of the data file occurs in the user folder, triggering the file removal event.

3. The method for restricting data storage space according to claim 1, characterized in that, the data file is configured with first update status information, and the step of when the data file triggers a file change event, determining the data file as a target file, and performing metadata reading on the target file to obtain first metadata information includes: When a preset first scanning condition is met, performing an update status scan on the file system to obtain first update status information corresponding to each data file; When the first update status information indicates that the data file is in a non-up-to-date state, detecting the trigger status of the file change event corresponding to the data file; When the data file triggers the file change event, determining the data file as the target file and performing metadata reading on the target file to obtain the first metadata information.

4. The method for restricting data storage space according to claim 1, characterized in that, the user folder includes at least one user subfolder, and before the step of performing metadata reading on the target folder after metadata update to obtain second metadata information, it further includes: When the user sub - folder triggers a folder change event, determine the user sub - folder as the target sub - folder, and perform metadata reading on the target sub - folder to obtain third metadata information; wherein, the third metadata information includes the current occupied space of the sub - folders in the target sub - folder and the historical occupied space of the sub - folders corresponding to the file change event. Update the metadata of the target folder according to the current occupied space of the sub - folder and the historical occupied space of the sub - folder corresponding to the file change event.

5. The method for restricting data storage space according to claim 4, wherein, The target file triggers the file change event in the target sub - folder. The updating of the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event includes: Update the metadata of the target sub - folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event. Based on the target sub - folder after metadata update, update the metadata of the target folder.

6. The method for restricting data storage space according to claim 5, wherein, The target folder includes multiple levels of user sub - folders. The updating of the metadata of the target folder based on the target sub - folder after metadata update includes: Based on the target sub - folder after metadata update, perform hierarchical metadata update on the user sub - folder to which the target sub - folder belongs. Based on the multiple levels of user sub - folders after hierarchical metadata update, update the metadata of the target folder.

7. The method for restricting data storage space according to claim 5, wherein, The target sub - folder includes a first sub - folder and a second sub - folder. When the data file triggers a file change event, determine the data file as the target file, and perform metadata reading on the target file to obtain first metadata information, including: When an operation of transferring the data file from the first sub - folder to the second sub - folder occurs in the user folder, determine that the file change event is triggered, and determine the data file as the target file. Perform metadata reading on the target file to obtain the first metadata information.

8. The method for restricting data storage space according to claim 7, wherein, The updating of the metadata of the target sub - folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event includes: Determine the storage space change amount according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event. Subtract the storage space change amount from the current occupied space of the folder in the first sub - folder to update the metadata of the first sub - folder. Add the storage space change amount to the current occupied space of the folder in the second subfolder to update the metadata of the second subfolder.

9. A device for restricting data storage space, characterized in that the device comprises: A first metadata reading module, configured to, when the data file triggers a file change event, determine the data file as a target file, and perform metadata reading on the target file to obtain first metadata information; wherein, the first metadata information includes the current occupied space of the target file and the historical occupied space of the file corresponding to the file change event; A folder metadata update module, configured to update the metadata of the target folder according to the current occupied space of the file and the historical occupied space of the file corresponding to the file change event; wherein, the target folder is the user folder that triggers the file change event; A second metadata reading module, configured to, after updating the metadata of the target folder, perform metadata reading on the target folder to obtain second metadata information; wherein, the second metadata information includes the current occupied space of the folder of the target folder; A storage space restriction module, configured to, when the current occupied space of the folder exceeds a preset folder space allocation threshold, perform a storage space restriction action matching the file change event.

10. An electronic device, characterized in that the electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the data storage space restriction method according to any one of claims 1 to 8 is implemented.