CN101446984B - Method and device for storing files and method and device for deleting files - Google Patents

Method and device for storing files and method and device for deleting files Download PDF

Info

Publication number
CN101446984B
CN101446984B CN2009100014643A CN200910001464A CN101446984B CN 101446984 B CN101446984 B CN 101446984B CN 2009100014643 A CN2009100014643 A CN 2009100014643A CN 200910001464 A CN200910001464 A CN 200910001464A CN 101446984 B CN101446984 B CN 101446984B
Authority
CN
China
Prior art keywords
directory
file
list
data block
index node
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.)
Expired - Fee Related
Application number
CN2009100014643A
Other languages
Chinese (zh)
Other versions
CN101446984A (en
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.)
Huawei Digital Technologies Chengdu Co Ltd
Original Assignee
Huawei Symantec Technologies 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 Huawei Symantec Technologies Co Ltd filed Critical Huawei Symantec Technologies Co Ltd
Priority to CN2009100014643A priority Critical patent/CN101446984B/en
Publication of CN101446984A publication Critical patent/CN101446984A/en
Priority to PCT/CN2009/073621 priority patent/WO2010078760A1/en
Application granted granted Critical
Publication of CN101446984B publication Critical patent/CN101446984B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (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 provides a method and a device for storing files, and a method and a device for deleting files. The method for storing files comprises the following steps: storing a catalogue data and the application file data under the catalogue in a data block; storing the data block pointer pointing to the data block; storing the catalogue index node information of the catalogue and the file index node information of the application file; storing the position information of the application file and the data block pointer and the application file and the file index node information. In the deleting catalogue, the disk resource occupied by these files can be found without traveling the files under the catalogue and the file and the catalogue can be deleted, thereby effectively decreasing the occupied system resource during the deleting the whole catalogue process.

Description

File storage method and device and file deletion method and device
Technical Field
The invention relates to a file storage technology, in particular to storage and deletion of files in file system application, and specifically relates to a file storage method and device and a file deletion method and device.
Background
At present, in the application of a video monitoring file system, the directory structure for storing video files is very simple, and only one-level or two-level directories are usually used. The files stored in the directory are many, and can reach hundreds of thousands or even millions. In the application of such a file system, files are generally only created and written, files are rarely read, and deleted files are often deleted together with the whole directory, and a certain file is rarely deleted.
For deleting a file, the disk resources used by the file are mainly recycled, including data blocks for storing data and index nodes for the file. And deleting the directory is to recycle all files in the directory and disk resources used by the directory, including data blocks for storing data, index nodes for the files, and data blocks for storing file information in the directory.
In the process of implementing the invention, the inventor finds that: for the existing file system, when deleting a directory, all files and sub-directories under the whole directory need to be traversed, and for a sub-directory, the files and sub-directories under the sub-directory also need to be traversed, and then the files and sub-directories are deleted in sequence, and then the directory is deleted. When a file is deleted, all files under the corresponding directory need to be traversed, information of disk resources occupied by the files is found out, and then the disk resources occupied by the files are released. If the disk resource occupied by a certain file is to be released, the metadata of the file on the disk must be read out and analyzed, so that the disk resource occupied by the file can be found and released. Therefore, the deletion process is time-consuming, and the access speed of other programs to the disk is seriously influenced.
Disclosure of Invention
The embodiment of the invention provides a file storage method and device and a file deletion method and device, which are used for finding disk resources occupied by files without traversing the files in a directory when the directory is deleted and deleting the directory and the files. Therefore, the system resources occupied when the whole directory is deleted can be effectively reduced.
According to an aspect of the present invention, there is provided a file storage method, the method including:
adding three attribute files for each directory, which are respectively:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
adding an offset position list for each application file, wherein the offset position list is used for recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
storing directory data, file data of application files in the directory and file index node information in a data block; storing a data block pointer to the data block; storing directory index node information of the directory and file index node information of the application file; and storing the position information of the data block pointer of the file data of the application file and the position information of the file index node information of the application file.
According to another aspect of the present invention, there is also provided a file deleting method, including:
adding three attribute files for each directory, which are respectively:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
adding an offset position list for each application file, wherein the offset position list is used for recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
acquiring a data block pointer set pointing to a data block storing directory data, file data of an application file under the directory and file index node information from a data block pointer list; acquiring directory index node information of the directory and file index node information of the application file from a directory node list and a file node list; acquiring the position information of a data block pointer of the file data of the application file and the position information of file index node information of the application file from an offset position list; acquiring a data block pointer corresponding to the application file to be deleted from the data block pointer set according to the position information of the data block pointer of the file data of the application file, and releasing the file data of the application file in the data block pointed by the data block pointer; and releasing the file index node information corresponding to the application file to be deleted according to the position information of the file index node information of the application file.
According to another aspect of the present invention, there is also provided a file storage apparatus, the apparatus including:
the directory processing unit is used for adding three attribute files for each directory, and the three attribute files are respectively as follows:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
the file processing unit is used for adding an offset position list for each application file, recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
the file data storage unit is used for storing directory data and file index node information of application files in the directory by taking a data block as a unit; a data block pointer storage unit for storing a data block pointer pointing to the data block; a directory node storage unit for storing directory index node information of the directory; the file node storage unit is used for storing file index node information of the application file; and the position information storage unit is used for storing the position information of the data block pointer of the file data of the application file in the data block pointer storage unit and the position information of the file index node of the application file in the file node storage unit.
According to another aspect of the present invention, there is also provided a file deleting apparatus, the apparatus including:
the directory processing unit is used for adding three attribute files for each directory, and the three attribute files are respectively as follows:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
the file processing unit is used for adding an offset position list for each application file, recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
a data block pointer acquisition unit, configured to acquire, from a data block pointer list, a data block pointer set pointing to a data block in which directory data and file data of an application file under the directory and file index node information are stored; a directory node acquisition unit, configured to acquire directory index node information of the directory and file index node information of the application file from a directory node list and a file node list; a file node acquisition unit configured to acquire, from an offset position list, position information of a data block pointer of file data of the application file and position information of file index node information of the application file; the data release unit is used for acquiring a data block pointer corresponding to the application file to be deleted from the data block pointer set according to the position information of the data block pointer of the file data of the application file, and releasing the file data of the application file in the data block pointed by the data block pointer; and releasing the file index node information corresponding to the application file to be deleted according to the position information of the file index node information of the application file.
By the technical scheme provided by the embodiment of the invention, when the directory is deleted, the disk resources occupied by the files can be found without traversing the files in the directory, and the directory and the files thereof are deleted. The system resources occupied when the whole directory is deleted are effectively reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a block diagram of a file storage device according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a file storage operation according to an embodiment of the present invention;
FIG. 3 is a tree structure diagram of a root directory storage according to an embodiment of the present invention;
FIG. 4 is a tree structure diagram of a root directory according to an embodiment of the present invention;
FIG. 5 is a tree structure diagram of a subdirectory according to an embodiment of the present invention;
FIG. 6 is a block diagram of a file deleting apparatus according to an embodiment of the present invention;
fig. 7 is a flowchart of a file deletion operation according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the 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.
In order to find the disk resources occupied by all files under a directory without traversing the files under the directory, and simultaneously, in order to improve the efficiency of deleting the directory, the storage structure of the files is changed, and three attribute files are added to each directory:
list of data block pointers: for recording the data blocks used by all application files under the directory and the data blocks used by the directory itself.
(II) list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are mainly searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the parent directory.
(III) file node list: and the index node information used for recording all the application files under the directory, including the index node information of the directory itself.
Adding a property file for each application file:
list of offset positions: the directory node list is used for recording the position of the data block number occupied by the application file in the data block pointer list of the directory to which the application file belongs, and simultaneously storing the position of the index node information of the application file in the directory node list.
Example one
As shown in fig. 1, the file storage apparatus 100 of the present embodiment includes: the file data storage unit 101 is configured to store directory data and application file data in the directory in units of data blocks; the data block pointer storage unit 102 is configured to store a data block pointer pointing to the data block; the directory node storage unit 103 is configured to store directory index node information of the directory; the file node storage unit 104 is configured to store the directory index node information and the application file index node information; the location information storage unit 105 is configured to store application file data block pointer location information of the application file in the data block pointer storage unit, and application file index node location information of the application file in the file node storage unit.
As shown in fig. 2, the file storage method flow of this embodiment includes: storing directory data and application file data under the directory in a data block of a nonvolatile memory (step S101); a data block pointer pointing to the data block is stored, directory index node information of the directory and file index node information of the application file are stored, and location information of the application file and the data block pointer and location information of the application file and the file index node information are stored (step S102).
As shown in fig. 3, a root directory 1000 and its subdirectory 2000 are created, and an application file 3000 is stored under the root directory 1000, where the inode number (inode information) of the root directory 1000 is 1000, the inode number of the subdirectory 2000 is 2000, and the inode number of the application file 3000 is 3000. An application file 3100, an application file 3200, an application file 3300, an application file 3400, and an application file 3500 are stored under the subdirectory 2000, wherein the inode numbers of the five application files of the subdirectory 2000 are 3100, 3200, 3300, 3400, and 3500 in this order.
As shown in fig. 4, three attribute files are created for the root directory 1000: a data block pointer list 1001, a directory node list 1002 and a file node list 1003, and the inode numbers of the three attribute files are 1001, 1002 and 1003 in sequence. And creates an offset location list 3001 for the application file 3000.
The data block pointer list 1001 records: pointers 421, 422, 423, 424 and pointers 500-504. The pointers point to different data blocks of the nonvolatile memory respectively, wherein the pointer 421 points to a data block storing root directory data, the pointer 422 points to a data block storing a pointer list of the root directory data block, the pointer 423 points to a data block storing root directory index node information, the pointer 424 points to a data block storing root directory file index node information, and the pointers 500-504 point to data blocks storing application file data under the root directory.
The directory node list 1002 records: root directory inode number 1000.
The file node list 1003 records: root directory inode number 1000, data block pointer list inode number 1001, directory node list inode number 1002, file node list inode number 1003, and application file inode number 3000.
The offset position list 3001 records: file node list offset pointer 5 and data block pointer list offset pointers 5, 6, 7, 8, 9. Where the meaning of file node list offset pointer 5 is: file inode number 5 pointing to the file node list 3000; the meaning of the data block pointer list offset pointers 5, 6, 7, 8, 9 is: a 5 th data block pointer 500, a 6 th data block pointer 501, a 7 th data block pointer 502, an 8 th data block pointer 503, and a 9 th data block pointer 504, which point to the data block pointer list in this order.
The method has the advantages that in order to find the disk resources occupied by all the files in the directory without traversing the files in the directory, and simultaneously in order to improve the efficiency of deleting the directory, the storage structure of the files is changed, and a data block pointer list, a directory node list and a file node list are added to each directory; an offset location list is added to the application file. Therefore, when the directory is deleted, the data block pointers of all the files to be deleted in the data block pointer list are obtained according to the offset position list, the data of the data blocks pointed by the pointers are released, and the directory node list and the index node information of the directories to be deleted and the application files in the file node list are deleted. The method and the device realize that the disk resources occupied by the files can be found without traversing the files under the directory, and establish the basis of data storage of the directory and the application files convenient for directory deletion.
Example two
The directory inode number 2000 of the subdirectory 2000 is added to the directory node list 1002 as shown in figure 4.
As shown in FIG. 5, three property files are created for subdirectory 2000: a data block pointer list 2001, a directory node list 2002 and a file node list 2003, and inode numbers of the three attribute files are 2001, 2002 and 2003 in this order.
Offset location list 3101 is created for application file 3100, offset location list 3201 is created for application file 3200, offset location list 3301 is created for application file 3300, offset location list 3401 is created for application file 3400, and offset location list 3501 is created for application file 3500.
The data block pointer list 2001 as a data block pointer set records: pointers 621, 622, 623, 624 and pointers 700-704. The pointers point to different data blocks of the nonvolatile memory respectively, wherein the pointer 621 points to a data block storing subdirectory data, the pointer 622 points to a data block storing a subdirectory data block pointer list, the pointer 623 points to a data block storing subdirectory index node information, the pointer 624 points to a data block storing root directory file index node information, and the pointers 700-704 point to data blocks storing application file data under subdirectories.
The directory node list 2002 records: offset location pointer 2 of subdirectory 2000 in directory node list 1002.
The file node list 2003 records: subdirectory inode number 2000, data block pointer list inode number 2001, directory node list inode number 2002, file node list inode number 2003, and application file inode numbers 3100, 3200, 3300, 3400, and 3500.
The offset position list 3101 has recorded therein: file node list offset pointer 5 and data block pointer list offset pointer 5. Where the meaning of file node list offset pointer 5 is: the 5 th file inode number 3100 that points to the file node list; the meaning of data block pointer list offset pointer 5 is: a 5 th data block pointer 700 to a list of data block pointers.
The offset position list 3201 records: file node list offset pointer 6 and data block pointer list offset pointer 6. Where the meaning of file node list offset pointer 6 is: the 6 th file inode number 3200, which points to the file node list; the meaning of data block pointer list offset pointer 6 is: a 6 th data block pointer 701 pointing to a list of data block pointers.
The offset position list 3301 records: file node list offset pointer 7 and data block pointer list offset pointer 7. Where the meaning of file node list offset pointer 7 is: file inode number 7 pointing to file node list 3300; the meaning of data block pointer list offset pointer 7 is: a 7 th data block pointer 702 to the data block pointer list.
The offset position list 3401 records: file node list offset pointer 8 and data block pointer list offset pointer 8. Where the meaning of file node list offset pointer 8 is: file inode number 8 pointing to the file node list 3400; the meaning of data block pointer list offset pointer 8 is: an 8 th data block pointer 703 pointing to the data block pointer list.
The offset position list 3501 records: file node list offset pointer 9 and data block pointer list offset pointer 9. Where the meaning of file node list offset pointer 9 is: file inode number 9 pointing to the file node list 3500; the meaning of data block pointer list offset pointer 9 is: a 9 th data block pointer 704 to a list of data block pointers.
In order to find the disk resources occupied by all files under a directory without traversing the files under the directory, and simultaneously, in order to improve the efficiency of deleting the directory, the storage structure of the files is changed, and a data block pointer list, a directory node list and a file node list are added to each directory; an offset location list is added to the application file. Therefore, when the directory is deleted, the data block pointers of all the files to be deleted in the data block pointer list are obtained according to the offset position list, the data of the data blocks pointed by the pointers are released, and the directory node list and the index node information of the directories to be deleted and the application files in the file node list are deleted. The method and the device realize that the disk resources occupied by the files can be found without traversing the files under the directory, and establish the basis of data storage of the directory and the application files convenient for directory deletion.
EXAMPLE III
As shown in fig. 6, the file deleting apparatus of the present embodiment includes: the data block pointer acquiring unit 201 is configured to acquire a data block pointer set pointing to a data block in which directory data and application file data under the directory are stored; the directory node obtaining unit 202 is configured to obtain directory index node information of the directory and file index node information of the application file; the file node obtaining unit 203 is configured to obtain location information of the application file and the data block pointer, and location information of the application file and the file index node information; the data releasing unit 204 is configured to obtain, from the data block pointer set of the data block pointer obtaining unit 201, a data block pointer corresponding to an application file to be deleted according to the location information of the application file and the data block pointer obtained by the file node obtaining unit 203, and release application file data in a data block pointed by the data block pointer; and according to the application file of the file node obtaining unit 203 and the position information of the file index node information, releasing the file index node information corresponding to the application file to be deleted.
As shown in fig. 7, the file deletion method flow of this embodiment includes: acquiring a data block pointer set pointing to a data block storing directory data and application file data under the directory, acquiring directory index node information of the directory and file index node information of the application file, and acquiring location information of the application file and the data block pointer and location information of the application file and the file index node information (step S201); acquiring a data block pointer corresponding to the application file to be deleted from the data block pointer set according to the position information of the application file and the data block pointer, and releasing application file data in a data block pointed by the data block pointer; and releasing the file index node information corresponding to the application file to be deleted according to the application file and the position information of the file index node information (step S202).
To illustrate an embodiment of how a file is deleted, it is illustrated in fig. 3 and 4. As shown in fig. 3, the inode number (inode information) of the root directory 1000 is 1000, the inode number of the subdirectory 2000 is 2000, and the inode number of the application file 3000 is 3000. If the application file 3000 is to be deleted, the following steps are performed:
as shown in fig. 4, three attribute files of the root directory 1000 are obtained: a data block pointer list 1001, a directory node list 1002, and a file node list 1003; the application file offset position list 3001 is acquired.
From the offset position list 3001, it can be known that: file node list offset pointer 5 points to the 5 th file inode number 3000 of the file node list; the data block pointer list offset pointers 5, 6, 7, 8, 9 point to the 5 th data block pointer 500, the 6 th data block pointer 501, the 7 th data block pointer 502, the 8 th data block pointer 503, and the 9 th data block pointer 504 of the data block pointer list in sequence.
The data stored in the nonvolatile memory data blocks indicated by the data block pointers 500, 501, 502, 503, and 504 are released, and the 5 th file inode number 3000 in the file node list is released, so that the application file 3000 in the root directory 1000 can be deleted.
In order to find the disk resources occupied by all files under a directory without traversing the files under the directory, and simultaneously, in order to improve the efficiency of deleting the directory, the storage structure of the files is changed, and a data block pointer list, a directory node list and a file node list are added to each directory; adding a list of offset locations to the application file. Therefore, when the directory is deleted, the data block pointers of all the files to be deleted in the data block pointer list are obtained according to the offset position list, the data of the data blocks pointed by the pointers are released, and the directory node list and the index node information of the directories to be deleted and the application files in the file node list are deleted. The method and the device realize that the disk resources occupied by the files can be released without traversing the files in the directory.
Example four
To illustrate an embodiment of how a file is deleted, it is described with reference to fig. 3, 4, and 5. As shown in fig. 3, the inode number (inode information) of the root directory 1000 is 1000, the inode number of the subdirectory 2000 is 2000, and the inode number of the application file 3000 is 3000. An application file 3100, an application file 3200, an application file 3300, an application file 3400 and an application file 3500 are stored under the subdirectory 2000, wherein the inode numbers of the application files of the five subdirectories are 3100, 3200, 3300, 3400 and 3500 in sequence.
The directory inode number 2000 of the subdirectory 2000 is added to the directory node list 1002 shown in fig. 4. If the subdirectory 2000 and its five application files are to be deleted, the following steps are performed:
as shown in fig. 5, three property files of the subdirectory 2000 are acquired: a data block pointer list 2001, a directory node list 2002, and a file node list 2003. Offset location list 3101 of application file 3100, offset location list 3201 of application file 3200, offset location list 3301 of application file 3300, offset location list 3401 of application file 3400, and offset location list 3501 of application file 3500 are acquired.
As seen from the offset position list 3101: file node list offset pointer 5 points to the 5 th file inode number 3100 for the file node list; data block pointer list offset pointer 5 points to the 5 th data block pointer 700 of the data block pointer list.
As can be seen from offset position list 3201: file node list offset pointer 6 points to the 6 th file inode number 3200 of the file node list; data block pointer list offset pointer 6 points to the 6 th data block pointer 701 of the data block pointer list.
As can be seen from the offset location list 3301: file node list offset pointer 7 points to the 7 th file inode number 3300 of the file node list; data block pointer list offset pointer 7 points to the 7 th data block pointer 702 of the data block pointer list.
As can be seen from the offset position list 3401: file node list offset pointer 8 points to the 8 th file inode number 3400 of the file node list; data block pointer list offset pointer 8 points to the 8 th data block pointer 703 of the data block pointer list.
As can be seen from the offset location list 3501: file node list offset pointer 9 points to the 9 th file inode number 3500 of the file node list; data block pointer list offset pointer 9 points to the 9 th data block pointer 704 of the data block pointer list.
From the list of directory nodes 2002: offset location pointer 2 in directory node list 2002 points to directory inode number 2000 in directory node list 1002.
Releasing the data stored on the nonvolatile memory data blocks pointed by the data block pointers 700, 701, 702, 703 and 704; releasing file inode numbers 3100, 3200, 3300, 3400, 3500 corresponding to bits 5, 6, 7, 8, 9 of the file node list 2003; a data block pointer corresponding to the subdirectory 2000 is 621, a data block pointer corresponding to the data block pointer list 2001 is 622, a data block pointer corresponding to the directory node list 2002 is 623, and a data block pointer corresponding to the file node list 2003 is 624, and data stored in nonvolatile memory data blocks corresponding to the data block pointers 621, 622, 623 and 624 are released; and releases the directory inode number 2000 of the subdirectory 2000 in the directory node list 1002. The deletion of the sub-directory 2000 and its five application files can be realized.
In video file applications such as video surveillance, the number of directories and the number of levels are generally small, and a large number of files exist in the directories. In such applications, deleting information also often takes the form of deleting an entire directory.
In order to find the disk resources occupied by all files under a directory without traversing the files under the directory, and simultaneously, in order to improve the efficiency of deleting the directory, the storage structure of the files is changed, and a data block pointer list, a directory node list and a file node list are added to each directory; adding a list of offset locations to the application file. Therefore, when the directory is deleted, the data block pointers of all the files to be deleted in the data block pointer list are obtained according to the offset position list, the data of the data blocks pointed by the pointers are released, and the directory node list and the index node information of the directories to be deleted and the application files in the file node list are deleted. The method and the device realize that the disk resources occupied by the files can be released without traversing the files in the directory.
The above specific embodiments are merely illustrative of the present invention and are not intended to limit the present invention.

Claims (11)

1. A method for storing files, the method comprising:
adding three attribute files for each directory, which are respectively:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
adding an offset position list for each application file, wherein the offset position list is used for recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
storing directory data, file data of application files in the directory and file index node information in a data block;
storing a data block pointer to the data block;
storing directory index node information of the directory and file index node information of the application file;
and storing the position information of the data block pointer of the file data of the application file and the position information of the file index node information of the application file.
2. The file storage method according to claim 1, wherein the directory inode information for storing the directory and the file inode information for the application file comprise:
storing index node information of a root directory and index node information of application files under the root directory; or
And storing the index node information of the root directory, the index node information of the application files and the index node information of the subdirectories under the root directory.
3. The file storage method of claim 2, wherein storing an offset location pointer of a subdirectory in a directory node list of a root directory.
4. A file deleting method is characterized by comprising the following steps:
adding three attribute files for each directory, which are respectively:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
adding an offset position list for each application file, wherein the offset position list is used for recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
acquiring a data block pointer set pointing to a data block storing directory data, file data of an application file under the directory and file index node information from a data block pointer list;
acquiring directory index node information of the directory and file index node information of the application file from a directory node list and a file node list;
acquiring the position information of a data block pointer of the file data of the application file and the position information of file index node information of the application file from an offset position list;
acquiring a data block pointer corresponding to the application file to be deleted from the data block pointer set according to the position information of the data block pointer of the file data of the application file, and releasing the file data of the application file in the data block pointed by the data block pointer; and releasing the file index node information corresponding to the application file to be deleted according to the position information of the file index node information of the application file.
5. The method of claim 4, wherein the obtaining directory inode information of the directory and file inode information of the application file comprises:
acquiring root directory index node information and file index node information under the root directory; or
And acquiring index node information of a root directory, and file index node information and subdirectory index node information under the root directory.
6. The file deletion method according to claim 5, wherein an offset location pointer of the subdirectory in the directory node list of the root directory is obtained, and the subdirectory index node information is obtained according to the offset location pointer of the subdirectory in the directory node list of the root directory;
acquiring a data block pointer corresponding to the subdirectory to be deleted, a data block pointer corresponding to a data block pointer list of the subdirectory, a data block pointer corresponding to a directory node list of the subdirectory and a data block pointer corresponding to a file node list of the subdirectory according to the subdirectory index node information;
releasing the data in the data blocks pointed by the data block pointers;
and releasing the subdirectory index node information of the subdirectory to be deleted in the directory node list of the root directory according to the offset position pointer of the subdirectory in the directory node list of the root directory.
7. A file storage device, said device comprising:
the directory processing unit is used for adding three attribute files for each directory, and the three attribute files are respectively as follows:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
the file processing unit is used for adding an offset position list for each application file, recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
the file data storage unit is used for storing directory data and file index node information of application files in the directory by taking a data block as a unit;
a data block pointer storage unit for storing a data block pointer pointing to the data block;
a directory node storage unit for storing directory index node information of the directory;
the file node storage unit is used for storing file index node information of the application file;
and the position information storage unit is used for storing the position information of the data block pointer of the file data of the application file in the data block pointer storage unit and the position information of the file index node of the application file in the file node storage unit.
8. The file storage device according to claim 7, wherein the directory node storage unit comprises: a root directory node storage unit and/or a subdirectory node storage unit; wherein,
the root directory node storage unit is used for storing root directory index node information and subdirectory index node information;
the subdirectory node storage unit is used for storing an offset position pointer of the subdirectory in a directory node list of the root directory.
9. A file deletion apparatus, comprising:
the directory processing unit is used for adding three attribute files for each directory, and the three attribute files are respectively as follows:
the data block pointer list is used for recording data blocks used by all application files in the directory and data blocks used by the directory;
list of directory nodes: the index node information of the subdirectory under the directory is recorded, the disk resources occupied by the files under the subdirectory are searched, and the directory is also saved as the position of the index node of the subdirectory in the index node list of the father directory;
the file node list is used for recording index node information used by all application files in the directory, and the index node information comprises index node information of the directory;
the file processing unit is used for adding an offset position list for each application file, recording the position of a data block number occupied by the application file in a data block pointer list of a directory to which the application file belongs, and simultaneously storing the position of index node information of the application file in the directory node list;
a data block pointer acquisition unit, configured to acquire, from a data block pointer list, a data block pointer set pointing to a data block in which directory data and file data of an application file under the directory and file index node information are stored;
a directory node acquisition unit, configured to acquire directory index node information of the directory and file index node information of the application file from a directory node list and a file node list;
a file node acquisition unit configured to acquire, from an offset position list, position information of a data block pointer of file data of the application file and position information of file index node information of the application file;
the data release unit is used for acquiring a data block pointer corresponding to the application file to be deleted from the data block pointer set according to the position information of the data block pointer of the file data of the application file, and releasing the file data of the application file in the data block pointed by the data block pointer; and releasing the file index node information corresponding to the application file to be deleted according to the position information of the file index node information of the application file.
10. The file deleting device according to claim 9, wherein the directory node acquiring unit includes: a root directory node acquisition unit and/or a subdirectory node acquisition unit; wherein,
the root directory node acquisition unit is used for acquiring root directory index node information and subdirectory index node information;
the subdirectory node acquisition unit is used for acquiring an offset position pointer of the subdirectory in a directory node list of the root directory.
11. The file deleting device according to claim 10, wherein the data releasing unit obtains an offset location pointer of the subdirectory in the directory node list of the root directory, and obtains the subdirectory index node information according to the offset location pointer of the subdirectory in the directory node list of the root directory;
acquiring a data block pointer corresponding to the subdirectory to be deleted, a data block pointer corresponding to a data block pointer list of the subdirectory, a data block pointer corresponding to a directory node list of the subdirectory and a data block pointer corresponding to a file node list of the subdirectory according to the subdirectory index node information;
releasing the data in the data blocks pointed by the data block pointers;
and releasing the subdirectory index node information of the subdirectory to be deleted in the directory node list of the root directory according to the offset position pointer of the subdirectory in the directory node list of the root directory.
CN2009100014643A 2009-01-09 2009-01-09 Method and device for storing files and method and device for deleting files Expired - Fee Related CN101446984B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN2009100014643A CN101446984B (en) 2009-01-09 2009-01-09 Method and device for storing files and method and device for deleting files
PCT/CN2009/073621 WO2010078760A1 (en) 2009-01-09 2009-08-28 A method, a device for storing file and a method, a device for deleting file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009100014643A CN101446984B (en) 2009-01-09 2009-01-09 Method and device for storing files and method and device for deleting files

Publications (2)

Publication Number Publication Date
CN101446984A CN101446984A (en) 2009-06-03
CN101446984B true CN101446984B (en) 2011-04-13

Family

ID=40742662

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009100014643A Expired - Fee Related CN101446984B (en) 2009-01-09 2009-01-09 Method and device for storing files and method and device for deleting files

Country Status (2)

Country Link
CN (1) CN101446984B (en)
WO (1) WO2010078760A1 (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101446984B (en) * 2009-01-09 2011-04-13 成都市华为赛门铁克科技有限公司 Method and device for storing files and method and device for deleting files
CN101605100B (en) * 2009-07-15 2012-04-25 华为技术有限公司 Method and apparatus for managing queue storage space
CN102508892B (en) * 2011-10-25 2014-01-22 深圳万兴信息科技股份有限公司 System and method for quickly previewing pictures
WO2013091244A1 (en) * 2011-12-23 2013-06-27 华为技术有限公司 File system data storage method and access method and device therefor
CN103164656B (en) * 2012-06-01 2015-12-16 北京安天电子设备有限公司 Based on the method and system of visible mutation erasing hidden file
CN103164501A (en) * 2012-07-04 2013-06-19 北京安天电子设备有限公司 Method and system of rapid file erasure of anti-recovery software
CN103544156B (en) * 2012-07-10 2019-04-09 腾讯科技(深圳)有限公司 File memory method and device
CN102831240B (en) * 2012-09-05 2016-03-30 曙光信息产业(北京)有限公司 The storage means of extended metadata file and storage organization
CN102955861B (en) * 2012-11-30 2017-04-12 华为技术有限公司 Method and device for generating index files based on backup files
CN103064639B (en) * 2012-12-28 2016-08-03 华为技术有限公司 Date storage method and device
CN103279489A (en) * 2013-04-25 2013-09-04 安科智慧城市技术(中国)有限公司 Method and device for storing metadata
CN104243425B (en) 2013-06-19 2018-09-04 深圳市腾讯计算机系统有限公司 A kind of method, apparatus and system carrying out Content Management in content distributing network
CN104572681B (en) * 2013-10-17 2018-06-22 北京同方微电子有限公司 A kind of smartcard file management system and its management method based on registration table
CN103942262A (en) * 2014-03-26 2014-07-23 浪潮电子信息产业股份有限公司 Method for optimal allocation of metadata in video storage system
CN106919347A (en) * 2017-02-28 2017-07-04 北京华云网际科技有限公司 The creation method and device of the catalogue of distributed block storage system
US11301421B2 (en) 2018-05-25 2022-04-12 Microsoft Technology Licensing, Llc Scalable multi-tier storage structures and techniques for accessing entries therein
CN109062935A (en) * 2018-06-14 2018-12-21 新华三技术有限公司 A kind of method and apparatus of file operation
CN109739811B (en) * 2018-12-11 2023-03-14 河南辉煌科技股份有限公司 Storage method supporting two-dimensional query of mass monitoring data
US11204892B2 (en) 2019-03-21 2021-12-21 Microsoft Technology Licensing, Llc Techniques for snapshotting scalable multitier storage structures

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1049029A3 (en) * 1999-04-28 2003-07-09 Emc Corporation File systems with versatile indirection
CN100359592C (en) * 2002-12-13 2008-01-02 康佳集团股份有限公司 Data storage method for hard disk for camera-shooting and recording device
CN100485681C (en) * 2006-03-23 2009-05-06 北京握奇数据系统有限公司 Smart card storage system and managing method for file creation in the system
CN101446984B (en) * 2009-01-09 2011-04-13 成都市华为赛门铁克科技有限公司 Method and device for storing files and method and device for deleting files

Also Published As

Publication number Publication date
CN101446984A (en) 2009-06-03
WO2010078760A1 (en) 2010-07-15

Similar Documents

Publication Publication Date Title
CN101446984B (en) Method and device for storing files and method and device for deleting files
US8983967B2 (en) Data storage system having mutable objects incorporating time
CN103080896B (en) Always searched to reduce the time to tape-shaped medium's to access rearrangement
CN101937377B (en) Data recovery method and device
CN103229173B (en) Metadata management method and system
CN103282899B (en) The storage method of data, access method and device in file system
KR100856245B1 (en) File system device and method for saving and seeking file thereof
CN102930060B (en) A kind of method of database quick indexing and device
CN1963814A (en) Managing method of data of memorizer
CN102779180A (en) Operation processing method of data storage system and data storage system
CN106874481B (en) Method and system for reading metadata information of distributed file system
CN107679420B (en) Permission setting method and system based on distributed file system
CN104346357A (en) File accessing method and system for embedded terminal
CN103425785A (en) Data storage system and user data storage and reading method thereof
CN110888837B (en) Object storage small file merging method and device
US20170262463A1 (en) Method and system for managing shrinking inode file space consumption using file trim operations
CN102289526B (en) HFS+file system data recovery method and device
CN103473298A (en) Data archiving method and device and storage system
CN104424219A (en) Method and equipment of managing data documents
CN103744875A (en) Data rapid transferring method and system based on file system
CN101324898A (en) Rapid search and recovery method based on file attribute
CN102609531B (en) Method for pegging files according to keywords
CN109189343B (en) Metadata disk-dropping method, device, equipment and computer-readable storage medium
CN110352410A (en) Track the access module and preextraction index node of index node
CN105260266A (en) Snapshot volume writing method and dependent snapshot system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee

Owner name: HUAWEI DIGITAL TECHNOLOGY (CHENGDU) CO., LTD.

Free format text: FORMER NAME: CHENGDU HUAWEI SYMANTEC TECHNOLOGIES CO., LTD.

CP01 Change in the name or title of a patent holder

Address after: 611731 Chengdu high tech Zone, Sichuan, West Park, Qingshui River

Patentee after: Huawei Symantec Technologies Co., Ltd.

Address before: 611731 Chengdu high tech Zone, Sichuan, West Park, Qingshui River

Patentee before: Chengdu Huawei Symantec Technologies Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110413

Termination date: 20190109