WO2021129048A1 - 一种文件数据写入方法、装置、设备及存储介质 - Google Patents

一种文件数据写入方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2021129048A1
WO2021129048A1 PCT/CN2020/120354 CN2020120354W WO2021129048A1 WO 2021129048 A1 WO2021129048 A1 WO 2021129048A1 CN 2020120354 W CN2020120354 W CN 2020120354W WO 2021129048 A1 WO2021129048 A1 WO 2021129048A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
storage node
data
chain
magic number
Prior art date
Application number
PCT/CN2020/120354
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 WO2021129048A1 publication Critical patent/WO2021129048A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Definitions

  • the embodiments of the present application relate to data storage technology, and in particular to a method, device, device, and storage medium for writing file data.
  • the storage unit Due to the physical structure of the Flash storage medium, the storage unit has a limit on the number of erasing operations.
  • the write operation can only be performed in empty or erased cells, so in most cases, the erase must be performed before the write operation.
  • the entire memory block needs to be erased. Therefore, the actual erase amount is much larger than the write amount, causing write amplification.
  • the file system stores additional information other than the data of the file itself, thereby further increasing the write amplification factor of the device, resulting in a reduction in the life of the storage device.
  • the embodiments of the present application provide a method, device, device, and storage medium for writing file data. It aims to solve one of the related technical problems to a certain extent, including the problem that the write amplification factor of the Flash type storage medium is too large, which reduces the life of the storage device.
  • the embodiment of the application provides a method for writing file data, including: matching the data in the magic number header of the chain end storage node in the file linked list with a preset magic number; wherein at least one file is attached to the file linked list.
  • Storage node when the magic number matching result meets the write permission condition, the data to be written is stored on the file body of the storage node at the end of the chain; the preset write operation related information corresponding to this data write operation is stored in the store In the file information header of the end-of-chain storage node; write the preset magic number in the magic number header of the end-of-chain storage node; fill in the address of the searched free storage node in the end of the chain storage node
  • the next-level node pointer is to use the idle storage node after being attached as the new end-of-chain storage node.
  • the embodiment of the present application provides a file data writing device, including: a magic number matching module, which is used to match the data in the magic number header of the chain end storage node in the file linked list with a preset magic number; wherein, the file At least one storage node is attached to the linked list; a data writing module is used to store the data to be written on the file body of the storage node at the end of the chain when the matching result of the magic number meets the allowable writing condition; the write operation information storage The module is used to store the preset write operation related information corresponding to this data write operation in the file information header of the storage node at the end of the chain; the magic number write module is used to store the magic of the node at the end of the chain The preset magic number is written in the number header; the pre-allocated storage node module is used to fill in the address of the searched idle storage node into the next-level node pointer of the chain end storage node, so as to store the connected The idle storage node serves as a new chain end storage node
  • An embodiment of the present application provides a device including a processor and a memory; wherein the processor is used to execute a program stored in the memory to implement any method in the embodiments of the present application.
  • the embodiment of the present application provides a storage medium storing a computer program, where the computer program implements any one of the methods in the embodiments of the present application when the computer program is executed by a processor.
  • FIG. 1 is a flowchart of a method for writing file data provided by an embodiment of the application
  • Figure 2 is a schematic diagram of the structure of a file provided by an embodiment of the application.
  • FIG. 3 is a schematic diagram of the structure of a creation file provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of the structure of a file after writing data provided by an embodiment of the application.
  • FIG. 5 is a schematic structural diagram of a file data writing device provided by an embodiment of the application.
  • Fig. 6 is a schematic diagram of a device provided by an embodiment of the application.
  • Fig. 1 shows a method for writing file data according to an embodiment of the present application, including:
  • Step S11 matching the data in the magic number header of the storage node at the end of the chain in the file linked list with the preset magic number; wherein at least one storage node is attached to the file linked list;
  • Step S12 When the magic number matching result meets the write permission condition, store the data to be written on the file body of the storage node at the end of the chain;
  • Step S13 Store the preset write operation related information corresponding to the current data write operation in the file information header of the storage node at the end of the chain;
  • Step S14 Write the preset magic number in the magic number header of the chain end storage node
  • Step S15 Fill in the address of the searched free storage node into the next-level node pointer of the end-of-chain storage node, so as to use the connected free storage node as a new end-of-chain storage node.
  • the file includes an inode file node and a file linked list.
  • the file content data is organized in a linked list, and the unit of the file linked list is called a storage node.
  • One or more storage nodes can be attached to a file linked list.
  • Figure 2 takes three storage nodes as an example.
  • the storage node includes the magic number header, the file information header, and the file body.
  • the file information header includes the file length, access time and modification time and other attributes that will be changed by the write operation.
  • the pointer of the inode file node points to the first storage node in the file linked list.
  • the file information headers of other storage nodes contain pointing to the next Pointer to the storage node.
  • the file system finds the end-of-chain storage node at the end of the file linked list. Obtain the data in the magic number header of the storage node at the end of the chain, and compare the data with the preset magic number. If the two are the same, the data is considered to match the preset magic number; if the two are different, the data is considered to be the same as the preset magic number. The preset magic number does not match.
  • the preset write operation related information is related information that will affect the write operation, and the preset write operation related information corresponding to this access is written into the file information header of the storage node at the end of the chain.
  • the end-of-chain storage node After the data is written into the file body of the end-of-chain storage node, the end-of-chain storage node has stored valid data, so it is necessary to write a preset magic number in the magic number header.
  • the preset magic number is stored in the magic number header and is used to identify that the storage node has stored valid data.
  • pre-allocate storage space for the file traverse the storage medium, find the free storage node, and write its address into the file information header of the end-of-chain storage node.
  • the free storage node is attached to the file list.
  • the original end-of-chain storage node becomes the penultimate storage node in the file linked list, and the idle storage node just attached to the end of the file linked list becomes the new end-of-chain storage node of the current file linked list.
  • the next write operation will be The above-mentioned write operation is performed under this new chain end storage node.
  • the data when writing data to a file, the data is written in the file body of the storage node at the end of the file link list, and the write operation related information is stored in the file information header.
  • Other storage nodes perform erasing and writing, thereby effectively reducing the write amplification factor of the Flash storage medium, thereby increasing the life of the Flash memory.
  • the storing the data to be written on the file body of the chain end storage node when the magic number matching result meets the allowable write condition includes:
  • the end-of-chain storage node is a storage node that is pre-allocated for writing data.
  • the magic number determines the authenticity of the end-of-chain storage node, and pre-allocation is used to avoid the impact of writing data on the previous storage node in the file linked list.
  • the storing the preset write operation related information corresponding to the current data write operation in the file information header of the chain end storage node includes:
  • the access time, the modification time, and the file length are stored in the file information header of the chain end storage node.
  • the file information header of the storage node at the end of the chain is updated at the same time, and the file length, access time and modification time information of the visit are stored in the file information header of the storage node at the end of the chain in.
  • the storage node can be pre-allocated to find a free storage node from the storage medium, and the address of the free storage node is filled into the next-level node pointer of the file information header of the storage node at the end of the chain, and the free storage node does not store Any information becomes the storage node at the end of the file list.
  • the method before matching the data in the magic number header of the chain end storage node in the file linked list with the preset magic number, the method further includes:
  • the address of the searched idle storage node is filled into the next-level node pointer of the inode file node.
  • the user inputs a file creation operation, and the file system generates a corresponding inode file node in response to the file creation operation.
  • Store the preset file additional information of the file in the inode file node.
  • the additional information of the preset file may include creation date, modification date, file length, file name, and access authority.
  • the storage node is pre-allocated, a free storage node is found from the storage medium, and the address of the free storage node is filled into the next-level node pointer of the inode file node.
  • the idle storage node does not store any information.
  • Figure 3 shows a schematic diagram of the structure of creating a file.
  • the process of creating a file is as follows:
  • the user creates a file named A.
  • the file system generates the corresponding inode file node.
  • Figure 4 shows a schematic diagram of the structure of the file after data is written. The process of additional writing of the file is as follows:
  • the file system finds storage node 1 corresponding to file A.
  • the magic number area of storage node 1 is blank, and there is no magic number, which results in a mismatch with the preset magic number. Therefore, it is determined that the file body area is an invalid area.
  • Pre-allocate storage nodes Find a free storage node from the disk, and fill the address of the storage node into the next-level node pointer of storage node 1.
  • the idle storage node does not store any information.
  • the file content is organized through a linked list, the magic number is used to determine whether the data in the file body of the storage node at the end of the chain is valid, and the pre-allocation method is used to avoid the impact of written data on the previous storage node.
  • the file system implemented by this method can greatly reduce the write amplification factor of the Flash storage device, thereby reducing the number of erasing, and improving the service life of the Flash storage device, which is of great significance to communication equipment with a long life cycle.
  • Figure 5 shows a file data writing device, including:
  • the magic number matching module 51 is configured to match the data in the magic number header of the chain end storage node in the file linked list with the preset magic number; wherein at least one storage node is attached to the file linked list;
  • the data writing module 52 is configured to store the data to be written on the file body of the storage node at the end of the chain when the magic number matching result meets the allowable writing condition;
  • the write operation information storage module 53 is configured to store the preset write operation related information corresponding to the current data write operation in the file information header of the storage node at the end of the chain;
  • the magic number writing module 54 is configured to write the preset magic number in the magic number header of the chain end storage node;
  • the pre-allocated storage node module 55 is used to fill in the address of the searched free storage node into the next-level node pointer of the end-of-chain storage node, so as to use the connected free storage node as a new end-of-chain storage node.
  • the device for writing file data further includes:
  • the file node generating module is used to generate the corresponding inode file node in response to the file creation operation before matching the data in the magic number header of the chain end storage node in the file linked list with the preset magic number;
  • the attachment information storage module is used to store the additional information of the preset file in the inode file node;
  • the storage node attachment module is used to fill in the address of the searched idle storage node into the next-level node pointer of the inode file node.
  • the preset file additional information includes creation date, modification date, file length, file name, and access authority.
  • the data writing module includes:
  • the writing condition determining unit is configured to determine that the data in the magic number header of the chain end storage node does not match the preset magic number, and determine that the file body of the chain end storage node is empty data, which conforms to the Allow write conditions.
  • the write operation information storage module includes:
  • the writing operation information determining unit is configured to determine the access time, modification time, and file length of the file after the data is written according to the data writing operation of this time;
  • the write operation information storage unit is configured to store the access time, the modification time, and the file length in the file information header of the chain end storage node.
  • an embodiment of the present application provides a device that includes a processor 601 and a memory 602; wherein, the processor 601 is configured to execute a program stored in the memory 602 to implement any of the embodiments of the present application a way.
  • the device may be a wireless base station device, such as 2G, 3G, 4G, and 5G devices, as well as more advanced wireless base station devices in the future, and 5G wireless base station devices are used to illustrate this application example.
  • a wireless base station device such as 2G, 3G, 4G, and 5G devices, as well as more advanced wireless base station devices in the future, and 5G wireless base station devices are used to illustrate this application example.
  • the solid state drive (SSD) of 5G wireless base station equipment is a Flash storage medium.
  • the file system implements the above method, which can effectively reduce the write amplification factor, thereby reducing the number of erasing and writing to the SSD device, and can increase the service life of the SSD device from 4 years to 12 years.
  • the device can be a wired switching transmission device.
  • the Nandflash of the wired switching transmission device belongs to the Flash storage medium.
  • the file system implements the above method, which can effectively reduce the write amplification coefficient, thereby reducing the number of erasing and writing to the Nandflash device, and can use the storage device Life expectancy increased from 6 years to 14 years.
  • the embodiment of the present application provides a storage medium that stores a computer program, and when the computer program is executed by a processor, any one of the methods in the embodiments of the present application is implemented.
  • the file data writing method, device, device, and storage medium provided by the embodiments of the present application write data in the file body of the storage node at the end of the chain in the file linked list, and store information related to the write operation in the file information header, which is effective Reduce the write amplification factor of the Flash storage medium, thereby increasing the life of the Flash storage.
  • user terminal encompasses any suitable type of wireless user equipment, such as a mobile phone, a portable data processing device, a portable web browser, or a vehicle-mounted mobile station.
  • the various embodiments of the present application can be implemented in hardware or dedicated circuits, software, logic or any combination thereof.
  • some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device, although the present application is not limited thereto.
  • Computer program instructions can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code written in any combination of one or more programming languages or Object code.
  • ISA instruction set architecture
  • the block diagram of any logic flow in the drawings of the present application may represent program steps, or may represent interconnected logic circuits, modules, and functions, or may represent a combination of program steps and logic circuits, modules, and functions.
  • the computer program can be stored on the memory.
  • the memory can be of any type suitable for the local technical environment and can be implemented using any suitable data storage technology, such as but not limited to read only memory (ROM), random access memory (RAM), optical storage devices and systems (digital multi-function optical discs) DVD or CD) etc.
  • Computer-readable media may include non-transitory storage media.
  • the data processor can be any type suitable for the local technical environment, such as but not limited to general-purpose computers, special-purpose computers, microprocessors, digital signal processors (DSP), application-specific integrated circuits (ASIC), programmable logic devices (FGPA) And processors based on multi-core processor architecture.
  • DSP digital signal processors
  • ASIC application-specific integrated circuits
  • FGPA programmable logic devices

