WO2023065815A1 - 文件系统部署及扩展方法、装置、设备及存储介质 - Google Patents

文件系统部署及扩展方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023065815A1
WO2023065815A1 PCT/CN2022/114617 CN2022114617W WO2023065815A1 WO 2023065815 A1 WO2023065815 A1 WO 2023065815A1 CN 2022114617 W CN2022114617 W CN 2022114617W WO 2023065815 A1 WO2023065815 A1 WO 2023065815A1
Authority
WO
WIPO (PCT)
Prior art keywords
file system
area
data
storage device
physical address
Prior art date
Application number
PCT/CN2022/114617
Other languages
English (en)
French (fr)
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 华为技术有限公司
Publication of WO2023065815A1 publication Critical patent/WO2023065815A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication

Definitions

  • the embodiments of the present application relate to the field of electronic equipment, and in particular to a file system deployment and expansion method, device, device, and storage medium.
  • the file system is an important part of the operating system of electronic devices such as terminal devices, servers, or virtual machines (VMs). It is a set of abstract data types that implement operations such as data storage, hierarchical organization, access, and acquisition.
  • the file system can provide a standard system call interface for the application program installed on the electronic device.
  • the application program can implement operations such as creating, deleting, and reading and writing data in the storage device by calling the standard system call interface provided by the file system.
  • Embodiments of the present application provide a file system deployment and expansion method, device, device, and storage medium, which can be applied to electronic equipment.
  • Electronic equipment can deploy a file system on a storage device through the file system deployment method, and expand the file system through the file system.
  • the method realizes extending the preset file system in the first partition of the storage device, so that when the electronic device is turned on for the first time, the small file system in the page mapping area is extended to the entire first partition.
  • the embodiment of the present application provides a method for deploying a file system, the method including: obtaining the starting physical address and length of the first partition of the storage device, and the size of the physical block of the storage device; The starting physical address and length, as well as the size of the physical block of the storage device, the metadata area of the file system is configured as a page mapping area, and the data area of the file system is configured as a segment mapping area; the logical block address in the file system is mapped When going to the physical block address in the storage device, the mapping granularity of the page mapping area is a page, and the mapping granularity of the segment mapping area is a segment, and the length of the segment is greater than the length of the page and smaller than the length of the physical block.
  • the file system deployment method can be applied to electronic equipment, and the electronic equipment can deploy the file system on the storage device through this method.
  • the processor of the electronic device can execute the code instructions of the operating system, and store the file data cached in the volatile memory to the storage device through the file system, or, from the storage device Read file data to realize the basic read and write functions of the file system.
  • the address mapping method between the file system and the storage device can align the logical address on the file system side with the physical address on the storage device side to a certain extent, and the garbage collection of the file system can achieve tidy storage.
  • the effect of the storage space on the device side saves the garbage collection process of the storage device, reduces the fragmentation of the storage space of the storage device caused by the garbage collection of the file system, and ensures the performance of the storage device.
  • the metadata area of the file system is configured as a page mapping area
  • the data area of the file system is configured as The segment mapping area
  • the segment mapping area may enable the metadata area of the file system to be deployed in the page mapping area of the storage device, and the data area to be deployed in the segment mapping area of the storage device.
  • the file system writes user data to the data area, it can sequentially allocate writing or reading within the segment, so as to adapt to the characteristics of flash sequential writing.
  • this segment mapping (segment mapping) method can reduce the volume of the mapping table compared with the page mapping method, which is conducive to fast reading of data.
  • the file system deployment method may be applicable to a scenario where the electronic device restores factory settings, or the electronic device formats the storage device or the first partition of the storage device.
  • the electronic device can be a mobile phone, and the mobile phone can include a storage device.
  • the mobile phone restores the factory settings, or formats the storage device, or formats a partition on the storage device, it can pass
  • a file system is deployed on a storage device.
  • the metadata area of the file system is configured as a page mapping area
  • the data area of the file system is configured as a page mapping area.
  • Configured as a segment mapping area including: the start physical address of the configuration metadata area is the same as the start physical address of the first partition, the start physical address of the configuration data area is connected to the end physical address of the metadata area, and the start physical address of the data area The starting physical address is aligned according to the size of the physical block of the storage device.
  • the method also includes: resetting the device flash translation layer mapping table in the segment mapping area; the device flash translation layer mapping table stores the mapping between the logical block address in the file system and the physical block address in the storage device relationship; initialize the management data in the metadata area; create a root directory file in the data area.
  • the root directory file refers to the uppermost directory where the file system stores data.
  • Resetting the device flash translation layer mapping table in the segment mapping area can clear the original residual data in the segment mapping area.
  • the management data of the metadata area of the file system may include: super block (super block, SB), (check point 1, CP), segment information table (segment information table, SIT), directory/node address table ( node address table, NAT), segment mapping area summary information (Segment Summary Area, SSA), etc.
  • the creation of the root directory file in the data area includes: according to the data type of the data to be written, and in units of logical blocks, the data is allocated with continuous free space; the data to be written is related to the root directory file. The data.
  • the written data is written in the physical block in an off-site update manner, and the written data carries an identifier of the data type of the written data.
  • the identifier of the data type carried by the write data can be used to inform the storage device of the data type of the write data, and the storage device can also allocate continuous free space for the write data in units of physical blocks according to the data type of the write data.
  • the data types include: key data, non-key data, key categories, and non-key categories.
  • the key data may refer to frequently read files, such as database files.
  • Non-critical data can refer to files that are basically not modified or have not been modified for a long time.
  • the key directory may refer to a directory corresponding to key data, for example, a directory storing a file path of key data.
  • the non-key directory may refer to a directory corresponding to non-key data, for example, a directory storing a file path of non-key data.
  • Allocating continuous free space for writing data may refer to: the same segment can contain the same type of data, or the same segment can preferentially write the same type of data. For example, for a certain segment, what is the type of the first data written, then when writing data to this segment, the same type of data can be written first, and for other types of data, it can be written in another segment enter.
  • the metadata area of the file system is configured as a page mapping area
  • the data area of the file system is configured as a page mapping area.
  • Configured as a segment mapping area including: when the electronic device where the storage device is located is restored to factory settings or the first partition is formatted, according to the starting physical address and length of the first partition and the size of the physical block of the storage device,
  • the metadata area of the file system is configured as a page mapping area
  • the data area of the file system is configured as a segment mapping area.
  • the electronic device may also first determine whether the first partition is occupied (or used), such as: the first partition is being accessed or data is being read or written from the first partition, then Indicates that the first partition is occupied.
  • the first partition is not occupied, the above steps of the file system deployment method can be executed.
  • the process can be ended directly without performing subsequent steps. That is, when the file system deployment method is executed, the first partition is an unused/occupied partition.
  • the embodiment of the present application provides a file system deployment device, which can be applied to electronic equipment, so that the electronic equipment implements the file system described in the first aspect and any possible implementation manner of the first aspect. deployment method.
  • the functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware.
  • the hardware or software includes one or more modules or units corresponding to the first aspect and the steps in the file system deployment method described in any possible implementation manner of the first aspect.
  • the apparatus may include: an acquisition unit, a processing unit, and the like.
  • the acquisition unit and the processing unit can cooperate to implement the file system deployment method described in the first aspect and any possible implementation manner of the first aspect.
  • the acquisition unit can be used to obtain the initial physical address and length of the first partition of the storage device, and the size of the physical block of the storage device;
  • the processing unit can be used to obtain the initial physical address and length of the first partition,
  • the size of the physical block of the storage device the metadata area of the file system is configured as a page mapping area, and the data area of the file system is configured as a segment mapping area;
  • the logical block address in the file system is mapped to the physical block in the storage device When the address is on, the mapping granularity of the page mapping area is page, and the mapping granularity of the segment mapping area is segment, and the length of the segment is greater than the length of the page and smaller than the length of the physical block.
  • the processing unit can be specifically configured to configure the starting physical address of the metadata area to be the same as the starting physical address of the first partition, and configure the starting physical address of the data area to be the same as the ending physical address of the metadata area.
  • the addresses are connected, and the starting physical address of the data area is aligned according to the physical block size of the storage device.
  • the processing unit is also used to reset the device flash translation layer mapping table in the segment mapping area, and the device flash translation layer mapping table stores the mapping between the logical block address in the file system and the physical block address in the storage device relationship; initialize the management data in the metadata area; create a root directory file in the data area.
  • the processing unit may specifically be configured to allocate continuous free space for the written data in logical block units according to the data type of the written data; the written data is data related to the root directory file.
  • the written data is written in the physical block in an off-site update manner, and the written data carries an identifier of the data type of the written data.
  • the data types include: key data, non-key data, key categories, and non-key categories.
  • the processing unit can be specifically configured to: when the electronic device where the storage device is located is restored to factory settings or the first partition is formatted, according to the initial physical address and length of the first partition, and the storage
  • the size of the physical block of the device, the metadata area of the file system is configured as a page mapping area, and the data area of the file system is configured as a segment mapping area.
  • the acquisition unit and the processing unit can cooperate to realize the functions corresponding to all the steps of the file system deployment method described in the first aspect and any possible implementation manner of the first aspect, which will not be repeated here.
  • an embodiment of the present application provides an electronic device, where the electronic device may include a storage device, and the storage device includes a first partition.
  • the electronic device includes: a processor, a memory for storing processor-executable instructions; when the processor is configured to execute the instructions, the electronic device implements the first aspect and any possible implementation manner of the first aspect.
  • an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored; when the computer program instructions are executed by an electronic device, the electronic device realizes the first aspect and the first aspect.
  • the embodiment of the present application provides a computer program product, including computer readable code, or a non-volatile computer readable storage medium bearing computer readable code, when the computer readable code is stored in an electronic device During operation, the processor in the electronic device implements the file system deployment method described in the first aspect and any possible implementation manner of the first aspect.
  • the embodiment of the present application provides a method for extending a file system, the method including: obtaining the starting physical address and length of the first partition of the storage device, the size of the physical block of the storage device, and the reserved The end physical address of the file system set; according to the initial physical address and length of the first partition and the size of the physical block of the storage device, determine the initial physical address and length of the metadata area of the extended file system and the extended The initial physical address and the length of the data area of the subsequent file system; according to the initial physical address and length of the first partition, the size of the physical block of the storage device, and the end physical address of the preset file system in the first partition, Configure the segment mapping area of the first stage; move the data in the data area of the preset file system to the segment mapping area of the first stage; add the extended starting physical address of the metadata area of the file system
  • the area composed of the length of the metadata area of the file system is configured as a page mapping area, and the area composed of the starting physical address of the data area of the extended
  • the mapping granularity of the page mapping area is page
  • the mapping granularity of the segment mapping area is segment
  • the length of the segment is greater than the length of the page, and less than the length of the physical block.
  • the electronic device implements the expansion of the preset file system in the first partition of the storage device through the file system extension method, so that the electronic device can expand the small file system in the page mapping area to the entire first partition when the electronic device is turned on for the first time.
  • the metadata area of the extended file system is located in the page mapping area, and the data area is located in the segment mapping area, and the original data is guaranteed not to be lost.
  • the starting physical address of the metadata area of the extended file system is the same as the starting physical address of the first partition, and the starting physical address of the data area of the extended file system is the same as that of the extended.
  • the ending physical address of the metadata area of the file system is connected, and the starting physical address of the data area of the extended file system is aligned according to the physical block size of the storage device.
  • the starting physical address of the segment mapping area in the first stage is connected to the end physical address of the preset file system, and the starting physical address of the segment mapping area in the first stage follows the physical address of the storage device.
  • the size of the block is aligned, and the starting physical address of the segment mapping area in the first stage is greater than the starting physical address of the data area of the extended file system.
  • the method before the data in the data area of the preset file system is moved to the segment mapping area of the first stage, the method also includes: resetting the device flash translation layer mapping table of the segment mapping area of the first stage ;
  • the device flash translation layer mapping table stores the mapping relationship between the logical block address in the file system and the physical block address in the storage device.
  • Resetting the device flash translation layer mapping table in the segment mapping area of the first stage can clear the original residual data in the segment mapping area of the first stage.
  • the method further includes: updating the management data of the metadata area of the extended file system.
  • the moving the data in the data area of the preset file system to the segment mapping area in the first stage includes: moving the data in the data area of the preset file system to the segment mapping area according to the following rules The segment map area for the first stage.
  • Idle data allocation is allocated according to the size of the physical block of the storage device; 2) The physical block of the storage device is written in the form of remote update; 3) The written data carries the identification of the data type .
  • the data types include: key data, non-key data, key categories, and non-key categories.
  • moving the data in the data area of the preset file system to the segment mapping area of the first stage includes: first moving all the key data and non-key data, and updating the corresponding management of the key data and non-key data
  • the data is written to the metadata area of the extended file system, and the key directories and non-key directories corresponding to the key data and non-key data are updated in the way of in-place update; then all the key directories and non-key directories are moved, and the key directories are updated.
  • the management data corresponding to the directory and non-key objects are written to the metadata area of the extended file system.
  • the above method of moving the data in the data area of the preset file system to the segment mapping area in the first stage can reduce the complexity and the amount of written data when moving data data blocks (such as hot data or cold data) .
  • the embodiment of the present application provides a file system extension device, which can be applied to electronic equipment, so that the electronic equipment implements the file system as described in the sixth aspect and any possible implementation manner of the sixth aspect. extension method.
  • the functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware.
  • the hardware or software includes one or more modules or units corresponding to the sixth aspect and the steps in the file system extension method described in any possible implementation manner of the sixth aspect.
  • the apparatus may include: an acquisition unit, a processing unit, and the like.
  • the acquisition unit and the processing unit can cooperate to implement the file system extension method described in the sixth aspect and any possible implementation manner of the sixth aspect.
  • the acquiring unit can be used to acquire the start physical address and length of the first partition of the storage device, the size of the physical block of the storage device, and the end physical address of the preset file system in the first partition.
  • the processing unit can be used to determine the initial physical address and length of the metadata area of the extended file system and the extended file according to the initial physical address and length of the first partition and the size of the physical block of the storage device.
  • the starting physical address and length of the data area of the system according to the starting physical address and length of the first partition, the size of the physical block of the storage device, and the ending physical address of the preset file system in the first partition, configure the first Stage segment mapping area; move the data of the pre-installed file system data area to the first stage segment mapping area; add the starting physical address of the extended file system metadata area to the extended file system
  • the area composed of the length of the metadata area is configured as a page mapping area, and the area composed of the starting physical address of the data area of the extended file system plus the length of the data area of the extended file system is configured as the second stage segment map area.
  • the mapping granularity of the page mapping area is page
  • the mapping granularity of the segment mapping area is segment
  • the length of the segment is greater than the length of the page, and less than the length of the physical block.
  • the starting physical address of the metadata area of the extended file system is the same as the starting physical address of the first partition, and the starting physical address of the data area of the extended file system is the same as that of the extended.
  • the ending physical address of the metadata area of the file system is connected, and the starting physical address of the data area of the extended file system is aligned according to the physical block size of the storage device.
  • the starting physical address of the segment mapping area in the first stage is connected to the end physical address of the preset file system, and the starting physical address of the segment mapping area in the first stage follows the physical address of the storage device.
  • the size of the block is aligned, and the starting physical address of the segment mapping area in the first stage is greater than the starting physical address of the data area of the extended file system.
  • the processing unit is also used to reset the device flash translation layer mapping table in the segment mapping area of the first stage; the device flash translation layer mapping table stores the logical block address in the file system and the physical block address in the storage device mapping relationship between them.
  • processing unit is further configured to update the management data of the metadata area of the extended file system.
  • the processing unit is specifically configured to move the data of the preset data area of the file system to the segment mapping area of the first stage according to the following rules.
  • Idle data allocation is allocated according to the size of the physical block of the storage device; 2) The physical block of the storage device is written in the form of remote update; 3) The written data carries the identification of the data type .
  • the data types include: key data, non-key data, key categories, and non-key categories.
  • the processing unit is specifically configured to first move all key data and non-key data, update the management data corresponding to the key data and non-key data, and write them into the metadata area of the extended file system to update in-place Update the key directories and non-key directories corresponding to the key data and non-key data in the same way; then move all the key directories and non-key directories, update the management data corresponding to the key directories and non-key objects and write them to the expanded file system metadata area.
  • the acquisition unit and the processing unit can cooperate to realize the functions corresponding to all the steps of the file system extension method described in the sixth aspect and any possible implementation manner of the sixth aspect, which will not be repeated here.
  • the embodiment of the present application provides an electronic device, where the electronic device may include a storage device, and the storage device includes a first partition.
  • the electronic device includes: a processor, a memory for storing processor-executable instructions; when the processor is configured to execute the instructions, the electronic device implements the sixth aspect and any possible implementation manner of the sixth aspect.
  • the embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored; when the computer program instructions are executed by the electronic device, the electronic device realizes the sixth aspect and the sixth aspect.
  • the embodiment of the present application provides a computer program product, including computer readable code, or a non-volatile computer readable storage medium carrying computer readable code, when the computer readable code is stored in an electronic device During operation, the processor in the electronic device implements the file system extension method according to the sixth aspect and any possible implementation manner of the sixth aspect.
  • FIG. 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 2 is a schematic diagram of the system architecture of the Android system provided by the embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a file system deployment method provided in an embodiment of the present application.
  • FIG. 4 is a schematic diagram of the composition of the file system provided by the embodiment of the present application.
  • FIG. 5 is a schematic diagram of the composition of a storage device provided in an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a corresponding relationship between a deployed file system and a storage device provided in an embodiment of the present application
  • FIG. 7 is a schematic flowchart of a file system extension method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of changes in the file system before and after the expansion of the file system preset in the first partition provided by the embodiment of the present application;
  • FIG. 9 is another schematic flow chart of the file system extension method provided by the embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a file system deployment device provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a file system expansion device provided by an embodiment of the present application.
  • references to "one embodiment” or “some embodiments” or the like in this specification means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
  • appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically stated otherwise.
  • the terms “including”, “comprising”, “having” and variations thereof mean “including but not limited to”, unless specifically stated otherwise.
  • the term “connected” includes both direct and indirect connections, unless otherwise stated.
  • first and second are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, a feature defined as “first” and “second” may explicitly or implicitly include one or more of these features.
  • the file system is an important part of the operating system of electronic devices such as terminal devices, servers, or virtual machines (VMs). It is a set of abstract data types that implement operations such as data storage, hierarchical organization, access, and acquisition.
  • the file system can provide a standard system call interface for the application program installed on the electronic device.
  • the application program can implement operations such as creating, deleting, and reading and writing data in the storage device by calling the standard system call interface provided by the file system.
  • the electronic device may be a mobile phone, a computer, and the like.
  • the storage device may be a storage device based on flash particles such as a solid state disk (solid state disk, SSD), a universal flash storage (universal flash storage, UFS), and an embedded multi-media card (embedded multi-media card, eMMC).
  • the file system may be a flash-friendly file system (flash-friendly file system, F2FS).
  • the space that the file system manages to write is the logical address space
  • the storage space in the storage device is the physical address space.
  • the continuous logical addresses at the file system level may become internal to the storage device. Random physical address, when the file system reads related data from the storage device, it may become a random read.
  • the current file system and storage device both have the function of garbage collection (garbage collection, GC), but there is mutual interference between the two. Garbage collection in the file system may cause serious fragmentation of the storage space of the storage device, affecting the performance of the storage device. performance.
  • the present application provides a method for deploying a file system, which can be applied to an electronic device, and the electronic device can deploy a file system on a storage device through the method.
  • the processor of the electronic device can execute the code instructions of the operating system, and store the file data cached in the volatile memory to the storage device through the file system, or, from the storage device Read file data to realize the basic read and write functions of the file system.
  • the address mapping method between the file system and the storage device can align the logical address on the file system side with the physical address on the storage device side to a certain extent.
  • the effect of the storage space saves the process of garbage collection of the storage device, which can reduce the fragmentation of the storage space of the storage device caused by the garbage collection of the file system and ensure the performance of the storage device.
  • the file system deployment method provided by the embodiments of the present application may be applicable to scenarios where the electronic device restores factory settings, or the electronic device formats the storage device or the first partition of the storage device.
  • the electronic device can be a mobile phone, and the mobile phone can include a storage device.
  • the mobile phone restores the factory settings, or formats the storage device, or formats a partition on the storage device, it can pass
  • the file system deployment method provided in the embodiment of the present application, the file system is deployed on the storage device.
  • the electronic device may include: a terminal device, a server, or a virtual machine (virtual machine, VM), etc.
  • Terminal devices can be mobile phones, tablet computers, desktops, laptops, handheld computers, notebook computers, ultra-mobile personal computers (ultra-mobile personal computers, UMPCs), netbooks, and cellular phones, personal digital assistants (personal digital assistants, PDA), augmented reality (augmented reality, AR) ⁇ virtual reality (virtual reality, VR) equipment and other equipment, the embodiment of the present application does not make special restrictions on the specific form of the electronic equipment.
  • FIG. 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
  • the electronic equipment may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193 , a display screen 194, and a subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit, NPU
  • the controller may be the nerve center and command center of the electronic equipment.
  • the controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is a cache memory.
  • the memory may hold instructions or data that the processor 110 has just used or recycled.
  • the memory can be volatile memory.
  • processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input and output
  • subscriber identity module subscriber identity module
  • SIM subscriber identity module
  • USB universal serial bus
  • the interface connection relationship among the modules shown in this embodiment is only a schematic illustration, and does not constitute a structural limitation of the electronic device.
  • the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is configured to receive a charging input from a charger. While the charging management module 140 is charging the battery 142 , it can also provide power for electronic devices through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
  • the power management module 141 may also be disposed in the processor 110 .
  • the power management module 141 and the charging management module 140 can also be set in the same device.
  • the wireless communication function of the electronic device can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied to electronic devices.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be set in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent from the processor 110, and be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite system, etc. (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and/or IR techniques, etc.
  • GSM global system for mobile communications
  • general packet radio service general packet radio service
  • CDMA code division multiple access
  • WCDMA broadband Code division multiple access
  • time division code division multiple access time-division code division multiple access
  • TD-SCDMA time-division code division multiple access
  • LTE long term evolution
  • BT GNSS
  • the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a Beidou navigation satellite system (beidou navigation satellite system, BDS), a quasi-zenith satellite system (quasi -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • Beidou navigation satellite system beidou navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device realizes the display function through the GPU, the display screen 194, and the application processor.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos and the like.
  • the display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc.
  • the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device can realize the shooting function through ISP, camera 193 , video codec, GPU, display screen 194 and application processor.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. Such as saving music, video and other files in the external memory card.
  • the internal memory 121 may be used to store computer-executable program codes including instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device by executing instructions stored in the internal memory 121 .
  • the processor 110 may implement the file system deployment method and the file system extension method provided in the embodiment of the present application by executing instructions stored in the internal memory 121 .
  • the internal memory 121 may include an area for storing programs and an area for storing data. Wherein, the storage program area can store the operating system, at least one application program required by the function (such as sound playback function, image playback function, or mkfs tool, resize tool, etc.) and the like.
  • the storage data area can store data (such as audio data, phone book, etc.) created during the use of the electronic device.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash memory (universal flash storage, UFS), eMMC, and the like.
  • the electronic device may deploy the file system on the internal memory 121 or on other storage devices connected to the external memory interface 120 through the file system deployment method provided in the embodiment of the present application.
  • Other storage devices externally connected to the internal memory 121 and the external memory interface 120 may be hybrid mapping storage devices based on flash particles described in the following embodiments.
  • the electronic device can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as calls, music playback, recording, etc.
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.
  • FIG. 1 does not constitute a specific limitation on the electronic device described in the embodiment of the present application.
  • the electronic device may also include more or fewer components than those shown in FIG. 1 , or combine certain components, or separate certain components, or arrange different components.
  • the components shown in Fig. 1 can be implemented in hardware, software or a combination of software and hardware.
  • the embodiment of the present application does not limit the specific structure of the electronic device.
  • the file system deployment method provided in the embodiment of the present application can be implemented by an application program installed on the electronic device, for example, the application program can be called a file system (make file system, mkfs) tool .
  • FIG. 2 is a schematic diagram of the system architecture of the Android system provided by the embodiment of the present application.
  • the Android system may include: an application layer (applications), an application framework layer (application framework), a system runtime layer (libraries), and a kernel layer.
  • the above-mentioned mkfs tool can be deployed at the application program layer, and the file system of the electronic device can be deployed at the kernel layer.
  • the application layer may also include third-party applications that can access the storage device through the file system, such as applications such as maps and browsers.
  • the operating system of the electronic device can also be HongmengTM (harmony) system, iosTM system, windowsTM system, macTM system, linuxTM system, etc., more specifically, it can also be HuaweiTM system or EMUITM system, Android Wear TM system, Lite OS TM system, Tizen TM system, watch os TM system, etc.
  • the operating system of the electronic device is not limited here.
  • FIG. 3 is a schematic flowchart of a file system deployment method provided by an embodiment of the present application.
  • the file system deployment method may include:
  • the storage device may be a storage device based on flash particles, and the storage device may be logically divided into one or more independent storage areas, and each storage area may be called a partition, and these partitions may be used to install operating systems, applications, and storage data files, etc.
  • Deploying a file system to a storage device generally refers to: deploying the file system to a partition in the storage device, such as the first partition.
  • the storage device may include a system partition and a user partition, and the first partition described in S301 may be the user partition.
  • the starting physical address of the first partition refers to the starting physical address of the storage space occupied by the first partition in the storage device
  • the length of the first partition refers to the starting point of the storage space occupied by the first partition in the storage device The length between the physical address and the end physical address.
  • the storage device may include multiple physical blocks, and the physical address of the storage space of the storage device may also be referred to as a physical block address (physics block address, PBA).
  • a physical block refers to a storage area in a storage device.
  • the physical block size can be 144MB, 288MB, etc.
  • the sizes of physical blocks in different storage devices may be the same or different, and there is no limitation here. Since each physical block in the storage device can only write data after the entire block is erased, the physical block is also called a physical erase block (physic erase block, PEB).
  • the electronic device when the storage device is connected to the electronic device, or installed in the electronic device, the electronic device can obtain the device information of the storage device, and the device information can include the partition information of the storage device, each partition (such as the first The starting physical address and length of the partition), the size of the physical block of the storage device, etc.
  • the mkfs tool can be initialized. During the initialization process, the mkfs tool can apply to the electronic device for its own running memory and initialize its own running memory. Data structure, parsing operating parameters, etc. Wherein, the operating parameters may include a device path of the storage device, and the device path specifies the starting physical address and length of the first partition where the file system needs to be deployed.
  • the file system may include a metadata (meta data) area and a data (main data) area, and the metadata area is also called a metadata management area.
  • the metadata area is used to store management data of the file system (management data is also called metadata), and the data area is used to store user data.
  • Management data refers to system data used to describe the characteristics of files in the data area, such as: access rights, file owners, and distribution information of file data blocks, etc. Files are user data stored in the data area.
  • the file system may include multiple logical blocks (logical blocks), which are also called logical erase blocks (logical erase blocks, LEBs).
  • the address allocated by the file system for user data may be called a logical block address (logical block address, LBA), and the logical block address is also referred to as a logical address.
  • LBA logical block address
  • the logical block address can be mapped to the actual physical block address in the storage device through address mapping within the device of the storage device.
  • the physical block address is also referred to as the physical address.
  • the storage device may be a flash granule storage device that supports configurable several page mapping areas and segment mapping areas, or may be called a hybrid mapping storage device based on (flash) granules.
  • Both the page mapping area and the segment mapping area refer to a storage area on the storage device.
  • the mapping granularity of the page mapping area is page
  • the mapping granularity of the segment mapping area is segment.
  • the size of a segment can be between pages and blocks (eg physical blocks). That is, the length of a segment is greater than the length of a page and less than the length of a block.
  • the size of a page may be 4KB
  • the size of a segment may be 2MB
  • the size of a block may be hundreds of MB, etc.
  • the physical block on the storage device side and the logical block on the file system side may be equally divided into n (n is an integer greater than 1) segments.
  • a segment in a physical block may be called a physical segment, and a segment in a logical block may be called a logical segment.
  • a physical block may include multiple physical segments, a physical segment may include multiple physical pages, a logical block may include multiple logical segments, and a logical segment may include multiple logical pages.
  • the metadata area of the file system is configured as a page mapping area
  • the data area of the file system is configured as a segment mapping area, which can make
  • the metadata area of the file system is deployed in the page mapping area of the storage device, and the data area is deployed in the segment mapping area of the storage device.
  • the file system When the file system writes user data to the data area, it can sequentially allocate writing or reading within the segment, so as to adapt to the characteristics of flash sequential writing.
  • this segment mapping (segment mapping) method can reduce the volume of the mapping table compared with the page mapping method, which is conducive to fast reading of data.
  • FIG. 4 is a schematic composition diagram of a file system provided by an embodiment of the present application.
  • the file system may include a key file identification (key file filter) module (or called a key data identification module) 401, a flash mode control (flash mode control) module 402, distribution ( allocator) module 403, and garbage collection (garbage collection, GC) module 404.
  • key file identification key file filter
  • flash mode control flash mode control
  • distribution ( allocator) module 403 garbage collection (garbage collection, GC) module 404.
  • garbage collection garbage collection
  • the key file identification module 401 can determine whether the data belongs to key data, and there is no limitation on the determination rules of key data here.
  • database files can be used as key data by identifying the naming of the files.
  • the flash mode control module 402 can control the use mode of the physical block of the storage device, for example, the use mode of the physical block can include one or more of the following: single level cell (single level cell, SLC) mode, double-layer unit (mutil level cell, MLC) mode, triple level cell (TLC) mode, quadrilateral level cell (QLC) mode, etc.
  • the usage mode of the physical block may further include modes of more layer units.
  • the file system can first judge whether the data belongs to key data through the key file identification module 401, if it is key data, then based on the flash memory mode control module 402, in the case of surplus free space , write data to the physical block in SLC mode.
  • SLC mode 1/3 of the space of the physical block can be used. That is, in the file system provided by the embodiment of the present application, the capability of fast writing (turbo write) to the physical block can be implemented on the file system side.
  • the usage mode switching channel of the physical block is opened between the file system and the storage device, and the usage mode of the physical block when data is written is controlled by the file system, which can improve the read and write performance of key data.
  • the fast write module on the storage device side can be removed.
  • the allocating module 403 is also called a space allocating module, and may be used to allocate storage space for user data or system data that needs to be stored in the storage device.
  • the allocation module 403 allocates the storage space, it allocates at the segment granularity, and the allocated address is the aforementioned logical block address. That is, the file system can allocate logical block addresses for user data through the allocation module 403 .
  • the garbage collection (garbage collection, GC) module 404 can be used to organize the logical address space of the file system, and ensure that the allocation module 403 can allocate continuous logical block addresses when performing space allocation.
  • the garbage collection module 404 when sorting out the logical address space of the file system, can also sort out free physical blocks on the storage device side while sorting out free logical blocks. That is, the garbage collection module 404 can perform unified garbage collection on the file system and the storage device.
  • the garbage collection module 404 organizes the logical blocks on the file system side and the physical blocks on the storage device side at the same time, which can improve the efficiency of garbage collection, save the process of garbage collection on the storage device, reduce the fragmentation of the storage space of the storage device, and ensure that the storage device is After long-term use, storage performance does not decline or declines less.
  • the garbage collection module on the storage device side may be removed to avoid mutual interference with the garbage collection module 404 on the file system side.
  • FIG. 4 shows the functions of the file system in a manner that the file system includes a key file identification module 401 , a flash memory mode control module 402 , an allocation module 403 , and a garbage collection module 404 .
  • the divisions of these modules are all functional/logical divisions.
  • the file system may actually include a software processing module, such as: flash translation layer (flash translation layer, FTL), and FTL can be used It possesses the capabilities of the aforementioned key file identification module 401 , flash memory mode control module 402 , allocation module 403 , and garbage collection module 404 .
  • flash translation layer flash translation layer
  • FIG. 5 is a schematic composition diagram of a storage device provided in an embodiment of the present application.
  • the storage device may include an address mapping (address translator) module 501 and a wear leveling (wear leveling, WL) module 502.
  • address mapping address translator
  • wear leveling wear leveling, WL
  • the address mapping module 501 can realize the above-mentioned function of mapping the logical block address to the actual physical block address in the storage device by performing address mapping (or called space mapping) at a segment granularity inside the device of the storage device.
  • address mapping or called space mapping
  • a segment (logical segment) in a logical block on the file system side can be mapped to a physical block corresponding to the logical block in the storage device, for example, a segment in the first logical block can be mapped into the first physical block corresponding to the first logical block in the storage device, the segment in the second logical block can be mapped to the second physical block corresponding to the second logical block in the storage device, to And so on.
  • This address mapping method between the file system and the storage device can align the logical block address on the file system side with the physical block address on the storage device side to a certain extent, and improve the read and write performance of the file system.
  • the wear leveling module 502 can be used to ensure that the times of erasing and writing of all physical erase blocks are roughly equal, so as to improve the service life of the storage device.
  • the metadata area of the file system is configured as a page mapping area
  • the starting physical address and length of the metadata area are recorded as [metaAddr, metaLen], "metaAddr” indicates the starting physical address of the metadata area, “metaLen” indicates the length of the metadata area, and the starting physical address of the data area
  • the address and length are recorded as [mainAddr, mainLen]
  • mainAddr indicates the starting physical address of the data area
  • mainLen indicates the length of the data area
  • the starting physical address of the first partition can be used as “metaAddr”
  • the area of "metaAddr” plus “metaLen” is configured as a page mapping area, and the first address connected to the end physical address of the area of "metaAddr” plus “metaLen” (that is, the end physical address of the metadata area) is used as the “mainAddr ", configure the area of "mainAddr” plus “mainLen” as the segment mapping area.
  • mainAddr needs to be aligned according to the size of the physical block of the storage device
  • the length of the metadata area is related to the data structure of the management data contained in the metadata area of the file system, and the data structure of the management data contained in the metadata area can be manually defined or
  • the length of the metadata area can be increased or decreased following the change of the data structure of the management data, which is not limited here.
  • the length of the data area can be related to the length of the metadata area and the length of the first partition, depending on the size of the area to be managed, for example, the length of the data area can be less than or equal to the length of the first partition minus the length of the metadata area The length is not limited here.
  • FIG. 6 is a schematic diagram of a corresponding relationship between a deployed file system and a storage device according to an embodiment of the present application.
  • the metadata area of the file system may include: super block (super block, SB), check point 1 (check point 1, CP1), check point 2 (check point 2, CP2) , segment information table 1 (segment information table 1, SIT1), segment information table 2 (segment information table 2, SIT2), directory/node address table 1 (node address table 1, NAT1) & directory/node address table 2 (node address table 2, NAT2), segment mapping area summary information (Segment Summary Area, SSA) and other management data.
  • & means "and”.
  • the data area can include user data or system data such as hot data, cold data, hot directory, and cold directory.
  • hot data, cold data, hot directory, and cold directory please refer to the following.
  • the electronic device can configure the metadata area of the file system as a page mapping area and configure the data area of the file system as a segment mapping area through the file system deployment method provided by the embodiment of the present application.
  • the starting physical address of the metadata area is the starting physical address of the corresponding page mapping area
  • the ending physical address of the metadata area is the corresponding ending physical address of the page mapping area
  • the data The start physical address of the zone is concatenated with the end physical address of the metadata zone.
  • the starting physical address of the data area is the starting physical address of the corresponding segment mapping area
  • the ending physical address of the data area is the corresponding ending physical address of the segment mapping area.
  • the file system deployment method can enable the electronic device to deploy the file system shown in Figure 4 above on the storage device (such as the first partition of the storage device) shown in Figure 5 above, so that the file system
  • the metadata area of the file system is located in the page mapping area
  • the data area of the file system is located in the segment mapping area. Therefore, the file system can be connected with the storage device up and down, and vertically optimized to realize the garbage collection of the file system instead of the garbage collection of the storage device, improve the efficiency of garbage collection, save the garbage collection process of the storage device, and reduce the storage space fragmentation of the storage device To ensure that the storage performance of the storage device does not decrease or decreases even less after long-term use.
  • the address mapping method between the file system and the storage device can align the logical block address on the file system side with the physical block address on the storage device side to a certain extent, improving the read and write performance of the file system.
  • the device FTL mapping table stores the mapping relationship between the logical block address on the file system side and the physical block address on the storage device side.
  • the file system can read data from the storage device based on the device FTL mapping table, or when the file system writes data to the storage device, it can maintain the corresponding logical block address and physical block address of the written data in the device FTL mapping table mapping relationship between them. For example, when an application program in an electronic device wants to read a certain file stored on the storage device, the file system can query the physical block address of the file in the device FTL mapping table according to the logical block address of the file, and read the file from the file's The file is read in the physical block address.
  • the device FTL mapping table in the segment mapping area is reset to clear the original residual data in the segment mapping area.
  • the management data of the metadata area of the file system may include: super block (super block, SB), (check point 1, CP), segment information table (segment information table, SIT ), directory/node address table (node address table, NAT), segment mapping area summary information (Segment Summary Area, SSA), etc.
  • the root directory file refers to the uppermost level directory where the file system stores data.
  • the data area of the file system is located in the segment mapping area.
  • the inside of the physical block can be written in an out-place update (OPU) manner, and the written data carries the identification/mark of the data type,
  • OPU out-place update
  • the identifier of the data type carried by the write data can be used to inform the storage device of the data type of the write data, and the storage device can also allocate continuous free space for the write data in units of physical blocks according to the data type of the write data.
  • the data types may include: key data (hot data, or hot data), non-key data (cold data, or ordinary data or cold data), key directories/indexes (hot node, or Hot directory), non-key directory (cold node, or ordinary node or cold node).
  • the key data may refer to frequently read files, such as database files.
  • Non-critical data can refer to files that are basically not modified or have not been modified for a long time.
  • the key directory may refer to a directory corresponding to key data, for example, a directory storing a file path of key data.
  • the non-key directory may refer to a directory corresponding to non-key data, for example, a directory storing a file path of non-key data.
  • Allocating continuous free space for writing data may refer to: the same segment can contain the same type of data, or the same segment can preferentially write the same type of data. For example, for a certain segment, what is the type of the first data written, then when writing data to this segment, the same type of data can be written first, and other types of data can be written in another segment enter.
  • the manner of identifying the data type of the written data may include: identifying the data type of the written data based on a suffix of the written data and/or based on an access frequency of the written data. For example, for a certain file, when the suffix of the file is ".db", it can be determined that the file is a database file, and the data type is key data. This application does not limit the manner of identifying the data type.
  • the electronic device may also first determine whether the first partition is occupied (or used), such as: accessing the first partition or being accessed from the first partition If data is read or written in the partition, it means that the first partition is occupied.
  • S302 may be executed.
  • the process can be ended directly without performing subsequent steps. That is, when the file system deployment method provided by the embodiment of the present application is executed, the first partition is an unused partition.
  • the above embodiments have introduced the process that the electronic device deploys a new file system on the first partition of the storage device.
  • a file system has been deployed on the first partition of the storage device, but the file system already deployed on the storage device is a small file system, and all small file systems are deployed in the page mapping area.
  • the electronic device is started for the first time (for example, it is turned on for the first time)
  • the small file system needs to be extended to extend the small file system to the entire first partition.
  • the storage device size of an electronic device is 256G, of which 200G is divided into a user area, that is, an area used by a user.
  • the manufacturer may have burned a small file system with a size of 4G in 200G to preset some data resources.
  • the electronic device starts up for the first time, it is necessary to expand this 4G small file system to the entire 200G area.
  • the embodiment of the present application further provides a method for extending the file system, which can be applied to electronic devices.
  • the electronic device can expand the preset file system in the first partition of the storage device through the file system extension method, so that when the electronic device is turned on for the first time, the small file system in the page mapping area is extended to the entire first partition. Partition, the metadata area of the extended file system is located in the page mapping area, and the data area is located in the segment mapping area, and the original data is guaranteed not to be lost.
  • the file system may refer to the description in the foregoing embodiments and the foregoing FIG. 4
  • the storage device may refer to the foregoing description in the embodiments and the foregoing FIG. 5 .
  • the method for extending the file system provided in the embodiment of the present application may also be implemented by an application program installed on the electronic device, for example, the application program may be called an expansion (resize) tool.
  • the storage device may be a flash granular storage device that supports configurable several page (page) mapping areas and segment (segment) mapping areas.
  • the storage device can include multiple mapping areas, each mapping area can be defined by [startAddr, len, type], "startAddr” is the starting physical address of the mapping area, "len” is the length of the mapping area, and "type” is the mapping The type of zone.
  • Types of mapping areas include: "page mapping area” or "segment mapping area”.
  • FIG. 7 is a schematic flowchart of a file system extension method provided in the embodiment of the present application.
  • the file system extension method provided in the embodiment of the present application may include:
  • the storage device may be a storage device based on flash particles, and the storage device may include one or more partitions, such as: a first partition, a second partition, a third partition, and so on.
  • the first partition of the storage device is a partition in which a file system has been preset in the page mapping area.
  • the storage device may include a system partition and a user partition, and the first partition described in S701 may be the user partition.
  • partitions reference may be made to the descriptions in the foregoing embodiments, and details are not repeated here.
  • the starting physical address of the first partition refers to the starting physical address of the storage space occupied by the first partition in the storage device
  • the length of the first partition refers to the starting point of the storage space occupied by the first partition in the storage device The length between the physical address and the end physical address.
  • the electronic device when the storage device is connected to the electronic device, or installed in the electronic device, the electronic device can obtain the device information of the storage device, and the device information can include the partition information of the storage device, each partition (such as the first The starting physical address and length of the partition), the size of the physical block of the storage device, etc.
  • the resize tool can be initialized. Data structure, parsing operating parameters, etc.
  • the operating parameters may include a device path of the storage device, and the device path specifies the starting physical address and length of the first partition that needs to expand the file system.
  • the initial physical address of the file system preset in the first partition is the same as the initial physical address of the first partition.
  • S702. Determine the initial physical address and length of the metadata area of the extended file system, and the initial physical address and length of the data area according to the initial physical address and length of the first partition and the size of the physical block of the storage device. length.
  • the starting physical address of the metadata area of the extended file system may be the same as the starting physical address of the first partition, and the starting physical address of the data area of the extended file system may be the same as that of the extended.
  • the end physical address of the metadata area of the file system can be connected, and the start physical address of the data area of the extended file system is aligned according to the physical block size of the storage device.
  • the length of the metadata area of the extended file system is related to the data structure of the management data contained in the metadata area of the extended file system, and the management data contained in the metadata area of the extended file system
  • the data structure of the file system can be defined or changed manually, and the length of the metadata area of the extended file system can be increased or decreased following the change of the data structure of the management data, which is not limited here.
  • the length of the data area of the extended file system may be related to the length of the metadata area of the extended file system and the length of the first partition, depending on the size of the area to be managed, for example, the data of the extended file system
  • the length of the zone may be less than or equal to the length of the first partition minus the length of the metadata zone of the extended file system, which is not limited here.
  • the starting physical address of the segment mapping area in the first stage is connected to the end physical address of the preset file system, and the starting physical address of the segment mapping area in the first stage follows the physical address of the storage device.
  • the size of the block is aligned, and the starting physical address of the segment mapping area in the first stage is greater than the starting physical address of the data area of the extended file system.
  • the length of the first-stage segment mapping area is the length of the first partition minus the starting physical address of the first-stage segment mapping area, that is, the length of the first-stage segment mapping area is the first-stage segment mapping area
  • the ending physical address of the first partition may be obtained by adding the starting physical address of the first partition to the length of the first partition.
  • the preset file system in the first partition is located in the page mapping area, then in S703, after the end physical address of the preset file system can be aligned according to the size of the physical block of the storage device
  • the initial physical address of the segment mapping area in the first stage is obtained, for example, the initial physical address of the segment mapping area in the first stage can be recorded as "mainAddrTmp". 'mainAddrTmp' is greater than 'mainAddr'.
  • the area from "mainAddrTmp" to the end physical address of the first partition can be configured as the segment mapping area of the first stage.
  • the length of the segment mapping area in the first stage can be recorded as "lenTmp”
  • [mainAddrTmp, lenTmp] can be configured as the segment mapping area in the first stage.
  • the identification of the data type can refer to the description in the foregoing embodiments, which can include: key data (hot data, or called hot data), non-key data (cold data, or called ordinary data or cold data), key directory /Index (hot node, or hot directory), non-key directory (cold node, or ordinary node or cold node), etc., will not be described here.
  • the moving process can be performed in the following manner:
  • [metaAddr, metaLen] can be configured as the page mapping area
  • [mainAddr, mainLen] can be configured as the segment mapping area of the second stage, so that the metadata area of the extended file system is located in the page mapping area, and the extended file The data area of the system is located in the segment map area of the second stage.
  • mapping area in the first stage and “segment mapping area in the second stage” are only used to distinguish the mapping areas of the two configurations from being different, and they can also be referred to as the mapping area, or the “segment mapping area of the first stage” may be referred to as the "first segment mapping area”, and the “segment mapping area of the second stage” may be referred to as the "second segment mapping area”, etc. limit.
  • FIG. 8 is a schematic diagram of changes in the file system before and after the extension of the preset file system in the first partition provided by the embodiment of the present application.
  • the metadata area of the file system may include: management data such as SB, CP1, CP2, SIT1, SIT2, NAT 1 & NAT 2 ("&" means sum), SSA, etc.
  • the data area may include hot data, cold data, hot directory, cold directory and other data.
  • the electronic device can expand the file system preset in the first partition through the method shown in FIG. 7 above.
  • the metadata area of the extended file system is configured as a page mapping area, and the data area of the extended file system is located in the segment mapping area.
  • the starting physical address of the metadata area of the extended file system is the starting physical address of the corresponding page mapping area, and the ending physical address of the metadata area of the extended file system
  • the address is the end physical address of the corresponding page mapping area
  • the start physical address of the data area of the extended file system is connected with the end physical address of the metadata area of the extended file system.
  • the starting physical address of the data area of the extended file system is the starting physical address of the corresponding segment mapping area
  • the ending physical address of the data area of the extended file system is the ending physical address of the corresponding segment mapping area.
  • FIG. 9 is another schematic flowchart of the file system extension method provided by the embodiment of the present application.
  • the file system extension method provided by the embodiment of the present application may also include S801 before S704.
  • Resetting the device FTL mapping table in the segment mapping area of the first stage can clear the original residual data in the segment mapping area of the first stage.
  • S802 may also be included.
  • management data such as super block and checkpoint can be updated and written to [metaAddr, metaLen] (that is, the metadata area of the file system).
  • the electronic device can expand the preset file system in the first partition of the storage device, so that when the electronic device is turned on for the first time, the The small file system in the page mapping area is extended to the entire first partition, the metadata area of the extended file system is located in the page mapping area, the data area is located in the segment mapping area, and the original data is guaranteed not to be lost.
  • FIG. 10 is a schematic structural diagram of an apparatus for deploying a file system provided by an embodiment of the present application.
  • the apparatus may include: an acquiring unit 1001, a processing unit 1002, and the like.
  • the obtaining unit 1001 and the processing unit 1002 may cooperate to implement the file system deployment method as described in the foregoing embodiments.
  • the obtaining unit 1001 can be used to obtain the initial physical address and length of the first partition of the storage device and the size of the physical block of the storage device; the processing unit 1002 can be used to obtain the initial physical address and the length of the first partition according to the first partition.
  • the metadata area of the file system is configured as a page mapping area
  • the data area of the file system is configured as a segment mapping area.
  • the mapping granularity of the page mapping area is a page
  • the mapping granularity of the segment mapping area is a segment.
  • the length of a segment is greater than the length of a page and smaller than a physical block. length.
  • the processing unit 1002 can specifically configure the starting physical address of the metadata area to be the same as the starting physical address of the first partition, and configure the starting physical address of the data area to be the same as the end of the metadata area.
  • the physical addresses are connected, and the starting physical address of the data area is aligned according to the physical block size of the storage device.
  • the processing unit 1002 is further configured to reset the device flash translation layer mapping table in the segment mapping area, and the device flash translation layer mapping table stores the address between the logical block address in the file system and the physical block address in the storage device. Mapping relationship; Initialize the management data in the metadata area; Create a root directory file in the data area.
  • the processing unit 1002 may specifically be configured to allocate continuous free space for the written data in logical block units according to the data type of the written data; the written data is data related to the root directory file.
  • the written data is written in the physical block in an off-site update manner, and the written data carries an identifier of the data type of the written data.
  • the data types include: key data, non-key data, key categories, and non-key categories.
  • the processing unit 1002 can specifically be configured to, when the electronic device where the storage device is located is restored to factory settings or the first partition is formatted, according to the starting physical address and length of the first partition, and The size of the physical block of the storage device, the metadata area of the file system is configured as a page mapping area, and the data area of the file system is configured as a segment mapping area.
  • the acquiring unit 1001 and the processing unit 1002 can cooperate to implement functions corresponding to all the steps of the file system deployment method described in the foregoing embodiments, which will not be repeated here.
  • an embodiment of the present application provides a file system extension device, which can be applied to the above-mentioned electronic device, and used to implement the file system extension method described in the foregoing embodiments.
  • the functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware.
  • the hardware or software includes one or more modules or units corresponding to the steps of the above file system extension method.
  • FIG. 11 is a schematic structural diagram of a file system expansion device provided by an embodiment of the present application.
  • the apparatus may include: an acquiring unit 1101, a processing unit 1102, and the like.
  • the obtaining unit 1101 and the processing unit 1102 may cooperate to implement the file system extension method described in the foregoing embodiments.
  • the acquisition unit 1101 may be configured to acquire the start physical address and length of the first partition of the storage device, the size of the physical block of the storage device, and the end physical address of the preset file system in the first partition.
  • the processing unit 1102 may be configured to determine the initial physical address and length of the metadata area of the extended file system, and the extended The starting physical address and length of the data area of the file system; according to the starting physical address and length of the first partition, the size of the physical block of the storage device, and the end physical address of the preset file system in the first partition, configure the second The segment mapping area of the first stage; move the data of the data area of the preset file system to the segment mapping area of the first stage; add the starting physical address of the metadata area of the extended file system to the extended file system
  • the area formed by the length of the metadata area of the file system is configured as a page mapping area
  • the area formed by the starting physical address of the data area of the extended file system plus the length of the data area of the extended file system is configured as the second The segment
  • the mapping granularity of the page mapping area is page
  • the mapping granularity of the segment mapping area is segment
  • the length of the segment is greater than the length of the page, and less than the length of the physical block.
  • the starting physical address of the metadata area of the extended file system is the same as the starting physical address of the first partition, and the starting physical address of the data area of the extended file system is the same as that of the extended.
  • the ending physical address of the metadata area of the file system is connected, and the starting physical address of the data area of the extended file system is aligned according to the physical block size of the storage device.
  • the starting physical address of the segment mapping area in the first stage is connected to the end physical address of the preset file system, and the starting physical address of the segment mapping area in the first stage follows the physical address of the storage device.
  • the size of the block is aligned, and the starting physical address of the segment mapping area in the first stage is greater than the starting physical address of the data area of the extended file system.
  • the processing unit 1102 is also used to reset the device flash translation layer mapping table in the segment mapping area of the first stage; the device flash translation layer mapping table stores the logical block address in the file system and the physical block in the storage device The mapping relationship between addresses.
  • processing unit 1102 is further configured to update the management data of the metadata area of the extended file system.
  • the processing unit 1102 is specifically configured to move the data of the preset data area of the file system to the segment mapping area of the first stage according to the following rules.
  • Idle data allocation is allocated according to the size of the physical block of the storage device; 2) The physical block of the storage device is written in the form of remote update; 3) The written data carries the identification of the data type .
  • the data types include: key data, non-key data, key categories, and non-key categories.
  • the processing unit 1102 is specifically configured to first move all critical data and non-critical data, update the management data corresponding to the critical data and non-critical data, and write them into the metadata area of the extended file system to in-place
  • the update method updates the key directories and non-key directories corresponding to the key data and non-key data; then moves all the key directories and non-key directories, updates the management data corresponding to the key directories and non-key objects, and writes them to the expanded file system metadata area.
  • the obtaining unit 1101 and the processing unit 1102 can cooperate to implement functions corresponding to all the steps of the file system extension method described in the foregoing embodiments, which will not be repeated here.
  • the division of modules (or called units) in the above device is only a division of logical functions, and may be fully or partially integrated into a physical entity or physically separated during actual implementation.
  • the units in the device can all be implemented in the form of software called by the processing element; they can also be implemented in the form of hardware; some units can also be implemented in the form of software called by the processing element, and some units can be realized in the form of hardware.
  • each unit can be a separate processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in the memory in the form of a program, which is called and executed by a certain processing element of the device. Function. In addition, all or part of these units can be integrated together, or implemented independently.
  • the processing element described here may also be referred to as a processor, and may be an integrated circuit with a signal processing capability. In the process of implementation, each step of the above method or each unit above may be implemented by an integrated logic circuit of hardware in the processor element or implemented in the form of software called by the processing element.
  • the units in the above device may be one or more integrated circuits configured to implement the above method, for example: one or more application specific integrated circuits (ASIC), or, one or more A digital signal processor (DSP), or, one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuit forms.
  • ASIC application specific integrated circuits
  • DSP digital signal processor
  • FPGA field programmable gate arrays
  • the processing element can be a general-purpose processor, such as a central processing unit (central processing unit, CPU) or other processors that can call programs.
  • CPU central processing unit
  • these units can be integrated together and implemented in the form of a system-on-a-chip (SOC).
  • the units of the above apparatus for implementing each corresponding step in the above method may be implemented in the form of a processing element scheduler.
  • the device may include a processing element and a storage element, and the processing element invokes a program stored in the storage element to execute the file system deployment method or the file system extension method described in the above method embodiments.
  • the storage element may be a storage element on the same chip as the processing element, that is, an on-chip storage element.
  • the program for executing the above method may be stored in a storage element on a different chip from the processing element, that is, an off-chip storage element.
  • the processing element invokes or loads a program from the off-chip storage element on the on-chip storage element, so as to invoke and execute the file system deployment method or the file system extension method described in the above method embodiments.
  • the embodiment of the present application also provides an electronic device.
  • the electronic device may be the above-mentioned electronic device.
  • the electronic device includes: a processor, a memory for storing instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the file system deployment method or the file system extension method as described in the foregoing embodiments.
  • the memory can be located inside the electronic device or outside the electronic device.
  • the processor includes one or more.
  • the electronic device may be a terminal device, a server, or a virtual machine (virtual machine, VM).
  • Terminal devices can be mobile phones, tablet computers, desktops, laptops, handheld computers, notebook computers, ultra-mobile personal computers (ultra-mobile personal computers, UMPCs), netbooks, and cellular phones, personal digital assistants (personal digital assistants, PDA), augmented reality (augmented reality, AR) ⁇ virtual reality (virtual reality, VR) equipment and other equipment, the embodiment of the present application does not make special restrictions on the specific form of the electronic equipment.
  • the unit of the electronic device that implements each step in the above method may be configured as one or more processing elements, where the processing elements may be integrated circuits, for example: one or more ASICs, or one Or multiple DSPs, or, one or more FPGAs, or a combination of these types of integrated circuits. These integrated circuits can be integrated together to form a chip.
  • an embodiment of the present application further provides a chip, and the chip can be applied to the above-mentioned electronic device.
  • the chip includes one or more interface circuits and one or more processors; the interface circuits and processors are interconnected through lines; the processor receives and executes computer instructions from the memory of the electronic device through the interface circuits, so as to realize the File system deployment method or file system extension method.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the software product is stored in a program product, such as a computer-readable storage medium, and includes several instructions to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all of the methods described in various embodiments of the present application. or partial steps.
  • the aforementioned storage medium includes: various media capable of storing program codes such as U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk.
  • an embodiment of the present application also provides a computer-readable storage medium on which computer program instructions are stored; when the computer program instructions are executed by an electronic device, the electronic device implements the file system deployment method as described in the embodiment or the file system extension method.
  • an embodiment of the present application further provides a computer program product, including: computer readable codes, or a non-volatile computer readable storage medium bearing computer readable codes, when the computer readable codes are stored in the electronic device
  • the processor in the electronic device implements the method for deploying the file system or the method for extending the file system as described in the foregoing embodiments.

