WO2021248406A1 - Method and apparatus for repairing file system - Google Patents

Method and apparatus for repairing file system Download PDF

Info

Publication number
WO2021248406A1
WO2021248406A1 PCT/CN2020/095581 CN2020095581W WO2021248406A1 WO 2021248406 A1 WO2021248406 A1 WO 2021248406A1 CN 2020095581 W CN2020095581 W CN 2020095581W WO 2021248406 A1 WO2021248406 A1 WO 2021248406A1
Authority
WO
WIPO (PCT)
Prior art keywords
cluster
fat
sub
file system
fats
Prior art date
Application number
PCT/CN2020/095581
Other languages
French (fr)
Chinese (zh)
Inventor
郭建
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2020/095581 priority Critical patent/WO2021248406A1/en
Priority to CN202080101901.3A priority patent/CN115698934A/en
Publication of WO2021248406A1 publication Critical patent/WO2021248406A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • This application relates to the field of computers, and in particular to a method and device for repairing a file system.
  • the file allocation table (FAT) file system is a widely used storage system.
  • consumer-grade video products such as driving recorders, digital video cameras (digital video, DV), smart home cameras, etc. all use the FAT file system To store data.
  • digital video cameras digital video, DV
  • smart home cameras etc. all use the FAT file system To store data.
  • Such consumer-grade camera products usually use external storage devices, which are prone to abnormal power failure, hot swapping, etc., which can cause damage to the FAT file system. For example, if a car crashes during driving, the secure digital memory (SD) card of the driving recorder is ejected, causing the FAT file system of the SD card to be damaged, and the FAT file system of the SD card needs to be repaired. .
  • SD secure digital memory
  • One method to repair the FAT file system is to build a cluster chain based on FAT, and repair the FAT file system based on the cluster chain. In the process of constructing the cluster chain, it is necessary to use the same memory as the FAT size. This memory requirement is a larger burden for consumer products. How to reduce the memory required to repair the FAT file system is Current issues that need to be resolved.
  • This application provides a method for repairing a file system, which can reduce the memory required for repairing a FAT file system.
  • a method for repairing a file system including: obtaining a FAT; dividing the FAT into N sub-FATs, where N is a positive integer greater than 1, and generating N cluster linked lists based on the N sub-FATs; The N cluster linked lists are merged to generate a target cluster linked list; the FAT file system is repaired according to the target cluster linked list.
  • the number of clusters contained in each sub-FAT is less than the number of clusters contained in the FAT. Therefore, the memory required to generate the cluster linked list based on each sub-FAT is small; N cluster linked lists are generated one by one Then, the N cluster linked lists are merged to generate a target cluster linked list.
  • the target cluster linked list is a complete cluster linked list corresponding to the FAT and can be used to repair the FAT file system. Compared with the method of directly generating a complete cluster linked list based on FAT and repairing the file system, the method provided in this application does not need to use large memory in the process of repairing the file system, thereby reducing the cost of electronic equipment using the FAT file system.
  • the number of clusters included in the N sub-FATs is the same.
  • the sub-FATs generated by dividing the FAT equally contain fewer clusters.
  • FAT contains 10 clusters, and N is equal to 2.
  • the FAT can be divided into two sub-FATs containing 5 clusters based on the equal division scheme, or the FAT can be divided into one sub-FAT containing 4 clusters based on the non-equal division scheme.
  • Sub-FAT and a sub-FAT containing 6 clusters The sub-FAT containing 5 clusters requires less memory than the sub-FAT containing 6 clusters. Therefore, dividing the FAT according to the equal partitioning scheme can reduce the number of sub-FATs. Memory required for FAT.
  • clusters included in at least one sub-FAT in the N sub-FATs are clusters with consecutive numbers.
  • the FAT contains 6 clusters, numbered 2, 3, 4, 5, 6, and 7.
  • the clusters numbered 2, 3, and 4 can be divided into one sub-FAT based on the continuous division scheme, and the numbers are 5,
  • the clusters 6 and 7 are divided into another sub-FAT;
  • the clusters numbered 2, 4, and 6 can be divided into one sub-FAT based on the non-contiguous division scheme, and the clusters numbered 3, 5, and 6 can be divided into another sub-FAT Sub FAT.
  • the clusters contained in a sub-FAT have a greater probability of belonging to a cluster chain, which can reduce the number of merging cluster chains, thereby reducing the consumption of computing resources.
  • the merging process of the N cluster chain sets to generate a target cluster chain set includes: traversing all cluster chain heads and cluster chain tails in the N cluster linked lists; and merging the N cluster linked lists The cluster chain having an association relationship between the middle cluster chain head and the cluster chain tail generates the target cluster linked list.
  • the present application provides an apparatus for repairing a file system, including a unit for executing the method described in the first aspect.
  • the device can be a terminal device or a server, or a chip in the terminal device or the server.
  • the device may include an input unit and a processing unit.
  • the processing unit may be a processor, and the input unit may be a transceiver; the terminal device may also include a storage unit, and the storage unit may be a memory; the storage unit is used to store instructions, The processing unit executes the instructions stored in the storage unit, so that the terminal device or the server executes the method described in the first aspect.
  • the processing unit can be a processing unit inside the chip, and the input unit can be an input/output interface, a pin or a circuit, etc.; the processing unit executes instructions stored in the storage unit , So that the chip executes the method described in the first aspect, the storage unit can be a storage unit (for example, a register, a cache, etc.) in the chip, or a storage unit (for example, a read-only memory) located outside the chip. , Random Access Memory, etc.).
  • the present application provides a computer-readable storage medium in which a computer program is stored.
  • the processor executes the method described in the first aspect.
  • the present application provides a computer program product, the computer program product comprising: computer program code, when the computer program code is executed by a processor, the processor executes the method described in the first aspect.
  • FIG. 1 is a schematic diagram of a FAT file system suitable for this application
  • FIG. 2 is a schematic diagram of a method for repairing a file system provided by the present application
  • FIG. 3 is a schematic diagram of a method for dividing sub-FAT provided by this application.
  • Fig. 4 is a schematic diagram of a method for merging linked lists of sub-clusters provided by the present application
  • Figure 5 is a schematic diagram of a complete cluster linked list provided by this application.
  • Fig. 6 is a schematic diagram of another method for merging linked lists of sub-clusters provided by the present application.
  • FIG. 7 is a schematic diagram of another method for repairing a file system provided by this application.
  • FIG. 8 is a schematic diagram of a device for repairing a file system provided by the present application.
  • Fig. 9 is a schematic diagram of a device for repairing a file system provided by the present application.
  • Figure 1 shows a schematic diagram of a FAT file system suitable for this application.
  • the FAT file system 100 includes a disk operating system boot record (DBR) 110, a FAT 120, and a data area (DATA) 130.
  • DBR disk operating system boot record
  • FAT 120 FAT 120
  • DATA data area
  • DBR110 is mainly used to record basic information such as the capacity of a single sector, the total number of sectors, the size of a single FAT, the number of FATs, and the cluster capacity.
  • DRB110 also stores file system information (FSInfo).
  • FSInfo includes available Information such as the number of clusters and the last allocated cluster number.
  • the FAT file system 100 may be a FAT32 file system, a FAT16 file system or other types of FAT file systems.
  • a cluster corresponds to 4 bytes of storage space. Even if a file has only one byte, the operating system will allocate a cluster for the file (that is, allocate storage space corresponding to a cluster) Therefore, the cluster is the basic storage unit of the FAT file system.
  • FAT120 records the cluster chain of all directories and files in the partition.
  • a file is not necessarily stored in a continuous area on the disk. It may be divided into several segments and stored like a chain.
  • This storage method is called chain storage, recording One or more clusters of the storage address of a file are cluster chains.
  • FAT120 needs to record which clusters are occupied by the file, and the cluster number of the next cluster associated with each occupied cluster; for the last cluster occupied by the file, FAT120 needs to record that the cluster is the last cluster.
  • FAT120 can also record free clusters and bad clusters.
  • the data area 130 records directory entries and user data.
  • the FAT file system 100 is an example of a FAT file system applicable to the present application.
  • the FAT file system applicable to the present application may also have other structures, such as a FAT file system including two FATs.
  • the FAT file system 100 may be unreadable and writable, and the FAT file system 100 needs to be repaired.
  • the following uses the FAT32 file system as an example to introduce the method for repairing the file system provided by this application, and the method can be executed by a processor.
  • the DBR can be verified first.
  • the processor can read the DBR from the partition into the memory, verify the DBR according to the FAT32 protocol and the hardware characteristics of the partition device, and repair it in the memory if there is an error in the DBR.
  • the cluster linked list can be constructed.
  • the method for constructing the cluster linked list is shown in FIG. 2.
  • the method 200 includes the following steps.
  • S220 Divide the FAT into N sub-FATs, where N is a positive integer greater than 1.
  • the FAT When dividing the FAT, the FAT can be divided equally or unequal. Among them, the divided FAT refers to the way that the number of clusters contained in each sub-FAT is equal. When the number of sub-FATs is determined, the sub-FATs generated by dividing the FAT equally contain fewer clusters.
  • FAT contains 10 clusters, and N is equal to 2.
  • the FAT can be divided into two sub-FATs containing 5 clusters based on the equal division scheme, or the FAT can be divided into one sub-FAT containing 4 clusters based on the non-equal division scheme.
  • Sub-FAT and a sub-FAT containing 6 clusters The sub-FAT containing 5 clusters requires less memory than the sub-FAT containing 6 clusters. Therefore, dividing the FAT according to the equal partitioning scheme can reduce the number of sub-FATs. Memory required for FAT.
  • Figure 3 shows a method of dividing sub-FATs.
  • each cluster corresponds to 4 bytes of disk space.
  • F8FFFF0F is cluster 0
  • FFFFFF0F is cluster 1
  • the first row is cluster 0 to cluster 3
  • the second row is cluster 4 to cluster 7
  • the third row is cluster 8.
  • the fourth row is from cluster 12 to cluster 15
  • the fifth row is cluster 16 and cluster 17.
  • FAT120 records 18 clusters. Among them, cluster 0 and cluster 1 are reserved items, which are fixed starting identifiers of FAT120, and are not referenced by any file. FAT120 can be divided from cluster 2 on.
  • the remaining clusters can be divided into 2 sub-FATs, and each sub-FAT includes 8 clusters.
  • clusters with consecutive numbers can be divided into one sub-FAT, as shown by the dotted line in FIG. 3.
  • the two sub-FATs obtained by dividing according to the above method are respectively FAT_0 and FAT_1.
  • FAT_0 includes clusters 2 to 9
  • FAT_1 includes clusters 10 to 17.
  • the numbers in FAT_0 and FAT_1 indicate the cluster number of the next cluster associated with the cluster.
  • the data corresponding to FAT_0 and FAT_1 are respectively read into the memory, and the memory data is traversed according to the FAT32 protocol to obtain cluster linked list 0 corresponding to FAT_0 and cluster linked list 1 corresponding to FAT_1, that is, execute S230.
  • the method of obtaining cluster linked list 0 based on FAT_0 is as follows.
  • the 2nd cluster FFFFFF0F is the root directory cluster, and the 2nd cluster contains the end of file (EOF) identifier. Therefore, the 2nd cluster alone forms a cluster chain.
  • No. 3 cluster records the cluster number 0A000000 of the next associated cluster, that is, the next cluster associated with the No. 3 cluster is the No. 10 cluster; However, the No. 10 cluster is not in FAT_0, and the No. 3 cluster is temporarily added to the cluster as a cluster chain Linked list 0.
  • next cluster associated with No. 4 cluster 05000000 is cluster No. 5
  • the next cluster associated with No. 5 cluster 06000000 is cluster No. 6
  • the information FFFFFF0F recorded in cluster No. 6 indicates that cluster No. 6 is the tail cluster. 4 ⁇ 5 ⁇ 6 is added to the cluster list 0 as a cluster chain.
  • the number 7 cluster 00000000 indicates that the cluster is free, and the number 7 cluster is not added to the cluster linked list 0.
  • the next cluster associated with the 8th cluster 09000000 is the 9th cluster, and the information FFFFFF0F recorded in the 9th cluster indicates that the 9th cluster is the tail cluster. 8 ⁇ 9 is added to the cluster list 0 as a cluster chain.
  • the method of obtaining cluster linked list 1 based on FAT_1 is as follows.
  • the next cluster related to cluster 10 0B000000 is cluster 11
  • the next cluster related to cluster 11 0C000000 is cluster 12
  • the next cluster related to cluster 12 0D000000 is cluster 13
  • the next cluster related to cluster 13 0E000000
  • the cluster is the 14th cluster
  • the FFFFFF0F recorded in the 14th cluster indicates that the 14th cluster is the last cluster of the file. 10 ⁇ 11 ⁇ 12 ⁇ 13 ⁇ 14 is added to the cluster list 1 as a cluster chain.
  • cluster 16 The next cluster associated with cluster 15 10000000 is cluster 16, and the next cluster associated with cluster 08000000 is cluster 8. However, cluster 8 is not in FAT_1, temporarily add 15 ⁇ 16 as a cluster chain to the cluster list 1 .
  • the number 17 cluster 00000000 indicates that the cluster is free, and the number 17 cluster is not added to the cluster linked list 1.
  • the cluster linked list 0 and the cluster linked list 1 are obtained, the cluster linked list is merged, that is, S240 is executed.
  • the principle of merging is: traverse all cluster chain heads and cluster chain tails in all cluster linked lists; merge cluster chains with associated cluster chain heads and cluster chain tails in all cluster linked lists to generate a complete cluster linked list.
  • Figure 4 shows a method of merging cluster linked list 0 and cluster linked list 1.
  • cluster linked list 1 cluster 2 no longer has subsequent associated clusters, and cluster 2 is skipped; the next cluster associated with cluster 3 is cluster 10, and cluster linked list 1 contains cluster 10, so cluster 3 is connected to the cluster chain 10 ⁇ 11 ⁇ 12 ⁇ 13 ⁇ 14 to merge, get cluster chain 3 ⁇ 10 ⁇ 11 ⁇ 12 ⁇ 13 ⁇ 14; in cluster chain 4 ⁇ 5 ⁇ 6, cluster 6 is the tail cluster, skip this cluster chain; In the chain 8 ⁇ 9, cluster 9 is the tail cluster, and the cluster chain is skipped.
  • the cluster chain table 1 the last cluster of the cluster chain 10 ⁇ 11 ⁇ 12 ⁇ 13 ⁇ 14 is the 14th cluster, and the 14th cluster is the tail cluster, skip this cluster; the last cluster of the cluster chain 15 ⁇ 16 is the 16th cluster , The next cluster associated with the 16th cluster is the 8th cluster, and the cluster linked list 0 contains the 8th cluster, then the cluster chain 15 ⁇ 16 can be merged with the cluster chain 8 ⁇ 9 to obtain the cluster chain 15 ⁇ 16 ⁇ 8 ⁇ 9.
  • cluster chain 2 cluster chain 3 ⁇ 10 ⁇ 11 ⁇ 12 ⁇ 13 ⁇ 14, cluster chain 4 ⁇ 5 ⁇ 6, cluster chain 15 ⁇ 16 ⁇ 8 ⁇ 9 constitute a complete cluster linked list (ie, target cluster linked list), As shown in Figure 5.
  • the cluster size of the FAT32 file system is 64KB. If the FAT is not split, the memory size required to generate the cluster linked list can be calculated to be about 8MB according to (128GB/64KB)*4. After the FAT is divided into two, the storage space corresponding to each sub-FAT is 64GB. According to (64GB/64KB)*4, it can be calculated that the memory size required to generate the cluster linked list is about 4MB. Therefore, the method 200 uses a small amount of memory in the process of generating the complete cluster linked list, thereby reducing the cost of the electronic device using the FAT file system.
  • the FAT can also be divided into four equal parts to obtain four sub-FATs, and the cluster linked lists corresponding to the four sub-FATs are merged to generate a complete cluster linked list.
  • cluster linked list 0 is generated based on FAT_0
  • cluster linked list 1 is generated based on FAT_1
  • cluster linked list 2 is generated based on FAT_2
  • cluster linked list 3 is generated based on FAT_3; then, cluster linked list 0, cluster linked list 1, cluster linked list 2 and clusters are traversed All cluster chain heads and cluster chain tails in linked list 3 are combined with cluster chains that have an association relationship.
  • the cluster size of the FAT32 file system is 64KB. After the FAT is divided into two, the storage space corresponding to each sub-FAT is 32GB. According to (32GB/64KB)*4, the cluster linked list can be calculated and generated.
  • the required memory size is approximately 2MB.
  • the processor can perform the following steps.
  • the directory entry tree can be constructed, the directory entry tree is corrected according to the target cluster linked list, the target cluster linked list is corrected according to the directory entry tree, the DBR, the target cluster linked list and the directory entry tree are written back to complete the repair of the FAT file system.
  • the process is shown in Figure 7. The method of repairing the FAT file system based on the target cluster linked list is described in detail below.
  • the directory entry is the description information of the file, and the name, creation time, file type (file or directory), starting cluster number, size and other information of the file are recorded in the directory entry.
  • a tree structure that is, a directory item tree, where each node in the directory item tree is a directory item.
  • the directory entry tree is traversed, and if the directory entry does not match the corresponding cluster chain, the directory entry is repaired according to the cluster chain.
  • the cluster size is 64KB
  • the starting cluster number is 5, and the size of the directory entry with the size of 183KB matches the cluster chain head is 5, and the length is 2 cluster chains
  • the cluster chain shows that the file size is 128K (64*2)
  • the directory entry records The file size of 183KB indicates that the file system is damaged. You can modify the file size information of the directory entry to 128KB.
  • the cluster chain in the target cluster linked list does not have a matching directory entry, the cluster chain is deleted from the target cluster linked list to complete the repair of the cluster chain.
  • the corresponding device includes a hardware structure and/or software module corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professional technicians can use different methods for each specific application to realize the described functions, but such realization should not be considered as going beyond the scope of this application.
  • the present application may divide the device for repairing the file system into functional units according to the foregoing method examples.
  • each function may be divided into each functional unit, or two or more functions may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in this application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • Fig. 8 shows a schematic structural diagram of an apparatus for repairing a file system provided by the present application.
  • the device 700 includes a processing unit 810.
  • the processing unit 810 is configured to: obtain the FAT; divide the FAT into N sub-FATs, where N is a positive integer greater than 1; generate N cluster linked lists according to the N sub-FATs; merge the N cluster linked lists Generate a target cluster linked list; repair the FAT file system according to the target cluster linked list.
  • the number of clusters included in the N sub-FATs is the same.
  • clusters included in at least one sub-FAT in the N sub-FATs are clusters with consecutive numbers.
  • the processing unit 810 is specifically configured to: traverse all cluster chain heads and cluster chain tails in the N cluster linked lists; merge cluster chain heads and cluster chain tails in the N cluster linked lists that have an associated relationship Cluster chain, generating the target cluster linked list.
  • Fig. 9 shows a schematic structural diagram of a device for predicting the state of a node provided by the present application.
  • the dotted line in Figure 9 indicates that the unit or the module is optional.
  • the device 900 may be used to implement the methods described in the foregoing method embodiments.
  • the device 900 may be a terminal device or a server or a chip.
  • the device 900 includes one or more processors 901, and the one or more processors 901 can support the device 900 to implement the method in the method embodiment.
  • the processor 901 may be a general-purpose processor or a special-purpose processor.
  • the processor 901 may be a central processing unit (CPU).
  • the CPU can be used to control the device 900, execute a software program, and process data of the software program.
  • the device 900 may also include a communication unit 905 to implement input (reception) and/or output (transmission) of signals (such as FAT).
  • the device 900 may be a chip, and the communication unit 905 may be an input and/or output circuit of the chip, or the communication unit 905 may be a communication interface of the chip, and the chip may be used as a terminal device or a network device or other electronic device. component.
  • the device 900 may be a terminal device or a server
  • the communication unit 905 may be a transceiver of the terminal device or the server
  • the communication unit 905 may be a transceiver circuit of the terminal device or the server.
  • the device 900 may include one or more memories 902, on which a program 904 is stored.
  • the program 904 can be run by the processor 901 to generate an instruction 903, so that the processor 901 executes the method described in the foregoing method embodiment according to the instruction 903.
  • the memory 902 may also store data (such as a file corresponding to FAT).
  • the processor 901 may also read data stored in the memory 902. The data may be stored at the same storage address as the program 904, and the data may also be stored at a different storage address from the program 904.
  • the processor 901 and the memory 902 may be provided separately or integrated together, for example, integrated on a system-on-chip (SOC) of the terminal device.
  • SOC system-on-chip
  • the processor 901 may be a CPU, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices , For example, discrete gates, transistor logic devices, or discrete hardware components.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • This application also provides a computer program product, which, when executed by the processor 901, implements the method described in any method embodiment in this application.
  • the computer program product may be stored in the memory 902, for example, a program 904.
  • the program 904 is finally converted into an executable object file that can be executed by the processor 901 through processing processes such as preprocessing, compilation, assembly, and linking.
  • the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the method described in any method embodiment in the present application is implemented.
  • the computer program can be a high-level language program or an executable target program.
  • the computer-readable storage medium is, for example, the memory 902.
  • the memory 902 may be a volatile memory or a non-volatile memory, or the memory 902 may include both a volatile memory and a non-volatile memory.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasable PROM, EPROM), a Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • dynamic RAM dynamic RAM
  • DRAM dynamic random access memory
  • synchronous dynamic random access memory synchronous DRAM, SDRAM
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous connection dynamic random access memory serial DRAM, SLDRAM
  • direct rambus RAM direct rambus RAM, DR RAM
  • the disclosed system, device, and method may be implemented in other ways. For example, some features of the method embodiments described above may be ignored or not implemented.
  • the device embodiments described above are merely illustrative.
  • the division of units is only a logical function division. In actual implementation, there may be other division methods, and multiple units or components may be combined or integrated into another system.
  • the coupling between the various units or the coupling between the various components may be direct coupling or indirect coupling, and the foregoing coupling includes electrical, mechanical, or other forms of connection.
  • the size of the sequence number does not mean the order of execution.
  • the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. .

