WO2024055571A1 - 一种namespace设置方法、装置及可读存储介质 - Google Patents
一种namespace设置方法、装置及可读存储介质 Download PDFInfo
- Publication number
- WO2024055571A1 WO2024055571A1 PCT/CN2023/085856 CN2023085856W WO2024055571A1 WO 2024055571 A1 WO2024055571 A1 WO 2024055571A1 CN 2023085856 W CN2023085856 W CN 2023085856W WO 2024055571 A1 WO2024055571 A1 WO 2024055571A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- namespace
- linked list
- read
- setting method
- virtual
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 90
- 230000005540 biological transmission Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 14
- 238000004891 communication Methods 0.000 claims description 8
- 238000012546 transfer Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 238000003491 array Methods 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 238000011895 specific detection Methods 0.000 description 1
- 238000013403 standard screening design Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0238—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
- G06F12/0246—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11C—STATIC STORES
- G11C16/00—Erasable programmable read-only memories
- G11C16/02—Erasable programmable read-only memories electrically programmable
- G11C16/06—Auxiliary circuits, e.g. for writing into memory
- G11C16/10—Programming or data input circuits
- G11C16/14—Circuits for erasing electrically, e.g. erase voltage switching circuits
- G11C16/16—Circuits for erasing electrically, e.g. erase voltage switching circuits for erasing blocks, e.g. arrays, words, groups
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11C—STATIC STORES
- G11C16/00—Erasable programmable read-only memories
- G11C16/02—Erasable programmable read-only memories electrically programmable
- G11C16/06—Auxiliary circuits, e.g. for writing into memory
- G11C16/26—Sensing or reading circuits; Data output circuits
Definitions
- This application relates to the field of information technology, and in particular to a namespace setting method, device and readable storage medium.
- NVMe Non-Volatile Memory express
- PCIe peripheral component interconnect express
- linear tables include arrays and linked lists.
- linked lists are often used. For linked lists whose memory is not continuous, elements can be added arbitrarily, but the index The time complexity is high, and each namespace element in the linked list needs to be indexed in sequence. As the length of the linked list increases, the indexing efficiency will become lower and lower, which will have a negative impact on data transmission efficiency.
- the purpose of this application is to provide a namespace setting method to solve the problem of high indexing time complexity of the current namespace.
- Each namespace element in the linked list needs to be indexed in sequence. As the length of the linked list increases, the indexing efficiency will increase. is getting lower and lower, thus negatively affecting data transmission efficiency.
- this application provides a namespace setting method, including:
- the first virtual linked list is a virtual linked list pre-constructed by the step pointer with the longest length set in the namespace.
- the step pointer is pointed by the namespace. Pointer to the namespace after ID number n;
- the basic linked list is a linked list with a step pointer length of 1 that is sorted in advance according to the ID of each namespace;
- the namespace that needs to be read is obtained based on the ID sequence number.
- the specific subsequent operation of the read instruction is: retrieving a certain namespace element in the memory, or deleting a certain namespace element in the memory.
- the next-level virtual linked list is a subsequent linked list whose step pointer length is lower than that of the upper-level virtual linked list.
- the namespace to be read after repeating the above steps until the namespace to be read is obtained from the basic linked list, it also includes:
- the solution also includes:
- the namespace is placed at the end of the basic linked list, and the ID of the newly created namespace is the ID value of the previous namespace plus 1.
- receiving a read instruction and parsing the read instruction to obtain the ID of the namespace that needs to be read includes:
- the read command is received through asynchronous transmission, and the read command is parsed asynchronously to obtain the ID of the namespace that needs to be read.
- the asynchronous transmission method uses cells as the transmission unit, and the information in the header is divided into cells.
- the information in the header is divided into cells.
- Directional logical address, priority, header error control, flow control, the data segment is loaded with user information or other management information of various services that is decomposed into data blocks.
- each virtual linked list will be rebuilt based on all namespaces.
- the preset time is the average time spent on sequentially searching namespaces.
- the read command is received as a communication command between the host and the SSD formulated for NVMe.
- receiving a read instruction and parsing the read instruction to obtain the ID of the namespace that needs to be read includes:
- alarm methods include:
- both the random linked list and the basic linked list are ordered linked lists.
- this application also provides a namespace setting device, including:
- the receiving module is used to receive read instructions and parse the read instructions to obtain the ID of the namespace that needs to be read;
- the reading module is used to obtain the first range of the namespace that needs to be read based on the acquisition of the first virtual linked list and the ID.
- the first virtual linked list is a virtual linked list constructed in advance through the longest step pointer set in the namespace.
- the step pointer is the pointer from namespace to the namespace after ID number n;
- the loop module is used to transfer the index of the namespace to the next-level virtual linked list, obtain the second range of the namespace that needs to be read in the first range based on the ID and the next-level virtual linked list, and determine the second range of the namespace that needs to be read. scope;
- the acquisition module is used to repeat the loop module until the namespace to be read is obtained from the basic linked list.
- the basic linked list is a linked list with a step pointer length of 1 that is sorted in advance according to the ID of each namespace.
- the device further includes:
- the interpretation module is used to determine whether the namespace needs to be deleted based on the read instructions. When the namespace needs to be deleted, When, turn on the set 0 module;
- Set 0 module is used to set the namespace flag to 0 to indicate that the namespace will no longer receive request instructions.
- the device further includes:
- the search module is used to receive the namespace creation command and search whether there is a flag set to 0 in the basic linked list. If there is a flag set to 0 in the basic linked list, open the set 1 module;
- Set 1 module used to set the flag position to 1 and modify the corresponding information of the namespace.
- the device further includes:
- the device further includes:
- Confirmation module used to confirm whether the ID value of the namespace can be divisible by each virtual linked list
- the divisible module adds the namespace ID to all virtual linked lists that can be divisible.
- the device further includes:
- the recording module is used to record the time from receiving the read command to obtaining the namespace, and determine whether it is higher than the preset time. If it is higher than the preset time, open the reconstruction module;
- the reconstruction module is used to reconstruct each virtual linked list based on all namespaces.
- this application also provides a namespace setting device, which includes a memory for storing computer programs;
- the processor is used to implement the steps of the above namespace setting method when executing the computer program.
- this application also provides a non-volatile readable storage medium.
- a computer program is stored on the non-volatile readable storage medium.
- the steps of the above namespace setting method are implemented. .
- the namespace setting method provided by this application establishes a multi-level virtual linked list by setting multiple step pointers with different lengths in the namespace. After receiving the read instruction, the read instruction obtains the ID of the namespace that needs to be read, and reads as needed. The ID of the namespace and narrow the search range in virtual linked lists at different levels starting from the virtual linked list with the highest length, thereby obtaining the namespace that needs to be read.
- the existing solution is to sequentially Search all namespaces in the linked list. Therefore, when the linked list is too long, it takes a long time to verify each namespace and the indexing efficiency is low.
- the virtual linked list constructed through multi-level step pointers can be determined first.
- the namespace setting device and computer-readable medium of this application correspond to the above namespace method, and the beneficial effects are the same as above.
- Figure 1 is a flow chart of a namespace setting method provided by an embodiment of the present application.
- Figure 2 is a schematic diagram of a namespace setting device provided by an embodiment of the present application.
- Figure 3 is a structural diagram of a namespace setting device provided by another embodiment of the present application.
- Figure 4 is a structural diagram of a non-volatile readable storage medium provided by an embodiment of the present application.
- the core of this application is to provide a namespace setting method to solve the problem of high indexing time complexity of the current namespace.
- Each namespace element in the linked list needs to be indexed in sequence. As the length of the linked list increases, the indexing efficiency will increase. is getting lower and lower, thus negatively affecting data transmission efficiency.
- Figure 1 is a flow chart of a namespace setting method provided by an embodiment of the present application. As shown in Figure 1, the method includes:
- S10 Receive the read command and parse the read command to obtain the ID of the namespace that needs to be read;
- namespace is "namespace”, also known as “namespace”. It is a form of code organization used by many programming languages. It is classified by namespace to distinguish different code functions and avoid different code snippets (usually worked together by different people or calling existing code snippets) when used at the same time. The same variable names between different codes cause conflicts.
- Identity document also known as serial number or account number, is a relatively unique code in a certain system, equivalent to a kind of "ID card”.
- the identity document is generally not Changed, as for What is used to identify the thing is determined by the rules set by the designer himself.
- the read instruction and the object to which the read instruction is sent are not limited. It can be understood that the specific subsequent operation of the read instruction may be to retrieve a certain namespace element in the memory, or it may be necessary to delete the memory. A certain namespace element, etc.
- the process after obtaining the namespace that needs to be read is not limited. It can be understood that the ID of the namespace is in the linked list in the memory through the naming rules of the namespace. Independent number for each namespace.
- a linked list is a non-continuous and non-sequential storage structure on a physical storage unit.
- the logical order of data elements is realized through the link order of pointers in the linked list.
- a linked list consists of a series of nodes (each element in the linked list is called a node), and nodes can be dynamically generated at runtime. Each node consists of two parts: one is the data field that stores data elements, and the other is the pointer field that stores the address of the next node.
- the first virtual linked list is a virtual linked list constructed in advance by setting the longest step pointer in the namespace.
- the step pointer is a pointer from the namespace to the namespace after the ID number is n.
- the length of the step pointer is 4.
- the first virtual linked list includes the namespace with ID 0, the namespace with ID 4, and all subsequent namespaces in the same linked list that are divisible by 4, and in this embodiment, the specific step size and length of the first virtual linked list None are limited. It can be understood that for the first linked list, the specific elements used to construct the first linked list are not constructed by the namespace, but by the step pointer in the namespace, so it is a virtual linked list.
- S12 Enter the next-level virtual linked list for indexing, and obtain a more accurate namespace range based on the ID and the next-level virtual linked list;
- next-level virtual linked list in this embodiment represents the next linked list whose step pointer length is lower than that of the upper-level virtual linked list.
- step pointers of 2, 4, and 8 in a namespace.
- the step pointer with a length of 8 constructs the above-mentioned first virtual linked list
- the next-level virtual linked list after the first virtual linked list is a virtual linked list with a length of 4
- the next-level virtual linked list of the virtual linked list with a length of 4 It is a virtual linked list with a length of 2.
- the number of virtual linked lists and the length of the corresponding step pointer are not limited.
- S13 Determine whether the current virtual linked list is a basic linked list. If the current virtual linked list is a basic linked list, go to S14. If the current virtual linked list is not a basic linked list, go back to S12;
- the basic linked list is a virtual linked list with a step pointer length of 1 that is sorted in advance according to the ID of each namespace, that is, a linked list containing all namespaces, and is sorted by ID, and the initial pointer in the namespace points to the previous one.
- the initial linked list constructed with a pointer to the next element.
- the namespace setting method provided in this embodiment establishes a multi-level virtual linked list by setting multiple step pointers with different lengths in the namespace. After receiving the read instruction, the read instruction obtains the ID of the namespace that needs to be read. Get the ID of the namespace and narrow the search range in virtual linked lists at different levels starting from the virtual linked list with the highest length, thereby obtaining the namespace that needs to be read. Compared with the existing namespace setting method, since the existing solution is through All namespaces in the linked list are searched in turn. Therefore, when the linked list is too long, it takes a long time to verify each namespace and the indexing efficiency is low.
- the virtual linked list constructed through multi-level step pointers can be first Determine a larger range, and then narrow the search range in sequence. Set the number of levels of the virtual linked list and the length of the virtual linked list at each level appropriately through the number of namespaces. Since the search is done through the pointer in the ID, the search range is searched in the virtual linked list. The efficiency is higher, and the index range can be gradually narrowed by ID, thereby effectively improving the indexing efficiency of namespace.
- the step pointer needs to be modified due to the method adopted in this application to construct the step pointer, an optimal solution is provided here.
- the namespace to be read based on the ID it also includes:
- the establishment instruction may be to establish one or more namespaces, and when establishing the namespace, it is searched whether there is any of the names mentioned in the above embodiment. It is necessary to delete the flag bit that is set to 0 by setting the flag bit to 1 and modify the corresponding information in the establishment instruction. to the namespace corresponding to the flag bit, thereby ensuring accurate utilization of storage space, and also reducing the steps required to modify the step pointer due to the creation of a new namespace, thereby increasing the operating efficiency of the system.
- the namespace is placed at the end of the basic linked list, and the ID of the newly created namespace is the ID value of the previous namespace plus 1.
- the namespace is placed at the end of the table, and a new ID is given to the namespace according to the naming rules.
- the number of newly created namespaces is not limited. , so multiple namespaces can be placed at the end at the same time and their IDs are added by 1 in sequence according to the naming rules to create them. In this embodiment, no specific identification is performed. The above method ensures the timely creation of the namespace and accurate naming.
- a step pointer is established for the newly created namespace, and the step pointer is added to the corresponding virtual linked list, ensuring the integrity and accuracy of the index.
- receiving read instructions and parsing the read instructions to obtain the ID of the namespace that needs to be read includes;
- the read command is received through asynchronous transmission, and the read command is parsed asynchronously to obtain the ID of the namespace that needs to be read.
- Asynchronous transfer (Asynchronous Transfer Mode, ATM) is that each character independently forms a frame for transmission. A continuous string is also encapsulated into continuous independent frames for transmission. The interval between each character can be arbitrary, so this kind of transmission The method is called asynchronous transmission.
- Asynchronous transfer mode is a cell switching and multiplexing technology.
- ATM uses the cell as the transmission unit. The cell has a fixed length of 53 bytes in total. The first 5 bytes are the header and the remaining 48 bytes are the data segment. The header contains information such as the logical address of the cell's destination, priority, header error control, and flow control. The data segment is loaded with user information or other management information of various services that is decomposed into data blocks and passes through the network transparently.
- the asynchronous transmission method increases the efficiency of transmission and indexing.
- the method also includes:
- each virtual linked list will be rebuilt based on all namespaces.
- the preset time there is no specific limit to the preset time. It may depend on the length of the linked list. For example, the average time used to search namespaces sequentially through the traditional method can be used as the preset time in this embodiment, so that it can be judged whether it is high or not. If the efficiency of the traditional method is lower than the efficiency of the traditional method, the range and length of the constructed virtual linked list at all levels are not reasonable enough, so the length and range of the virtual linked list are re-constructed to ensure that the less efficient ones can be processed in a timely manner. The virtual linked list construction method is adjusted.
- the namespace setting method is described in detail, and this application also provides corresponding embodiments of the namespace setting device. It should be noted that this application describes the embodiments of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware.
- SSD Solid State Drives
- solid drives are hard drives made of solid-state electronic storage chip arrays and are composed of control units and storage units (FLASH chips, DRAM chips). SSDs are exactly the same as traditional hard drives in terms of interface specifications and definitions, functions and usage methods. The product shape and size are also completely consistent with traditional hard drives, but their I/O performance is greatly improved compared to traditional hard drives.
- Namespace divides the flash memory space in SSD into several independent logical spaces.
- the address of each independent logical space is from 0 to N-1.
- NSID globally unique identifier of namespace.
- a further optimal solution is provided here to receive the read instruction and parse the read instruction to obtain the ID of the namespace that needs to be read, including:
- Flash memory is an electronic form of programmable read-only memory that can be erased and written to multiple times during operation. This technology is mainly used for general data storage and data exchange between computers and other digital products such as memory cards and flash drives. Flash memory is a special type of storage that is written with macroblocks. In the early stages, once the flash memory is erased, the data on the entire chip is erased. The flash memory provided according to this embodiment ensures data security performance.
- Warning lights, buzzers, etc. can be used, or other methods can be used, such as sending warning information to the equipment terminal, and adding alarm information. way, thus ensuring.
- Figure 2 is a schematic diagram of a namespace setting device provided by an embodiment of the present application.
- the device includes:
- the receiving module 10 is used to receive the read instruction, and parse the read instruction to obtain the ID of the namespace that needs to be read;
- the reading module 11 is used to obtain the first range of the namespace that needs to be read based on the acquisition of the first virtual linked list and the ID.
- the first virtual linked list is a virtual linked list constructed in advance through the longest step pointer set in the namespace.
- the step pointer is the pointer of namespace to the namespace after ID number n;
- the loop module 12 is used to transfer the index of the namespace to the next-level virtual linked list, obtain the second range of the namespace that needs to be read in the first range according to the ID and the next-level virtual linked list, and determine the third range of the namespace that needs to be read. Two ranges;
- the acquisition module 13 is used to repeat the loop module 12 until the namespace to be read is obtained from the basic linked list.
- the basic linked list is a linked list with a step pointer length of 1 that is sorted in advance according to the ID of each namespace.
- the device further includes:
- the interpretation module is used to determine whether the namespace needs to be deleted based on the read instructions. When the namespace needs to be deleted, the set 0 module is turned on;
- Set 0 module is used to set the namespace flag to 0 to indicate that the namespace will no longer receive request instructions.
- the device further includes:
- the search module is used to receive the namespace creation command and search whether there is a flag set to 0 in the basic linked list. If there is a flag set to 0 in the basic linked list, open the set 1 module;
- Set 1 module used to set the flag position to 1 and modify the corresponding information of the namespace.
- the device further includes:
- the device further includes:
- Confirmation module used to confirm whether the ID value of the namespace can be divisible by each virtual linked list
- the divisible module adds the namespace ID to all virtual linked lists that can be divisible.
- the device further includes:
- the recording module is used to record the time from receiving the read command to obtaining the namespace, and determine whether it is higher than the preset time. If it is higher than the preset time, open the reconstruction module;
- the reconstruction module is used to reconstruct each virtual linked list based on all namespaces.
- the namespace setting device includes a memory and a processor.
- the processor executes the program stored in the memory, it can establish a multi-level virtual linked list by setting multiple step pointers with different lengths in the namespace.
- the subsequent reading instruction obtains the ID of the namespace that needs to be read.
- the search range is narrowed down in virtual linked lists at different levels starting from the virtual linked list with the highest length, thereby obtaining the namespace that needs to be read, and
- the existing solution searches all namespaces in the linked list in sequence, when the linked list is too long, it takes a long time to verify each namespace and the indexing efficiency is low.
- the virtual linked list constructed through multi-level step pointers can first determine a larger range, and then narrow the search range in sequence.
- the number of levels of the virtual linked list and the length of the virtual linked list at each level can be reasonably set through the number of namespaces. Since The search is performed through the pointer in the ID, so the search range in the virtual linked list is more efficient, and the index range can be gradually narrowed through the ID, thereby effectively improving the indexing efficiency of the namespace.
- Figure 3 is a structural diagram of a namespace setting device provided by another embodiment of the present application.
- the namespace setting device includes: a memory 20 for storing computer programs;
- the processor 21 is configured to implement the steps of the namespace setting method mentioned in the above embodiment when executing the computer program.
- the namespace setting device may include but is not limited to a smart phone, a tablet computer, a notebook computer or a desktop computer.
- the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc.
- the processor 21 may adopt at least one hardware form among digital signal processing (Digital Signal Processor, DSP), field-programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). accomplish.
- the processor 21 may also include a main processor and a co-processor.
- the main processor is a processor used to process data in the wake-up state, also called a central processing unit (Central Processing Unit, CPU); the co-processor is A low-power processor used to process data in standby mode.
- CPU Central Processing Unit
- the processor 21 may be integrated with a graphics processor (Graphics Processing Unit, GPU), and the GPU is responsible for rendering and drawing content to be displayed on the display screen.
- the processor 21 may also include an artificial intelligence (Artificial Intelligence, AI) processor, which is used to process machine learning related tasks. Learn computational operations.
- AI Artificial Intelligence
- Memory 20 may include one or more non-volatile readable storage media, which may be non-transitory.
- the memory 20 may also include high-speed random access memory, and non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices.
- the memory 20 is at least used to store the following computer program 201. After the computer program is loaded and executed by the processor 21, the relevant steps of namespace setting and release disclosed in any of the foregoing embodiments can be implemented.
- the resources stored in the memory 20 may also include the operating system 202, data 203, etc., and the storage method may be short-term storage or permanent storage.
- the operating system 202 may include Windows, Unix, Linux, etc.
- the data 203 may include, but is not limited to, the data involved in the namespace setting method provided in the above embodiment, and the like.
- the namespace setting device may also include a display screen 22 , an input/output interface 23 , a communication interface 24 , a power supply 25 and a communication bus 26 .
- Figure 3 does not constitute a limitation on the namespace setting device, and may include more or fewer components than shown in the figure.
- the namespace setting device provided by the embodiment of the present application includes a memory and a processor.
- the processor executes the program stored in the memory, it can implement the following method: the namespace setting method provided in the above embodiment.
- the namespace setting device includes a memory and a processor.
- the processor executes the program stored in the memory, it can establish a multi-level virtual linked list by setting multiple step pointers with different lengths in the namespace.
- the subsequent reading instruction obtains the ID of the namespace that needs to be read.
- the search range is narrowed down in virtual linked lists at different levels starting from the virtual linked list with the highest length, thereby obtaining the namespace that needs to be read, and
- the existing solution searches all namespaces in the linked list in sequence, when the linked list is too long, it takes a long time to verify each namespace and the indexing efficiency is low.
- the virtual linked list constructed through multi-level step pointers can first determine a larger range, and then narrow the search range in sequence.
- the number of levels of the virtual linked list and the length of the virtual linked list at each level can be reasonably set through the number of namespaces. Since The search is performed through the pointer in the ID, so the search range in the virtual linked list is more efficient, and the index range can be gradually narrowed through the ID, thereby effectively improving the indexing efficiency of the namespace.
- this application also provides a corresponding embodiment of the non-volatile readable storage medium 400 .
- the computer program 401 is stored on the non-volatile readable storage medium 400.
- the steps described in the above method embodiments are implemented.
- the methods in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , execute all or part of the steps of the methods described in various embodiments of this application.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code. .
- the stored program when executed, it can establish a multi-level virtual linked list by setting multiple step pointers with different lengths in the namespace.
- the program After receiving the read instruction, the program can be read Fetch the instruction to obtain the ID of the namespace that needs to be read.
- the search range is narrowed down in virtual linked lists at different levels starting from the virtual linked list with the longest length, thereby obtaining the namespace that needs to be read, and the existing namespace.
- a larger range can be determined first, and then the search range can be narrowed down in sequence.
- the number of levels of the virtual linked list and the length of the virtual linked list at each level can be reasonably set through the number of namespaces.
- the pointer in the ID is searched, so the search range in the virtual linked list is more efficient, and the index range can be gradually narrowed through the ID, thereby effectively improving the indexing efficiency of the namespace.
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
本申请公开了一种namespace设置方法、装置及可读存储介质,涉及信息技术领域。本申请所提供的namespace设置方法,通过namespace中设置多个长度不同的步长指针建立多级虚拟链表,在接收到读取指令后读取指令获得需要读取的namespace的ID,并从长度最高的虚拟链表开始在不同级的虚拟链表依次缩小搜索范围,从而获取得到需要读取的namespace,与现有的namespace设置方法相比,本方案中通过多级的步长指针构建的虚拟链表,可以先确定一个较大的范围,随后依次缩小搜索范围,在虚拟链表中搜寻范围的效率更高,且可以通过ID逐渐缩小索引范围,从而有效提高索引效率。
Description
相关申请的交叉引用
本申请要求于2022年09月16日提交中国专利局,申请号为202211131081.X,申请名称为“一种namespace设置方法、装置及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及信息技术领域,特别是涉及一种namespace设置方法、装置及可读存储介质。
近年来,固态硬盘技术的日渐成熟,因其在性能、功耗、可靠性上优势,正在逐步替代传统机械硬盘的位置,再加上计算存储等新领域的开辟,大容量闪存出现带来成本越来越低,固态硬盘市场占有率逐渐提高。非易失性存储器(Non-Volatile Memory express,NVMe)在使用时一般情况下作为计算机拓展总线(peripheral component interconnect express,PCIe)设备下挂在主机,而每个NVMe固态硬盘中的闪存空间可以划分为若干个独立的命名空间(namespace)。
现有的namespace设置方法一般是通过线性表管理,线性表常见形式有数组和链表;考虑到为了线性表的灵活性,多采取链表的形式,对于链表内存不连续,可以任意添加元素,但索引时间复杂度较高,需要对链表中的每个namespace元素依次进行索引,随着链表长度的增加,索引效率会越来越低,从而对数据传输效率产生负面影响。
发明内容
本申请的目的是提供一种namespace设置方法,以便于解决当前的namespace的索引时间复杂度较高,需要对链表中的每个namespace元素依次进行索引,随着链表长度的增加,索引效率会越来越低,从而对数据传输效率产生负面影响的问题。
为解决上述技术问题,本申请提供一种namespace设置方法,包括:
接收读取指令,并解析读取指令获得需要读取的namespace的ID;
根据第一虚拟链表以及ID的获取得到需要读取的namespace的第一范围,第一虚拟链表为预先通过在namespace中设置的长度最长的步长指针构建的虚拟链表,步长指针为namespace指向ID序号为n后的namespace的指针;
将namespace的索引转向下一级虚拟链表,根据ID以及下一级虚拟链表在第一范围中
获取需要读取的namespace的第二范围,确定出需要读取的namespace的第二范围;
判断当前虚拟链表是否为基础链表,基础链表为预先根据各namespace的ID进行排序的步长指针长度为1的链表;
若当前虚拟链表不为基础链表,则回到将namespace的索引转向下一级虚拟链表的步骤;
若当前虚拟链表为基础链表,则根据ID序号获取得到需要读取的namespace。
在本申请一些实施例中,读取指令的具体后续操作为:调取存储器中的某个namespace元素,或者,删除存储器中的某个namespace元素。
在本申请一些实施例中,下一级虚拟链表为步长指针长度低于上一级虚拟链表的后一个链表。
在本申请一些实施例中,在重复上述步骤直到从基础链表中获取得到需要读取的namespace,还包括:
根据读取指令判断是否需要删除namespace;
若需要删除namespace,则将namespace的标志位置0,用于表征namespace不再接收请求指令。
在本申请一些实施例中,该方案还包括:
接收到namespace建立指令,在基础链表中搜寻是否存在置0的标志位;
若基础链表中存在置0的标志位,则将标志位置1并修改namespace的相应信息。
在本申请一些实施例中,接收到namespace建立指令,在基础链表中搜寻是否存在置0的标志位之后,还包括:
若基础链表中不存在置0的标志位,则将namespace置于基础链表的末尾,并且新建立的namespace的ID为上一个namespace的ID值加1。
在本申请一些实施例中,在将namespace置于基础链表的末尾之后,还包括:
确认namespace的ID值是否能被各虚拟链表整除;
将namespace的ID加入至所有能整除的虚拟链表中。
在本申请一些实施例中,接收读取指令,并解析读取指令获得需要读取的namespace的ID包括;
通过异步传输的方式接收读取指令,并通过异步的方式解析读取指令获得需要读取的namespace的ID。
在本申请一些实施例中,异步传输的方式采用信元作为传输单位,信头中信息有信元去
向的逻辑地址、优先级、信头差错控制、流量控制,数据段中装入被分解成数据块的各种不同业务的用户信息或其他管理信息。
在本申请一些实施例中,还包括:
记录从接收读取指令到获取到namespace的时间,判断是否高于预设时间;
若高于预设时间,则根据全部namespace重新构建各虚拟链表。
在本申请一些实施例中,预设时间为依次搜寻到的namespace所用的平均时间。
在本申请一些实施例中,接收读取指令为NVMe制定的主机与SSD之间通信命令。
在本申请一些实施例中,接收读取指令,并解析读取指令获得需要读取的namespace的ID包括:
接收的IO命令后,解析命令得到NSID;
根据NSID中的namespace,在namespace对应的闪存空间进行读写;
在闪存空间中获取namespace的ID。
在本申请一些实施例中,还包括:
在虚拟链表出现故障时,进行报警。
在本申请一些实施例中,报警方式包括:
采用警示灯、蜂鸣器报警;
或者,给设备终端发送警告信息。
在本申请一些实施例中,随机链表与基础链表均为有序链表。
为解决上述问题,本申请还提供一种namespace设置装置,包括:
接收模块,用于接收读取指令,并解析读取指令获得需要读取的namespace的ID;
读取模块,用于根据第一虚拟链表以及ID的获取得到需要读取的namespace的第一范围,第一虚拟链表为预先通过在namespace中设置的长度最长的步长指针构建的虚拟链表,步长指针为namespace指向ID序号为n后的namespace的指针;
循环模块,用于将namespace的索引转向下一级虚拟链表,根据ID以及下一级虚拟链表在第一范围中获取需要读取的namespace的第二范围,确定出需要读取的namespace的第二范围;
获取模块,用于重复进行循环模块直到从基础链表中获取得到需要读取的namespace时,基础链表为预先根据各namespace的ID进行排序的步长指针长度为1的链表。
在本申请一些实施例中,该装置还包括:
判读模块,用于根据读取指令判断是否需要删除namespace,当需要删除namespace
时,开启置0模块;
置0模块,用于将namespace的标志位置0,用于表征namespace不再接收请求指令。
在本申请一些实施例中,该装置还包括:
搜寻模块,用于接收到namespace建立指令,在基础链表中搜寻是否存在置0的标志位,若基础链表中存在置0的标志位开启置1模块;
置1模块,用于将标志位置1并修改namespace的相应信息。
在本申请一些实施例中,该装置还包括:
建立模块,当若基础链表中不存在置0的标志位时开启,用于将namespace置于基础链表的末尾,并且新建立的namespace的ID为上一个namespace的ID值加1。
在本申请一些实施例中,该装置还包括:
确认模块,用于确认namespace的ID值是否能被各虚拟链表整除;
整除模块,将namespace的ID加入至所有能整除的虚拟链表中。
在本申请一些实施例中,该装置还包括:
记录模块,用于记录从接收读取指令到获取到namespace的时间,判断是否高于预设时间,若高于预设时间,开启重构模块;
重构模块,用于根据全部namespace重新构建各虚拟链表。
为解决上述问题,本申请还提供一种namespace设置装置,包括存储器,用于存储计算机程序;
处理器,用于执行计算机程序时实现如上述的namespace设置方法的步骤。
为解决上述问题,本申请还提供一种非易失性可读存储介质,非易失性可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述的namespace设置方法的步骤。
本申请所提供的namespace设置方法,通过namespace中设置多个长度不同的步长指针建立多级虚拟链表,在接收到读取指令后读取指令获得需要读取的namespace的ID,根据需要读取的namespace的ID并从长度最高的虚拟链表开始在不同级的虚拟链表依次缩小搜索范围,从而获取得到需要读取的namespace,与现有的namespace设置方法相比,由于现有的方案是通过依次搜寻链表中全部namespace,因此当链表过长时,对每个namespace进行验证所需要的时间较长,索引效率较低,而本方案中通过多级的步长指针构建的虚拟链表,可以先确定一个较大的范围,随后依次缩小搜索范围,通过namespace的个数合理设置虚拟链表的级数以及各级虚拟链表的长度,由于是通过ID中的指针进行搜寻,因此在虚拟链表中搜寻范围的效率更高,且可以通过ID逐渐缩小索引范围,从而有效提高namespace
的索引效率。
本申请namespace设置装置及计算机可读介质与上述的namespace方法对应,有益效果同上。
为了更清楚地说明本申请实施例,下面将对实施例中所需要使用的附图做简单的介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种namespace设置方法的流程图;
图2为本申请实施例提供的一种namespace设置装置的示意图;
图3为本申请另一实施例提供的namespace设置装置的结构图;
图4为本申请一实施例提供的非易失性可读存储介质的结构图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下,所获得的所有其他实施例,都属于本申请保护范围。
本申请的核心是提供一种namespace设置方法,以便于解决当前的namespace的索引时间复杂度较高,需要对链表中的每个namespace元素依次进行索引,随着链表长度的增加,索引效率会越来越低,从而对数据传输效率产生负面影响的问题。
为了使本技术领域的人员更好地理解本申请方案,下面结合附图和具体实施方式对本申请作进一步的详细说明。
图1为本申请实施例提供的一种namespace设置方法的流程图,如图1所示,该方法包括:
S10:接收读取指令,并解析读取指令获得需要读取的namespace的ID;
需要说明的是,namespace即“命名空间”,也称“名称空间”。是许多编程语言使用的一种代码组织的形式,通过命名空间来分类,区别不同的代码功能,避免不同的代码片段(通常由不同的人协同工作或调用已有的代码片段)同时使用时由于不同代码间变量名相同而造成冲突。
身份标识号码(Identity document,ID),也称为序列号或账号,是某个体系中相对唯一的编码,相当于是一种“身份证”在某一具体的事物中,身份标识号一般是不变的,至于
用什么来标识该事物,则由设计者自己制定的规则来确定。
在本实施例中对于读取指令以及发送读取指令的对象不进行限定,可以理解的是读取指令的具体后续操作可以是调取存储器中的某个namespace元素,也可以是需要删除存储器中的某个namespace元素等等,在本实施例中对于获取到需要读取的namespace之后的流程也不进行限定,可以理解的是,namespace的ID即经由namespace的命名规则在存储器中的链表中的每个namespace的独立编号。
S11:根据第一虚拟链表以及ID的获取得到需要读取的namespace的第一范围;
链表是一种物理存储单元上非连续、非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接次序实现的。链表由一系列结点(链表中每一个元素称为结点)组成,结点可以在运行时动态生成。每个结点包括两个部分:一个是存储数据元素的数据域,另一个是存储下一个结点地址的指针域。
第一虚拟链表为预先通过在namespace中设置的长度最长的步长指针构建的虚拟链表,步长指针为namespace指向ID序号为n后的namespace的指针,例如,步长指针的长度为4,则第一虚拟链表包括ID为0的namespace,ID为4的namespace,以及在同一链表中后续的所有的能被4整除的namespace,且本实施例中对于第一虚拟链表的具体步长以及长度均不进行限定,可以理解的是,对于第一链表而言,构建第一链表的具体元素并非是由namespace进行构建,而是由namespace中的步长指针进行构建的,因此为虚拟链表。
S12:进入下一级虚拟链表进行索引,根据ID以及下一级虚拟链表获取得到更精准的namespace的范围;
需要说明的是,本实施例中的下一级虚拟链表即表示步长指针长度低于上一级虚拟链表的后一个链表,例如一个namespace中存在有为2,4,8的步长指针,则长度为8的步长指针构建的为上述的第一虚拟链表,第一虚拟链表之后的下一级虚拟链表则为长度为4的虚拟链表,长度为4的虚拟链表的下一级虚拟链表则为长度为2的虚拟链表,在本实施例中对于虚拟链表的个数以及对应的步长指针的长度等等均不进行限定。
S13:判断当前的虚拟链表是否为基础链表,若当前的虚拟链表为基础链表,进入S14,若当前的虚拟链表不为基础链表,回到S12;
需要说明的是基础链表为预先根据各namespace的ID进行排序的步长指针长度为1的虚拟链表,即包含所有的namespace的链表,且通过ID依次排序,通过namespace中的初始指针即指向上一个和下一个元素的指针进行构建的最初始的链表。
S14:根据ID获取得到需要读取的namespace。
在本实施例中,对于获取得到namespace之后的具体步骤,例如针对该namespace中的内容进行修改,删除,调取等等均不进行限定。
本实施例所提供的namespace设置方法,通过namespace中设置多个长度不同的步长指针建立多级虚拟链表,在接收到读取指令后读取指令获得需要读取的namespace的ID,根据需要读取的namespace的ID并从长度最高的虚拟链表开始在不同级的虚拟链表依次缩小搜索范围,从而获取得到需要读取的namespace,与现有的namespace设置方法相比,由于现有的方案是通过依次搜寻链表中全部namespace,因此当链表过长时,对每个namespace进行验证所需要的时间较长,索引效率较低,而本方案中通过多级的步长指针构建的虚拟链表,可以先确定一个较大的范围,随后依次缩小搜索范围,通过namespace的个数合理设置虚拟链表的级数以及各级虚拟链表的长度,由于是通过ID中的指针进行搜寻,因此在虚拟链表中搜寻范围的效率更高,且可以通过ID逐渐缩小索引范围,从而有效提高namespace的索引效率。
考虑到在删除namespace时,由于本申请中采取的构建步长指针的方式,从而要对步长指针进行修改,在此提供优选方案,在根据ID获取得到需要读取的namespace之后,还包括:
根据读取指令判断是否需要删除namespace;
若需要删除namespace,则将namespace的标志位置0,用于表征namespace不再接收请求指令。
在本申请中,对于位于链表尾部的namespace实例进行增删时,虽然也需要对链表中部分namespace的步长指针进行更新,耗时还不算大;但若在链表中间进行实例增删,则需对更改实例前部分实例,以及其后所有实例的步长指针进行更新,这样会使链表删除和创建变的极其复杂,在链表创建删除耗费资源是很难被接受的。为了解决这个问题,我们在链表元素中增设了一个标志位,当链表删除namespace实例时,只需要在链表索引到该元素,将该标志位置0,不再接收请求,这样主机层面就可以认为该namespace实例被删除,也无需更新其他链表的步长指针,从而节省了运行资源,提高了运行效率。
考虑到在建立namespace时对于存储空间的利用,在此提出优选方案,该方案还包括:
接收到namespace建立指令,在基础链表中搜寻是否存在置0的标志位;
若基础链表中存在置0的标志位,则将标志位置1并修改namespace的相应信息。
在本实施例中对于namespace的具体的建立指令不进行限定,可以理解的是,建立指令可以是建立一个或多个namespace,且基于建立该namespace时,则寻找是否存在上述实施例中提到的需要删除被置0的标志位,通过将该标志位置1,并且将建立指令中的对应信息修改
到该标志位对应的namespace中,从而保证了存储空间的准确利用,也可以减小由于建立新的namespace从而要对步长指针进行一定的修改的步骤,从而增加系统的运行效率。
在上述实施例中提到的建立新的namespace流程中,考虑到可能存在基础链表中不存在置0的标志位,在此提供优选方案,接收到namespace建立指令,在基础链表中搜寻是否存在置0的标志位之后,还包括:
若基础链表中不存在置0的标志位,则将namespace置于基础链表的末尾,并且新建立的namespace的ID为上一个namespace的ID值加1。
即检测到不存在置0的标志位后,则将namespace置于表尾,并且根据命名规则,赋予namespace的新ID,可以理解的是,本实施例中对于新建的namespace的个数不进行限定,因此可以是多个namespace同时置于末尾并按命名规则依次对其ID进行加1从而建立,在本实施例中不进行具体鉴定,通过上述方式保证对于namespace的及时建立,以及准确命名。
上述实施例中提出,在不存在置0的标志位后,则将namespace置于表尾,考虑到由于步长指针的存在,在此提供优选方案,本实施例中的在将namespace置于基础链表的末尾之后,还包括:
确认namespace的ID值是否能被各虚拟链表整除;
将namespace的ID加入至所有能整除的虚拟链表中。
即对于新建立的namespace进行步长指针的建立,并将该步长指针加入到对应的虚拟链表中,保证了索引的完整性以及准确性。
考虑到在数据传输以及读取中进一步增加运行效率,接收读取指令,并解析读取指令获得需要读取的namespace的ID包括;
通过异步传输的方式接收读取指令,并通过异步的方式解析读取指令获得需要读取的namespace的ID。
异步传输(Asynchronous Transfer Mode,ATM)是每一个字符独立形成一个帧进行传输,一个连续的字符串同样被封装成连续的独立帧进行传输,各个字符间的间隔可以是任意的,所以这种传输方式称为异步传输。异步传输模式是一种信元交换和多路复用技术。ATM采用信元作为传输单位,信元具有固定长度,总共53字节,前5字节是信头,其余48字节是数据段。信头中有信元去向的逻辑地址、优先级、信头差错控制、流量控制等信息。数据段中装入被分解成数据块的各种不同业务的用户信息或其他管理信息,并透明地穿过网络,通过采取异步传输方式从而增加了传输以及索引的效率。
考虑到实际利用效率的具体检测,在此提供优选方案,该方法还包括:
记录从接收读取指令到获取到namespace的时间,判断是否高于预设时间;
若高于预设时间,则根据全部namespace重新构建各虚拟链表。
在本实施例中对于预设时间不进行具体限定,可以视链表长度而定,例如通过传统的方式依次搜寻namespace所用得平均时间即可以作为本实施例中的预设时间,从而可以判断是否高于传统方式的效率,若低于传统方式的效率,则是构建的各级虚拟链表的范围以及长度不够合理,从而重新对虚拟链表的长度以及范围进行构建,从而保证能及时对效率较低的虚拟链表构建方式进行调整。
在上述实施例中,对于namespace设置方法进行了详细描述,本申请还提供namespace设置装置对应的实施例。需要说明的是,本申请从两个角度对装置部分的实施例进行描述,一种是基于功能模块的角度,另一种是基于硬件的角度。
上述实施例中对于通信方式未进行具体的限定,在此提出优选方案,接收读取指令为NVMe制定的主机与SSD之间通信命令。
固态硬盘(Solid State Drives,SSD),简称固盘,固态硬盘用固态电子存储芯片阵列而制成的硬盘,由控制单元和存储单元(FLASH芯片、DRAM芯片)组成。固态硬盘在接口的规范和定义、功能及使用方法上与传统硬盘的完全相同,在产品外形和尺寸上也完全与传统硬盘一致,但I/O性能相对于传统硬盘大大提升。
namespace,简称NS,将SSD中闪存空间划分为若干个独立的逻辑空间,每个独立逻辑空间地址从0到N-1,我们将划分出来的每一个逻辑空间我们叫做namespace。namespace的全局唯一标识是NSID。通过本实施例限定了通信是主机与SSD之间的通信,即限定了namespace的存储实在SSD中,因此存储性能更加强大。
根据上述的存储空间为namespace的优选方案,在此提供进一步的优选方案,接收读取指令,并解析读取指令获得需要读取的namespace的ID包括:
接收的IO命令后,解析命令得到NSID;
根据NSID中的namespace,在namespace对应的闪存空间进行读写;
在闪存空间中获取namespace的ID。
闪速存储器是一种可编程只读存储器的电子形式,在操作过程中可以多次擦除和写入。该技术主要用于计算机和其他数字产品(如存储卡和闪存驱动器)之间的通用数据存储和数据交换。闪存是一种用宏块写入的特殊存储。在早期阶段,一旦闪存被擦除,整个芯片上的数据就会被擦除。根据本实施例提供的闪存,从而保证数据的安全性能。
考虑到虚拟链表在读写中出现问题时需要及时解决以防止数据丢失,在此提供优选方
案,还包括:
在虚拟链表出现故障时,进行报警。
需要说明的是,本实施例中对于具体的报警方式不进行限定,可以采用警示灯,蜂鸣器等等,也可以采用其他的一些方式进行,例如给设备终端发送警告信息,通过添加报警的方式,从而保证。
图2为本申请实施例提供的一种namespace设置装置的示意图,该装置包括:
接收模块10,用于接收读取指令,并解析读取指令获得需要读取的namespace的ID;
读取模块11,用于根据第一虚拟链表以及ID的获取得到需要读取的namespace的第一范围,第一虚拟链表为预先通过在namespace中设置的长度最长的步长指针构建的虚拟链表,步长指针为namespace指向ID序号为n后的namespace的指针;
循环模块12,用于将namespace的索引转向下一级虚拟链表,根据ID以及下一级虚拟链表在第一范围中获取需要读取的namespace的第二范围,确定出需要读取的namespace的第二范围;
获取模块13,用于重复进行循环模块12直到从基础链表中获取得到需要读取的namespace时,基础链表为预先根据各namespace的ID进行排序的步长指针长度为1的链表。
在本申请一些实施例中,该装置还包括:
判读模块,用于根据读取指令判断是否需要删除namespace,当需要删除namespace时,开启置0模块;
置0模块,用于将namespace的标志位置0,用于表征namespace不再接收请求指令。
在本申请一些实施例中,该装置还包括:
搜寻模块,用于接收到namespace建立指令,在基础链表中搜寻是否存在置0的标志位,若基础链表中存在置0的标志位开启置1模块;
置1模块,用于将标志位置1并修改namespace的相应信息。
在本申请一些实施例中,该装置还包括:
建立模块,当若基础链表中不存在置0的标志位时开启,用于将namespace置于基础链表的末尾,并且新建立的namespace的ID为上一个namespace的ID值加1。
在本申请一些实施例中,该装置还包括:
确认模块,用于确认namespace的ID值是否能被各虚拟链表整除;
整除模块,将namespace的ID加入至所有能整除的虚拟链表中。
在本申请一些实施例中,该装置还包括:
记录模块,用于记录从接收读取指令到获取到namespace的时间,判断是否高于预设时间,若高于预设时间,开启重构模块;
重构模块,用于根据全部namespace重新构建各虚拟链表。
由于装置部分的实施例与方法部分的实施例相互对应,因此装置部分的实施例请参见方法部分的实施例的描述,这里暂不赘述。
本申请所提供的namespace设置装置,包括存储器与处理器,处理器执行存储器中存储的程序时可以实现通过namespace中设置多个长度不同的步长指针建立多级虚拟链表,在接收到读取指令后读取指令获得需要读取的namespace的ID,根据需要读取的namespace的ID并从长度最高的虚拟链表开始在不同级的虚拟链表依次缩小搜索范围,从而获取得到需要读取的namespace,与现有的namespace设置方法相比,由于现有的方案是通过依次搜寻链表中全部namespace,因此当链表过长时,对每个namespace进行验证所需要的时间较长,索引效率较低,而本方案中通过多级的步长指针构建的虚拟链表,可以先确定一个较大的范围,随后依次缩小搜索范围,通过namespace的个数合理设置虚拟链表的级数以及各级虚拟链表的长度,由于是通过ID中的指针进行搜寻,因此在虚拟链表中搜寻范围的效率更高,且可以通过ID逐渐缩小索引范围,从而有效提高namespace的索引效率。
图3为本申请另一实施例提供的namespace设置装置的结构图,如图3所示,namespace设置装置包括:存储器20,用于存储计算机程序;
处理器21,用于执行计算机程序时实现如上述实施例中所提到的namespace设置方法的步骤。
本实施例提供的namespace设置装置可以包括但不限于智能手机、平板电脑、笔记本电脑或台式电脑等。
其中,处理器21可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器21可以采用数字信号处理(Digital Signal Processor,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器21也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称中央处理器(Central Processing Unit,CPU);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器21可以在集成有图像处理器(Graphics Processing Unit,GPU),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器21还可以包括人工智能(Artificial Intelligence,AI)处理器,该AI处理器用于处理有关机器学
习的计算操作。
存储器20可以包括一个或多个非易失性可读存储介质,该非易失性可读存储介质可以是非暂态的。存储器20还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。本实施例中,存储器20至少用于存储以下计算机程序201,其中,该计算机程序被处理器21加载并执行之后,能够实现前述任一实施例公开的namespace设置放啊的相关步骤。另外,存储器20所存储的资源还可以包括操作系统202和数据203等,存储方式可以是短暂存储或者永久存储。其中,操作系统202可以包括Windows、Unix、Linux等。数据203可以包括但不限于上述实施例中所提供的namespace设置方法中涉及的数据等。
在一些实施例中,namespace设置装置还可包括有显示屏22、输入输出接口23、通信接口24、电源25以及通信总线26。
本领域技术人员可以理解,图3中示出的结构并不构成对namespace设置装置的限定,可以包括比图示更多或更少的组件。
本申请实施例提供的namespace设置装置,包括存储器和处理器,处理器在执行存储器存储的程序时,能够实现如下方法:上述实施例中提供的namespace设置方法。
由于装置部分的实施例与方法部分的实施例相互对应,因此装置部分的实施例请参见方法部分的实施例的描述,这里暂不赘述。
本申请所提供的namespace设置装置,包括存储器与处理器,处理器执行存储器中存储的程序时可以实现通过namespace中设置多个长度不同的步长指针建立多级虚拟链表,在接收到读取指令后读取指令获得需要读取的namespace的ID,根据需要读取的namespace的ID并从长度最高的虚拟链表开始在不同级的虚拟链表依次缩小搜索范围,从而获取得到需要读取的namespace,与现有的namespace设置方法相比,由于现有的方案是通过依次搜寻链表中全部namespace,因此当链表过长时,对每个namespace进行验证所需要的时间较长,索引效率较低,而本方案中通过多级的步长指针构建的虚拟链表,可以先确定一个较大的范围,随后依次缩小搜索范围,通过namespace的个数合理设置虚拟链表的级数以及各级虚拟链表的长度,由于是通过ID中的指针进行搜寻,因此在虚拟链表中搜寻范围的效率更高,且可以通过ID逐渐缩小索引范围,从而有效提高namespace的索引效率。
最后,参考图4,本申请还提供一种非易失性可读存储介400对应的实施例。非易失性可读存储介质400上存储有计算机程序401,计算机程序401被处理器执行时实现如上述方法实施例中记载的步骤。
可以理解的是,如果上述实施例中的方法以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
由于可读存储介质部分的实施例与方法部分的实施例相互对应,因此装置部分的实施例及其对应的有益效果请参见方法部分的实施例的描述,这里暂不赘述。
本申请所提供的非易失性可读存储介质,其中存储的程序在被执行时可以达到通过namespace中设置多个长度不同的步长指针建立多级虚拟链表,在接收到读取指令后读取指令获得需要读取的namespace的ID,根据需要读取的namespace的ID并从长度最高的虚拟链表开始在不同级的虚拟链表依次缩小搜索范围,从而获取得到需要读取的namespace,与现有的namespace设置方法相比,由于现有的方案是通过依次搜寻链表中全部namespace,因此当链表过长时,对每个namespace进行验证所需要的时间较长,索引效率较低,而本方案中通过多级的步长指针构建的虚拟链表,可以先确定一个较大的范围,随后依次缩小搜索范围,通过namespace的个数合理设置虚拟链表的级数以及各级虚拟链表的长度,由于是通过ID中的指针进行搜寻,因此在虚拟链表中搜寻范围的效率更高,且可以通过ID逐渐缩小索引范围,从而有效提高namespace的索引效率
以上对本申请所提供的一种namespace设置方法、装置及可读存储介质进行了详细介绍。说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围内。
还需要说明的是,在本说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备
所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
Claims (20)
- 一种namespace设置方法,其特征在于,包括:接收读取指令,并解析所述读取指令获得需要读取的namespace的ID;根据第一虚拟链表以及所述ID的获取得到需要读取的所述namespace的第一范围,所述第一虚拟链表为预先通过在所述namespace中设置的长度最长的步长指针构建的虚拟链表,所述步长指针为所述namespace指向ID序号为n后的所述namespace的指针;将所述namespace的索引转向下一级虚拟链表,根据所述ID以及所述下一级虚拟链表在所述第一范围中获取需要读取的所述namespace的第二范围,确定出需要读取的所述namespace的第二范围;判断当前虚拟链表是否为基础链表,所述基础链表为预先根据各所述namespace的ID进行排序的步长指针长度为1的链表;若当前虚拟链表不为基础链表,则回到所述将所述namespace的索引转向下一级虚拟链表的步骤;若当前虚拟链表为基础链表,则根据所述ID序号获取得到需要读取的所述namespace。
- 根据权利要求1所述的namespace设置方法,其特征在于,所述读取指令的具体后续操作为:调取存储器中的某个namespace元素,或者,删除存储器中的某个namespace元素。
- 根据权利要求1所述的namespace设置方法,其特征在于,所述下一级虚拟链表为步长指针长度低于上一级虚拟链表的后一个链表。
- 根据权利要求1所述的namespace设置方法,其特征在于,在所述根据所述ID序号获取得到需要读取的所述namespace之后,还包括:根据所述读取指令判断是否需要删除所述namespace;若需要删除所述namespace,则将所述namespace的标志位置0,用于表征所述namespace不再接收请求指令。
- 根据权利要求4所述的namespace设置方法,其特征在于,还包括:接收到所述namespace建立指令,在所述基础链表中搜寻是否存在置0的所述标志位;若所述基础链表中存在置0的所述标志位,则将所述标志位置1并修改所述namespace的相应信息。
- 根据权利要求5所述的namespace设置方法,其特征在于,接收到所述 namespace建立指令,在所述基础链表中搜寻是否存在置0的所述标志位之后,还包括:若所述基础链表中不存在置0的所述标志位,则将所述namespace置于所述基础链表的末尾,并且新建立的所述namespace的ID为上一个所述namespace的ID值加1。
- 根据权利要求6所述的namespace设置方法,其特征在于,在所述将所述namespace置于所述基础链表的末尾之后,还包括:确认所述namespace的ID值是否能被各所述虚拟链表整除;将所述namespace的ID加入至所有能整除的所述虚拟链表中。
- 根据权利要求1至7任意一项所述的namespace设置方法,其特征在于,接收读取指令,并解析所述读取指令获得需要读取的namespace的ID包括;通过异步传输的方式接收所述读取指令,并通过异步的方式解析所述读取指令获得需要读取的所述namespace的ID。
- 根据权利要求8所述的namespace设置方法,其特征在于,所述异步传输的方式采用信元作为传输单位,信头中信息有信元去向的逻辑地址、优先级、信头差错控制、流量控制,数据段中装入被分解成数据块的各种不同业务的用户信息或其他管理信息。
- 根据权利要求8所述的namespace设置方法,其特征在于,还包括:记录从接收所述读取指令到获取到所述namespace的时间,判断所述namespace的时间是否高于预设时间;若所述namespace的时间高于预设时间,则根据全部所述namespace重新构建各所述虚拟链表。
- 根据权利要求8所述的namespace设置方法,其特征在于,所述预设时间为依次搜寻到的namespace所用的平均时间。
- 根据权利要求10所述的namespace设置方法,其特征在于,接收的所述读取指令为NVMe制定的主机与SSD之间通信命令。
- 根据权利要求12所述的namespace设置方法,其特征在于,所述接收读取指令,并解析所述读取指令获得需要读取的namespace的ID包括:接收的IO命令后,解析命令得到NSID;根据所述NSID中的所述namespace,在所述namespace对应的闪存空间进行读写;在所述闪存空间中获取所述namespace的ID。
- 根据权利要求1所述的namespace设置方法,其特征在于,还包括:在所述虚拟链表出现故障时,进行报警。
- 根据权利要求1所述的namespace设置方法,其特征在于,报警方式包括:采用警示灯、蜂鸣器报警;或者,给设备终端发送警告信息。
- 根据权利要求14所述的namespace设置方法,其特征在于,所述随机链表与所述基础链表均为有序链表。
- 根据权利要求14所述的namespace设置方法,其特征在于,在所述虚拟链表出现故障时,进行报警之后,还包括:重置所述虚拟链表,并进入所述接收读取指令,并解析所述读取指令获得需要读取的namespace的ID的步骤。
- 一种namespace设置装置,其特征在于,包括:接收模块,用于接收读取指令,并解析所述读取指令获得需要读取的namespace的ID;读取模块,用于根据第一虚拟链表以及所述ID的获取得到需要读取的所述namespace的第一范围,所述第一虚拟链表为预先通过在所述namespace中设置的长度最长的步长指针构建的虚拟链表,所述步长指针为所述namespace指向ID序号为n后的所述namespace的指针;循环模块,用于将所述namespace的索引转向下一级虚拟链表,根据所述ID以及所述下一级虚拟链表在所述第一范围中获取需要读取的所述namespace的第二范围,确定出需要读取的所述namespace的第二范围;判断模块,用于判断当前虚拟链表是否为基础链表,所述基础链表为预先根据各所述namespace的ID进行排序的步长指针长度为1的链表,若当前虚拟链表不为基础链表,则回到所述循环模块,若当前虚拟链表为基础链表,则进入所述获取模块;获取模块,用于根据所述ID序号获取得到需要读取的所述namespace。
- 一种namespace设置装置,其特征在于,包括存储器,用于存储计算机程序;处理器,用于执行所述计算机程序时实现如权利要求1至17任一项所述的namespace设置方法的步骤。
- 一种非易失性可读存储介质,其特征在于,所述非易失性可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至17任一项所述的namespace设置方法的步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211131081.X | 2022-09-16 | ||
CN202211131081.XA CN115525580A (zh) | 2022-09-16 | 2022-09-16 | 一种namespace设置方法、装置及可读存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024055571A1 true WO2024055571A1 (zh) | 2024-03-21 |
Family
ID=84698221
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/085856 WO2024055571A1 (zh) | 2022-09-16 | 2023-04-03 | 一种namespace设置方法、装置及可读存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115525580A (zh) |
WO (1) | WO2024055571A1 (zh) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115525580A (zh) * | 2022-09-16 | 2022-12-27 | 山东云海国创云计算装备产业创新中心有限公司 | 一种namespace设置方法、装置及可读存储介质 |
CN117149093B (zh) * | 2023-10-27 | 2024-03-26 | 四川省华存智谷科技有限责任公司 | 一种通过ssd缩容提升存储系统可靠性的方法 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10095701B1 (en) * | 2015-09-30 | 2018-10-09 | EMC IP Holding Company LLC | Translation-based name node configuration for object access in a multi-tier storage system |
CN110377436A (zh) * | 2019-07-12 | 2019-10-25 | 清华大学 | 持久性内存的数据存储访问方法、设备及装置 |
CN111651269A (zh) * | 2020-05-18 | 2020-09-11 | 青岛镕铭半导体有限公司 | 实现设备虚拟化的方法、装置及计算机可读存储介质 |
CN113065964A (zh) * | 2021-04-13 | 2021-07-02 | 上证所信息网络有限公司 | 一种采用可变步长跳表的数据存储系统及方法 |
CN115525580A (zh) * | 2022-09-16 | 2022-12-27 | 山东云海国创云计算装备产业创新中心有限公司 | 一种namespace设置方法、装置及可读存储介质 |
-
2022
- 2022-09-16 CN CN202211131081.XA patent/CN115525580A/zh active Pending
-
2023
- 2023-04-03 WO PCT/CN2023/085856 patent/WO2024055571A1/zh unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10095701B1 (en) * | 2015-09-30 | 2018-10-09 | EMC IP Holding Company LLC | Translation-based name node configuration for object access in a multi-tier storage system |
CN110377436A (zh) * | 2019-07-12 | 2019-10-25 | 清华大学 | 持久性内存的数据存储访问方法、设备及装置 |
CN111651269A (zh) * | 2020-05-18 | 2020-09-11 | 青岛镕铭半导体有限公司 | 实现设备虚拟化的方法、装置及计算机可读存储介质 |
CN113065964A (zh) * | 2021-04-13 | 2021-07-02 | 上证所信息网络有限公司 | 一种采用可变步长跳表的数据存储系统及方法 |
CN115525580A (zh) * | 2022-09-16 | 2022-12-27 | 山东云海国创云计算装备产业创新中心有限公司 | 一种namespace设置方法、装置及可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN115525580A (zh) | 2022-12-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2024055571A1 (zh) | 一种namespace设置方法、装置及可读存储介质 | |
US11681754B2 (en) | Technologies for managing connected data on persistent memory-based systems | |
CN103810237A (zh) | 数据管理方法和系统 | |
WO2018205151A1 (zh) | 数据更新方法和存储装置 | |
WO2021223468A1 (zh) | 一种基于ssd的日志数据保存方法、装置、设备和介质 | |
CN113569508B (zh) | 基于id进行数据索引与访问的数据库模型构建方法及设备 | |
CN106095698A (zh) | 面向对象的缓存写入、读取方法及装置 | |
WO2014110940A1 (en) | A method, apparatus and system for storing, reading the directory index | |
CN113721862B (zh) | 数据处理方法及装置 | |
CN106980665A (zh) | 数据字典实现方法、装置及数据字典管理系统 | |
CN106909554A (zh) | 一种数据库文本表数据的加载方法及装置 | |
US9292549B2 (en) | Method and system for index serialization | |
CN109407985B (zh) | 一种数据管理的方法以及相关装置 | |
CN113901280A (zh) | 一种集成电路展平式设计的字符串存储与查询系统及方法 | |
CN109597707A (zh) | 克隆卷数据拷贝方法、装置及计算机可读存储介质 | |
CN111241090A (zh) | 存储系统中管理数据索引的方法和装置 | |
WO2024187779A1 (zh) | 业务数据存储方法、装置、计算机设备和存储介质 | |
WO2022121274A1 (zh) | 一种存储系统中元数据管理方法、装置及存储系统 | |
JP2000207260A (ja) | ハンドヘルド装置のデ―タ記憶およびデ―タ取出しのための方法および装置 | |
WO2024027140A1 (zh) | 一种数据处理方法、装置、设备、系统及可读存储介质 | |
WO2024016789A1 (zh) | 日志数据查询方法、装置、设备和介质 | |
CN111752941A (zh) | 一种数据存储、访问方法、装置、服务器及存储介质 | |
CN115576947A (zh) | 一种数据管理方法、装置、组合库、电子设备及存储介质 | |
CN109241058A (zh) | 一种向b+树批量插入键值对的方法和装置 | |
WO2020238750A1 (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: 23864313 Country of ref document: EP Kind code of ref document: A1 |