Landscapes

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

Abstract

本申请提供一种文件系统部署及扩展方法、装置、设备及存储介质,涉及电子设备领域。电子设备可以通过该文件系统部署方法将文件系统部署于存储设备上。本申请中,文件系统和存储设备之间的地址映射方式可以使文件系统侧的逻辑地址与存储设备侧的物理地址在一定程度上对齐,文件系统进行垃圾回收的时候可以达到整理存储设备侧的存储空间的效果,省去了存储设备进行垃圾回收的过程,能够减少文件系统进行垃圾回收所导致的存储设备的存储空间碎片化,保证存储设备的性能。

Description

文件系统部署及扩展方法、装置、设备及存储介质
本申请要求于2021年10月22日提交国家知识产权局、申请号为202111235979.7、申请名称为“文件系统部署及扩展方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及电子设备领域,尤其涉及一种文件系统部署及扩展方法、装置、设备及存储介质。
背景技术
文件系统是终端设备、服务器或虚拟机(virtual machine,VM)等电子设备的操作系统的重要组成部分,是一套实现了数据的存储、分级组织、访问和获取等操作的抽象数据类型。文件系统可以为电子设备上安装的应用程序提供一种标准系统调用接口,应用程序通过调用文件系统提供的标准系统调用接口,可以实现在存储设备中创建、删除、读写数据等操作。
发明内容
本申请实施例提供一种文件系统部署及扩展方法、装置、设备及存储介质,可以应用于电子设备,电子设备可以通过该文件系统部署方法将文件系统部署于存储设备上,通过该文件系统扩展方法实现对存储设备的第一分区中已经预置的文件系统进行扩展,使得电子设备在第一次开机时,将页映射区域的小型文件系统扩展到整个第一分区。
第一方面,本申请实施例提供一种文件系统部署方法,所述方法包括:获取存储设备的第一分区的起始物理地址和长度、以及存储设备的物理块的大小;根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区;文件系统中的逻辑块地址在映射到存储设备中的物理块地址上时,页映射区的映射粒度为页,段映射区的映射粒度为段,段的长度大于页的长度、且小于物理块的长度。
该文件系统部署方法可以应用于电子设备,电子设备可以通过该方法将文件系统部署于存储设备上。电子设备将文件系统部署到存储设备上后,电子设备的处理器可以执行操作系统的代码指令,将易失性内存中缓存的文件数据通过文件系统存储到存储设备中,或者,从存储设备中读取文件数据,以实现文件系统的基本读写功能。
该文件系统部署方法中,文件系统和存储设备之间的地址映射方式可以使文件系统侧的逻辑地址与存储设备侧的物理地址在一定程度上对齐,文件系统进行垃圾回收的时候可以达到整理存储设备侧的存储空间的效果,省去了存储设备进行垃圾回收的过程,能够减少文件系统进行垃圾回收所导致的存储设备的存储空间碎片化,保证存储设备的性能。
另外,该文件系统部署方法中根据第一分区的起始物理地址和长度、以及存储设 备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区,可以使得文件系统的元数据区被部署于存储设备的页映射区,数据区被部署于存储设备的段映射区。文件系统在向数据区写入用户数据时,可以在段内顺序分配写入或读取,以适配flash顺序写入的特性。采用这种段映射(segment mapping)的方式相比于采用页映射的方式,可以减少映射表的体积,有利于快速读取数据。
一些实现方式中,该文件系统部署方法可以适用于电子设备恢复出厂设置、或者电子设备将存储设备或者存储设备的第一分区进行格式化的场景。例如,一种可能的实现场景中,电子设备可以是手机,手机可以包括存储设备,则手机在恢复出厂设置、或者格式化存储设备、又或者格式化存储设备上的某个分区时,可以通过该文件系统部署方法,在存储设备上部署文件系统。
一种可能的实现方式中,所述根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区,包括:配置元数据区的起始物理地址与第一分区的起始物理地址相同,配置数据区的起始物理地址与元数据区的结束物理地址相连,且数据区的起始物理地址按照存储设备的物理块的大小对齐。
可选地,所述方法还包括:重置段映射区的器件闪存转换层映射表;器件闪存转换层映射表存储了文件系统中的逻辑块地址和存储设备中的物理块地址之间的映射关系;初始化元数据区的管理数据;在数据区创建根目录文件。根目录文件是指文件系统存储数据的最上一级目录。
重置段映射区的器件闪存转换层映射表,可以清空段映射区原来的残留数据。
示例性地,文件系统的元数据区的管理数据可以包括:超级块(super block,SB)、(check point 1,CP)、段信息表(segment information table,SIT)、目录/节点地址表(node address table,NAT)、段映射区摘要信息(Segment Summary Area,SSA)等。
一种可能的实现方式中,所述在数据区创建根目录文件,包括:按照写入数据的数据类型、以逻辑块为单位为写入数据分配连续空闲空间;写入数据为根目录文件相关的数据。
可选地,写入数据在物理块内部以异地更新的方式写入,且写入数据中携带写入数据的数据类型的标识。
写入数据携带的数据类型的标识可以用于告知存储设备该写入数据的数据类型,存储设备也可以按照写入数据的数据类型以物理块为单位为写入数据分配连续空闲空间。
一种可能的实现方式中,数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
其中,关键数据可以是指经常读取的文件,如数据库文件。非关键数据可以是指基本不修改或长期不修改的文件。关键目录可以是指关键数据对应的目录,如:保存关键数据的文件路径的目录。非关键目录可以是指非关键数据对应的目录,如:保存非关键数据的文件路径的目录。为写入数据分配连续空闲空间,可以是指:同一个段中可以包含同一类型的数据,或者说同一个段中可优先写入同一类型的数据。例如, 对于某个段而言,写入的第一个数据为什么类型,则后续向该段写入数据时,可以优先写入相同类型的数据,对于其他类型的数据,可以再分一个段写入。
一种可能的实现方式中,所述根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区,包括:当存储设备所在的电子设备恢复出厂设置、或者将第一分区进行格式化时,根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区。
可选地,该文件系统部署方法中,电子设备还可以先判断第一分区是否被占用(或使用),如:正在访问第一分区或正在从第一分区中读取或写入数据,则表示第一分区被占用。当第一分区没有被占用时,可以执行该文件系统部署方法的上述步骤。当第一分区被占用时,可以直接结束流程,不执行后续步骤。也即,该文件系统部署方法在执行时,第一分区是未被使用/占用的分区。
第二方面,本申请实施例提供一种文件系统部署装置,该装置可以应用于电子设备,以使电子设备实现如第一方面及第一方面的任意一种可能的实现方式所述的文件系统部署方法。该装置的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与第一方面及第一方面的任意一种可能的实现方式所述的文件系统部署方法中的步骤相对应的模块或单元。
例如,该装置可以包括:获取单元、处理单元等。获取单元和处理单元可以配合实现如第一方面及第一方面的任意一种可能的实现方式所述的文件系统部署方法。如:获取单元,可以用于获取存储设备的第一分区的起始物理地址和长度、以及存储设备的物理块的大小;处理单元,可以用于根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区;文件系统中的逻辑块地址在映射到存储设备中的物理块地址上时,页映射区的映射粒度为页,段映射区的映射粒度为段,段的长度大于页的长度、且小于物理块的长度。
一种可能的实现方式中,处理单元,具体可以用于配置元数据区的起始物理地址与第一分区的起始物理地址相同,配置数据区的起始物理地址与元数据区的结束物理地址相连,且数据区的起始物理地址按照存储设备的物理块的大小对齐。
可选地,处理单元,还用于重置段映射区的器件闪存转换层映射表,器件闪存转换层映射表存储了文件系统中的逻辑块地址和存储设备中的物理块地址之间的映射关系;初始化元数据区的管理数据;在数据区创建根目录文件。
一种可能的实现方式中,处理单元,具体可以用于按照写入数据的数据类型、以逻辑块为单位为写入数据分配连续空闲空间;写入数据为根目录文件相关的数据。
可选地,写入数据在物理块内部以异地更新的方式写入,且写入数据中携带写入数据的数据类型的标识。
一种可能的实现方式中,数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
一种可能的实现方式中,处理单元,具体可以用于当存储设备所在的电子设备恢复出厂设置、或者将第一分区进行格式化时,根据第一分区的起始物理地址和长度、 以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区。
类似地,获取单元和处理单元可以配合实现如第一方面及第一方面的任意一种可能的实现方式所述的文件系统部署方法的全部步骤对应的功能,在此不再一一赘述。
第三方面,本申请实施例提供一种电子设备,电子设备可以包括存储设备,存储设备包括第一分区。电子设备包括:处理器,用于存储处理器可执行指令的存储器;处理器被配置为执行所述指令时,使得电子设备实现如第一方面及第一方面的任意一种可能的实现方式所述的文件系统部署方法。
第四方面,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序指令;当所述计算机程序指令被电子设备执行时,使得电子设备实现如第一方面及第一方面的任意一种可能的实现方式所述的文件系统部署方法。
第五方面,本申请实施例提供一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备中运行时,所述电子设备中的处理器实现如第一方面及第一方面的任意一种可能的实现方式所述的文件系统部署方法。
上述第二方面至第五方面所具备的有益效果,可参考第一方面中所述,在此不再赘述。
第六方面,本申请实施例提供一种文件系统扩展方法,所述方法包括:获取存储设备的第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置的文件系统的结束物理地址;根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,确定扩展后的文件系统的元数据区的起始物理地址和长度、以及扩展后的文件系统的数据区的起始物理地址和长度;根据第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置的文件系统的结束物理地址,配置第一阶段的段映射区;将预置的文件系统的数据区的数据搬移到第一阶段的段映射区;将扩展后的文件系统的元数据区的起始物理地址加上扩展后的文件系统的元数据区的长度所组成的区域配置为页映射区,将扩展后的文件系统的数据区的起始物理地址加上扩展后的文件系统的数据区的长度所组成的区域配置为第二阶段的段映射区。扩展后的文件系统中的逻辑块地址在映射到存储设备中的物理块地址上时,页映射区的映射粒度为页,段映射区的映射粒度为段,段的长度大于页的长度、且小于物理块的长度。
电子设备通过该文件系统扩展方法实现对存储设备的第一分区中已经预置的文件系统进行扩展,可以使得电子设备在第一次开机时,将页映射区域的小型文件系统扩展到整个第一分区,扩展后的文件系统的元数据区位于页映射区,数据区位于段映射区,且保证原有数据不丢失。
一种可能的实现方式中,扩展后的文件系统的元数据区的起始物理地址与第一分区的起始物理地址相同,扩展后的文件系统的数据区的起始物理地址与扩展后的文件系统的元数据区的结束物理地址相连,且扩展后的文件系统的数据区的起始物理地址按照存储设备的物理块的大小对齐。
一种可能的实现方式中,第一阶段的段映射区的起始物理地址与预置的文件系统 的结束物理地址相连,且第一阶段的段映射区的起始物理地址按照存储设备的物理块的大小对齐,且第一阶段的段映射区的起始物理地址大于扩展后的文件系统的数据区的起始物理地址。
可选地,所述将预置的文件系统的数据区的数据搬移到第一阶段的段映射区之前,所述方法还包括:重置第一阶段的段映射区的器件闪存转换层映射表;器件闪存转换层映射表存储了文件系统中的逻辑块地址和存储设备中的物理块地址之间的映射关系。
重置第一阶段的段映射区的器件闪存转换层映射表,可以清空第一阶段的段映射区原来的残留数据。
可选地,所述方法还包括:更新扩展后的文件系统的元数据区的管理数据。
一种可能的实现方式中,所述将预置的文件系统的数据区的数据搬移到第一阶段的段映射区,包括:按照如下规则,将预置的文件系统的数据区的数据搬移到第一阶段的段映射区。
1)空闲数据分配按照所述存储设备的物理块的大小为单位进行分配;2)所述存储设备的物理块内部按照异地更新的方式进行写入;3)写入数据中携带数据类型的标识。
一种可能的实现方式中,数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
可选地,所述将预置的文件系统的数据区的数据搬移到第一阶段的段映射区,包括:先搬移所有的关键数据和非关键数据,更新关键数据和非关键数据对应的管理数据并写入到扩展后的文件系统的元数据区,以原地更新的方式更新关键数据和非关键数据对应的关键目录和非关键目录;再搬移所有的关键目录和非关键目录,更新关键目录和非关键目对应的管理数据并写入到扩展后的文件系统的元数据区。
上述将预置的文件系统的数据区的数据搬移到第一阶段的段映射区的搬移方式,可以减少在搬移data数据块(如hot data或cold data)的时候的复杂度和写入数据量。
第七方面,本申请实施例提供一种文件系统扩展装置,该装置可以应用于电子设备,以使电子设备实现如第六方面及第六方面的任意一种可能的实现方式所述的文件系统扩展方法。该装置的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与第六方面及第六方面的任意一种可能的实现方式所述的文件系统扩展方法中的步骤相对应的模块或单元。
例如,该装置可以包括:获取单元、处理单元等。获取单元和处理单元可以配合实现如第六方面及第六方面的任意一种可能的实现方式所述的文件系统扩展方法。如:获取单元,可以用于获取存储设备的第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置的文件系统的结束物理地址。处理单元,可以用于根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,确定扩展后的文件系统的元数据区的起始物理地址和长度、以及扩展后的文件系统的数据区的起始物理地址和长度;根据第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置的文件系统的结束物理地址,配置第一阶段的段映射区;将预置的文件系统的数据区的数据搬移到第一阶段的段映射区;将扩展后的文件系统的元数据区的起始物理地址加上扩展后的文件系统的元数据区的长度所组成的区域配置为页 映射区,将扩展后的文件系统的数据区的起始物理地址加上扩展后的文件系统的数据区的长度所组成的区域配置为第二阶段的段映射区。扩展后的文件系统中的逻辑块地址在映射到存储设备中的物理块地址上时,页映射区的映射粒度为页,段映射区的映射粒度为段,段的长度大于页的长度、且小于物理块的长度。
一种可能的实现方式中,扩展后的文件系统的元数据区的起始物理地址与第一分区的起始物理地址相同,扩展后的文件系统的数据区的起始物理地址与扩展后的文件系统的元数据区的结束物理地址相连,且扩展后的文件系统的数据区的起始物理地址按照存储设备的物理块的大小对齐。
一种可能的实现方式中,第一阶段的段映射区的起始物理地址与预置的文件系统的结束物理地址相连,且第一阶段的段映射区的起始物理地址按照存储设备的物理块的大小对齐,且第一阶段的段映射区的起始物理地址大于扩展后的文件系统的数据区的起始物理地址。
可选地,处理单元,还用于重置第一阶段的段映射区的器件闪存转换层映射表;器件闪存转换层映射表存储了文件系统中的逻辑块地址和存储设备中的物理块地址之间的映射关系。
可选地,处理单元,还用于更新扩展后的文件系统的元数据区的管理数据。
一种可能的实现方式中,处理单元,具体用于按照如下规则,将预置的文件系统的数据区的数据搬移到第一阶段的段映射区。
1)空闲数据分配按照所述存储设备的物理块的大小为单位进行分配;2)所述存储设备的物理块内部按照异地更新的方式进行写入;3)写入数据中携带数据类型的标识。
一种可能的实现方式中,数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
可选地,处理单元,具体用于先搬移所有的关键数据和非关键数据,更新关键数据和非关键数据对应的管理数据并写入到扩展后的文件系统的元数据区,以原地更新的方式更新关键数据和非关键数据对应的关键目录和非关键目录;再搬移所有的关键目录和非关键目录,更新关键目录和非关键目对应的管理数据并写入到扩展后的文件系统的元数据区。
类似地,获取单元和处理单元可以配合实现如第六方面及第六方面的任意一种可能的实现方式所述的文件系统扩展方法的全部步骤对应的功能,在此不再一一赘述。
第八方面,本申请实施例提供一种电子设备,电子设备可以包括存储设备,存储设备包括第一分区。电子设备包括:处理器,用于存储处理器可执行指令的存储器;处理器被配置为执行所述指令时,使得电子设备实现如第六方面及第六方面的任意一种可能的实现方式所述的文件系统扩展方法。
第九方面,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序指令;当所述计算机程序指令被电子设备执行时,使得电子设备实现如第六方面及第六方面的任意一种可能的实现方式所述的文件系统扩展方法。
第十方面,本申请实施例提供一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电 子设备中运行时,所述电子设备中的处理器实现如第六方面及第六方面的任意一种可能的实现方式所述的文件系统扩展方法。
上述第七方面至第十方面所具备的有益效果,可参考第六方面中所述,在此不再赘述。
应当理解的是,本申请中对技术特征、技术方案、有益效果或类似语言的描述并不是暗示在任意的单个实施例中可以实现所有的特点和优点。相反,可以理解的是对于特征或有益效果的描述意味着在至少一个实施例中包括特定的技术特征、技术方案或有益效果。因此,本说明书中对于技术特征、技术方案或有益效果的描述并不一定是指相同的实施例。进而,还可以任何适当的方式组合本实施例中所描述的技术特征、技术方案和有益效果。本领域技术人员将会理解,无需特定实施例的一个或多个特定的技术特征、技术方案或有益效果即可实现实施例。在其他实施例中,还可在没有体现所有实施例的特定实施例中识别出额外的技术特征和有益效果。
附图说明
图1为本申请实施例提供的电子设备的结构示意图;
图2为本申请实施例提供的安卓系统的体系架构示意图;
图3为本申请实施例提供的文件系统部署方法的流程示意图;
图4为本申请实施例提供的文件系统的组成示意图;
图5为本申请实施例提供的存储设备的组成示意图;
图6为本申请实施例提供的完成部署后的文件系统与存储设备之间的对应关系示意图;
图7为本申请实施例提供的文件系统扩展方法的流程示意图;
图8为本申请实施例提供的对第一分区中预置的文件系统进行扩展前和扩展后的文件系统的变化示意图;
图9为本申请实施例提供的文件系统扩展方法的另一流程示意图;
图10为本申请实施例提供的文件系统部署装置的结构示意图;
图11为本申请实施例提供的文件系统扩展装置的结构示意图。
具体实施方式
以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括例如“一个或多个”这种表达形式,除非其上下文中明确地有相反指示。还应当理解,在本申请以下各实施例中,“至少一个”、“一个或多个”是指一个或两个以上(包含两个)。字符“/”一般表示前后关联对象是一种“或”的关系。
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他 方式另外特别强调。术语“连接”包括直接连接和间接连接,除非另外说明。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。
在本申请实施例中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。
文件系统是终端设备、服务器或虚拟机(virtual machine,VM)等电子设备的操作系统的重要组成部分,是一套实现了数据的存储、分级组织、访问和获取等操作的抽象数据类型。文件系统可以为电子设备上安装的应用程序提供一种标准系统调用接口,应用程序通过调用文件系统提供的标准系统调用接口,可以实现在存储设备中创建、删除、读写数据等操作。
例如,一些场景中,电子设备可以是手机、电脑等。存储设备可以是固态硬盘(solid state disk,SSD)、通用闪存(universal flash storage,UFS)和嵌入式多媒体卡(embedded multi-media card,eMMC)等基于flash颗粒的存储设备。文件系统可以是闪存友好文件系统(flash-friendly file system,F2FS)。
目前的文件系统与存储设备之间存在信息隔离,文件系统管理写入的空间为逻辑地址空间,存储设备中的存储空间为物理地址空间,文件系统层面的连续逻辑地址到了存储设备内部可能变成随机物理地址,文件系统从存储设备读取相关数据时可能变成随机读取。另外,目前的文件系统与存储设备都具备垃圾回收(garbage collection,GC)的功能,但两者存在相互干扰,文件系统进行垃圾回收可能会导致存储设备的存储空间碎片化严重,影响存储设备的性能。
本申请提供一种文件系统部署方法,可以应用于电子设备,电子设备可以通过该方法将文件系统部署于存储设备上。电子设备将文件系统部署到存储设备上后,电子设备的处理器可以执行操作系统的代码指令,将易失性内存中缓存的文件数据通过文件系统存储到存储设备中,或者,从存储设备中读取文件数据,以实现文件系统的基本读写功能。该方法中,文件系统和存储设备之间的地址映射方式可以使文件系统侧的逻辑地址与存储设备侧的物理地址在一定程度上对齐,文件系统进行垃圾回收的时候可以达到整理存储设备侧的存储空间的效果,省去了存储设备进行垃圾回收的过程,能够减少文件系统进行垃圾回收所导致的存储设备的存储空间碎片化,保证存储设备的性能。
一些实施例中,本申请实施例提供的文件系统部署方法可以适用于电子设备恢复出厂设置、或者电子设备将存储设备或者存储设备的第一分区进行格式化的场景。例如,一种可能的实现场景中,电子设备可以是手机,手机可以包括存储设备,则手机在恢复出厂设置、或者格式化存储设备、又或者格式化存储设备上的某个分区时,可以通过本申请实施例提供的文件系统部署方法,在存储设备上部署文件系统。
一些实施例中,电子设备可以包括:终端设备、服务器或虚拟机(virtual machine,VM)等。终端设备可以是手机、平板电脑、桌面型、膝上型、手持计算机、笔记本电 脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备等设备,本申请实施例对电子设备的具体形态不作特殊限制。
示例性地,图1为本申请实施例提供的电子设备的结构示意图。如图1所示,电子设备可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。例如,该存储器可以是易失性内存。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
可以理解的是,本实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备的结构限定。在另一些实施例中,电子设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施 例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。移动通信模块150可以提供应用在电子设备上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting  diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备的各种功能应用以及数据处理。例如,在本申请实施例中,处理器110可以通过执行存储在内部存储器121中的指令,实现本申请实施例提供的文件系统部署方法、文件系统扩展方法。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能、或者mkfs工具、resize工具等)等。存储数据区可存储电子设备使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)、eMMC等。在本申请实施例中,电子设备可以通过本申请实施例提供的文件系统部署方法,将文件系统部署于内部存储器121上或者外部存储器接口120外接的其他存储设备上。内部存储器121和外部存储器接口120外接的其他存储设备可以是下述实施例中所述的基于flash颗粒的混合映射存储设备。
电子设备可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如通话,音乐播放,录音等。
传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,图1所示的结构并不构成对本申请实施例所述的电子设备的具体限定。在另一些实施例中,电子设备也可以包括比图1所示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图1所示的部件可以以硬件,软件或软件和硬件的组合实现。本申请实施例对电子设备的具体结构不作限制。
一种可能的实现方式中,本申请实施例提供的文件系统部署方法可以通过电子设备上安装的一个应用程序来实现,例如,该应用程序可以称为建立文件系统(make file system,mkfs)工具。
示例性地,以电子设备的操作系统为安卓 TM(android)系统为例,图2为本申请实施例提供的安卓系统的体系架构示意图。如图2所示,安卓系统可以包括:应用程 序层(applications)、应用程序框架层(application framework)、系统运行库层(libraries)、以及内核层。在本申请实施例中,上述mkfs工具可以部署在应用程序层,电子设备的文件系统可以在内核层。可选地,应用程序层还可以包括能够通过文件系统访问存储设备的第三方应用,如:地图、浏览器等应用。
另外一些示例中,电子设备的操作系统还可以是鸿蒙 TM(harmony)系统、ios TM系统、windows TM系统、mac TM系统、linux TM系统等,更具体的,还可以是小米 TM系统或EMUI TM系统,Android Wear TM系统、Lite OS TM系统、Tizen TM系统、watch os TM系统等。在此对电子设备的操作系统不作限制。
下面结合具体的示例对本申请实施例提供的文件系统部署方法进行说明。
示例性地,图3为本申请实施例提供的文件系统部署方法的流程示意图。如图3所示,该文件系统部署方法可以包括:
S301、获取存储设备的第一分区的起始物理地址和长度、以及存储设备的物理块的大小。
其中,存储设备可以是基于flash颗粒的存储设备,存储设备可以被按照逻辑划分为一个或多个独立的存储区域,每个存储区域可以称为一个分区,这些分区可以分别用于安装操作系统、应用程序、以及存储数据文件等。对存储设备部署文件系统通常是指:将文件系统部署到存储设备中的一个分区上,如:第一分区。
例如,一种可能的实现方式中,存储设备可以包括系统分区和用户分区,上述S301中所述的第一分区可以是用户分区。
第一分区的起始物理地址是指第一分区在存储设备中所占的存储空间的起始物理地址,第一分区的长度是指第一分区在存储设备中所占的存储空间的起始物理地址至结束物理地址之间的长度。存储设备可以包括多个物理块,存储设备的存储空间的物理地址也可以称为物理块地址(physics block address,PBA)。物理块是指存储设备中的一块存储区域。例如,物理块的大小可以是144MB,288MB等。不同存储设备中物理块的大小可以相同或不同,在此不作限制。由于存储设备中的每个物理块是要整个块都擦除后才能再写入数据的,所以,物理块也称为物理擦除块(physic erase block,PEB)。
示例性地,当存储设备与电子设备连接,或者,安装于电子设备中时,电子设备可以获取到存储设备的设备信息,设备信息中可以包括存储设备的分区信息、每个分区(如第一分区)的起始物理地址和长度、存储设备的物理块的大小等。
例如,以电子设备通过上述mkfs工具实现本申请实施例提供的文件系统部署方法为例,mkfs工具可以进行初始化,在初始化过程中,mkfs工具可以向电子设备申请自身的运行内存,初始化自身运行的数据结构,解析运行参数等。其中,运行参数可以包括存储设备的设备路径,该设备路径中指明了需要部署文件系统的第一分区的起始物理地址和长度。
S302、根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页(page)映射区,将文件系统的数据区配置为段(segment)映射区。
示例性地,文件系统可以包括元数据(meta data)区和数据(main data)区,元 数据区也称元数据管理区。元数据区用于存储文件系统的管理数据(管理数据也称元数据),数据区用于存储用户数据。管理数据是指用来描述数据区文件的特征的系统数据,如:访问权限、文件拥有者、以及文件数据块的分布信息等,文件即数据区存储的用户数据。
在本申请中,文件系统可以包括多个逻辑块(logical block),逻辑块也称为逻辑擦除块(logical erase block,LEB)。文件系统为用户数据分配的地址可以称为逻辑块地址(logical block address,LBA),逻辑块地址也简称逻辑地址。逻辑块地址可以在存储设备的器件内部进行地址映射,映射到存储设备中实际的物理块地址上,物理块地址也简称物理地址。存储设备可以是支持可配置若干个页映射区、段映射区的flash颗粒存储设备,也可以称为基于(flash)颗粒的混合映射存储设备。页映射区和段映射区均是指存储设备上的一块存储区域。逻辑块地址在映射到存储设备的物理块地址上时,页映射区的映射粒度为页,段映射区的映射粒度为段。段的大小可以在页和块(如物理块)之间。也即,段的长度大于页的长度且小于块的长度。例如,一种可能的示例中,页的大小可以是4KB,段的大小可以是2MB,块的大小可以为几百MB等,在此对段的具体大小不作限制。
示例性地,存储设备侧的物理块和文件系统侧的逻辑块可以分别被等分为n(n为大于1的整数)个段。物理块中的段可以称为物理段(physic segment),逻辑块中的段可以称为逻辑段(logic segment)。一个物理块可以包括多个物理段,一个物理段可以包括多个物理页,一个逻辑块可以包括多个逻辑段,一个逻辑段可以包括多个逻辑页。
S302中根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区,可以使得文件系统的元数据区被部署于存储设备的页映射区,数据区被部署于存储设备的段映射区。文件系统在向数据区写入用户数据时,可以在段内顺序分配写入或读取,以适配flash顺序写入的特性。采用这种段映射(segment mapping)的方式相比于采用页映射的方式,可以减少映射表的体积,有利于快速读取数据。
示例性地,图4为本申请实施例提供的文件系统的组成示意图。如图4所示,在本申请实施例中,文件系统可以包括关键文件识别(key file filter)模块(或称为关键数据识别模块)401、闪存模式控制(flash mode control)模块402、分配(allocator)模块403、以及垃圾回收(garbage collection,GC)模块404。
关键文件识别模块401可以判断数据是否属于关键数据,在此对关键数据的判断规则不作限制。例如,可以通过识别文件的命名,将数据库文件作为关键数据。闪存模式控制模块402可以控制存储设备的物理块的使用模式,例如,物理块的使用模式可以包括以下一种或多种:单层单元(single level cell,SLC)模式,双层单元(mutil level cell,MLC)模式、三层单元(triple level cell,TLC)模式、四层单元(quadrilateral level cell,QLC)模式等。或者,物理块的使用模式以后还可以包括更多层单元的模式。当文件系统需要向存储设备写入数据时,文件系统可以先通过关键文件识别模块401判断该数据是否属于关键数据,若为关键数据,则基于闪存模式控制模块402,在空闲空间富余的情况下,将数据写入到SLC模式的物理块中。使用SLC模式时,可 以使用物理块的1/3的空间。也即,在本申请实施例提供的文件系统中,向物理块中快速写入(turbo write)的能力可以在文件系统侧实现。文件系统和存储设备之间打通了物理块的使用模式切换通道,由文件系统控制数据写入时物理块的使用模式,可以提升关键数据的读写性能。可选地,存储设备侧的快速写入模块可以被移除。
分配模块403也称空间分配模块,可以用于为需要存储在存储设备中的用户数据或系统数据分配存储空间。分配模块403在分配存储空间时,是以段粒度进行分配,分配到的地址为前述提到的逻辑块地址。也即,文件系统可以通过分配模块403为用户数据分配逻辑块地址。
垃圾回收(garbage collection,GC)模块404可以用于整理文件系统的逻辑地址空间,保障分配模块403在进行空间分配时可以分配到连续的逻辑块地址。在本申请实施例中,垃圾回收模块404在整理文件系统的逻辑地址空间时,整理出空闲的逻辑块的同时,也能够整理出存储设备侧空闲的物理块。也即,垃圾回收模块404可以对文件系统和存储设备进行统一垃圾回收。垃圾回收模块404同时整理文件系统侧的逻辑块和存储设备侧的物理块,可以提升垃圾回收的效率,省去存储设备进行垃圾回收的过程,减少存储设备的存储空间碎片化,保障存储设备在长期使用之后存储性能不下降或下降更少。可选地,存储设备侧的垃圾回收模块可以被移除,避免与文件系统侧的垃圾回收模块404互相干扰。
需要说明的是,上述图4中虽然是以文件系统包括关键文件识别模块401、闪存模式控制模块402、分配模块403、以及垃圾回收模块404的方式,示出了文件系统所具备的功能。但应当理解,这些模块的划分均为功能/逻辑划分,在一些实施例中,文件系统中实际上也可以包括一个软件处理模块,如:闪存转换层(flash translation layer,FTL),FTL可以用于具备前述关键文件识别模块401、闪存模式控制模块402、分配模块403、以及垃圾回收模块404等模块所具备的能力。
示例性地,图5为本申请实施例提供的存储设备的组成示意图。如图5所示,在本申请实施例中,存储设备可以包括地址映射(address translator)模块501、磨损均衡(wear leveling,WL)模块502。
地址映射模块501可以实现上述将逻辑块地址在存储设备的器件内部以段粒度进行地址映射(或称为空间映射),映射到存储设备中实际的物理块地址上的功能。在地址映射过程中,文件系统侧的一个逻辑块内的段(逻辑段)可以被映射到存储设备内与该逻辑块对应的物理块内,例如,第一个逻辑块内的段可以被映射到存储设备内与第一个逻辑块对应的第一个物理块内,第二个逻辑块内的段可以被映射到存储设备内与第二个逻辑块对应的第二个物理块内,以此类推。文件系统和存储设备之间的这种地址映射方式可以使文件系统侧的逻辑块地址与存储设备侧的物理块地址在一定程度上对齐,提高文件系统的读写性能。
磨损均衡模块502可以用于保障所有的物理擦除块的擦写次数大致相等,以提高存储设备的使用寿命。
一种可能的实现方式中,上述根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区的步骤,可以包括:配置元数据区的起始物理地址与第一分区的起始物 理地址相同,配置数据区的起始物理地址与元数据区的结束物理地址相连,且数据区的起始物理地址按照存储设备的物理块的大小对齐。
例如,假设元数据区的起始物理地址和长度记为[metaAddr,metaLen],“metaAddr”表示元数据区的起始物理地址,“metaLen”表示元数据区的长度,数据区的起始物理地址和长度记为[mainAddr,mainLen],“mainAddr”表示数据区的起始物理地址,“mainLen”表示数据区的长度,则可以将第一分区的起始物理地址作为“metaAddr”,将“metaAddr”加上“metaLen”的区域配置为page映射区,将与“metaAddr”加上“metaLen”的区域的结束物理地址(即元数据区的结束物理地址)相连的第一个地址作为“mainAddr”,将“mainAddr”加上“mainLen”的区域配置为segment映射区。在配置过程中,“mainAddr”需要按照存储设备的物理块的大小对齐,也即,“mainAddr”的位置应当为一个完整的物理块的起始物理地址。
在上述元数据区和数据区的配置过程中,元数据区的长度与文件系统的元数据区中包含的管理数据的数据结构相关,元数据区中包含的管理数据的数据结构可以人为定义或改变,元数据区的长度可以跟随管理数据的数据结构的改变而增加或减少,在此不作限制。数据区的长度可以与元数据区的长度、以及第一分区的长度相关,取决于需要管理的区域的大小,例如,数据区的长度可以小于或等于第一分区的长度减去元数据区的长度,在此也不作限制。
示例性地,图6为本申请实施例提供的完成部署后的文件系统与存储设备之间的对应关系示意图。如图6所示,一些实施例中,文件系统的元数据区可以包括:超级块(super block,SB)、检查点1(check point 1,CP1)、检查点2(check point 2,CP2)、段信息表1(segment information table 1,SIT1)、段信息表2(segment information table 2,SIT2)、目录/节点地址表1(node address table 1,NAT1)&目录/节点地址表2(node address table 2,NAT2)、段映射区摘要信息(Segment Summary Area,SSA)等管理数据。其中,“&”表示“和”。数据区可以包括热数据、冷数据、热目录、冷目录等用户数据或系统数据。热数据、冷数据、热目录、以及冷目录的定义请参考下文所述。
电子设备通过本申请实施例提供的文件系统部署方法,可以将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区。请参考图6中所示的虚线所示,元数据区的起始物理地址即对应的页映射区的起始物理地址,元数据区的结束物理地址即对应的页映射区结束物理地址,数据区的起始物理地址与元数据区的结束物理地址相连。数据区的起始物理地址即对应的段映射区的起始物理地址,数据区的结束物理地址即对应的段映射区结束物理地址。
本申请实施例提供的该文件系统部署方法,可以使得电子设备可以将上述图4所示的文件系统部署在上述图5所示的存储设备(如存储设备的第一分区)上,使得文件系统的元数据区位于页映射区,文件系统的数据区位于段映射区。从而,文件系统可以和存储设备上下打通,垂直优化,实现文件系统的垃圾回收取代存储设备的垃圾回收,提升垃圾回收的效率,省去存储设备进行垃圾回收的过程,减少存储设备的存储空间碎片化,保障存储设备在长期使用之后存储性能不下降或下降更少。另外,文件系统和存储设备之间的地址映射方式可以使文件系统侧的逻辑块地址与存储设备侧 的物理块地址在一定程度上对齐,提高文件系统的读写性能。
可选地,请继续参考图3所示,本申请实施例提供的文件系统部署方法中,S302之后,还包括:
S303、重置文件系统的数据区所在的段映射区的器件闪存转换层(flash translation layer,FTL)映射表。
其中,器件FTL映射表中存储了文件系统侧的逻辑块地址和存储设备侧的物理块地址之间的映射关系。文件系统可以基于器件FTL映射表从存储设备中读取数据,或者,文件系统向存储设备中写入数据时,可以在器件FTL映射表中维护写入数据对应的逻辑块地址和物理块地址之间的映射关系。例如,当电子设备中的应用程序想要读取存储设备上存储的某个文件时,文件系统可以根据文件的逻辑块地址在器件FTL映射表中查询到文件的物理块地址,并从文件的物理块地址中读取该文件。
S303中重置段映射区的器件FTL映射表,可以清空段映射区原来的残留数据。
S304、初始化文件系统的元数据区的管理数据。
示例性地,如前述实施例中所述,文件系统的元数据区的管理数据可以包括:超级块(super block,SB)、(check point 1,CP)、段信息表(segment information table,SIT)、目录/节点地址表(node address table,NAT)、段映射区摘要信息(Segment Summary Area,SSA)等。在重置文件系统的数据区所在的段映射区的器件FTL映射表后,还可以对元数据区的管理数据进行初始化。
S305、在文件系统的数据区创建根目录文件。
其中,根目录文件是指文件系统存储数据的最上一级目录。本申请实施例中,文件系统的数据区位于段映射区,在文件系统的数据区创建根目录文件时,文件系统侧对于需要写入存储设备的数据,可以识别写入数据的数据类型,按照写入数据的数据类型以逻辑块为单位为写入数据分配连续空闲空间。
一种实现方式中,文件系统在向存储设备写入数据时,物理块内部可以以异地更新(out-place update,OPU)的方式写入,且写入数据中携带数据类型的标识/标记,写入数据携带的数据类型的标识可以用于告知存储设备该写入数据的数据类型,存储设备也可以按照写入数据的数据类型以物理块为单位为写入数据分配连续空闲空间。
示例性地,数据类型可以包括:关键数据(hot data,或称为热数据)、非关键数据(cold data,或称为普通数据或冷数据)、关键目录/索引(hot node,或称为热目录)、非关键目录(cold node,或称为普通node或冷node)。其中,关键数据可以是指经常读取的文件,如数据库文件。非关键数据可以是指基本不修改或长期不修改的文件。关键目录可以是指关键数据对应的目录,如:保存关键数据的文件路径的目录。非关键目录可以是指非关键数据对应的目录,如:保存非关键数据的文件路径的目录。为写入数据分配连续空闲空间,可以是指:同一个段中可以包含同一类型的数据,或者说同一个段中可优先写入同一类型的数据。例如,对于某个段而言,写入的第一个数据为什么类型,则后续向该段写入数据时,可以优先写入相同类型的数据,对于其他类型的数据,可以再分一个段写入。
可选地,一些实施例中,识别写入数据的数据类型的方式可以包括:基于写入数据的后缀和/或基于写入数据的访问频率,识别写入数据的数据类型。例如,对于某个 文件而言,当该文件的后缀为“.db”,可以确定该文件为数据库文件,数据类型为关键数据。本申请对识别数据类型的方式不作限制。
可选地,本申请实施例提供的该文件系统部署方法中,S302之前,电子设备还可以先判断第一分区是否被占用(或使用),如:正在访问第一分区或正在从第一分区中读取或写入数据,则表示第一分区被占用。当第一分区没有被占用时,可以执行S302。当第一分区被占用时,可以直接结束流程,不执行后续步骤。也即,本申请实施例提供的文件系统部署方法在执行时,第一分区是未被使用的分区。
以上实施例介绍了电子设备在存储设备的第一分区上部署一个新的文件系统的过程。还有一些可能的实现场景中,存储设备的第一分区上已经部署了文件系统,但存储设备已经部署的文件系统为小型文件系统,且小型文件系统全部部署在页映射区。当电子设备在第一次启动(如第一次开机)时,需要对该小型文件系统进行扩展,将小型文件系统扩展到整个第一分区。例如,假设某个电子设备(如手机)的存储设备大小为256G,其中,200G划分为用户区,即用户使用的区域。在电子设备出厂时,厂商可能在200G中已经烧录了一个4G大小的小型文件系统,用于预置一些数据资源。在电子设备第一次启动时,需要将这个4G大小的小型文件系统扩展到整个200G的区域。
针对上述扩展文件系统的场景,本申请实施例还提供了一种文件系统扩展方法,可以应用于电子设备。电子设备可以通过该文件系统扩展方法实现对存储设备的第一分区中已经预置的文件系统进行扩展,使得电子设备在第一次开机时,将页映射区域的小型文件系统扩展到整个第一分区,扩展后的文件系统的元数据区位于页映射区,数据区位于段映射区,且保证原有数据不丢失。其中,文件系统可以参考前述实施例中所述、以及前述图4所示,存储设备可以参考前述实施例中所述、以及前述图5所示。
一种可能的实现方式中,本申请实施例提供的文件系统扩展方法也可以通过电子设备上安装的一个应用程序来实现,例如,该应用程序可以称为扩展(resize)工具。
下面结合具体的示例对本申请实施例提供的文件系统扩展方法进行说明。
需要说明的是,下述说明中,存储设备可以是支持可配置若干个页(page)映射区域、段(segment)映射区域的flash颗粒存储设备。存储设备可以包括多个映射区,每个映射区可以由[startAddr,len,type]定义,“startAddr”为映射区的起始物理地址,“len”为映射区的长度,“type”为映射区的类型。映射区的类型包括:“page映射区”或“segment映射区”。
示例性地,图7为本申请实施例提供的文件系统扩展方法的流程示意图,如图7所示,本申请实施例提供的文件系统扩展方法可以包括:
S701、获取存储设备的第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置(已烧录)的文件系统的结束物理地址(尾部物理地址)。
如上所述,存储设备可以是基于flash颗粒的存储设备,存储设备可以包括一个或多个分区,如:第一分区、第二分区、第三分区等。其中,存储设备的第一分区是已经在页映射区域预置了文件系统的分区。例如,一种可能的实现方式中,存储设备可以包括系统分区和用户分区,上述S701中所述的第一分区可以是用户分区。分区的定 义可以参考前述实施例中所述,不再赘述。
第一分区的起始物理地址是指第一分区在存储设备中所占的存储空间的起始物理地址,第一分区的长度是指第一分区在存储设备中所占的存储空间的起始物理地址至结束物理地址之间的长度。
示例性地,当存储设备与电子设备连接,或者,安装于电子设备中时,电子设备可以获取到存储设备的设备信息,设备信息中可以包括存储设备的分区信息、每个分区(如第一分区)的起始物理地址和长度、存储设备的物理块的大小等。
例如,以电子设备通过上述resize工具实现本申请实施例提供的文件系统扩展方法为例,resize工具可以进行初始化,在初始化过程中,resize工具可以向电子设备申请自身的运行内存,初始化自身运行的数据结构,解析运行参数等。其中,运行参数可以包括存储设备的设备路径,该设备路径中指明了需要扩展文件系统的第一分区的起始物理地址和长度。
可选地,第一分区内预置的文件系统的起始物理地址与第一分区的起始物理地址相同。
S702、根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,确定扩展后的文件系统的元数据区的起始物理地址和长度、以及数据区的起始物理地址和长度。
一种可能的实现方式中,扩展后的文件系统的元数据区的起始物理地址与第一分区的起始物理地址可以相同,扩展后的文件系统的数据区的起始物理地址与扩展后的文件系统的元数据区的结束物理地址可以相连,且扩展后的文件系统的数据区的起始物理地址按照存储设备的物理块的大小对齐。
一些实施例中,扩展后的文件系统的元数据区的长度与扩展后的文件系统的元数据区中包含的管理数据的数据结构相关,扩展后的文件系统的元数据区中包含的管理数据的数据结构可以人为定义或改变,扩展后的文件系统的元数据区的长度可以跟随管理数据的数据结构的改变而增加或减少,在此不作限制。扩展后的文件系统的数据区的长度可以与扩展后的文件系统的元数据区的长度、以及第一分区的长度相关,取决于需要管理的区域的大小,例如,扩展后的文件系统的数据区的长度可以小于或等于第一分区的长度减去扩展后的文件系统的元数据区的长度,在此也不作限制。
例如,假设扩展后的文件系统的元数据区的起始物理地址和长度记为[metaAddr,metaLen],“metaAddr”表示扩展后的文件系统的元数据区的起始物理地址,“metaLen”表示扩展后的文件系统的元数据区的长度,扩展后的文件系统的数据区的起始物理地址和长度记为[mainAddr,mainLen],“mainAddr”表示扩展后的文件系统的数据区的起始物理地址,“mainLen”表示扩展后的文件系统的数据区的长度,则“metaAddr”可以与第一分区的起始物理地址相同,“mainAddr”与“metaAddr”加上“metaLen”后的结束物理地址相连,且“mainAddr”按照存储设备的物理块的大小对齐。也即,“mainAddr”的位置应当为一个完整的物理块的起始物理地址。
S703、根据第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置的文件系统的结束物理地址,配置第一阶段的段(segment)映射区。
一种可能的实现方式中,第一阶段的段映射区的起始物理地址与预置的文件系统 的结束物理地址相连,且第一阶段的段映射区的起始物理地址按照存储设备的物理块的大小对齐,且第一阶段的段映射区的起始物理地址大于扩展后的文件系统的数据区的起始物理地址。
第一阶段的段映射区的长度为第一分区的长度减去第一阶段的段映射区的起始物理地址,也即,第一阶段的段映射区的长度为第一阶段的段映射区的起始物理地址至第一分区的结束物理地址之间的长度。第一分区的结束物理地址可以由第一分区的起始物理地址加上第一分区的长度得到。
例如,以S702中给出的示例为例,第一分区内预置的文件系统位于页映射区,则S703中可以在预置的文件系统的结束物理地址后按照存储设备的物理块的大小对齐得到第一阶段的段映射区的起始物理地址,如:第一阶段的段映射区的起始物理地址可以记为“mainAddrTmp”。“mainAddrTmp”大于“mainAddr”。在得到“mainAddrTmp”后,可以将“mainAddrTmp”至至第一分区的结束物理地址之间的区域配置为第一阶段的段映射区。如:第一阶段的段映射区的长度可以记为“lenTmp”,可以配置[mainAddrTmp,lenTmp]为第一阶段的段映射区。
S704、将预置的文件系统的数据区的数据搬移到第一阶段的段映射区。
在本申请中,将预置的文件系统的数据区的数据搬移到第一阶段的段映射区时,需要遵循如下约束:
1)空闲数据分配按照存储设备的物理块的大小为单位进行分配。
2)存储设备的物理块内部按照OPU方式进行写入。
3)写入数据中携带数据类型的标识/标记。
其中,数据类型的标识可以参考前述实施例中所述,可以包括:关键数据(hot data,或称为热数据)、非关键数据(cold data,或称为普通数据或冷数据)、关键目录/索引(hot node,或称为热目录)、非关键目录(cold node,或称为普通node或冷node)等,在此不再赘述。
由于段映射区只支持OPU方式写入,所以将预置的文件系统的数据区的数据搬移到第一阶段的段映射区时可能存在如下问题:
在搬移data数据块(如hot data或cold data)的时候,会去更新其对应的node数据块(如hot node或cold node)中的数据地址(data addr);如果此时node数据块已经搬移过,则又得更新,会造成复杂度和写入数据量增加。而node数据块的搬移则不会存在这种情况,因为仅仅改变的是元数据区的NAT表,此时NAT还没有更新,所以不存在重复更新的情况。对此,本申请实施例中可以按照下述方式执行搬移过程:
1)先搬移所有的data数据块,更新data数据块对应的SIT、SSR管理数据并写入到[metaAddr,metaLen](即文件系统的元数据区),以原地更新(in-place update,IPU)的方式更新data数据块对应的node数据块。
2)再搬移所有的node数据块,更新node数据块对应的SSR、SIT、NAT管理数据并写入到[metaAddr,metaLen](即文件系统的元数据区)。
S705、将扩展后的文件系统的元数据区的起始物理地址加上扩展后的文件系统的元数据区的长度所组成的区域配置为页(page)映射区,将扩展后的文件系统的数据区的起始物理地址加上扩展后的文件系统的数据区的长度所组成的区域配置为第二阶 段的段映射区。
例如,可以将[metaAddr,metaLen]配置为页映射区,将[mainAddr,mainLen]配置为第二阶段的段映射区,使扩展后的文件系统的元数据区位于页映射区,扩展后的文件系统的数据区位于第二阶段的段映射区。
需要说明的是,上述图7所示的流程中,“第一阶段的段映射区”和“第二阶段的段映射区”的描述仅仅是为了区分两次配置的映射区不同,也可以均称为映射区,或者,“第一阶段的段映射区”可以称为“第一段映射区”,“第二阶段的段映射区”可以称为“第二段映射区”等,并不作限制。
示例性地,图8为本申请实施例提供的对第一分区中预置的文件系统进行扩展前和扩展后的文件系统的变化示意图。如图8所示,一些实施例中,文件系统的元数据区可以包括:SB、CP1、CP2、SIT1、SIT2、NAT 1&NAT 2(“&”表示和)、SSA等管理数据。数据区可以包括热数据、冷数据、热目录、冷目录等数据。电子设备通过上述图7所示的方法,可以对第一分区中预置的文件系统进行扩展。扩展后的文件系统的元数据区配置为页映射区,扩展后的文件系统的数据区位于段映射区。
请参考图8中所示的虚线所示,扩展后的文件系统的元数据区的起始物理地址即对应的页映射区的起始物理地址,扩展后的文件系统的元数据区的结束物理地址即对应的页映射区的结束物理地址,扩展后的文件系统的数据区的起始物理地址与扩展后的文件系统的元数据区的结束物理地址相连。扩展后的文件系统的数据区的起始物理地址即对应的段映射区的起始物理地址,扩展后的文件系统的数据区的结束物理地址即对应的段映射区的结束物理地址。
可选地,图9为本申请实施例提供的文件系统扩展方法的另一流程示意图,如图9所示,本申请实施例提供的文件系统扩展方法中,S704之前,还可以包括S801。
S801、重置第一阶段的段映射区的器件FTL映射表。
器件FTL映射表可以参考前述实施例中所述,不再赘述。
重置第一阶段的段映射区的器件FTL映射表,可以清空第一阶段的段映射区原来的残留数据。
S705之后,还可以包括S802。
S802、更新扩展后的文件系统的元数据区的管理数据。
例如,可以更新super block、checkpoint等管理数据并写入到[metaAddr,metaLen](即文件系统的元数据区)。
通过上述图7至图9所示的实施例中所述的方式,电子设备可以实现对存储设备的第一分区中已经预置的文件系统进行扩展,使得电子设备在第一次开机时,将页映射区域的小型文件系统扩展到整个第一分区,扩展后的文件系统的元数据区位于页映射区,数据区位于段映射区,且保证原有数据不丢失。
应当理解,以上各实施例中所述仅为对本申请实施例提供的文件系统部署方法、及文件系统扩展方法的示例性说明。在其他一些可能的实现方式中,以上所述的各实施例也可以删减或增加某些执行步骤,或者以上实施例中所述的部分步骤的顺序也可以进行调整,本申请对此均不作限制。
对应于前述实施例中所述的文件系统部署方法,本申请实施例提供一种文件系统 部署装置,该装置可以应用于上述电子设备,用于实现前述实施例所述的文件系统部署方法。该装置的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述文件系统部署方法的步骤相对应的模块或单元。例如,图10为本申请实施例提供的文件系统部署装置的结构示意图。如图10所示,该装置可以包括:获取单元1001、处理单元1002等。获取单元1001和处理单元1002可以配合实现如前述实施例所述的文件系统部署方法。
如:获取单元1001,可以用于获取存储设备的第一分区的起始物理地址和长度、以及存储设备的物理块的大小;处理单元1002,可以用于根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区。文件系统中的逻辑块地址在映射到存储设备中的物理块地址上时,页映射区的映射粒度为页,段映射区的映射粒度为段,段的长度大于页的长度、且小于物理块的长度。
一种可能的实现方式中,处理单元1002,具体可以用于配置元数据区的起始物理地址与第一分区的起始物理地址相同,配置数据区的起始物理地址与元数据区的结束物理地址相连,且数据区的起始物理地址按照存储设备的物理块的大小对齐。
可选地,处理单元1002,还用于重置段映射区的器件闪存转换层映射表,器件闪存转换层映射表存储了文件系统中的逻辑块地址和存储设备中的物理块地址之间的映射关系;初始化元数据区的管理数据;在数据区创建根目录文件。
一种可能的实现方式中,处理单元1002,具体可以用于按照写入数据的数据类型、以逻辑块为单位为写入数据分配连续空闲空间;写入数据为根目录文件相关的数据。
可选地,写入数据在物理块内部以异地更新的方式写入,且写入数据中携带写入数据的数据类型的标识。
一种可能的实现方式中,数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
一种可能的实现方式中,处理单元1002,具体可以用于当存储设备所在的电子设备恢复出厂设置、或者将第一分区进行格式化时,根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区。
类似地,获取单元1001和处理单元1002可以配合实现如前述实施例所述的文件系统部署方法的全部步骤对应的功能,在此不再一一赘述。
对应于前述实施例中所述的文件系统扩展方法,本申请实施例提供一种文件系统扩展装置,该装置可以应用于上述电子设备,用于实现前述实施例所述的文件系统扩展方法。该装置的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述文件系统扩展方法的步骤相对应的模块或单元。例如,图11为本申请实施例提供的文件系统扩展装置的结构示意图。如图11所示,该装置可以包括:获取单元1101、处理单元1102等。获取单元1101和处理单元1102可以配合实现如前述实施例所述的文件系统扩展方法。
如:获取单元1101,可以用于获取存储设备的第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置的文件系统的结束物理地址。处理单 元1102,可以用于根据第一分区的起始物理地址和长度、以及存储设备的物理块的大小,确定扩展后的文件系统的元数据区的起始物理地址和长度、以及扩展后的文件系统的数据区的起始物理地址和长度;根据第一分区的起始物理地址和长度、存储设备的物理块的大小、以及第一分区内预置的文件系统的结束物理地址,配置第一阶段的段映射区;将预置的文件系统的数据区的数据搬移到第一阶段的段映射区;将扩展后的文件系统的元数据区的起始物理地址加上扩展后的文件系统的元数据区的长度所组成的区域配置为页映射区,将扩展后的文件系统的数据区的起始物理地址加上扩展后的文件系统的数据区的长度所组成的区域配置为第二阶段的段映射区。扩展后的文件系统中的逻辑块地址在映射到存储设备中的物理块地址上时,页映射区的映射粒度为页,段映射区的映射粒度为段,段的长度大于页的长度、且小于物理块的长度。
一种可能的实现方式中,扩展后的文件系统的元数据区的起始物理地址与第一分区的起始物理地址相同,扩展后的文件系统的数据区的起始物理地址与扩展后的文件系统的元数据区的结束物理地址相连,且扩展后的文件系统的数据区的起始物理地址按照存储设备的物理块的大小对齐。
一种可能的实现方式中,第一阶段的段映射区的起始物理地址与预置的文件系统的结束物理地址相连,且第一阶段的段映射区的起始物理地址按照存储设备的物理块的大小对齐,且第一阶段的段映射区的起始物理地址大于扩展后的文件系统的数据区的起始物理地址。
可选地,处理单元1102,还用于重置第一阶段的段映射区的器件闪存转换层映射表;器件闪存转换层映射表存储了文件系统中的逻辑块地址和存储设备中的物理块地址之间的映射关系。
可选地,处理单元1102,还用于更新扩展后的文件系统的元数据区的管理数据。
一种可能的实现方式中,处理单元1102,具体用于按照如下规则,将预置的文件系统的数据区的数据搬移到第一阶段的段映射区。
1)空闲数据分配按照所述存储设备的物理块的大小为单位进行分配;2)所述存储设备的物理块内部按照异地更新的方式进行写入;3)写入数据中携带数据类型的标识。
一种可能的实现方式中,数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
可选地,处理单元1102,具体用于先搬移所有的关键数据和非关键数据,更新关键数据和非关键数据对应的管理数据并写入到扩展后的文件系统的元数据区,以原地更新的方式更新关键数据和非关键数据对应的关键目录和非关键目录;再搬移所有的关键目录和非关键目录,更新关键目录和非关键目对应的管理数据并写入到扩展后的文件系统的元数据区。
类似地,获取单元1101和处理单元1102可以配合实现如前述实施例所述的文件系统扩展方法的全部步骤对应的功能,在此不再一一赘述。
应理解以上装置中模块(或称为单元)的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。且装置中的单元可以全部以软件通过处理元件调用的形式实现;也可以全部以硬件的形式实现;还可 以部分单元以软件通过处理元件调用的形式实现,部分单元以硬件的形式实现。
例如,各个单元可以为单独设立的处理元件,也可以集成在装置的某一个芯片中实现,此外,也可以以程序的形式存储于存储器中,由装置的某一个处理元件调用并执行该单元的功能。此外这些单元全部或部分可以集成在一起,也可以独立实现。这里所述的处理元件又可以称为处理器,可以是一种具有信号的处理能力的集成电路。在实现过程中,上述方法的各步骤或以上各个单元可以通过处理器元件中的硬件的集成逻辑电路实现或者以软件通过处理元件调用的形式实现。
在一个例子中,以上装置中的单元可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个专用集成电路(application specific integrated circuit,ASIC),或,一个或多个数字信号处理器(digital signal process,DSP),或,一个或者多个现场可编辑逻辑门阵列(field programmable gate array,FPGA),或这些集成电路形式中至少两种的组合。
再如,当装置中的单元可以通过处理元件调度程序的形式实现时,该处理元件可以是通用处理器,例如中央处理器(central processing unit,CPU)或其它可以调用程序的处理器。再如,这些单元可以集成在一起,以片上系统(system-on-a-chip,SOC)的形式实现。
在一种实现中,以上装置实现以上方法中各个对应步骤的单元可以通过处理元件调度程序的形式实现。例如,该装置可以包括处理元件和存储元件,处理元件调用存储元件存储的程序,以执行以上方法实施例所述的文件系统部署方法或文件系统扩展方法。存储元件可以为与处理元件处于同一芯片上的存储元件,即片内存储元件。
在另一种实现中,用于执行以上方法的程序可以在与处理元件处于不同芯片上的存储元件,即片外存储元件。此时,处理元件从片外存储元件调用或加载程序于片内存储元件上,以调用并执行以上方法实施例所述的文件系统部署方法或文件系统扩展方法。
本申请实施例还提供一种电子设备。该电子设备可以是上述电子设备。电子设备包括:处理器,用于存储处理器可执行指令的存储器;处理器被配置为执行所述指令时,使得电子设备实现如前述实施例所述文件系统部署方法或文件系统扩展方法。该存储器可以位于该电子设备之内,也可以位于该电子设备之外。且该处理器包括一个或多个。
示例性地,该电子设备可以是终端设备、服务器或虚拟机(virtual machine,VM)等。终端设备可以是手机、平板电脑、桌面型、膝上型、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备等设备,本申请实施例对电子设备的具体形态不作特殊限制。
在又一种实现中,该电子设备实现以上方法中各个步骤的单元可以是被配置成一个或多个处理元件,这里的处理元件可以为集成电路,例如:一个或多个ASIC,或,一个或多个DSP,或,一个或者多个FPGA,或者这些类集成电路的组合。这些集成电路可以集成在一起,构成芯片。
例如,本申请实施例还提供一种芯片,该芯片可以应用于上述电子设备。芯片包括一个或多个接口电路和一个或多个处理器;接口电路和处理器通过线路互联;处理器通过接口电路从电子设备的存储器接收并执行计算机指令,以实现如前述实施例所述的文件系统部署方法或文件系统扩展方法。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。
基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,如:程序。该软件产品存储在一个程序产品,如计算机可读存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
例如,本申请实施例还提供一种计算机可读存储介质,其上存储有计算机程序指令;当所述计算机程序指令被电子设备执行时,使得电子设备实现如实施例所述的文件系统部署方法或文件系统扩展方法。
又例如,本申请实施例还提供一种计算机程序产品,包括:计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备中运行时,所述电子设备中的处理器实现如前述实施例所述的文件系统部署方法或文件系统扩展方法。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (20)

  1. 一种文件系统部署方法,其特征在于,所述方法包括:
    获取存储设备的第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小;
    根据所述第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区;
    所述文件系统中的逻辑块地址在映射到所述存储设备中的物理块地址上时,所述页映射区的映射粒度为页,所述段映射区的映射粒度为段,所述段的长度大于所述页的长度、且小于所述物理块的长度。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区,包括:
    配置所述元数据区的起始物理地址与所述第一分区的起始物理地址相同,配置所述数据区的起始物理地址与所述元数据区的结束物理地址相连,且所述数据区的起始物理地址按照所述存储设备的物理块的大小对齐。
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:
    重置所述段映射区的器件闪存转换层映射表;所述器件闪存转换层映射表存储了所述文件系统中的逻辑块地址和所述存储设备中的物理块地址之间的映射关系;
    初始化所述元数据区的管理数据;
    在所述数据区创建根目录文件。
  4. 根据权利要求3所述的方法,其特征在于,所述在所述数据区创建根目录文件,包括:
    按照写入数据的数据类型、以逻辑块为单位为所述写入数据分配连续空闲空间;所述写入数据为所述根目录文件相关的数据。
  5. 根据权利要求4所述的方法,其特征在于,所述写入数据在物理块内部以异地更新的方式写入,且所述写入数据中携带所述写入数据的数据类型的标识。
  6. 根据权利要求5所述的方法,其特征在于,所述数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述根据所述第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区,包括:
    当所述存储设备所在的电子设备恢复出厂设置、或者将所述第一分区进行格式化时,根据所述第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区。
  8. 一种文件系统扩展方法,其特征在于,所述方法包括:
    获取存储设备的第一分区的起始物理地址和长度、所述存储设备的物理块的大小、以及所述第一分区内预置的文件系统的结束物理地址;
    根据所述第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小,确定扩展后的文件系统的元数据区的起始物理地址和长度、以及扩展后的文件系统的 数据区的起始物理地址和长度;
    根据所述第一分区的起始物理地址和长度、所述存储设备的物理块的大小、以及所述第一分区内预置的文件系统的结束物理地址,配置第一阶段的段映射区;
    将所述预置的文件系统的数据区的数据搬移到所述第一阶段的段映射区;
    将所述扩展后的文件系统的元数据区的起始物理地址加上所述扩展后的文件系统的元数据区的长度所组成的区域配置为页映射区,将所述扩展后的文件系统的数据区的起始物理地址加上所述扩展后的文件系统的数据区的长度所组成的区域配置为第二阶段的段映射区;
    所述扩展后的文件系统中的逻辑块地址在映射到所述存储设备中的物理块地址上时,所述页映射区的映射粒度为页,所述段映射区的映射粒度为段,所述段的长度大于所述页的长度、且小于所述物理块的长度。
  9. 根据权利要求8所述的方法,其特征在于,所述扩展后的文件系统的元数据区的起始物理地址与所述第一分区的起始物理地址相同,所述扩展后的文件系统的数据区的起始物理地址与所述扩展后的文件系统的元数据区的结束物理地址相连,且所述扩展后的文件系统的数据区的起始物理地址按照所述存储设备的物理块的大小对齐。
  10. 根据权利要求8或9所述的方法,其特征在于,所述第一阶段的段映射区的起始物理地址与所述预置的文件系统的结束物理地址相连,且所述第一阶段的段映射区的起始物理地址按照所述存储设备的物理块的大小对齐,且所述第一阶段的段映射区的起始物理地址大于所述扩展后的文件系统的数据区的起始物理地址。
  11. 根据权利要求8-10任一项所述的方法,其特征在于,所述将所述预置的文件系统的数据区的数据搬移到所述第一阶段的段映射区之前,所述方法还包括:
    重置所述第一阶段的段映射区的器件闪存转换层映射表;所述器件闪存转换层映射表存储了所述文件系统中的逻辑块地址和所述存储设备中的物理块地址之间的映射关系。
  12. 根据权利要求8-11任一项所述的方法,其特征在于,所述方法还包括:
    更新所述扩展后的文件系统的元数据区的管理数据。
  13. 根据权利要求8-12任一项所述的方法,其特征在于,所述将所述预置的文件系统的数据区的数据搬移到所述第一阶段的段映射区,包括:
    按照如下规则,将所述预置的文件系统的数据区的数据搬移到所述第一阶段的段映射区;
    1)空闲数据分配按照所述存储设备的物理块的大小为单位进行分配;
    2)所述存储设备的物理块内部按照异地更新的方式进行写入;
    3)写入数据中携带数据类型的标识。
  14. 根据权利要求13所述的方法,其特征在于,所述数据类型包括:关键数据、非关键数据、关键目录、以及非关键目录。
  15. 根据权利要求14所述的方法,其特征在于,所述将所述预置的文件系统的数据区的数据搬移到所述第一阶段的段映射区,包括:
    先搬移所有的关键数据和非关键数据,更新所述关键数据和非关键数据对应的管理数据并写入到所述扩展后的文件系统的元数据区,以原地更新的方式更新所述关键 数据和非关键数据对应的关键目录和非关键目录;
    再搬移所有的关键目录和非关键目录,更新所述关键目录和非关键目对应的管理数据并写入到所述扩展后的文件系统的元数据区。
  16. 一种文件系统部署装置,其特征在于,所述装置包括:
    获取单元,用于获取存储设备的第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小;
    处理单元,用于根据所述第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小,将文件系统的元数据区配置为页映射区,将文件系统的数据区配置为段映射区;
    所述文件系统中的逻辑块地址在映射到所述存储设备中的物理块地址上时,所述页映射区的映射粒度为页,所述段映射区的映射粒度为段,所述段的长度大于所述页的长度、且小于所述物理块的长度。
  17. 一种文件系统扩展装置,其特征在于,所述装置包括:
    获取单元,用于获取存储设备的第一分区的起始物理地址和长度、所述存储设备的物理块的大小、以及所述第一分区内预置的文件系统的结束物理地址;
    处理单元,用于根据所述第一分区的起始物理地址和长度、以及所述存储设备的物理块的大小,确定扩展后的文件系统的元数据区的起始物理地址和长度、以及扩展后的文件系统的数据区的起始物理地址和长度;根据所述第一分区的起始物理地址和长度、所述存储设备的物理块的大小、以及所述第一分区内预置的文件系统的结束物理地址,配置第一阶段的段映射区;将所述预置的文件系统的数据区的数据搬移到所述第一阶段的段映射区;将所述扩展后的文件系统的元数据区的起始物理地址加上所述扩展后的文件系统的元数据区的长度所组成的区域配置为页映射区,将所述扩展后的文件系统的数据区的起始物理地址加上所述扩展后的文件系统的数据区的长度所组成的区域配置为第二阶段的段映射区;
    所述扩展后的文件系统中的逻辑块地址在映射到所述存储设备中的物理块地址上时,所述页映射区的映射粒度为页,所述段映射区的映射粒度为段,所述段的长度大于所述页的长度、且小于所述物理块的长度。
  18. 一种电子设备,其特征在于,包括:处理器,用于存储所述处理器可执行指令的存储器;
    所述处理器被配置为执行所述指令时,使得所述电子设备实现如权利要求1-15任一项所述的方法。
  19. 一种计算机可读存储介质,其上存储有计算机程序指令;其特征在于,当所述计算机程序指令被电子设备执行时,使得电子设备实现如权利要求1-15任一项所述的方法。
  20. 一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,其特征在于,当所述计算机可读代码在电子设备中运行时,所述电子设备中的处理器实现如权利要求1-15任一项所述的方法。