Landscapes

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

Abstract

A method for repairing a file system, the method comprising: acquiring a FAT (S210); segmenting the FAT into N sub-FATs, wherein N is a positive integer greater than 1 (S220); generating N cluster chain tables according to the N sub-FATs (S230); merging the N cluster chain tables to generate a target cluster chain table (S240); and repairing a FAT file system according to the target cluster chain table (S250). After a FAT is segmented into N sub-FATs, the number of clusters included in each sub-FAT is less than the number of clusters included in the FAT, and therefore, the amount of memory required for generating a cluster chain table on the basis of each sub-FAT is small. Compared with a method whereby a complete cluster chain table is directly generated according to a FAT and a file system is repaired, the method does not require a large memory during the process of repairing a file system, thereby reducing the cost of an electronic device with a FAT file system.

Description

修复文件系统的方法和装置Method and device for repairing file system 技术领域Technical field
本申请涉及计算机领域,具体涉及一种修复文件系统的方法和装置。This application relates to the field of computers, and in particular to a method and device for repairing a file system.
背景技术Background technique
文件分配表(file allocation table,FAT)文件系统是一种应用广泛的存储系统,例如,行车记录仪、运动数码摄像机(digital video,DV)、智能家庭摄像机等消费级摄像产品均使用FAT文件系统来存储数据。The file allocation table (FAT) file system is a widely used storage system. For example, consumer-grade video products such as driving recorders, digital video cameras (digital video, DV), smart home cameras, etc. all use the FAT file system To store data.
这类消费级摄像产品通常采用外插式存储设备,外插式存储设备容易发生异常掉电、热插拔等情况,此时会导致FAT文件系统损坏。例如,汽车在行驶过程中发生了碰撞,行车记录仪的安全数码记忆(secure digital memory,SD)卡被弹出,导致SD卡的FAT文件系统受到损坏,则需要对SD卡的FAT文件系统进行修复。Such consumer-grade camera products usually use external storage devices, which are prone to abnormal power failure, hot swapping, etc., which can cause damage to the FAT file system. For example, if a car crashes during driving, the secure digital memory (SD) card of the driving recorder is ejected, causing the FAT file system of the SD card to be damaged, and the FAT file system of the SD card needs to be repaired. .
一种修复FAT文件系统的方法是基于FAT构建簇链(cluster chain),基于簇链修复FAT文件系统。在构建簇链的过程中,需要使用与FAT的大小(FAT size)相同的内存,该内存需求对于消费级产品来说是一个较大的负担,如何减小修复FAT文件系统所需的内存是当前需要解决的问题。One method to repair the FAT file system is to build a cluster chain based on FAT, and repair the FAT file system based on the cluster chain. In the process of constructing the cluster chain, it is necessary to use the same memory as the FAT size. This memory requirement is a larger burden for consumer products. How to reduce the memory required to repair the FAT file system is Current issues that need to be resolved.
发明内容Summary of the invention
本申请提供了一种修复文件系统的方法,能够减小修复FAT文件系统所需的内存。This application provides a method for repairing a file system, which can reduce the memory required for repairing a FAT file system.
第一方面,提供了一种修复文件系统的方法,包括:获取FAT;将所述FAT切分为N个子FAT,N为大于1的正整数;根据所述N个子FAT生成N个簇链表;对所述N个簇链表进行合并处理生成目标簇链表;根据所述目标簇链表修复FAT文件系统。In a first aspect, a method for repairing a file system is provided, including: obtaining a FAT; dividing the FAT into N sub-FATs, where N is a positive integer greater than 1, and generating N cluster linked lists based on the N sub-FATs; The N cluster linked lists are merged to generate a target cluster linked list; the FAT file system is repaired according to the target cluster linked list.
将FAT切分为N个子FAT后,每个子FAT包含的簇的数量少于FAT包含的簇的数量,因此,基于每个子FAT生成簇链表时所需的内存较小;逐个生成N个簇链表后,对该N个簇链表进行合并处理生成目标簇链表,目标簇链表是与FAT对应的完整簇链表,可以用于修复FAT文件系统。相比于直接根据FAT生成完整簇链表并修复文件系统的方法,本申请提供的方法在修复文件系统的过程中无需使用大内存,从而减小了应用FAT文件系统的电子设备的成本。After the FAT is divided into N sub-FATs, the number of clusters contained in each sub-FAT is less than the number of clusters contained in the FAT. Therefore, the memory required to generate the cluster linked list based on each sub-FAT is small; N cluster linked lists are generated one by one Then, the N cluster linked lists are merged to generate a target cluster linked list. The target cluster linked list is a complete cluster linked list corresponding to the FAT and can be used to repair the FAT file system. Compared with the method of directly generating a complete cluster linked list based on FAT and repairing the file system, the method provided in this application does not need to use large memory in the process of repairing the file system, thereby reducing the cost of electronic equipment using the FAT file system.
可选地,所述N个子FAT包含的簇的数量相同。Optionally, the number of clusters included in the N sub-FATs is the same.
当子FAT的数量确定时,等分FAT所生成的子FAT包含的簇的数量更少。例如,FAT包含10个簇,N等于2,可以基于等分方案将该FAT分为两个分别包含5个簇的子FAT,也可以基于非等分方案将该FAT分为一个包含4个簇的子FAT和一个包含6个簇的子FAT,包含5个簇的子FAT所需的内存比包含6个簇的子FAT所需的内存小,因此,按照等分方案切分FAT能够减少子FAT所需的内存。When the number of sub-FATs is determined, the sub-FATs generated by dividing the FAT equally contain fewer clusters. For example, FAT contains 10 clusters, and N is equal to 2. The FAT can be divided into two sub-FATs containing 5 clusters based on the equal division scheme, or the FAT can be divided into one sub-FAT containing 4 clusters based on the non-equal division scheme. Sub-FAT and a sub-FAT containing 6 clusters. The sub-FAT containing 5 clusters requires less memory than the sub-FAT containing 6 clusters. Therefore, dividing the FAT according to the equal partitioning scheme can reduce the number of sub-FATs. Memory required for FAT.
可选地,所述N个子FAT中至少一个子FAT包含的簇为编号连续的簇。Optionally, clusters included in at least one sub-FAT in the N sub-FATs are clusters with consecutive numbers.
例如,FAT包含6个簇,编号分别为2、3、4、5、6、7,可以基于连续划分方案将编号为2、3、4的簇划分至一个子FAT,以及将编号为5、6、7的簇划分至另一个子FAT;也可以基于非连续划分方案将编号为2、4、6的簇划分至一个子FAT,以及将编号为3、5、6的簇划分至另一个子FAT。连续划分方案中,一个子FAT所包含的簇有更大的概率属于一个簇链,能够减少簇链的合并次数,从而减小对计算资源的消耗。For example, the FAT contains 6 clusters, numbered 2, 3, 4, 5, 6, and 7. The clusters numbered 2, 3, and 4 can be divided into one sub-FAT based on the continuous division scheme, and the numbers are 5, The clusters 6 and 7 are divided into another sub-FAT; the clusters numbered 2, 4, and 6 can be divided into one sub-FAT based on the non-contiguous division scheme, and the clusters numbered 3, 5, and 6 can be divided into another sub-FAT Sub FAT. In the continuous division scheme, the clusters contained in a sub-FAT have a greater probability of belonging to a cluster chain, which can reduce the number of merging cluster chains, thereby reducing the consumption of computing resources.
可选地,所述对所述N个簇链集合进行合并处理生成目标簇链集合,包括:遍历所述N个簇链表中所有的簇链头和簇链尾;合并所述N个簇链表中簇链头与簇链尾具有关联关系的簇链,生成所述目标簇链表。Optionally, the merging process of the N cluster chain sets to generate a target cluster chain set includes: traversing all cluster chain heads and cluster chain tails in the N cluster linked lists; and merging the N cluster linked lists The cluster chain having an association relationship between the middle cluster chain head and the cluster chain tail generates the target cluster linked list.
遍历所有的簇链头和簇链尾,然后合并具有关联关系的簇链,能够避免属于一个簇链的多个子簇链被遗漏,提高FAT文件系统修复的成功率。Traverse all cluster chain heads and cluster chain tails, and then merge cluster chains with associated relationships, which can prevent multiple sub-cluster chains belonging to a cluster chain from being missed, and improve the success rate of FAT file system repair.
第二方面,本申请提供了一种修复文件系统的装置,包括用于执行第一方面所述的方法的单元。该装置可以是终端设备或服务器,也可以是终端设备或服务器内的芯片。该装置可以包括输入单元和处理单元。In a second aspect, the present application provides an apparatus for repairing a file system, including a unit for executing the method described in the first aspect. The device can be a terminal device or a server, or a chip in the terminal device or the server. The device may include an input unit and a processing unit.
当该装置是终端设备或服务器时,该处理单元可以是处理器,该输入单元可以是收发器;该终端设备还可以包括存储单元,该存储单元可以是存储器;该存储单元用于存储指令,该处理单元执行该存储单元所存储的指令,以使该终端设备或该服务器执行第一方面所述的方法。When the device is a terminal device or a server, the processing unit may be a processor, and the input unit may be a transceiver; the terminal device may also include a storage unit, and the storage unit may be a memory; the storage unit is used to store instructions, The processing unit executes the instructions stored in the storage unit, so that the terminal device or the server executes the method described in the first aspect.
当该装置是终端设备或服务器内的芯片时,该处理单元可以是芯片内部的处理单元,该输入单元可以是输入/输出接口、管脚或电路等;该处理单元执行存储单元所存储的指令,以使该芯片执行第一方面所述的方法,该存储单元可以是该芯片内的存储单元(例如,寄存器、缓存等),也可以是位于该芯片外部的存储单元(例如,只读存储器、随机存取存储器等)。When the device is a chip in a terminal device or a server, the processing unit can be a processing unit inside the chip, and the input unit can be an input/output interface, a pin or a circuit, etc.; the processing unit executes instructions stored in the storage unit , So that the chip executes the method described in the first aspect, the storage unit can be a storage unit (for example, a register, a cache, etc.) in the chip, or a storage unit (for example, a read-only memory) located outside the chip. , Random Access Memory, etc.).
第三方面,本申请提供了一种计算机可读存储介质,该计算机可读存储介质中存储了计算机程序,该计算机程序被处理器执行时,使得处理器执行第一方面所述的方法。In a third aspect, the present application provides a computer-readable storage medium in which a computer program is stored. When the computer program is executed by a processor, the processor executes the method described in the first aspect.
第四方面,本申请提供了一种计算机程序产品,该计算机程序产品包括:计算机程序代码,当该计算机程序代码被处理器运行时,使得处理器执行第一方面所述的方法。In a fourth aspect, the present application provides a computer program product, the computer program product comprising: computer program code, when the computer program code is executed by a processor, the processor executes the method described in the first aspect.
附图说明Description of the drawings
图1是一种适用于本申请的FAT文件系统的示意图;Figure 1 is a schematic diagram of a FAT file system suitable for this application;
图2是本申请提供的一种修复文件系统的方法的示意图;FIG. 2 is a schematic diagram of a method for repairing a file system provided by the present application;
图3是本申请提供的一种划分子FAT的方法的示意图;FIG. 3 is a schematic diagram of a method for dividing sub-FAT provided by this application;
图4是本申请提供的一种合并子簇链表的方法的示意图;Fig. 4 is a schematic diagram of a method for merging linked lists of sub-clusters provided by the present application;
图5是本申请提供的一种完整簇链表的示意图;Figure 5 is a schematic diagram of a complete cluster linked list provided by this application;
图6是本申请提供的另一种合并子簇链表的方法的示意图;Fig. 6 is a schematic diagram of another method for merging linked lists of sub-clusters provided by the present application;
图7是本申请提供的另一种修复文件系统的方法的示意图;FIG. 7 is a schematic diagram of another method for repairing a file system provided by this application;
图8是本申请提供的一种修复文件系统的装置的示意图;FIG. 8 is a schematic diagram of a device for repairing a file system provided by the present application;
图9是本申请提供的一种修复文件系统的设备的示意图。Fig. 9 is a schematic diagram of a device for repairing a file system provided by the present application.
具体实施方式detailed description
下面将结合附图,对本申请中的技术方案进行描述。The technical solution in this application will be described below in conjunction with the accompanying drawings.
图1示出了适用于本申请的一种FAT文件系统的示意图。Figure 1 shows a schematic diagram of a FAT file system suitable for this application.
FAT文件系统100包括磁盘操作系统引导启动记录(disk operating system boot record,DBR)110、FAT120和数据区(DATA)130。The FAT file system 100 includes a disk operating system boot record (DBR) 110, a FAT 120, and a data area (DATA) 130.
DBR110主要用于记录单个扇区的容量、扇区的总数、单个FAT的大小、FAT的数量、簇容量等基础信息,DRB110还存储有文件系统信息(file system information,FSInfo),FSInfo包括可用的簇的数量、最后分配出去的簇号等信息。DBR110 is mainly used to record basic information such as the capacity of a single sector, the total number of sectors, the size of a single FAT, the number of FATs, and the cluster capacity. DRB110 also stores file system information (FSInfo). FSInfo includes available Information such as the number of clusters and the last allocated cluster number.
FAT文件系统100可以是FAT32文件系统,也可以是FAT16文件系统或其它类型的FAT文件系统。对于FAT32文件系统,一个簇对应4个字节(byte)大小的存储空间,即使某个文件只有一个字节,操作系统也会为该文件分配一个簇(即,分配一个簇对应的存储空间),因此,簇是FAT文件系统的基本存储单位。The FAT file system 100 may be a FAT32 file system, a FAT16 file system or other types of FAT file systems. For the FAT32 file system, a cluster corresponds to 4 bytes of storage space. Even if a file has only one byte, the operating system will allocate a cluster for the file (that is, allocate storage space corresponding to a cluster) Therefore, the cluster is the basic storage unit of the FAT file system.
FAT120记录了分区中所有的目录和文件的簇链。FAT120 records the cluster chain of all directories and files in the partition.
大文件需要被分配多个簇,但是,一个文件并不一定存放在磁盘中的一个连续的区域内,可能会被分为若干段,像链子一样存放,这种存储方式成为链式存储,记录一个文件的存储地址的一个或多个簇即簇链。为了实现链式存储,FAT120需要记录哪些簇已被文件占用,以及每个被占用的簇关联的下一个簇的簇号;对于文件占用的最后一个簇,FAT120需要记录该簇是最后一个簇。FAT120还可以记录空闲簇和坏簇。Large files need to be allocated to multiple clusters. However, a file is not necessarily stored in a continuous area on the disk. It may be divided into several segments and stored like a chain. This storage method is called chain storage, recording One or more clusters of the storage address of a file are cluster chains. In order to achieve chain storage, FAT120 needs to record which clusters are occupied by the file, and the cluster number of the next cluster associated with each occupied cluster; for the last cluster occupied by the file, FAT120 needs to record that the cluster is the last cluster. FAT120 can also record free clusters and bad clusters.
数据区130记录了目录项和用户数据。The data area 130 records directory entries and user data.
FAT文件系统100是适用于本申请的FAT文件系统的一个示例,适用于本申请的FAT文件系统还可以具有其它结构,例如包括两个FAT的FAT文件系统。The FAT file system 100 is an example of a FAT file system applicable to the present application. The FAT file system applicable to the present application may also have other structures, such as a FAT file system including two FATs.
如果DBR110、FAT120和数据区130中的数据出现错误,就可能导致FAT文件系统100不可读写,需要对FAT文件系统100进行修复。If the data in the DBR110, FAT120, and data area 130 is wrong, the FAT file system 100 may be unreadable and writable, and the FAT file system 100 needs to be repaired.
下面以FAT32文件系统为例介绍本申请提供的修复文件系统的方法,该方法可以由处理器执行。The following uses the FAT32 file system as an example to introduce the method for repairing the file system provided by this application, and the method can be executed by a processor.
首先可以校验DBR。校验DBR时,处理器可以将DBR从分区读到内存中,按照FAT32协议与分区设备硬件特性校验DBR,如果DBR存在错误则在内存中进行修复。The DBR can be verified first. When verifying the DBR, the processor can read the DBR from the partition into the memory, verify the DBR according to the FAT32 protocol and the hardware characteristics of the partition device, and repair it in the memory if there is an error in the DBR.
DBR校验完毕后可以构建簇链表,构建簇链表的方法如图2所示,方法200包括如下步骤。After the DBR check is completed, the cluster linked list can be constructed. The method for constructing the cluster linked list is shown in FIG. 2. The method 200 includes the following steps.
S210,获取FAT。S210: Obtain FAT.
S220,将所述FAT切分为N个子FAT,N为大于1的正整数。S220: Divide the FAT into N sub-FATs, where N is a positive integer greater than 1.
在切分FAT时,可以等分FAT,也可以不等分FAT,其中,等分FAT指的是按照每个子FAT包含的簇的数量相等的方式进行切分。当子FAT的数量确定时,等分FAT所生成的子FAT包含的簇的数量更少。When dividing the FAT, the FAT can be divided equally or unequal. Among them, the divided FAT refers to the way that the number of clusters contained in each sub-FAT is equal. When the number of sub-FATs is determined, the sub-FATs generated by dividing the FAT equally contain fewer clusters.
例如,FAT包含10个簇,N等于2,可以基于等分方案将该FAT分为两个分别包含5个簇的子FAT,也可以基于非等分方案将该FAT分为一个包含4个簇的子FAT和一个包含6个簇的子FAT,包含5个簇的子FAT所需的内存比包含6个簇的子FAT所需的内存小,因此,按照等分方案切分FAT能够减少子FAT所需的内存。For example, FAT contains 10 clusters, and N is equal to 2. The FAT can be divided into two sub-FATs containing 5 clusters based on the equal division scheme, or the FAT can be divided into one sub-FAT containing 4 clusters based on the non-equal division scheme. Sub-FAT and a sub-FAT containing 6 clusters. The sub-FAT containing 5 clusters requires less memory than the sub-FAT containing 6 clusters. Therefore, dividing the FAT according to the equal partitioning scheme can reduce the number of sub-FATs. Memory required for FAT.
图3示出了一种划分子FAT的方法。Figure 3 shows a method of dividing sub-FATs.
FAT120中,每个簇对应4个字节的磁盘空间。从FAT120的左上角开始,F8FFFF0F 为0号簇,FFFFFF0F为1号簇,以此类推,第一行为0号簇至3号簇,第二行为4号簇至7号簇,第三行为8号簇至11号簇,第四行为12号簇至15号簇,第五行为16号簇和17号簇。FAT120记录了18个簇,其中,0号簇和1号簇为保留项,是FAT120的固定的起始标识,不被任何文件引用,可以从2号簇开始对FAT120进行划分。In FAT120, each cluster corresponds to 4 bytes of disk space. Starting from the upper left corner of FAT120, F8FFFF0F is cluster 0, FFFFFF0F is cluster 1, and so on, the first row is cluster 0 to cluster 3, the second row is cluster 4 to cluster 7, and the third row is cluster 8. From clusters to cluster 11, the fourth row is from cluster 12 to cluster 15, and the fifth row is cluster 16 and cluster 17. FAT120 records 18 clusters. Among them, cluster 0 and cluster 1 are reserved items, which are fixed starting identifiers of FAT120, and are not referenced by any file. FAT120 can be divided from cluster 2 on.
例如,可以将剩余的簇划分为2个子FAT,每个子FAT包括8个簇,其中,可以将编号连续的簇划分至一个子FAT,如图3中的虚线所示。按照上述方法划分得到的两个子FAT分别为FAT_0和FAT_1,FAT_0包括2号簇至9号簇,FAT_1包括10号簇至17号簇。图3中,FAT_0和FAT_1中的数字表示该簇关联的下一个簇的簇号。For example, the remaining clusters can be divided into 2 sub-FATs, and each sub-FAT includes 8 clusters. Among them, clusters with consecutive numbers can be divided into one sub-FAT, as shown by the dotted line in FIG. 3. The two sub-FATs obtained by dividing according to the above method are respectively FAT_0 and FAT_1. FAT_0 includes clusters 2 to 9 and FAT_1 includes clusters 10 to 17. In Figure 3, the numbers in FAT_0 and FAT_1 indicate the cluster number of the next cluster associated with the cluster.
接下来分别将FAT_0和FAT_1对应的数据读入内存,按照FAT32协议遍历内存数据,得到FAT_0对应的簇链表0和FAT_1对应的簇链表1,即,执行S230。Next, the data corresponding to FAT_0 and FAT_1 are respectively read into the memory, and the memory data is traversed according to the FAT32 protocol to obtain cluster linked list 0 corresponding to FAT_0 and cluster linked list 1 corresponding to FAT_1, that is, execute S230.
S230,根据所述N个子FAT生成N个簇链表。S230: Generate N cluster linked lists according to the N sub-FATs.
下面介绍得到簇链表0和簇链表1的方法。The following describes how to obtain cluster linked list 0 and cluster linked list 1.
基于FAT_0得到簇链表0的方法如下所示。The method of obtaining cluster linked list 0 based on FAT_0 is as follows.
2号簇FFFFFF0F是根目录簇,2号簇包含文件结束(end of file,EOF)标识,因此,2号簇单独组成一个簇链。The 2nd cluster FFFFFF0F is the root directory cluster, and the 2nd cluster contains the end of file (EOF) identifier. Therefore, the 2nd cluster alone forms a cluster chain.
3号簇记录了关联的下一个簇的簇号0A000000,即,3号簇关联的下一个簇为10号簇;但是,10号簇不在FAT_0中,暂时将3号簇作为一个簇链加入簇链表0。No. 3 cluster records the cluster number 0A000000 of the next associated cluster, that is, the next cluster associated with the No. 3 cluster is the No. 10 cluster; However, the No. 10 cluster is not in FAT_0, and the No. 3 cluster is temporarily added to the cluster as a cluster chain Linked list 0.
4号簇05000000关联的下一个簇为5号簇,5号簇06000000关联的下一个簇为6号簇,6号簇记录的信息FFFFFF0F表示6号簇为尾簇。4→5→6作为一个簇链加入簇链表0。The next cluster associated with No. 4 cluster 05000000 is cluster No. 5, the next cluster associated with No. 5 cluster 06000000 is cluster No. 6, and the information FFFFFF0F recorded in cluster No. 6 indicates that cluster No. 6 is the tail cluster. 4→5→6 is added to the cluster list 0 as a cluster chain.
7号簇00000000表示该簇为空闲簇,7号簇不加入簇链表0。The number 7 cluster 00000000 indicates that the cluster is free, and the number 7 cluster is not added to the cluster linked list 0.
8号簇09000000关联的下一个簇为9号簇,9号簇记录的信息FFFFFF0F表示9号簇为尾簇。8→9作为一个簇链加入簇链表0。The next cluster associated with the 8th cluster 09000000 is the 9th cluster, and the information FFFFFF0F recorded in the 9th cluster indicates that the 9th cluster is the tail cluster. 8→9 is added to the cluster list 0 as a cluster chain.
基于FAT_1得到簇链表1的方法如下所示。The method of obtaining cluster linked list 1 based on FAT_1 is as follows.
10号簇0B000000关联的下一个簇为11号簇,11号簇0C000000关联的下一个簇为12号簇,12号簇0D000000关联的下一个簇为13号簇,13号簇0E000000关联的下一个簇为14号簇,14号簇记录的FFFFFF0F表示14号簇为该文件的尾簇。10→11→12→13→14作为一个簇链加入簇链表1。The next cluster related to cluster 10 0B000000 is cluster 11, the next cluster related to cluster 11 0C000000 is cluster 12, the next cluster related to cluster 12 0D000000 is cluster 13, and the next cluster related to cluster 13 0E000000 The cluster is the 14th cluster, and the FFFFFF0F recorded in the 14th cluster indicates that the 14th cluster is the last cluster of the file. 10→11→12→13→14 is added to the cluster list 1 as a cluster chain.
15号簇10000000关联的下一个簇为16号簇,16号簇08000000关联的下一个簇为8号簇;但是,8号簇不在FAT_1中,暂时将15→16作为一个簇链加入簇链表1。The next cluster associated with cluster 15 10000000 is cluster 16, and the next cluster associated with cluster 08000000 is cluster 8. However, cluster 8 is not in FAT_1, temporarily add 15→16 as a cluster chain to the cluster list 1 .
17号簇00000000表示该簇为空闲簇,17号簇不加入簇链表1。The number 17 cluster 00000000 indicates that the cluster is free, and the number 17 cluster is not added to the cluster linked list 1.
获得簇链表0和簇链表1之后,进行簇链表的合并,即,执行S240。After the cluster linked list 0 and the cluster linked list 1 are obtained, the cluster linked list is merged, that is, S240 is executed.
S240,对所述N个簇链表进行合并处理生成目标簇链表。S240, merging the N cluster linked lists to generate a target cluster linked list.
合并原则是:遍历全部簇链表中所有的簇链头和簇链尾;合并全部簇链表中簇链头与簇链尾具有关联关系的簇链,生成完整簇链表。The principle of merging is: traverse all cluster chain heads and cluster chain tails in all cluster linked lists; merge cluster chains with associated cluster chain heads and cluster chain tails in all cluster linked lists to generate a complete cluster linked list.
遍历所有的簇链头和簇链尾,然后合并具有关联关系的簇链,能够避免属于一个簇链的多个子簇链被遗漏,提高FAT文件系统修复的成功率。Traverse all cluster chain heads and cluster chain tails, and then merge cluster chains with associated relationships, which can prevent multiple sub-cluster chains belonging to a cluster chain from being missed, and improve the success rate of FAT file system repair.
图4示出了合并簇链表0和簇链表1的方法。Figure 4 shows a method of merging cluster linked list 0 and cluster linked list 1.
簇链表0中,2号簇不再有后续关联簇,跳过2号簇;3号簇关联的下一个簇为10号簇,簇链表1包含10号簇,则将3号簇与簇链10→11→12→13→14进行合并,得到簇链 3→10→11→12→13→14;簇链4→5→6中,6号簇为尾簇,跳过该簇链;簇链8→9中,9号簇为尾簇,跳过该簇链。In cluster linked list 0, cluster 2 no longer has subsequent associated clusters, and cluster 2 is skipped; the next cluster associated with cluster 3 is cluster 10, and cluster linked list 1 contains cluster 10, so cluster 3 is connected to the cluster chain 10→11→12→13→14 to merge, get cluster chain 3→10→11→12→13→14; in cluster chain 4→5→6, cluster 6 is the tail cluster, skip this cluster chain; In the chain 8→9, cluster 9 is the tail cluster, and the cluster chain is skipped.
簇链表1中,簇链10→11→12→13→14的最后一个簇是14号簇,14号簇是尾簇,跳过该簇;簇链15→16的最后一个簇是16号簇,16号簇关联的下一个簇是8号簇,簇链表0包含8号簇,则可以将簇链15→16与簇链8→9进行合并,得到簇链15→16→8→9。In the cluster chain table 1, the last cluster of the cluster chain 10→11→12→13→14 is the 14th cluster, and the 14th cluster is the tail cluster, skip this cluster; the last cluster of the cluster chain 15→16 is the 16th cluster , The next cluster associated with the 16th cluster is the 8th cluster, and the cluster linked list 0 contains the 8th cluster, then the cluster chain 15→16 can be merged with the cluster chain 8→9 to obtain the cluster chain 15→16→8→9.
至此,簇链2、簇链3→10→11→12→13→14、簇链4→5→6、簇链15→16→8→9组成了完整簇链表(即,目标簇链表),如图5所示。At this point, cluster chain 2, cluster chain 3→10→11→12→13→14, cluster chain 4→5→6, cluster chain 15→16→8→9 constitute a complete cluster linked list (ie, target cluster linked list), As shown in Figure 5.
以电子设备的存储空间为128GB为例,FAT32文件系统的簇大小为64KB,若不拆分FAT,则根据(128GB/64KB)*4可以计算出生成簇链表所需的内存大小约为8MB。二等分FAT后,每个子FAT对应的存储空间为64GB,根据(64GB/64KB)*4可以计算出生成簇链表所需的内存大小约为4MB。因此,方法200在生成完整簇链表的过程中使用了较小的内存,从而减小了应用FAT文件系统的电子设备的成本。Taking the storage space of the electronic device as an example, the cluster size of the FAT32 file system is 64KB. If the FAT is not split, the memory size required to generate the cluster linked list can be calculated to be about 8MB according to (128GB/64KB)*4. After the FAT is divided into two, the storage space corresponding to each sub-FAT is 64GB. According to (64GB/64KB)*4, it can be calculated that the memory size required to generate the cluster linked list is about 4MB. Therefore, the method 200 uses a small amount of memory in the process of generating the complete cluster linked list, thereby reducing the cost of the electronic device using the FAT file system.
可选地,还可以将FAT四等分,得到四个子FAT,将该四个子FAT对应的簇链表进行合并,生成完整簇链表。如图6所示,基于FAT_0生成簇链表0,基于FAT_1生成簇链表1,基于FAT_2生成簇链表2,基于FAT_3生成簇链表3;随后,遍历簇链表0、簇链表1、簇链表2和簇链表3中的全部簇链头和簇链尾,合并具有关联关系的簇链。Optionally, the FAT can also be divided into four equal parts to obtain four sub-FATs, and the cluster linked lists corresponding to the four sub-FATs are merged to generate a complete cluster linked list. As shown in Figure 6, cluster linked list 0 is generated based on FAT_0, cluster linked list 1 is generated based on FAT_1, cluster linked list 2 is generated based on FAT_2, and cluster linked list 3 is generated based on FAT_3; then, cluster linked list 0, cluster linked list 1, cluster linked list 2 and clusters are traversed All cluster chain heads and cluster chain tails in linked list 3 are combined with cluster chains that have an association relationship.
以电子设备的存储空间为128GB为例,FAT32文件系统的簇大小为64KB,二等分FAT后,每个子FAT对应的存储空间为32GB,根据(32GB/64KB)*4可以计算出生成簇链表所需的内存大小约为2MB。Taking the storage space of the electronic device as an example, the cluster size of the FAT32 file system is 64KB. After the FAT is divided into two, the storage space corresponding to each sub-FAT is 32GB. According to (32GB/64KB)*4, the cluster linked list can be calculated and generated. The required memory size is approximately 2MB.
生成目标簇链表后,处理器可以执行下列步骤。After generating the target cluster linked list, the processor can perform the following steps.
S250,根据所述目标簇链表修复FAT文件系统。S250: Repair the FAT file system according to the target cluster linked list.
可以构建目录项树,根据目标簇链表纠正目录项树,根据目录项树纠正目标簇链表,回写DBR、目标簇链表和目录项树,从而完成FAT文件系统的修复。该过程如图7所示,下面详细介绍根据目标簇链表修复FAT文件系统的方法。The directory entry tree can be constructed, the directory entry tree is corrected according to the target cluster linked list, the target cluster linked list is corrected according to the directory entry tree, the DBR, the target cluster linked list and the directory entry tree are written back to complete the repair of the FAT file system. The process is shown in Figure 7. The method of repairing the FAT file system based on the target cluster linked list is described in detail below.
目录项是文件的描述信息,目录项中记录该文件的名称、创建时间、文件类型(文件或者目录)、起始簇号、大小等信息。从根目录开始,遍历所有目录项,得到一个树形结构,即,目录项树,其中,目录项树中的每一个节点为一个目录项。The directory entry is the description information of the file, and the name, creation time, file type (file or directory), starting cluster number, size and other information of the file are recorded in the directory entry. Starting from the root directory, all directory items are traversed to obtain a tree structure, that is, a directory item tree, where each node in the directory item tree is a directory item.
随后遍历目录项树,如果目录项与对应的簇链不匹配,则按照簇链修复目录项。例如:簇大小为64KB,起始簇号5,大小为183KB的目录项匹配上簇链头为5,长度为2簇链;簇链显示文件大小为128K(64*2),而目录项记录的文件大小为183KB,说明文件系统有损坏,可以将目录项的文件大小信息修改为128KB。Then the directory entry tree is traversed, and if the directory entry does not match the corresponding cluster chain, the directory entry is repaired according to the cluster chain. For example: the cluster size is 64KB, the starting cluster number is 5, and the size of the directory entry with the size of 183KB matches the cluster chain head is 5, and the length is 2 cluster chains; the cluster chain shows that the file size is 128K (64*2), and the directory entry records The file size of 183KB indicates that the file system is damaged. You can modify the file size information of the directory entry to 128KB.
在上一步检查之后,如果目标簇链表中的簇链没有匹配的目录项,则将该簇链从目标簇链表中删除,完成簇链的修复。After the previous check, if the cluster chain in the target cluster linked list does not have a matching directory entry, the cluster chain is deleted from the target cluster linked list to complete the repair of the cluster chain.
最后按照协议将修复的DBR、簇链和目录项回写到分区中。Finally, according to the agreement, the repaired DBR, cluster chain and directory entries are written back to the partition.
上文详细介绍了本申请提供的修复文件系统的方法的示例。可以理解的是,相应的装置为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人 员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The example of the method for repairing the file system provided by this application is described in detail above. It can be understood that, in order to realize the above-mentioned functions, the corresponding device includes a hardware structure and/or software module corresponding to each function. Those skilled in the art should easily realize that in combination with the units and algorithm steps of the examples described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professional technicians can use different methods for each specific application to realize the described functions, but such realization should not be considered as going beyond the scope of this application.
本申请可以根据上述方法示例对修复文件系统的装置进行功能单元的划分,例如,可以将各个功能划分为各个功能单元,也可以将两个或两个以上的功能集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The present application may divide the device for repairing the file system into functional units according to the foregoing method examples. For example, each function may be divided into each functional unit, or two or more functions may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in this application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
图8示出了本申请提供的一种修复文件系统的装置的结构示意图。装置700包括处理单元810。Fig. 8 shows a schematic structural diagram of an apparatus for repairing a file system provided by the present application. The device 700 includes a processing unit 810.
处理单元810用于:获取FAT;将所述FAT切分为N个子FAT,N为大于1的正整数;根据所述N个子FAT生成N个簇链表;对所述N个簇链表进行合并处理生成目标簇链表;根据所述目标簇链表修复FAT文件系统。The processing unit 810 is configured to: obtain the FAT; divide the FAT into N sub-FATs, where N is a positive integer greater than 1; generate N cluster linked lists according to the N sub-FATs; merge the N cluster linked lists Generate a target cluster linked list; repair the FAT file system according to the target cluster linked list.
可选地,所述N个子FAT包含的簇的数量相同。Optionally, the number of clusters included in the N sub-FATs is the same.
可选地,所述N个子FAT中至少一个子FAT包含的簇为编号连续的簇。Optionally, clusters included in at least one sub-FAT in the N sub-FATs are clusters with consecutive numbers.
可选地,所述处理单元810具体用于:遍历所述N个簇链表中所有的簇链头和簇链尾;合并所述N个簇链表中簇链头与簇链尾具有关联关系的簇链,生成所述目标簇链表。Optionally, the processing unit 810 is specifically configured to: traverse all cluster chain heads and cluster chain tails in the N cluster linked lists; merge cluster chain heads and cluster chain tails in the N cluster linked lists that have an associated relationship Cluster chain, generating the target cluster linked list.
装置800执行修复文件系统的方法的具体方式以及产生的有益效果可以参见方法实施例中的相关描述。For the specific manner of the method for repairing the file system performed by the apparatus 800 and the beneficial effects produced, refer to the related description in the method embodiment.
图9示出了本申请提供的一种预测节点状态的设备的结构示意图。图9中的虚线表示该单元或该模块为可选的。设备900可用于实现上述方法实施例中描述的方法。设备900可以是终端设备或服务器或芯片。Fig. 9 shows a schematic structural diagram of a device for predicting the state of a node provided by the present application. The dotted line in Figure 9 indicates that the unit or the module is optional. The device 900 may be used to implement the methods described in the foregoing method embodiments. The device 900 may be a terminal device or a server or a chip.
设备900包括一个或多个处理器901,该一个或多个处理器901可支持设备900实现方法实施例中的方法。处理器901可以是通用处理器或者专用处理器。例如,处理器901可以是中央处理器(central processing unit,CPU)。CPU可以用于对设备900进行控制,执行软件程序,处理软件程序的数据。设备900还可以包括通信单元905,用以实现信号(如FAT)的输入(接收)和/或输出(发送)。The device 900 includes one or more processors 901, and the one or more processors 901 can support the device 900 to implement the method in the method embodiment. The processor 901 may be a general-purpose processor or a special-purpose processor. For example, the processor 901 may be a central processing unit (CPU). The CPU can be used to control the device 900, execute a software program, and process data of the software program. The device 900 may also include a communication unit 905 to implement input (reception) and/or output (transmission) of signals (such as FAT).
例如,设备900可以是芯片,通信单元905可以是该芯片的输入和/或输出电路,或者,通信单元905可以是该芯片的通信接口,该芯片可以作为终端设备或网络设备或其它电子设备的组成部分。For example, the device 900 may be a chip, and the communication unit 905 may be an input and/or output circuit of the chip, or the communication unit 905 may be a communication interface of the chip, and the chip may be used as a terminal device or a network device or other electronic device. component.
又例如,设备900可以是终端设备或服务器,通信单元905可以是该终端设备或该服务器的收发器,或者,通信单元905可以是该终端设备或该服务器的收发电路。For another example, the device 900 may be a terminal device or a server, and the communication unit 905 may be a transceiver of the terminal device or the server, or the communication unit 905 may be a transceiver circuit of the terminal device or the server.
设备900中可以包括一个或多个存储器902,其上存有程序904,程序904可被处理器901运行,生成指令903,使得处理器901根据指令903执行上述方法实施例中描述的方法。可选地,存储器902中还可以存储有数据(如FAT对应的文件)。可选地,处理器901还可以读取存储器902中存储的数据,该数据可以与程序904存储在相同的存储地址,该数据也可以与程序904存储在不同的存储地址。The device 900 may include one or more memories 902, on which a program 904 is stored. The program 904 can be run by the processor 901 to generate an instruction 903, so that the processor 901 executes the method described in the foregoing method embodiment according to the instruction 903. Optionally, the memory 902 may also store data (such as a file corresponding to FAT). Optionally, the processor 901 may also read data stored in the memory 902. The data may be stored at the same storage address as the program 904, and the data may also be stored at a different storage address from the program 904.
处理器901和存储器902可以单独设置,也可以集成在一起,例如,集成在终端设备的系统级芯片(system on chip,SOC)上。The processor 901 and the memory 902 may be provided separately or integrated together, for example, integrated on a system-on-chip (SOC) of the terminal device.
处理器901执行方法实施例的具体方式可以参见方法实施例中的相关描述。For the specific manner in which the processor 901 executes the method embodiment, reference may be made to the related description in the method embodiment.
应理解,上述方法实施例的各步骤可以通过处理器901中的硬件形式的逻辑电路或者软件形式的指令完成。处理器901可以是CPU、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其它可编程逻辑器件,例如,分立门、晶体管逻辑器件或分立硬件组件。It should be understood that each step of the foregoing method embodiment may be completed by a logic circuit in the form of hardware or instructions in the form of software in the processor 901. The processor 901 may be a CPU, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices , For example, discrete gates, transistor logic devices, or discrete hardware components.
本申请还提供了一种计算机程序产品,该计算机程序产品被处理器901执行时实现本申请中任一方法实施例所述的方法。This application also provides a computer program product, which, when executed by the processor 901, implements the method described in any method embodiment in this application.
该计算机程序产品可以存储在存储器902中,例如是程序904,程序904经过预处理、编译、汇编和链接等处理过程最终被转换为能够被处理器901执行的可执行目标文件。The computer program product may be stored in the memory 902, for example, a program 904. The program 904 is finally converted into an executable object file that can be executed by the processor 901 through processing processes such as preprocessing, compilation, assembly, and linking.
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时实现本申请中任一方法实施例所述的方法。该计算机程序可以是高级语言程序,也可以是可执行目标程序。The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the method described in any method embodiment in the present application is implemented. The computer program can be a high-level language program or an executable target program.
该计算机可读存储介质例如是存储器902。存储器902可以是易失性存储器或非易失性存储器,或者,存储器902可以同时包括易失性存储器和非易失性存储器。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。The computer-readable storage medium is, for example, the memory 902. The memory 902 may be a volatile memory or a non-volatile memory, or the memory 902 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasable PROM, EPROM), a Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of RAM are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), and synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM) ) And direct memory bus random access memory (direct rambus RAM, DR RAM).
本领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的装置和设备的具体工作过程以及产生的技术效果,可以参考前述方法实施例中对应的过程和技术效果,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process and technical effects of the devices and equipment described above can refer to the corresponding processes and technical effects in the foregoing method embodiments. Here, No longer.
在本申请所提供的几个实施例中,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的方法实施例的一些特征可以忽略,或不执行。以上所描述的装置实施例仅仅是示意性的,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,多个单元或组件可以结合或者可以集成到另一个系统。另外,各单元之间的耦合或各个组件之间的耦合可以是直接耦合,也可以是间接耦合,上述耦合包括电的、机械的或其它形式的连接。In the several embodiments provided in this application, the disclosed system, device, and method may be implemented in other ways. For example, some features of the method embodiments described above may be ignored or not implemented. The device embodiments described above are merely illustrative. The division of units is only a logical function division. In actual implementation, there may be other division methods, and multiple units or components may be combined or integrated into another system. In addition, the coupling between the various units or the coupling between the various components may be direct coupling or indirect coupling, and the foregoing coupling includes electrical, mechanical, or other forms of connection.
在本申请的各种实施例中,序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施例的实施过程构成任何限定。In the various embodiments of the present application, the size of the sequence number does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. .
另外,本文中的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。In addition, the term "and/or" in this article is only an association relationship describing associated objects, which means that there can be three types of relationships, for example, A and/or B, which can mean that A alone exists, and both A and B exist. , There are three cases of B alone. In addition, the character "/" in this text generally indicates that the associated objects before and after are in an "or" relationship.
总之,以上所述仅为本申请技术方案的较佳实施例而已,并非用于限定本申请的保护 范围。凡在本申请的原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。In short, the above descriptions are only preferred embodiments of the technical solutions of the present application, and are not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the principles of this application shall be included in the protection scope of this application.