Landscapes

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

Abstract

一种文件数据写入方法、装置、设备及存储介质,该方法包括:将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配;当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上;将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中;在所述链尾存储节点的魔幻数头中写入所述预设魔幻数;将搜索到的空闲存储节点的地址填入所述链尾存储节点的下一级节点指针。

Description

一种文件数据写入方法、装置、设备及存储介质
相关申请的交叉引用
本申请基于申请号为201911379453.9、申请日为2019年12月27日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请实施例涉及数据存储技术,具体涉及一种文件数据写入方法、装置、设备及存储介质。
背景技术
Flash类型的存储介质,由于其物理结构原因,其存储单元存在擦除操作次数限制。写入操作只能在空或已擦除的单元内进行,所以大多数情况下,在进行写入操作之前必须先执行擦除。在一些情况下,写入1比特的数据,需要将整个存储块擦除,因此实际擦除量比写入量大很多,造成写放大。而且文件系统会存储文件本身数据以外的其他附加信息,从而进一步加大设备的写放大系数,导致存储器件的寿命降低。
发明内容
本申请实施例提供了一种文件数据写入方法、装置、设备及存储介质。旨在一定程度上解决相关的技术问题之一,包括Flash类型的存储介质写放大系数过大,降低存储器件的寿命的问题。
本申请实施例提供一种文件数据写入方法,包括:将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配;其中,所述文件链表上挂接有至少一个存储节点;当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上;将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中;在所述链尾存储节点的魔幻数头中写入所述预设魔幻数;将搜索到的空闲存储节点的地址填入所述链尾存储节点的下一级节点指针,以将挂接后的所述空闲存储节点作为新的链尾存储节点。
本申请实施例提供一种文件数据写入装置,包括:魔幻数匹配模块,用于将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配;其中,所述文件链表上挂接有至少一个存储节点;数据写入模块,用于当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上;写操作信息存储模块,用于将本次数据写入 操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中;魔幻数写入模块,用于在所述链尾存储节点的魔幻数头中写入所述预设魔幻数;预分配存储节点模块,用于将搜索到的空闲存储节点的地址填入所述链尾存储节点的下一级节点指针,以将挂接后的所述空闲存储节点作为新的链尾存储节点。
本申请实施例提供一种设备,包括处理器以及存储器;其中,所述处理器用于执行存储器中存储的程序,以实现本申请实施例中的任意一种方法。
本申请实施例提供了一种存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现本申请实施例中的任意一种方法。
附图说明
图1为本申请实施例提供的文件数据写入方法的流程图;
图2为本申请实施例提供的文件的结构示意图;
图3为本申请实施例提供的创建文件的结构示意图;
图4为本申请实施例提供的写数据后的文件的结构示意图;
图5为本申请实施例提供的文件数据写入装置的结构示意图;
图6为本申请实施例提供的设备的示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚明白,下文中将结合附图对本申请的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
图1示出根据本申请实施例的文件数据写入方法,包括:
步骤S11、将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配;其中,所述文件链表上挂接有至少一个存储节点;
步骤S12、当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上;
步骤S13、将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中;
步骤S14、在所述链尾存储节点的魔幻数头中写入所述预设魔幻数;
步骤S15、将搜索到的空闲存储节点的地址填入所述链尾存储节点的下一级节点指针,以将挂接后的所述空闲存储节点作为新的链尾存储节点。
其中,如图2所示,文件包括inode文件节点和文件链表,文件内容数据以链表的方式组织,文件链表的单元称为存储节点。一个文件链表下可以挂接一个或多个存储节点, 创建文件时会预分配一个存储节点,随着写操作会追加更多的存储节点,图2中以3个存储节点为例。存储节点包括魔幻数头、文件信息头和文件体。文件信息头包括文件长度、访问时间和修改时间等写操作会改变的属性。inode文件节点的指针指向文件链表中的第一个存储节点,当文件链表下挂接有多个存储节点时,除了位于文件链表尾端的存储节点,其他存储节点的文件信息头中包含指向下一级存储节点的指针。当用户对文件进行追加写数据时,文件系统找到位于文件链表尾端的链尾存储节点。获取链尾存储节点的魔幻数头中的数据,将该数据与预设魔幻数进行对比,如果两者相同,则认为该数据与预设魔幻数匹配;如果两者不同,则认为该数据与预设魔幻数不匹配。当魔幻数头中的数据与预设魔幻数不匹配时,可以确认链尾存储节点的文件体中没有存储有效数据,可以将数据写入链尾存储节点的文件体中。预设写操作相关信息是对于写操作会影响的相关信息,将本次访问对应的预设写操作相关信息写入链尾存储节点的文件信息头中。在数据写入链尾存储节点的文件体后,链尾存储节点已经存储了有效数据,所以需要在魔幻数头中写入预设魔幻数。预设魔幻数是存储在魔幻数头中,用于标识该存储节点已经存储了有效数据。之后,再为文件预分配存储空间,在存储介质中遍历,找到空闲存储节点,将其地址写入链尾存储节点的文件信息头中,此时,文件链表下挂接了这个空闲存储节点,原来的链尾存储节点成为文件链表中倒数第二个存储节点,而刚刚挂接到文件链表尾端的这个空闲存储节点成为当前文件链表的新的链尾存储节点,下次写操作时,将在这个新的链尾存储节点下执行上述写操作。
通过本申请实施例中的上述方法,向文件中写入数据时,在文件链表中链尾存储节点的文件体写入数据,并在文件信息头中存储写操作相关信息,不对文件链表下的其他存储节点进行擦除和写入,从而有效地降低Flash存储介质的写放大系数,从而提高Flash存储器的寿命。
在一种实现方式中,所述当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上,包括:
当所述链尾存储节点的魔幻数头中的数据与所述预设魔幻数不匹配,判定所述链尾存储节点的文件体中为空数据,符合所述允许写入条件。
由于链尾存储节点的魔幻数头区域为空白,将魔幻数头中的数据与预设魔幻数进行匹配,将会导致不匹配,因此判定为链尾存储节点的文件体区域为无效区域,即文件体中为空数据。在确定链尾存储节点的文件体中没有存储文件有效数据的情况下,就可以执行将数据存储在链尾存储节点的文件体上。链尾存储节点是为了写入数据而预分配的存储节点,通过魔幻数确定链尾存储节点真实有效,通过预分配方式避免写入数据对文件链表中前级 存储节点的影响。
在一种实现方式中,所述将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中,包括:
根据所述本次数据写入操作,确定文件的访问时间、修改时间和写入数据后的文件长度;
将所述访问时间、所述修改时间和所述文件长度存储在所述链尾存储节点的文件信息头中。
在将数据追加到链尾存储节点的文件体上后,同时更新链尾存储节点的文件信息头,将该次访问的文件长度、访问时间和修改时间信息存储在链尾存储节点的文件信息头中。之后便可以预分配存储节点,从储存介质中寻找一块空闲的存储节点,将该空闲存储节点的地址填入链尾存储节点的文件信息头的下一级节点指针,而该空闲存储节点不存储任何信息,并成为文件链表的链尾存储节点。
在一种实现方式中,在所述将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配之前,还包括:
响应于文件创建操作,生成对应的inode文件节点;
将预设文件附加信息存储在所述inode文件节点中;
将搜索到的空闲存储节点的地址填入所述inode文件节点的下一级节点指针。
用户要创建新的文件,则会输入文件创建操作,文件系统响应于文件创建操作,生成对应的inode文件节点。在inode文件节点中存储文件的预设文件附加信息。所述预设文件附加信息可以包括创建日期、修改日期、文件长度、文件名和访问权限。之后预分配存储节点,从储存介质中寻找一块空闲的存储节点,将该空闲存储节点的地址填入inode文件节点的下一级节点指针。而该空闲存储节点不存储任何信息。
示例:
图3示出的创建文件的结构示意图,文件创建的过程如下:
1.用户创建文件名为A的文件。文件系统生成对应的inode文件节点。
2.在inode文件节点中存储文件A的预设文件附加信息。
3.预分配存储节点。从磁盘中寻找一块空闲的存储节点,将该存储节点的地址填入inode文件节点的下一级节点指针。而该空闲存储节点不存储任何信息。
图4示出的写数据后的文件的结构示意图,文件追加写的过程如下:
1.用户对文件A进行追加写数据。文件系统找到文件A对应的存储节点1。
2.存储节点1的魔幻数区域为空白,不存在魔幻数,导致与预设魔幻数不匹配,因此 判定文件体区域为无效区域。
3.将数据追加到存储节点1的文件体上,同时更新存储节点的文件信息头,将该次访问的文件长度、访问时间和修改时间信息存储在存储节点1的文件信息头中。
4.预分配存储节点。从磁盘中寻找一块空闲的存储节点,将该存储节点的地址填入存储节点1的下一级节点指针。而该空闲存储节点不存储任何信息。
通过链表的方式组织文件内容,通过魔幻数确定链尾存储节点的文件体中数据是否有效,通过预分配方式避免写入数据对前级存储节点的影响。这种方法实现的文件系统,能够极大地降低Flash存储器件的写放大系数,从而减少擦除次数,实现提高Flash存储器件的使用寿命,对长生命周期的通信设备有重大意义。
图5示出文件数据写入装置,包括:
魔幻数匹配模块51,用于将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配;其中,所述文件链表上挂接有至少一个存储节点;
数据写入模块52,用于当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上;
写操作信息存储模块53,用于将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中;
魔幻数写入模块54,用于在所述链尾存储节点的魔幻数头中写入所述预设魔幻数;
预分配存储节点模块55,用于将搜索到的空闲存储节点的地址填入所述链尾存储节点的下一级节点指针,以将挂接后的所述空闲存储节点作为新的链尾存储节点。
在一种实现方式中,文件数据写入装置,还包括:
文件节点生成模块,用于在所述将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配之前,响应于文件创建操作,生成对应的inode文件节点;
附件信息存储模块,用于将预设文件附加信息存储在所述inode文件节点中;
存储节点挂接模块,用于将搜索到的空闲存储节点的地址填入所述inode文件节点的下一级节点指针。
在一种实现方式中,所述预设文件附加信息包括创建日期、修改日期、文件长度、文件名和访问权限。
在一种实现方式中,所述数据写入模块,包括:
写入条件判定单元,用于当所述链尾存储节点的魔幻数头中的数据与所述预设魔幻数不匹配,判定所述链尾存储节点的文件体中为空数据,符合所述允许写入条件。
在一种实现方式中,所述写操作信息存储模块,包括:
写操作信息确定单元,用于根据所述本次数据写入操作,确定文件的访问时间、修改时间和写入数据后的文件长度;
写操作信息存储单元,用于将所述访问时间、所述修改时间和所述文件长度存储在所述链尾存储节点的文件信息头中。
参照图6,本申请实施例提供一种设备,所述设备包括处理器601以及存储器602;其中,所述处理器601用于执行存储器602中存储的程序,以实现本申请实施例中的任意一种方法。
作为例子,该设备可以为无线基站设备,例如2G、3G、4G和5G设备以及未来更加先进的无线基站设备,以5G无线基站设备来说明本应用实例。
5G无线基站设备的固态驱动器(Solid State Drive,SSD)属于Flash存储介质。文件系统实现上述方法,能够有效地降低写放大系数,从而降低对SSD设备的擦写次数,能够将SSD设备的使用寿命从4年提高到12年。
该设备可以为有线交换传输设备,有线交换传输设备的Nandflash属于Flash存储介质,文件系统实现上述方法,能够有效地降低写放大系数,从而降低对Nandflash设备的擦写次数,能够将存储设备的使用寿命从6年提高到14年。
本申请实施例提供了一种存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例中的任意一种方法。
本申请实施例所提供的文件数据写入方法、装置、设备及存储介质,通过在文件链表中链尾存储节点的文件体写入数据,并在文件信息头中存储写操作相关信息,有效的降低Flash存储介质的写放大系数,从而提高Flash存储器的寿命。
以上所述,仅为本申请的一些实施例而已,并非用于限定本申请的保护范围。
本领域内的技术人员应明白,术语用户终端涵盖任何适合类型的无线用户设备,例如移动电话、便携数据处理装置、便携网络浏览器或车载移动台。
一般来说,本申请的多种实施例可以在硬件或专用电路、软件、逻辑或其任何组合中实现。例如,一些方面可以被实现在硬件中,而其它方面可以被实现在可以被控制器、微处理器或其它计算装置执行的固件或软件中,尽管本申请不限于此。
本申请的实施例可以通过移动装置的数据处理器执行计算机程序指令来实现,例如在处理器实体中,或者通过硬件,或者通过软件和硬件的组合。计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码。
本申请附图中的任何逻辑流程的框图可以表示程序步骤,或者可以表示相互连接的逻 辑电路、模块和功能,或者可以表示程序步骤与逻辑电路、模块和功能的组合。计算机程序可以存储在存储器上。存储器可以具有任何适合于本地技术环境的类型并且可以使用任何适合的数据存储技术实现,例如但不限于只读存储器(ROM)、随机访问存储器(RAM)、光存储器装置和系统(数码多功能光碟DVD或CD光盘)等。计算机可读介质可以包括非瞬时性存储介质。数据处理器可以是任何适合于本地技术环境的类型,例如但不限于通用计算机、专用计算机、微处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、可编程逻辑器件(FGPA)以及基于多核处理器架构的处理器。
上文已提供了对本申请的一些实施例的详细描述。但结合附图和权利要求来考虑,对以上实施例的多种修改和调整对本领域技术人员来说是显而易见的,但不偏离本申请的范围。因此,本申请的恰当范围将根据权利要求确定。