PCT/CN2022/114617 2021-10-22 2022-08-24 文件系统部署及扩展方法、装置、设备及存储介质 WO2023065815A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111235979.7A CN116010297A (zh) 2021-10-22 2021-10-22 文件系统部署及扩展方法、装置、设备及存储介质
CN202111235979.7 2021-10-22

Publications (1)

Publication Number Publication Date
WO2023065815A1 true WO2023065815A1 (zh) 2023-04-27

Family

ID=86028584

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/114617 WO2023065815A1 (zh) 2021-10-22 2022-08-24 文件系统部署及扩展方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN116010297A (zh)
WO (1) WO2023065815A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116737601B (zh) * 2023-08-11 2023-11-17 深圳市航顺芯片技术研发有限公司 将外设寄存器扩展为系统ram的方法、装置及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300082A1 (en) * 2008-06-02 2009-12-03 Ming-Dar Chen Method for memory space management
US20110099350A1 (en) * 2009-10-23 2011-04-28 Seagate Technology Llc Block boundary resolution for mismatched logical and physical block sizes
CN106326134A (zh) * 2015-06-30 2017-01-11 华为技术有限公司 Ftl地址映射的方法及装置
CN110727604A (zh) * 2019-08-26 2020-01-24 华为技术有限公司 一种数据处理方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300082A1 (en) * 2008-06-02 2009-12-03 Ming-Dar Chen Method for memory space management
US20110099350A1 (en) * 2009-10-23 2011-04-28 Seagate Technology Llc Block boundary resolution for mismatched logical and physical block sizes
CN106326134A (zh) * 2015-06-30 2017-01-11 华为技术有限公司 Ftl地址映射的方法及装置
CN110727604A (zh) * 2019-08-26 2020-01-24 华为技术有限公司 一种数据处理方法及装置