Claims (10)

  1. 一种修复文件系统的方法,其特征在于,包括:A method for repairing a file system, which is characterized in that it comprises:
    获取文件分配表FAT;Obtain the file allocation table FAT;
    将所述FAT切分为N个子FAT,N为大于1的正整数;Divide the FAT into N sub-FATs, where N is a positive integer greater than 1;
    根据所述N个子FAT生成N个簇链表;Generating N cluster linked lists according to the N sub-FATs;
    对所述N个簇链表进行合并处理生成目标簇链表;Merging the N cluster linked lists to generate a target cluster linked list;
    根据所述目标簇链表修复FAT文件系统。Repair the FAT file system according to the target cluster linked list.
  2. 根据权利要求1所述的方法,其特征在于,所述N个子FAT包含的簇的数量相同。The method according to claim 1, wherein the number of clusters included in the N sub-FATs is the same.
  3. 根据权利要求1或2所述的方法,其特征在于,所述N个子FAT中至少一个子FAT包含的簇为编号连续的簇。The method according to claim 1 or 2, wherein the clusters contained in at least one sub-FAT in the N sub-FATs are clusters with consecutive numbers.
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述对所述N个簇链集合进行合并处理生成目标簇链集合,包括:The method according to any one of claims 1 to 3, wherein the merging of the N cluster chain sets to generate a target cluster chain set comprises:
    遍历所述N个簇链表中所有的簇链头和簇链尾;Traverse all cluster chain heads and cluster chain tails in the N cluster linked lists;
    合并所述N个簇链表中簇链头与簇链尾具有关联关系的簇链,生成所述目标簇链表。Combining cluster chains in the N cluster linked lists with cluster chain heads and cluster chain tails in an associated relationship to generate the target cluster linked list.
  5. 一种修复文件系统的装置,其特征在于,包括处理单元,用于:A device for repairing a file system is characterized by comprising a processing unit for:
    获取文件分配表FAT;Obtain the file allocation table FAT;
    将所述FAT切分为N个子FAT,N为大于1的正整数;Divide the FAT into N sub-FATs, where N is a positive integer greater than 1;
    根据所述N个子FAT生成N个簇链表;Generating N cluster linked lists according to the N sub-FATs;
    对所述N个簇链表进行合并处理生成目标簇链表;Merging the N cluster linked lists to generate a target cluster linked list;
    根据所述目标簇链表修复FAT文件系统。Repair the FAT file system according to the target cluster linked list.
  6. 根据权利要求5所述的装置,其特征在于,所述N个子FAT包含的簇的数量相同。The device according to claim 5, wherein the number of clusters included in the N sub-FATs is the same.
  7. 根据权利要求5或6所述的装置,其特征在于,所述N个子FAT中至少一个子FAT包含的簇为编号连续的簇。The device according to claim 5 or 6, wherein the clusters contained in at least one sub-FAT in the N sub-FATs are clusters with consecutive numbers.
  8. 根据权利要求5至7中任一项所述的装置,其特征在于,所述处理单元具体用于:The device according to any one of claims 5 to 7, wherein the processing unit is specifically configured to:
    遍历所述N个簇链表中所有的簇链头和簇链尾;Traverse all cluster chain heads and cluster chain tails in the N cluster linked lists;
    合并所述N个簇链表中簇链头与簇链尾具有关联关系的簇链,生成所述目标簇链表。Combining cluster chains in the N cluster linked lists with cluster chain heads and cluster chain tails in an associated relationship to generate the target cluster linked list.
  9. 一种修复文件系统的设备,其特征在于,所述设备包括处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于从所述存储器中调用并运行所述计算机程序,使得所述设备执行权利要求1至4中任一项所述的方法。A device for repairing a file system, characterized in that the device includes a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory so that all The device executes the method of any one of claims 1 to 4.
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储了计算机程序,当所述计算机程序被处理器执行时,使得处理器执行权利要求1至4中任一项所述的方法。A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes any one of claims 1 to 4 Methods.
PCT/CN2020/095581 2020-06-11 2020-06-11 Method and apparatus for repairing file system WO2021248406A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/095581 WO2021248406A1 (en) 2020-06-11 2020-06-11 Method and apparatus for repairing file system
CN202080101901.3A CN115698934A (en) 2020-06-11 2020-06-11 Method and device for repairing file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/095581 WO2021248406A1 (en) 2020-06-11 2020-06-11 Method and apparatus for repairing file system