Claims (10)

  1. 一种文件数据写入方法,包括:
    将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配;其中,所述文件链表上挂接有至少一个存储节点;
    当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上;
    将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中;
    在所述链尾存储节点的魔幻数头中写入所述预设魔幻数;
    将搜索到的空闲存储节点的地址填入所述链尾存储节点的下一级节点指针,以将挂接后的所述空闲存储节点作为新的链尾存储节点。
  2. 根据权利要求1所述的方法,在所述的将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配的步骤之前,还包括:
    响应于文件创建操作,生成对应的inode文件节点;
    将预设文件附加信息存储在所述inode文件节点中;
    将搜索到的空闲存储节点的地址填入所述inode文件节点的下一级节点指针。
  3. 根据权利要求2所述的方法,其中,所述预设文件附加信息包括创建日期、修改日期、文件长度、文件名和访问权限。
  4. 根据权利要求1所述的方法,其中,所述当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上,包括:
    当所述链尾存储节点的魔幻数头中的数据与所述预设魔幻数不匹配,判定所述链尾存储节点的文件体中为空数据,符合所述允许写入条件。
  5. 根据权利要求1所述的方法,其中,所述将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中,包括:
    根据所述本次数据写入操作,确定文件的访问时间、修改时间和写入数据后的文件长度;
    将所述访问时间、所述修改时间和所述文件长度存储在所述链尾存储节点的文件信息头中。
  6. 一种文件数据写入装置,包括:
    魔幻数匹配模块,用于将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配;其中,所述文件链表上挂接有至少一个存储节点;
    数据写入模块,用于当魔幻数匹配结果符合允许写入条件,将待写入数据存储到所述链尾存储节点的文件体上;
    写操作信息存储模块,用于将本次数据写入操作对应的预设写操作相关信息存储在所述链尾存储节点的文件信息头中;
    魔幻数写入模块,用于在所述链尾存储节点的魔幻数头中写入所述预设魔幻数;
    预分配存储节点模块,用于将搜索到的空闲存储节点的地址填入所述链尾存储节点的下一级节点指针,以将挂接后的所述空闲存储节点作为新的链尾存储节点。
  7. 根据权利要求6所述的装置,还包括:
    文件节点生成模块,用于在所述将文件链表中链尾存储节点的魔幻数头中的数据与预设魔幻数进行匹配之前,响应于文件创建操作,生成对应的inode文件节点;
    附件信息存储模块,用于将预设文件附加信息存储在所述inode文件节点中;
    存储节点挂接模块,用于将搜索到的空闲存储节点的地址填入所述inode文件节点的下一级节点指针。
  8. 根据权利要求6所述的装置,其中,所述数据写入模块,包括:
    写入条件判定单元,用于当所述链尾存储节点的魔幻数头中的数据与所述预设魔幻数不匹配,判定所述链尾存储节点的文件体中为空数据,符合所述允许写入条件。
  9. 一种设备,包括处理器以及存储器;其中,
    所述处理器用于执行存储器中存储的程序,以实现权利要求1-5任一项所述的方法。
  10. 一种存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现权利要求1-5任一项所述的方法。