Also Published As

Publication number Publication date
CN116010297A (zh) 2023-04-25

Similar Documents

Publication Publication Date Title
EP4109230A1 (en) Storage system, file storage and reading method, and terminal device
US11733869B2 (en) Apparatus and method to share host system RAM with mass storage memory RAM
US11782647B2 (en) Managing operational state data in memory module
WO2021036848A1 (zh) 一种数据处理方法及装置
US10540094B2 (en) Extended utilization area for a memory device
US8386537B2 (en) Method for trimming data on non-volatile flash media
US9164804B2 (en) Virtual memory module
EP4239477A1 (en) Virtual memory management method and electronic device
US8615624B2 (en) Methods, apparatuses, and computer program products for enhancing memory erase functionality
CN113590501A (zh) 一种数据存储方法及相关设备
CN114840450B (zh) 一种存储空间整理方法及电子设备
WO2023065815A1 (zh) 文件系统部署及扩展方法、装置、设备及存储介质
WO2023065915A1 (zh) 存储方法、装置、设备及存储介质
CN117312055B (zh) 数据备份的方法及相关装置
WO2024045841A1 (zh) 存储的方法、装置和电子设备
TWI760884B (zh) 主機效能加速模式的資料讀取方法及裝置
US20100131726A1 (en) Methods, apparatuses, and computer program products for enhancing memory erase functionality
CN117407925A (zh) 扩展内存隔离域的方法和电子设备

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: 22882434

Country of ref document: EP

Kind code of ref document: A1