Publications (1)

Publication Number Publication Date
WO2021248406A1 true WO2021248406A1 (en) 2021-12-16

Family

ID=78846716

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/095581 WO2021248406A1 (en) 2020-06-11 2020-06-11 Method and apparatus for repairing file system

Country Status (2)

Country Link
CN (1) CN115698934A (en)
WO (1) WO2021248406A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050076063A1 (en) * 2001-11-08 2005-04-07 Fujitsu Limited File system for enabling the restoration of a deffective file
CN1776687A (en) * 2005-12-16 2006-05-24 北京中星微电子有限公司 File segmenting method and device for FAT file system
CN103377220A (en) * 2012-04-23 2013-10-30 安凯(广州)微电子技术有限公司 Storage method and system for file systems
CN105808384A (en) * 2016-03-14 2016-07-27 云南大学 Method for recovering simultaneously damaged MBR and FAT32 system parameters
CN106326384A (en) * 2016-08-16 2017-01-11 中国科学院长春光学精密机械与物理研究所 File storage method suitable for high-speed mass storage based on FPGA (Field Programmable Gate Array)

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050076063A1 (en) * 2001-11-08 2005-04-07 Fujitsu Limited File system for enabling the restoration of a deffective file
CN1776687A (en) * 2005-12-16 2006-05-24 北京中星微电子有限公司 File segmenting method and device for FAT file system
CN103377220A (en) * 2012-04-23 2013-10-30 安凯(广州)微电子技术有限公司 Storage method and system for file systems
CN105808384A (en) * 2016-03-14 2016-07-27 云南大学 Method for recovering simultaneously damaged MBR and FAT32 system parameters
CN106326384A (en) * 2016-08-16 2017-01-11 中国科学院长春光学精密机械与物理研究所 File storage method suitable for high-speed mass storage based on FPGA (Field Programmable Gate Array)