PCT/CN2020/120354 2019-12-27 2020-10-12 一种文件数据写入方法、装置、设备及存储介质 WO2021129048A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911379453.9A CN113050876A (zh) 2019-12-27 2019-12-27 一种文件数据写入方法、装置、设备及存储介质
CN201911379453.9 2019-12-27

Publications (1)

Publication Number Publication Date
WO2021129048A1 true WO2021129048A1 (zh) 2021-07-01

Family

ID=76506692

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/120354 WO2021129048A1 (zh) 2019-12-27 2020-10-12 一种文件数据写入方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN113050876A (zh)
WO (1) WO2021129048A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567261A (zh) * 2003-06-13 2005-01-19 鸿富锦精密工业(深圳)有限公司 闪存文件系统及方法
US20110246706A1 (en) * 2010-03-30 2011-10-06 Hitachi, Ltd. Disk array configuration program, computer, and computer system
CN108664482A (zh) * 2017-03-27 2018-10-16 纳思达股份有限公司 Flash存储器及存储文件管理方法
CN110174998A (zh) * 2019-05-05 2019-08-27 上海威固信息技术股份有限公司 一种提高高速信号采集系统实时性的方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567261A (zh) * 2003-06-13 2005-01-19 鸿富锦精密工业(深圳)有限公司 闪存文件系统及方法
US20110246706A1 (en) * 2010-03-30 2011-10-06 Hitachi, Ltd. Disk array configuration program, computer, and computer system
CN108664482A (zh) * 2017-03-27 2018-10-16 纳思达股份有限公司 Flash存储器及存储文件管理方法
CN110174998A (zh) * 2019-05-05 2019-08-27 上海威固信息技术股份有限公司 一种提高高速信号采集系统实时性的方法

