A system startup method and related devices
By creating a thread in the kernel state of the terminal device, pre-caches the metadata of the disk partition to the page cache, the congestion problem caused by read and write operations during the FSK process during system startup is solved, and a faster system startup time is achieved.
Patent Information
- Application Number
- CN202210530457.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-07-12
- Filing Date
- 2019-09-26
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2039-09-26
AI Technical Summary
When the terminal device starts, because the file system detection (fsck) requires reading and writing to the disk, it is easy to cause congestion during the system startup, which increases the time-consuming system startup.
Create a thread in the kernel state through which the metadata of the disk partition is read and pre-caches it into the page cache. Subsequent file system detection and mount processes can directly read metadata from the page cache to avoid directly reading the disk.
By pre-cacheting the metadata of disk partitions, the read and write operations at system startup are reduced, congestion during system startup is avoided, and the overall time-consuming system startup is reduced.
Smart Images

Figure CN115061734B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic technologies, and in particular, to a system startup method and related devices. Background Art
[0002] Terminal devices are prone to power loss. During the process of reading and writing disk files on a terminal device, if power is suddenly lost, it is likely to cause disk file damage. Therefore, in order to ensure the availability of the disk, during the startup process of the terminal device, it is necessary to perform a file system check (fsck) on the disk partition to detect whether the disk partition is damaged.
[0003] In the prior art, after a kernel driver in the kernel mode detects a disk partition, it will report the disk partition event to the user mode. After a user space process (ueventd) in the user mode monitors the disk partition event, it will generate corresponding disk partition nodes. Subsequently, other programs in the user mode can read and write the disk partition by reading and writing the corresponding nodes. When the initialization process (init) in the user mode monitors the generation of the disk partition nodes, the init process starts a child process for file system check (fsck). The fsck process detects whether these disk partition nodes are abnormal. If the detection result is normal, the init process mounts the disk partition.
[0004] Since the fsck process needs to perform read and write operations (input / output, I / O) on the disk, and other programs in the user mode need to wait until the fsck process finishes the detection before they can run. Therefore, the terminal device system is prone to congestion during startup, increasing the startup time of the system. Summary of the Invention
[0005] Embodiments of this application provide a system startup method and related devices, including: when a kernel driver in the kernel mode detects a first disk partition, creating a first thread; in the kernel mode, reading metadata of the first disk partition through the first thread; and writing the metadata of the first disk partition into a first page cache through the first thread.
[0006] In the kernel mode, the first thread pre-caches the metadata of the disk partition into the page cache. Subsequently, the fsck process in the user mode can directly read the metadata of the disk partition from this page cache. Since the storage area of this page cache is memory, and the read and write operation rate is relatively high compared to the disk, it can effectively avoid congestion during the startup of the terminal device system and reduce the startup time of the system.
[0007] In a first aspect, this application provides a system startup method, including:
[0008] After the terminal device is powered on and starts up, first, the kernel driver in the kernel mode detects the disk partition. When the kernel driver in the kernel mode detects the first disk partition, a first thread is created;
[0009] In the kernel mode, the metadata of the first disk partition is read through the first thread;
[0010] The metadata of the first disk partition is written into the first page cache through the first thread. The first page cache is managed by the first address space (i_mapping), the first address space is managed by the first inode (bd_inode), and the first inode is managed by the block device pointer (bdev).
[0011] In the embodiment of the present application, in the kernel mode, the first thread pre-caches the metadata of the disk partition into the page cache. Subsequently, when the file system in the user mode detects the fsck process and loads the mount process, it can directly read the metadata of the disk partition from the page cache. Since the fsck process and the mount process in the user mode can read the cached data in the first page cache instead of reading the first disk partition and performing fsck and mount on the metadata of the first disk partition. And the data in the first page cache is cached in the memory, so the speed of reading the first page cache is much faster than the speed of reading the first disk partition. At the same time, the action of the first thread pre-caching the metadata of the disk partition into the page cache can be executed in parallel with other system startup processes, reducing the time-consuming of system startup. Therefore, it can effectively avoid the congestion situation during the system startup of the terminal device and reduce the time-consuming of system startup.
[0012] Combined with the first aspect, in the embodiment of the first aspect, when the kernel driver in the kernel mode detects the first disk partition, creating the first thread includes:
[0013] Detect whether the current disk partition is the first disk partition through the kernel driver in the kernel mode. Specifically, the kernel driver determines whether the disk partition is the first disk partition by calling the initialization function to detect whether the partition number of the disk partition is the first partition number. The initialization function can be "add_partition()";
[0014] When it is determined through the kernel driver that the current disk partition is the first disk partition, call the first function to create the first thread. The first function can be "kthread_run(read_pagecaches,NULL,"fsck_boost")";
[0015] Pass the pointer to the first structure of the first disk partition and the first partition number to the first thread, where the pointer to the first structure is the pointer to the general disk structure of the first disk partition. The pointer to the first structure can be "struct gendisk* disk", and the first partition number is the partition number of the first disk partition.
[0016] In the embodiment of the present application, a first thread is created by calling a first function, and the pointer to the first structure of the first disk partition and the first partition number are passed to the first thread, so that the first thread can operate on the first disk partition. This enriches the implementation flexibility of the present solution.
[0017] Combined with the first aspect, in the embodiment of the first aspect, the first thread reads the metadata of the first disk partition, including:
[0018] The first thread calls a third function to open the first disk partition;
[0019] After the first disk partition is opened by the first thread, it is necessary to read the metadata of the first disk partition. At this time, the first thread can call a page operation function, and read the metadata of the first disk partition through the page operation function. The page operation function can be the "pagechache" operation function. The metadata is used to save the status information of the file system corresponding to the disk partition.
[0020] In the embodiment of the present application, the first disk partition is opened by calling a third function, and the first thread can read the metadata of the first disk partition by calling a page operation function. This enriches the implementation flexibility of the present solution.
[0021] Combined with the first aspect, in the embodiment of the first aspect, before the first thread calls the third function to open the first disk partition, it further includes:
[0022] According to the pointer to the first structure of the first disk partition and the first partition number, the first thread calls a second function to obtain a first block pointer, where the first block pointer is the pointer to the block device structure corresponding to the first disk device. Taking the second function as "bdget_disk(disk, partno)" as an example, where "disk" is the pointer to the first structure and "partno" is the first partition number. The first thread can obtain the pointer to the block device structure corresponding to the first disk partition through the second function. This pointer is called the first block pointer. Specifically, the first block pointer is "bdev";
[0023] The first thread calls the third function and passes the first block pointer to the third function;
[0024] According to the first block pointer, the first disk partition is opened through the third function.
[0025] In the embodiment of the present application, the first thread of the terminal device calls a second function to obtain the first block pointer according to the first structure pointer and the first partition number of the first disk partition. The first thread opens the first disk partition by calling the third function and passing the first block pointer to the third function. This improves the feasibility of the solution.
[0026] Combined with the first aspect, in the embodiment of the first aspect, reading the metadata of the first disk partition through the page operation function includes:
[0027] The first thread passes the size of the data amount to be read and the offset of the data amount to be read to the page operation function. According to the size of the data amount to be read and the offset of the data amount to be read, the page operation function reads the metadata of the first disk partition. This makes the size of the data amount read by the page operation function close to the actual requirement, avoiding extreme situations of reading too much or too little data, and improving the feasibility of the solution.
[0028] Combined with the first aspect, in the embodiment of the first aspect, reading the metadata of the first disk partition through the page operation function includes:
[0029] Through the page operation function, the read metadata of the first disk partition is written into the first page cache. The page operation function can write the metadata of the first disk partition into the first page cache through the function "__do_page_cache_readahead(mapping,NULL,offset,nr_to_read,0)".
[0030] Combined with the first aspect, in the embodiment of the first aspect, it further includes:
[0031] The terminal device performs the boot-up operation according to the original process. When the system starts and enters the user state, the terminal device needs to perform a file system check (fsck) on the first disk partition. In the user state, when performing a file system check on the first disk partition, if the file system check result of the first disk partition is normal, according to the first index relationship and by calling the fourth function, it is queried whether there is cached data in the first page cache, where the first index relationship includes the first address space for managing the first page cache and the first inode for managing the first address space. The first index relationship is "bdev-bd_inode-i_mapping";
[0032] If it exists, the cached data is used for mounting.
[0033] In the embodiment of the present application, after entering the user mode, if the file system detection result is normal, the metadata of the first disk partition is normal data, and the terminal device does not need to repair this part of the data. The cached data cached in the first page cache can be used for the subsequent mounting process. The speed of the loading process can be greatly improved, and the time consumed for system startup can be reduced.
[0034] Combined with the first aspect, in the embodiment of the first aspect, after querying whether there is such cached data in the first page cache, it further includes:
[0035] If there is no cached data in the first page cache, the metadata of the first disk partition is read by calling the fifth function; the metadata of the first disk partition is used for mounting. To ensure the normal startup of the system.
[0036] Combined with the first aspect, in the embodiment of the first aspect, it further includes:
[0037] In the kernel mode, the first memory space is applied for by the first thread; the metadata of the first disk partition is read by the first thread; the metadata of the first disk partition is written into the first memory space by the first thread. The first file node is established by the first thread, and the first file node is mapped to the first memory space; in the user mode, the metadata of the first disk partition cached in the first memory space is read by accessing the first file node; the file system detection is performed on the cached metadata of the first disk partition, and at the same time as writing the result into the first memory space by accessing the first file node, the result is written into the first disk partition.
[0038] In the embodiment of the present application, when the terminal device system starts up, in the kernel mode, the metadata of the first disk partition is cached into the first memory space by calling the first thread. In the subsequent user mode, when performing file system detection, the metadata of the first disk partition cached in the first memory space can be directly read. Since the first thread caches the metadata of the first disk partition into the first memory space, this operation can be executed in parallel with other boot processes. Therefore, the time consumed for system startup can be effectively reduced.
[0039] In the second aspect, a terminal device is provided, and the terminal device has the function of implementing the system startup method in the above first aspect. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0040] In a third aspect, a terminal device is provided, which includes a transceiver, a memory, and a processor. Among them, the transceiver, the memory, and the processor communicate with each other through an internal connection path. The memory is used to store instructions, and the processor is used to execute the instructions stored in the memory to control the receiver to receive signals and control the transmitter to send signals. When the processor executes the instructions stored in the memory, the processor is caused to execute the method in the first aspect or any possible implementation manner of the first aspect.
[0041] In a fourth aspect, a computer program product is provided, which includes computer program code. When the computer program code is run on a computer, the computer is caused to execute the methods in the above aspects.
[0042] In a fifth aspect, a computer-readable medium is provided for storing a computer program, and the computer program includes instructions for executing the methods in the above aspects.
[0043] In a sixth aspect, a chip system is provided, which includes a processor. The processor is used to call and run the computer program from a memory, and the computer program is used to implement the methods in the above aspects.
[0044] From the above technical solutions, it can be seen that the embodiments of the present application have the following advantages:
[0045] When the kernel driver in the kernel mode detects the first disk partition, a first thread is created; in the kernel mode, the metadata of the first disk partition is read through the first thread; the metadata of the first disk partition is written into the first page cache through the first thread.
[0046] In the kernel mode, the first thread pre-caches the metadata of the disk partition into the page cache, and the subsequent fsck process in the user mode can directly read the metadata of the disk partition from the page cache. Since the storage area of the page cache is memory, the read and write operation rate is relatively large compared with the disk. Therefore, it can effectively avoid the congestion situation when the terminal device system starts up and reduce the startup time of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a schematic diagram of an embodiment of a system startup method provided by an embodiment of the present application;
[0048] Figure 2 It is a schematic diagram of an embodiment of another system startup method provided by an embodiment of the present application;
[0049] Figure 3 It is a schematic diagram of an embodiment of a terminal device in an embodiment of the present application;
[0050] Figure 4Schematic diagram of the hardware structure of the terminal device in the embodiments of the present application;
[0051] Figure 5 Schematic diagram of the structure of the chip system in the embodiments of the present application. Detailed implementation manners
[0052] Before introducing this embodiment, several concepts that may appear in this embodiment are first introduced. It should be understood that the following concept explanations may be limited by the specific circumstances of this embodiment, but it does not mean that the present application can only be limited to this specific situation, and there may also be differences in the explanations of the following concepts along with the specific circumstances of different embodiments.
[0053] File system check: The file system in a computer generally exists in one of two states: clean or dirty. If a file system is to be mounted on a disk partition, this file system must be clean, that is, its structure is complete and the metadata is consistent with each other and with the data. However, sometimes the consistency of the file system may be damaged. For example, when the system powers off, the data in the memory will be lost, or due to disk failures such as disk bad sectors, etc., the consistency of the file system data will be damaged. To check and maintain the inconsistent file system, the file system provides a file system check (fsck) to facilitate users to check and repair the file system.
[0054] The boot file system detection method proposed in this application can be applied to terminal devices. Terminal devices can be wireless terminals that provide voice and / or data connectivity to users, handheld devices with wireless connection functions, or other processing devices connected to a wireless modem. The wireless terminal can communicate with one or more core networks via a radio access network (RAN). The wireless terminal can be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer of the mobile terminal. It can also be a personal computer (PC). For example, it can be a portable, pocket-sized, handheld, computer-integrated, or vehicle-mounted mobile device that exchanges voice and / or data with the wireless access network. For example, devices such as personal communication service (PCS) phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, and personal digital assistants (PDAs). The wireless terminal can also be referred to as a system, subscriber unit, subscriber station, mobile station, mobile, remote station, access point, remote terminal, access terminal, user terminal, user agent, user device, or user equipment (UE), and specific definitions are not limited here.
[0055] To enable those skilled in the art to better understand the solution of this application, the following will introduce the embodiments of this application in conjunction with the accompanying drawings in the embodiments of this application. Please refer to Figure 1 , Figure 1 which is a schematic diagram of an embodiment of a system startup method provided by an embodiment of this application. In the embodiments of this application, the system of the terminal device is taken as an example of the Linux system for illustration.
[0056] 101. The kernel driver in the kernel state detects the disk partition.
[0057] In this embodiment, after the terminal device is powered on and starts up, first, the kernel driver in the kernel mode detects the disk partitions. Specifically, the kernel driver determines whether a disk partition is a preset disk partition by detecting whether the partition number of the disk partition is a preset partition number.
[0058] In this embodiment, the preset disk partition is referred to as the first disk partition in the embodiment of the present application. In an alternative implementation, the first disk partition is the "userdata" partition, and at this time, the partition name of the preset first disk partition is "userdata". It should be noted that in addition to being preset as the "userdata" partition, the first disk partition can also be other disk partitions, such as the "A" partition. It can also be multiple disk partitions. For example, the first disk partition is the "data" partition and the "A" partition, which is not limited here.
[0059] In an alternative implementation, the kernel driver first calls an initialization function, which can be the "add_partition()" function. Then, the initialization function detects the partition names of each disk partition. When the partition name "userdata" is detected, it is determined that the disk partition corresponding to this partition name is the first disk partition.
[0060] Since the kernel driver detects whether each disk partition is the first disk partition by traversing, when detecting each disk partition, a partition number will be given to the disk partition corresponding to it. For example: when the kernel driver detects the first disk partition "A", the partition number of this disk partition is marked as "1". When the kernel driver detects the second disk partition "userdata", the partition number of this disk partition is marked as "2". Since the partition name of this disk partition is "userdata", which is the same as the partition name of the predefined first disk partition, it is determined that this partition is the first disk partition. Therefore, the kernel driver determines that the partition number "2" of this disk partition is the first partition number.
[0061] 102. When the kernel driver detects the first disk partition, create a first thread.
[0062] In this embodiment, when the kernel driver detects that the partition name of a certain disk partition is the preset partition name, the kernel driver determines that the currently detected disk partition is the first disk partition. When the kernel driver detects the first disk partition, the kernel driver can create a first thread by calling a first function, or it can be other functions predefined by the user, which is not limited here. Create the first thread, and this first thread is an independently running thread, running in parallel with other threads in the kernel mode. This first thread can be the "fsck_boost" thread, or it can be other threads predefined by the user, which is not limited here.
[0063] In an alternative implementation, taking the first function "kthread_run(read_pagecaches, NULL, \"fsck_boost\")" as an example, when the kernel driver detects that the current disk partition name is "userdata" through the first function, and the return value of "fsck_boost" in the first function is "1", that is, "fsck_boost = 1". At this time, the kernel driver determines that the current disk partition is the first disk partition according to this return value. At this time, the kernel driver creates a first thread by calling the first function.
[0064] When creating the first thread, the kernel driver passes the pointer to the general structure corresponding to the first disk partition to the first thread. The kernel driver also passes the partition number corresponding to the first disk partition to the first thread. This pointer to the general structure is called the first structure pointer in the embodiments of the present application, and this partition number is the first partition number. This structure is used to indicate the physical pages that a file has cached. When the system reads a file, it will first query from the index relationship corresponding to the file whether the required data has been cached. If the data has not been cached, a read / write request will be issued to the disk.
[0065] In an alternative implementation, the first structure pointer is "struct gendisk*disk".
[0066] 103. Open the first disk partition through the first thread.
[0067] In this embodiment, first, the first thread obtains the first block pointer by calling a second function according to the first structure pointer and the first partition number. In an alternative implementation, this second function can be "bdget_disk(disk, partno)". Taking the second function being "bdget_disk(disk, partno)" as an example, where "disk" is the first structure pointer and "partno" is the first partition number. The first thread can obtain the pointer to the block device structure corresponding to the first disk partition through the second function. This pointer is called the first block pointer. Specifically, the first block pointer is "bdev".
[0068] Secondly, according to the first block pointer, the third function is called by the first thread, and the first block pointer is passed to the third function. The third function is used to open the first disk partition. In an alternative implementation, the third function can be "blkdev_get(bdev,FMODE_READ,NULL)". Taking the third function as "blkdev_get(bdev,FMODE_READ,NULL)" as an example, where: "bdev" is the first block pointer, the first disk partition is found through the first block pointer, "FMODE_READ" indicates the read-only mode, and "NULL" is an irrelevant variable and can be null.
[0069] Finally, through the third function and the first block pointer passed to the third function, the third function opens the first disk partition.
[0070] 104. Call the page operation function through the first thread and use the page operation function to read the metadata of the first disk partition.
[0071] In this embodiment, after the first disk partition is opened by the first thread, the metadata of the first disk partition needs to be read. At this time, the first thread can call the page operation function and read the metadata of the first disk partition through the page operation function. The page operation function can be the "pagechache" operation function. The metadata is used to save the status information of the file system corresponding to the disk partition.
[0072] Specifically, the size of the data volume to be read is transmitted to the page operation function through the first thread, and the size of the data volume to be read is determined by the metadata size of the first disk partition. Usually, when the total capacity of the first disk partition is 64 gigabytes (GB), the metadata size of the first disk partition is 200 megabits (MB). Therefore, the size of the data volume to be read is 200MB. If the total capacity of the first disk partition is 512GB, the size of the data volume to be read is 500MB. It should be noted that when the metadata size of the first disk partition is 300MB, the size of the data volume to be read can be less than 300MB, such as 100MB; it can also be greater than 300MB, such as 400MB, and it is not limited here.
[0073] In addition, the offset situation of the data volume to be read also needs to be transmitted to the page operation function through the first thread. Since the page reads the metadata of the first disk partition, and the metadata (taking 200MB as an example) is usually stored at 0-0 to 0xC800000 of the disk partition address, the offset situation of the data volume to be read is usually 0.
[0074] In an alternative implementation, the page operation function can read the metadata of the first disk partition through the "__do_page_cache_readahead(mapping, NULL, offset, nr_to_read, 0)" function.
[0075] It should be noted that since the first thread is a kernel-mode thread and reads the metadata of the first disk partition in the kernel mode, the page operation function called by the first thread runs in the kernel mode, and the page operation function does not need to include operations on the pointer of the "struct file" structure.
[0076] 105. Use the page operation function to write the metadata of the first disk partition into the first page cache.
[0077] In this embodiment, after the metadata of the first disk partition is read, the page operation function is used to write the metadata of the first disk partition into the first page cache (pagecache).
[0078] Specifically, the first page cache is managed by the first address space (i_mapping), the first address space is managed by the first inode (bd_inode), and the first inode is managed by the block device pointer (bdev). In the embodiments of the present application, the above management relationship is called the first index relationship, and the first index relationship is "bdev - bd_inode - i_mapping", and the first inode corresponds to the first disk partition.
[0079] In an alternative implementation, the page operation function can write the metadata of the first disk partition into the first page cache through the "__do_page_cache_readahead(mapping, NULL, offset, nr_to_read, 0)" function.
[0080] After the page operation function writes the metadata of the first disk partition into the first page cache, the metadata of the first disk partition cached in the first page cache can be read through the first index relationship. The metadata of the first disk partition cached in the first page cache is called cached data.
[0081] 106. Perform a file system check on the metadata of the first disk partition in user mode.
[0082] In this embodiment, after step 105, the terminal device performs the boot operation according to the original process. When the system starts and enters the user state, the terminal device needs to perform a file system check (fsck) on the first disk partition. Since in the previous steps, the terminal device has cached the metadata of the first disk partition in the first page cache, therefore, in the user state, the file system check can be performed on the cached data in the first page cache instead of reading the first disk partition and performing a file system check on the metadata of the first disk partition.
[0083] Specifically, in the user state, the file system check process can be started through the init process. At this time, the file system check accesses the address "dev / block / userdata" of the first disk partition to obtain the cached data, which is the metadata of the first disk partition cached in the first page cache.
[0084] There is an association relationship between "dev / block / userdata" in the user state and the first index relationship "bdev-bd_inode-i_mapping" in the kernel state. Therefore, the cached data in the first page cache corresponding to the first address space can be read by accessing "dev / block / userdata". When read and write operations are required in the file system check process, the objects of the read and write operations are both "dev / block / userdata". It should be noted that "userdata" in "dev / block / userdata" is only for illustrative purposes, and according to the actual situation of the disk partition, it may also be other address names.
[0085] When the result of the file system check is normal, step 107 is executed; when the result of the file system check is abnormal, the original file system check process of the system is entered to repair the first disk partition.
[0086] 107. If the result of the file system check is normal, then mount.
[0087] In this embodiment, after the file system check is completed and the result of the file system check of the disk partition is normal, the terminal device needs to mount the disk partition. This mount is a mount naming of the disk partition. After the disk partition is mounted with a certain file system, such as the flash friendly file system (F2FS) or the fourth extended file system (EXT4), the user can access the files on the partition.
[0088] Therefore, when the result of the file system detection of the cached data (i.e., the metadata of the first disk partition) in step 106 is normal, step 107 is entered.
[0089] First, the terminal device calls the fifth function to start the mounting process, and through the fifth function, calls the fourth function to query whether there is cached data in the first page cache. The fourth function can be either an independent function or a sub-function under the fifth function, which is not limited here.
[0090] Specifically, in the user space, the terminal device obtains the first index relationship through the fifth function. Then, the fourth function obtains the first page cache according to the first index relationship.
[0091] In an optional implementation, when the first disk partition is mounted as the F2FS file system, the fifth function carries "sbi", which is a variable in the fifth function. The "sbi" points to "sb", and the "sb" is a pointer to a standard superblock structure in the linux system. The "sb" further points to "s_bdev", and the "s_bdev" points to the block device where the file system is mounted. In this embodiment, the "s_bdev" points to the block device corresponding to the first disk partition, that is, "bdev", and the "bdev" stores the first inode "bd_inode" corresponding to the first disk partition. The first inode manages the first address space "i_mapping".
[0092] Therefore, the fifth function can obtain the first index relationship "bdev - bd_inode - i_mapping" through "sbi - sb - s_bdev", and finally obtain the index relationship: "sbi - sb - s_bdev - bd_inode - i_mapping". The fifth function passes the first index relationship to the fourth function, and the fourth function can obtain the first address space through the first index relationship. The first address space manages the first page cache. In this embodiment, the fifth function can be "get_meta_page_ex()", and the fourth function can be "page = find_lock_page(mapping, index)", where "mapping" is the position read by the fourth function. In this embodiment, the "mapping" is "i_mapping".
[0093] When the fourth function detects that there is cached data in the storage area (the first page cache) corresponding to the first address space, the terminal device uses the cached data for mounting. After successful mounting, the terminal device calls "blkdev_put" to release the data in the first page cache; when the fourth function detects that there is no cached data in the storage area corresponding to the first address space, the fourth function passes the detection result range to the fifth function. The fifth function reads the metadata of the first disk partition from the first disk partition according to the detection result. In an alternative implementation, if the fourth function is a sub-function of the fifth function, the fifth function calls the functions in the fifth function except the fourth function according to the detection result to read the metadata of the first disk partition from the first disk partition.
[0094] The fifth function uses the metadata of the first disk partition to perform the mount process.
[0095] In the embodiment of the present application, in the kernel state, the first thread pre-caches the metadata of the disk partition into the page cache, and subsequently, the fsck process and the mount process in the user state can directly read the metadata of the disk partition from the page cache. Since the fsck process and the mount process in the user state can read the cached data in the first page cache instead of reading the first disk partition and performing fsck and mount on the metadata of the first disk partition. And the data in the first page cache is cached in the memory, so the speed of reading the first page cache is much faster than the speed of reading the first disk partition. At the same time, the action of the first thread pre-caching the metadata of the disk partition into the page cache can be executed in parallel with other system startup processes, reducing the startup time of the system. Therefore, it can effectively avoid the congestion situation during the startup of the terminal device system and reduce the startup time of the system.
[0096] In addition to reducing the startup time of the system through the above-mentioned embodiment process. The present application also proposes another method for system startup to reduce the startup time of the system. Please refer to Figure 2 , Figure 2 which is a schematic diagram of an embodiment of another system startup method provided by the embodiment of the present application. In the embodiment of the present application, the system of the terminal device is also taken as an example of the Linux system for illustration.
[0097] 201. The kernel driver in the kernel state detects the disk partition.
[0098] In this embodiment, it is similar to the foregoing step 101, and will not be elaborated here.
[0099] 202. When the kernel driver detects the first disk partition, create the first thread.
[0100] In this embodiment, it is similar to the foregoing step 102, and will not be elaborated here.
[0101] 203. Apply for the first memory space through the first thread.
[0102] In this embodiment, in the kernel mode, when the terminal device detects the first disk partition, the first thread is created. The terminal device uses the first thread to apply for the first memory space in the memory. The size of the first memory space is determined by the metadata size of the first disk partition. Usually, when the total capacity of the first disk partition is 64 gigabytes (GB), the metadata size of the first disk partition is 200 megabytes (mbit, MB). Therefore, the size of the applied first memory space is 200MB, that is, a 200MB memory block is applied; if the total capacity of the first disk partition is 512GB, the size of the first memory space is 500MB. It should be noted that when the metadata size of the first disk partition is 300MB, the size of the data to be read can be less than 300MB, such as 100MB; it can also be greater than 300MB, such as 400MB, which is not limited here.
[0103] 204. Read the metadata of the first disk partition.
[0104] In this embodiment, after applying for the first memory space through the first thread, the metadata of the first disk partition is read through the first thread.
[0105] In an alternative implementation, the first thread reads the metadata of the first disk partition by calling a page operation function. The specific reading method is similar to step 104 and will not be elaborated here.
[0106] 205. Write the metadata of the first disk partition into the first memory space.
[0107] In this embodiment, the first thread writes the read metadata of the first disk partition into the first memory space. The specific writing method is similar to step 105 and will not be elaborated here.
[0108] 206. Establish the first file node through the first thread.
[0109] In this embodiment, in order to enable subsequent steps to operate on the metadata of the first disk partition cached in the first memory space. It is necessary to establish the first file node through the first thread, and the first file node is mapped to the first memory space.
[0110] In an alternative implementation, the first file node can be a file node under the "proc" directory. The address name of the first file node can be "proc / block / xxx", where "xxx" can vary according to the actual situation. For example, the address name of the first file node can be "proc / block / userdata", or it can also be "proc / block / 123", which is not limited here.
[0111] Specifically, in the Linux system, the "proc" directory is a file system, namely the proc file system. The proc file system is a pseudo file system (i.e., a virtual file system), which stores a series of special files of the current kernel running state. Users can view information about the system hardware and the currently running processes through these files, and can change the kernel running state by modifying some of these files.
[0112] 207. Perform a file system check on the metadata of the first disk partition cached in the first memory space.
[0113] In this embodiment, in the user space, the terminal device performs a file system check on the metadata of the first disk partition cached in the first memory space.
[0114] In an alternative implementation, the initialization process (init) in the user space reads the metadata of the first disk partition cached in the first memory space by accessing the first file node. During the process of performing the file system check, when a write operation is required, in addition to writing to the first memory space, it is also necessary to write to the first disk partition at the same time. Taking recording the result of the file system check as an example, the terminal device writes the result of the file system check to the first memory space by accessing the first file node; at the same time, it writes the result of the file system check to the first disk partition. By synchronously writing data to the memory block and the disk, the data in the memory block is ensured to be consistent with the data at the corresponding position on the disk.
[0115] Specifically, the first disk partition is accessed by accessing the address "dev / block / userdata" of the first disk partition. It should be noted that the address of the first disk partition is only for illustrative purposes and is not limited here.
[0116] When the file system check result is normal, the terminal device releases the first memory space. Subsequently, for mounting, the metadata of the first disk partition is read by accessing the address of the first disk partition. And the metadata of the first disk partition is used for mounting.
[0117] In the embodiment of the present application, when the terminal device system starts up, in the kernel mode, by calling the first thread, the metadata of the first disk partition is cached into the first memory space. Subsequently, in the user mode, when performing a file system check, the metadata of the first disk partition cached in the first memory space can be directly read. Since the first thread caches the metadata of the first disk partition into the first memory space, this operation can be executed in parallel with other boot processes. Therefore, the time consumption of system startup can be effectively reduced.
[0118] The solution provided by the embodiment of the present application has been introduced from the perspective of the above main method. It can be understood that in order to implement the above functions, the above terminal device includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the modules and algorithm steps of each example 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 in the way of hardware or computer software driving the hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0119] The embodiment of the present application can perform a functional module division on the terminal device according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into a processing module 301. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiment of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0120] The following is a detailed description of the terminal device in the present application. Please refer to Figure 3 , Figure 3 which is a schematic diagram of an embodiment of the terminal device in the embodiment of the present application. The terminal device 30 includes:
[0121] A processing module 301, configured to create a first thread when the kernel driver in the kernel mode detects the first disk partition;
[0122] A reading module 302, configured to read the metadata of the first disk partition through the first thread in the kernel mode;
[0123] A writing module 303, configured to write the metadata of the first disk partition into the first page cache through the first thread.
[0124] In some embodiments of the present application, the terminal device 30 includes:
[0125] The processing module 301 is specifically configured to detect whether the current disk partition is the first disk partition through a kernel driver in the kernel mode;
[0126] The processing module 301 is specifically configured to, when it is determined through the kernel driver that the current disk partition is the first disk partition, call a first function to create a first thread;
[0127] The processing module 301 is specifically configured to pass a pointer to a first structure of the first disk partition and a first partition number to the first thread, where the pointer to the first structure is a pointer to a general disk structure of the first disk partition, and the first partition number is the partition number of the first disk partition.
[0128] In some embodiments of the present application, the terminal device 30 includes:
[0129] The reading module 302 is specifically configured to call a third function through the first thread to open the first disk partition;
[0130] The reading module 302 is specifically configured to call a page operation function through the first thread and read metadata of the first disk partition through the page operation function.
[0131] In some embodiments of the present application, the terminal device 30 includes:
[0132] The reading module 302 is further configured to obtain a first block pointer by calling a second function through the first thread according to the pointer to the first structure of the first disk partition and the first partition number,
[0133] where the first block pointer is a pointer to a block device structure corresponding to the first disk device;
[0134] The reading module 302 is further configured to call a third function through the first thread and pass the first block pointer to the third function;
[0135] The reading module 302 is further configured to open the first disk partition through the third function according to the first block pointer.
[0136] In some embodiments of the present application, the terminal device 30 includes:
[0137] The reading module 302 is specifically configured to pass the size of the data amount to be read and the offset of the data amount to be read to the page operation function through the first thread,
[0138] Read the metadata of the first disk partition through the page operation function according to the size of the data amount to be read and the offset of the data amount to be read.
[0139] In some embodiments of the present application, the terminal device 30 includes:
[0140] The writing module 303 is specifically configured to write the metadata of the first disk partition read into the first page cache through a page operation function.
[0141] In some embodiments of the present application, the terminal device 30 includes:
[0142] The processing module 301 is further configured to perform a file system check on the first disk partition in the user state. If the file system check fsck result of the first disk partition is normal,
[0143] The processing module 301 is further configured to query whether there is cached data in the first page cache according to the first index relationship and by calling a fourth function. The first index relationship includes a first address space for managing the first page cache and a first inode for managing the first address space;
[0144] The processing module 301 is further configured to, if it exists, use the cached data for mounting.
[0145] In some embodiments of the present application, the terminal device 30 includes:
[0146] The processing module 301 is further configured to, if it does not exist, read the metadata of the first disk partition by calling a fifth function;
[0147] The processing module 301 is further configured to use the metadata of the first disk partition for mounting.
[0148] In some embodiments of the present application, the terminal device 30 includes:
[0149] The processing module 301 is further configured to apply for a first memory space through a first thread in the kernel state;
[0150] The processing module 301 is further configured to read the metadata of the first disk partition through a first thread;
[0151] The processing module 301 is further configured to write the metadata of the first disk partition into the first memory space through a first thread.
[0152] In some embodiments of the present application, the terminal device 30 includes:
[0153] The processing module 301 is further configured to establish a first file node through a first thread, and the first file node is mapped to the first memory space;
[0154] The processing module 301 is further configured to, in the user state, read the metadata of the first disk partition cached in the first memory space by accessing the first file node;
[0155] The processing module 301 is further configured to perform a file system check on the cached metadata of the first disk partition and record the result of the file system check.
[0156] In some embodiments of the present application, the terminal device 30 includes:
[0157] The processing module 301 is further configured to write the result into the first disk partition while writing the result into the first memory space by accessing the first file node.
[0158] The terminal device in the embodiments of the present application is described above from the perspective of modular functional entities. Next, the terminal device in the embodiments of the present application will be described from the perspective of hardware processing. Figure 4 It is a schematic diagram of the hardware structure of the terminal device in the embodiments of the present application. As Figure 4 shown, the terminal device may include:
[0159] Figure 4 It is a schematic diagram of the hardware structure of the terminal device in the embodiments of the present application. As Figure 4 shown, the terminal device may include:
[0160] The terminal device includes at least one processor 401, a communication line 407, a memory 403, and at least one communication interface 404.
[0161] The processor 401 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the solution of the present application.
[0162] The communication line 407 may include a path for transmitting information between the above components.
[0163] The communication interface 404 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet.
[0164] The memory 403 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM), or other type of dynamic storage device that can store information and instructions. The memory may exist independently and be connected to the processor through the communication line 407. The memory may also be integrated with the processor.
[0165] Among them, the memory 403 is used to store computer-executable instructions for executing the solution of this application, and is controlled by the processor 401 to execute. The processor 401 is used to execute the computer-executable instructions stored in the memory 403, so as to implement the system startup method provided in the above embodiments of this application.
[0166] Optionally, the computer-executable instructions in the embodiments of this application may also be referred to as application code, and the embodiments of this application do not make specific limitations on this.
[0167] In a specific implementation, as an embodiment, the terminal device may include multiple processors, such as Figure 4 the processor 401 and the processor 402 in. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. Here, the processor may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0168] In a specific implementation, as an embodiment, the terminal device may further include an output device 405 and an input device 406. The output device 405 communicates with the processor 401 and can display information in various ways. The input device 406 communicates with the processor 401 and can receive user input in various ways. For example, the input device 406 may be a mouse, a touch screen device, or a sensing device, etc.
[0169] This application also provides a chip system. Please refer to Figure 5 , the chip system includes a processor 501 and a memory 502. The memory 502 is used to store necessary program instructions and data of the terminal device. The chip system may be composed of chips or may include chips and other discrete devices.
[0170] In a possible design, the chip system further includes a power supply and a transceiver ( Figure 5 not shown in) for supporting the above terminal device to implement its involved functions. For example, the transceiver receives the data and / or information involved in the above method embodiments, such as the metadata of the first disk partition, etc. After receiving the data and / or information involved in the above method embodiments, the transceiver sends these data and / or information to the processor 501 so that the processor 501 can process these data and / or information.
[0171] In addition, it should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the accompanying drawings of the device embodiments provided in this application, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines.
[0172] Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures for implementing the same function can also be various, such as analog circuits, digital circuits or dedicated circuits. However, for this application, in more cases, software program implementation is a better implementation method. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disc of a computer, and includes several instructions to enable a terminal device to execute the methods described in various embodiments of this application.
[0173] In the above embodiments, it can be implemented in whole or in part through software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0174] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, a computer, a training set construction device, a computing device, or a data center to another website, a computer, a training set construction device, a computing device, or a data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a training device or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0175] It should be understood that the term "one embodiment" or "an embodiment" mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in an embodiment" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the order numbers of the above processes do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0176] In addition, the terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after.
[0177] It should be understood that in the embodiments of the present application, "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0178] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0179] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0180] In several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0181] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0182] In addition, the functional units in each embodiment of this application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0183] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a terminal device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application.
[0184] In summary, the above are only the preferred embodiments of the technical solution of the present application, and are not used to limit the protection scope of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A system startup method, applied to an electronic device, Characterized in that, It includes: When the kernel driver in the kernel mode detects the first disk partition, create a first thread; In the kernel mode, read the metadata of the first disk partition through the first thread; Write the metadata of the first disk partition into the first page cache through the first thread; Among them, the step of creating the first thread when the kernel driver in the kernel mode detects the first disk partition includes: Detect whether the current disk partition is the first disk partition through the kernel driver in the kernel mode; When it is determined through the kernel driver that the current disk partition is the first disk partition, call a first function to create the first thread; Pass the pointer of the first structure of the first disk partition and the first partition number to the first thread, where the pointer of the first structure is the general disk structure pointer of the first disk partition, and the first partition number is the partition number of the first disk partition.
2. The method according to claim 1, Characterized in that, The step of reading the metadata of the first disk partition through the first thread includes: Open the first disk partition through the first thread by calling a third function; Call a page operation function through the first thread, and read the metadata of the first disk partition through the page operation function.
3. The method according to claim 2, Characterized in that, Before opening the first disk partition by calling the third function through the first thread, the method further includes: According to the pointer of the first structure and the first partition number of the first disk partition, call a second function through the first thread to obtain a first block pointer, Wherein, the first block pointer is the block device structure pointer corresponding to the first disk device; Call the third function through the first thread and pass the first block pointer to the third function; Open the first disk partition through the third function according to the first block pointer.
4. The method according to claim 2, Characterized in that, The step of reading the metadata of the first disk partition through the page operation function includes: Pass the size of the data volume to be read and the offset of the data volume to be read into the page operation function through the first thread, Read the metadata of the first disk partition through the page operation function according to the size of the read data volume and the offset of the data volume to be read.
5. The method according to claim 4, Characterized in that, The step of reading the metadata of the first disk partition through the page operation function includes: Write the read metadata of the first disk partition into the first page cache through the page operation function.
6. The method according to any one of claims 1-5, Characterized in that, The method further includes: In the user mode, perform a file system check on the first disk partition. If the fsck result of the file system check of the first disk partition is normal, According to the first index relationship, and by calling the fourth function, query whether there is cached data in the first page cache, where the first index relationship includes the first address space for managing the first page cache and the first index node for managing the first address space; If it exists, mount using the cached data; If it does not exist, read the metadata of the first disk partition by calling the fifth function; Mount using the metadata of the first disk partition.
7. The method according to claim 1, wherein, after creating the first thread, the method further includes: In kernel mode, apply for a first memory space through the first thread; Read the metadata of the first disk partition through the first thread; Write the metadata of the first disk partition into the first memory space through the first thread.
8. The method according to claim 7, wherein, after writing the metadata of the first disk partition into the first memory space through the first thread, the method further includes: Establish a first file node through the first thread, and the first file node is mapped to the first memory space; In user mode, read the metadata of the first disk partition cached in the first memory space by accessing the first file node; Perform a file system check on the cached metadata of the first disk partition and record the result of the file system check.
9. The method according to claim 8, wherein, recording the result of the file system check includes: While writing the result to the first memory space by accessing the first file node, write the result to the first disk partition.
10. A terminal device, wherein, includes: A processing module for creating a first thread when a kernel driver in kernel mode detects a first disk partition; A reading module for reading the metadata of the first disk partition through the first thread in kernel mode; A writing module for writing the metadata of the first disk partition into the first page cache through the first thread; The processing module is specifically configured to detect whether the current disk partition is the first disk partition through the kernel driver in kernel mode; The processing module is specifically configured to call a first function to create the first thread when it is determined through the kernel driver that the current disk partition is the first disk partition; The processing module is specifically configured to pass a pointer to the first structure of the first disk partition and the first partition number of the first disk partition to the first thread, where the pointer to the first structure is the pointer to the general disk structure of the first disk partition, and the first partition number is the partition number of the first disk partition.
11. The terminal device according to claim 10, wherein, The reading module is specifically configured to open the first disk partition by calling a third function through the first thread; The reading module is specifically configured to call a page operation function through the first thread and read the metadata of the first disk partition through the page operation function.
12. The terminal device according to claim 11, wherein, the reading module is further configured to, according to the first structure pointer and the first partition number of the first disk partition, call a second function through the first thread to obtain a first block pointer, wherein the first block pointer is a block device structure pointer corresponding to a first disk device; the reading module is further configured to call the third function through the first thread and pass the first block pointer to the third function; the reading module is further configured to open the first disk partition through the third function according to the first block pointer.
13. The terminal device according to claim 11, wherein, the reading module is specifically configured to pass, through the first thread, the size of the data amount to be read and the offset of the data amount to be read to the page operation function, and read the metadata of the first disk partition through the page operation function according to the size of the data amount to be read and the offset of the data amount to be read.
14. The terminal device according to claim 13, wherein, the writing module is specifically configured to write the read metadata of the first disk partition into the first page cache through the page operation function.
15. The terminal device according to any one of claims 10-14, wherein, the processing module is further configured to, in user mode, perform a file system check on the first disk partition. If the fsck result of the file system check of the first disk partition is normal, the processing module is further configured to, according to a first index relationship, and by calling a fourth function, query whether there is cached data in the first page cache, where the first index relationship includes a first address space for managing the first page cache and a first inode for managing the first address space; the processing module is further configured to, if there is, mount using the cached data; the processing module is further configured to, if not, read the metadata of the first disk partition by calling a fifth function; the processing module is further configured to mount using the metadata of the first disk partition.
16. The terminal device according to claim 10, wherein, the processing module is further configured to, in kernel mode, apply for a first memory space through the first thread; the processing module is further configured to read the metadata of the first disk partition through the first thread; the processing module is further configured to write the metadata of the first disk partition into the first memory space through the first thread.
17. The terminal device according to claim 16, wherein, the processing module is further configured to establish a first file node through the first thread, and the first file node is mapped to the first memory space; the processing module is further configured to, in user mode, read the metadata of the first disk partition cached in the first memory space by accessing the first file node; The processing module is further configured to perform a file system detection on the metadata of the cached first disk partition and record the result of the file system detection.
18. The terminal device according to claim 17, wherein, the processing module is further configured to write the result to the first disk partition while writing the result to the first memory space by accessing the first file node.
19. A terminal device, wherein, the terminal device includes: an input / output (I / O) interface, a processor, and a memory, and program instructions are stored in the memory; the processor is configured to execute the program instructions stored in the memory to perform the method according to any one of claims 1 to 9.
20. A computer-readable storage medium includes instructions, wherein, when the instructions run on a terminal device, the terminal device is caused to perform the method according to any one of claims 1 to 9.
21. A computer program, wherein, when the computer program is executed by a terminal device, it is configured to perform the method according to any one of claims 1 to 9.
22. A chip includes at least one processor, a memory, and a communication interface, and the processor is connected to the memory and the communication interface, wherein, the processor is configured to read and execute a computer program stored in the memory to perform the method according to any one of the foregoing claims 1 to 9.
Citation Information
Patent Citations
Method and device for accelerating starting of computer device
CN103677900A