Also Published As

Publication number Publication date
CN115698934A (en) 2023-02-03

Similar Documents

Publication Publication Date Title
US10437481B2 (en) Data access method and related apparatus and system
KR102007650B1 (en) Segment group considering segment cleaning apparatus and method thereof
CN106557427B (en) Memory management method and device for shared memory database
CN110297603B (en) Method and device for improving random writing performance based on solid state disk and computer equipment
US10649967B2 (en) Memory object pool use in a distributed index and query system
CN114138776A (en) Method, system, apparatus and medium for graph structure and graph attribute separation design
US20220253252A1 (en) Data processing method and apparatus
CN108628760B (en) Method and device for atomic write command
CN111124314A (en) SSD performance improving method and device for mapping table dynamic loading, computer equipment and storage medium
WO2021248406A1 (en) Method and apparatus for repairing file system
CN111026678B (en) Cache design method and device based on solid state disk and computer equipment
WO2021227789A1 (en) Storage space allocation method and device, terminal, and computer readable storage medium
CN108628761B (en) Atomic command execution method and device
CN113010111A (en) SSD access acceleration method and device, computer equipment and storage medium
CN112559385A (en) Method and device for improving SSD writing performance, computer equipment and storage medium
CN117215491A (en) Rapid data access method, rapid data access device and optical module
CN110851162A (en) SSD (solid State disk) firmware upgrading method and device compatible with RAID and non-RAID
CN113704027B (en) File aggregation compatible method and device, computer equipment and storage medium
CN111625477B (en) Processing method and device for read request for accessing erase block
US8200936B2 (en) Systems and methods for recording information to a memory card
CN115563021A (en) Method and device for improving repeated reading performance based on solid state disk and computer equipment
CN111831589A (en) Method and device for improving IO command processing parallelism
CN116501266B (en) Message context processing method, device, computer equipment and storage medium
CN111008195A (en) Database free space management method, system, terminal and storage medium
CN112069088A (en) Address mapping management method and related device and equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20940132

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20940132

Country of ref document: EP

Kind code of ref document: A1