Also Published As

Publication number Publication date
CN113050876A (zh) 2021-06-29

Similar Documents

Publication Publication Date Title
TW201915733A (zh) 用以在記憶裝置中進行存取管理的方法、相關記憶裝置及其控制器以及相關電子裝置
JP2018018557A (ja) 持続性記憶装置からデータを読み取る方法およびシステム、ならびに非一時的記憶媒体
TW201926046A (zh) 存取快閃記憶體模組的方法及相關的快閃記憶體控制器與電子裝置
US10761781B2 (en) Apparatus and methods for a distributed memory system including memory nodes
US20200225882A1 (en) System and method for compaction-less key-value store for improving storage capacity, write amplification, and i/o performance
US11086554B2 (en) Writing same data on a storage system
US20150046142A1 (en) Fifo cache simulation using a bloom filter ring
EP3196767B1 (en) Method for writing data into flash memory device, flash memory device and storage system
CN107665095B (zh) 存储器空间管理的设备、方法及可读存储介质
KR20200043676A (ko) 메모리 시스템 및 메모리 시스템의 동작방법
TWI570559B (zh) 快閃記憶體及其存取方法
US9519541B2 (en) Data storage device and data checking and correction for volatile memory
WO2023155531A1 (zh) 数据读写方法、装置及相关设备
WO2015176664A1 (zh) 一种数据操作的方法、设备和系统
JP2014225197A (ja) データ記憶システムおよびその制御方法
US20220092046A1 (en) System and method for efficient expansion of key value hash table
WO2021129048A1 (zh) 一种文件数据写入方法、装置、设备及存储介质
KR101676175B1 (ko) 전원 손실 이후 데이터 손실을 방지하기 위한 메모리 저장 장치 및 방법
KR102071072B1 (ko) 데이터 저장장치의 주소 맵핑 테이블 운용 방법
EP3819771B1 (en) Data processing method and device, apparatus, and system
WO2020039927A1 (ja) 不揮発性記憶装置、ホスト装置、及びデータ記憶システム
US20220164135A1 (en) Apparatus, method and computer program for managing memory page updates within non-volatile memory
JP2013109404A (ja) 情報処理装置
JP6289883B2 (ja) ストレージ装置
WO2022116067A1 (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: 20904862

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20904862

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 16.02.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20904862

Country of ref document: EP

Kind code of ref document: A1