A reading and writing method for a multi-core storage device
By using a linked list structure for node management and communication in multi-core memory devices, the problem of increasing software processing time caused by message queueing in the prior art is solved, and more efficient read and write performance is achieved.
Patent Information
- Application Number
- CN202411389333.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-10-08
AI Technical Summary
When existing multi-core memory devices communicate between cores, read and write requests are passed through message queues, resulting in an increase in software processing time and affecting read and write performance.
The linked list structure is used for node management and communication, and the node-based linked lists are communicated in real time between the front-end and the back-end, reducing dependence on message queues and improving read and write performance.
By reducing the time overhead of message queues, the read and write performance of multi-core memory devices is improved and the overall processing efficiency of the device is improved.
Smart Images

Figure CN118885136B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of storage device reading and writing methods, and in particular to a multi-core storage device reading and writing method. Background Art
[0002] With the development of technology, the read and write performance of storage devices such as eMMC (embedded Multi Media Card), UFS (Universal Flash Storage), and SSD (Solid State Drive) is increasing. One of the key factors affecting the read and write performance is the software time consumption of the device firmware. In order to meet higher read and write performance requirements, storage devices generally adopt multi-core solutions. The interaction efficiency between multiple cores will affect the read and write performance. Existing solutions generally use message queues to communicate between cores to transmit read and write requests, and only one request is transmitted each time, which increases the total software processing time. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a read and write method for a multi-core storage device, aiming to reduce the time overhead of using a message queue and improve the read and write performance.
[0004] In a first aspect, an embodiment of the present application provides a method for reading and writing a multi-core storage device, comprising:
[0005] The front end receives the first operation request, applies for a first node from a preset node pool according to the first operation request, pre-processes information of the first node, and sends the first node and the first operation request to the back end through a preset message queue;
[0006] The backend parses the first node according to the first operation request to obtain node data corresponding to the first node;
[0007] When the front end receives the second operation request, it applies for a second node from a preset node pool according to the second operation request, and generates a linked list according to the first node and the second node, wherein the linked list head points to the first node;
[0008] The backend obtains the node status of the first node, and when the node status is a processing status, parses the second node to obtain node data corresponding to the second node.
[0009] According to some embodiments of the present application, after the backend obtains the node status of the first node, the method further includes:
[0010] When the node state is a waiting state, the backend continuously polls the node state and flash operation result of the first node, wherein the waiting state indicates that the first node is the last node of the linked list and a new node is being generated.
[0011] According to some embodiments of the present application, after the backend obtains the node status of the first node, the method further includes:
[0012] When the node state is the end state, the backend exits the operation after waiting for the flash result processing of all nodes to be completed. The end state indicates that the first node is the last node of the linked list and no new node will be added, thus terminating the linked list.
[0013] According to some embodiments of the present application, the preprocessing of the information of the first node includes:
[0014] The node state of the first node is set to a waiting state, the logical address of the first node is set to a first preset value, the buffer address of the first node is set to a second preset value, and the use flag of the first node is set to incomplete.
[0015] According to some embodiments of the present application, after applying for the second node from the preset node pool according to the second operation request, it also includes: the first node is set with pointer information and points to the address of the second node, and the pointer information defaults to a null pointer.
[0016] According to some embodiments of the present application, the backend parses the first node according to the first operation request, including:
[0017] The backend receives the first operation request and the first node;
[0018] Acquire the logical address of the first node, convert the logical address into a physical address through a preset mapping table, and asynchronously read the information of the first node from the flash memory;
[0019] The information of the first node is monitored in a polling manner and the use flag of the first node is updated.
[0020] According to some embodiments of the present application, when the node state is a processing state, the method further includes:
[0021] The node address of the second node is obtained, and the operation request of the second node is processed.
[0022] According to some embodiments of the present application, including:
[0023] When the backend exits the operation, the frontend recycles the first node to the node pool.
[0024] According to some embodiments of the present application, it further includes:
[0025] When the first operation request is processed and completed or the operation attribute is switched, the linked list communication ends, and the front end and the back end return to the message queue for communication.
[0026] According to some embodiments of the present application, when the node state is a processing state, the method includes:
[0027] Checking a usage flag of the first node;
[0028] When the use mark of the first node is completed, the address data of the buffer of the first node is uploaded, and the first node is released, and the head node of the linked list points to the second node.
[0029] According to the technical solution of the embodiment of the present application, at least the following beneficial effects are achieved: the front end receives a first operation request, applies for a first node from a preset node pool according to the first operation request, pre-processes the information of the first node, and sends the first node and the first operation request to the back end through a preset message queue; the back end parses the first node according to the first operation request to obtain node data corresponding to the first node; when the front end receives a second operation request, applies for a second node from a preset node pool according to the second operation request, and generates a linked list according to the first node and the second node, wherein the linked list head of the linked list points to the first node; the back end obtains the node state of the first node, and when the node state is a processing state, parses the second node to obtain the node data corresponding to the second node. The front end and the back end of the embodiment of the present application communicate based on a linked list to which nodes can be added in real time, thereby reducing the time of using message queues and improving read and write performance.
[0030] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0032] Figure 1 is a flow chart of a reading and writing method of a multi-core storage device provided by an embodiment of the present application;
[0033] Figure 2 This is a flowchart of a backend monitoring and updating a first node provided by an embodiment of the present application;
[0034] Figure 3This is a flowchart of a backend performing a flag check on a first node provided by an embodiment of the present application;
[0035] Figure 4 It is a schematic diagram of the overall flow of a reading and writing method of a multi-core storage device executed by a front-end side provided by an embodiment of the present application;
[0036] Figure 5 A flowchart of obtaining a first read-write command provided by an embodiment of the present application;
[0037] Figure 6 A flowchart of obtaining multiple read and write requests for the same read and write information provided by an embodiment of the present application;
[0038] Figure 7 A flowchart of querying the node status of a first node provided by an embodiment of the present application;
[0039] Figure 8 It is a schematic diagram of the overall flow of a reading and writing method of a multi-core storage device executed by a back-end side provided by an embodiment of the present application. DETAILED DESCRIPTION
[0040] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0041] In the description of the present application, it should be understood that descriptions involving orientation, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0042] In the description of this application, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0043] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.
[0044] First, some nouns involved in this application are analyzed:
[0045] Node pool: refers to a group of pre-created and managed nodes, which can be physical servers, virtual machines, containers, or other types of computing resources. The concept of node pools is very common in cloud computing, distributed systems, and network technologies. They are used to improve resource utilization, reduce resource allocation and management overhead, and speed up resource allocation. Depending on the load changes, the node pool can dynamically increase or decrease the number of nodes, and this process is usually automated. Each node is usually isolated from other nodes to ensure the independence and security of the application.
[0046] Message queue: is a software component used to handle message passing in a computer system. It is an application-to-application communication method that allows messages to be passed between different processes, systems or services. The core role of a message queue is to provide a mechanism for asynchronously exchanging data between message senders and message receivers, thereby improving the decoupling, scalability and reliability of the system.
[0047] Linked list: is a common data structure, which consists of a series of nodes, each node contains two parts: data part and pointer part. The data part stores the data of the node, while the pointer part stores the reference to the next node in the same linked list (in a doubly linked list, there is also a reference to the previous node). Linked lists can be unidirectional, bidirectional or circular.
[0048] Buffer address: usually refers to the starting address of an area in the memory used to store data. A buffer is an area in the computer's memory used to temporarily store data. It can be used for various purposes, such as caching input / output data, temporarily storing intermediate results during calculations, etc. A buffer address is a memory address that points to the starting position of a buffer. In programming, this address is often used to access and manipulate data in a buffer.
[0049] With the development of technology, the read and write performance of storage devices such as eMMC, UFS, and SSD is increasing. One of the key factors affecting the read and write performance is the software time consumption of the device firmware. In order to meet higher read and write performance requirements, storage devices generally adopt multi-core solutions. The interaction efficiency between multiple cores will affect the read and write performance. Existing solutions generally use message queues to communicate between cores to transmit read and write requests, and only one request is transmitted at a time, which increases the total software processing time.
[0050] Based on the above situation, an embodiment of the present application proposes a reading and writing method for a multi-core storage device, aiming to reduce the time of using message queues and improve reading and writing performance.
[0051] The reading and writing methods of the multi-core storage device provided in the embodiments of the present application relate to the field of reading and writing of storage devices. The reading and writing methods of the multi-core storage device provided in the embodiments of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can realize the application of the reading and writing methods of the multi-core storage device, etc., but is not limited to the above forms.
[0052] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0053] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with the relevant laws, regulations, and standards of the relevant countries and regions. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0054] See also Figure 1 , Figure 1 A flowchart of a method for reading and writing a multi-core storage device provided in an embodiment of the present application is shown; Figure 1As shown, a reading and writing method of a multi-core storage device provided in an embodiment of the present application includes but is not limited to steps S110-S140, and each step is introduced in turn below.
[0055] Step S110, the front end receives the first operation request, applies for the first node from the preset node pool according to the node status first operation request, preprocesses the information of the node status first node, and sends the node status first node and the node status first operation request to the back end through a preset message queue.
[0056] Step S120: The node status backend parses the node status first node according to the node status first operation request to obtain node data corresponding to the node status first node.
[0057] Step S130, when the current end receives the second operation request, applies for the second node from the preset node pool according to the node status second operation request, and generates a linked list according to the node status first node and the node status second node, wherein the linked list head of the node status linked list points to the node status first node.
[0058] Step S140, the backend obtains the node status of the first node, and when the node status is the processing status, parses the node status of the second node to obtain the node data corresponding to the node status of the second node.
[0059] In one embodiment, the front end first receives a first operation request, which may come from a user interface or another system component. According to this request, the front end applies for a first node from a preset node pool, which is a resource pool that stores multiple idle nodes and is used to quickly allocate and recycle nodes. The front end preprocesses the information of the first node, and the front end sends the preprocessed first node and the first operation request to the back end through a preset message queue. The message queue provides an asynchronous communication mechanism to ensure the orderliness of the request and the decoupling of the system. After receiving the request, the back end parses the first node according to the first operation request and extracts the node data. This process may involve reading the properties, parameters and status of the node. The generated linked list is used to track and manage related operation requests to ensure that the requests are processed in the correct order and logical relationship. The back end obtains the node status of the first node and checks whether it is in a processing state. If so, the back end continues to parse the second node and extract the corresponding node data. This reduces the time overhead of using the message queue and improves the read and write performance.
[0060] In one embodiment, after the backend obtains the node status of the first node in step S140, when the node status is in a waiting state, the backend continuously polls the node status and flash operation results of the first node, wherein the waiting state indicates that the first node is the last node of the linked list and a new node is being generated.
[0061] It is understandable that when the state of the first node is detected as the waiting state, the backend determines that the node is the last node of the current linked list, and the frontend is preparing a new node to join the linked list. The backend not only monitors the node state, but also monitors the flash operation results related to the node, because the node data may need to be written to or read from the flash memory, and the backend needs to ensure that these operations have been completed before continuing processing.
[0062] In one embodiment, in step S140, after the backend obtains the node status of the first node, when the node status is the end status, the backend exits the operation after waiting for the flash result processing of all nodes to be completed, wherein the end status indicates that the first node is the last node of the linked list, and no new nodes will be added, thus ending the linked list.
[0063] It is understandable that after obtaining the node status of the first node, the backend will check the node status of the first node. If the node status of the first node is the end state, this means that the current node is the last node of the linked list and no more nodes will be added to the linked list. In the end state, the backend will wait for all associated flash operations to be completed, including but not limited to flash operations such as reading and writing, and involving one or more nodes in the linked list. When all flash operation results have been processed, the backend will confirm whether each operation is successful. This ensures the integrity and consistency of the data and reduces the possibility of data loss or errors. After confirming that all flash operations are completed, the backend will exit the current operation process. This marks the end of the linked list operation, and the backend can start processing other tasks or requests. Before exiting the operation, the backend will update the status of the first node and notify the front end of this change, so that the front end can synchronize its status information and perform corresponding user interface updates or subsequent operations.
[0064] In one embodiment, step S110 preprocesses the information of the first node, including setting the node state of the first node to a waiting state, setting the logical address of the first node to a first preset value, setting the buffer address of the first node to a second preset value, and setting the use flag of the first node to incomplete.
[0065] It should be noted that the node state of the first node is set to the waiting state, which indicates that the node is ready to receive data but has not yet started processing. The waiting state is the initial stage of the node processing flow, which is used to indicate that the node has been requested from the node pool and is waiting for further instructions or data. The logical address is the identifier of the node in the system, which is used to identify the node and read the node information in subsequent data processing and communication. The buffer address refers to the starting position of the memory area used by the node to store data. This address is pre-allocated to ensure that the node has enough space to process the upcoming data; the use flag of the first node is set to unfinished. This flag is used to indicate the current task processing status of the node. Unfinished means that the node has been assigned a task, but the task has not yet been processed or completed by the backend.
[0066] In one embodiment, after applying for the second node from the preset node pool according to the second operation request, the first node is provided with pointer information pointing to the address of the second node, and the pointer information is a null pointer by default.
[0067] It should be noted that when the first node is requested from the node pool, its pointer information is preprocessed to the default value, i.e., a null pointer. This means that at the beginning, the first node does not point to any other node in the linked list. When the system needs to process multiple consecutive operation requests, a new node will be requested from the node pool and linked to the existing linked list. When the second node is successfully requested and preprocessed, the pointer information of the first node will be updated to point to the address of the second node.
[0068] See also Figure 2 , Figure 2 This is a flow chart of monitoring and updating the first node by the back end provided in one embodiment of the present application; Figure 2 As shown, the backend parses the first node according to the first operation request, including but not limited to steps S210-S230, and each step is introduced in turn below.
[0069] Step S210: The backend receives a first operation request and a first node.
[0070] Step S220: Acquire the logical address of the first node, convert the logical address into a physical address through a preset mapping table, and asynchronously read the information of the first node from the flash memory.
[0071] Step S230: Monitor the information of the first node in a polling manner and update the usage flag of the first node.
[0072] In one embodiment, the backend starts the processing flow, first receiving the first operation request and the first node related thereto from the frontend, the backend obtains the logical address of the first node, and the backend uses a preset mapping table to convert the logical address into a physical address. This mapping table is part of the system, and it defines the correspondence between the logical address and the physical address, thereby allowing the backend to accurately locate the storage location in the flash memory. After converting the physical address, the backend asynchronously reads the information of the first node from the flash memory. The asynchronous operation allows the backend to continue processing other tasks while waiting for the flash memory read to complete, which can improve the overall performance and response speed of the system. When the flash memory read operation is completed, the backend updates the node status of the first node. The updated status helps the system track the current status of the node and provide a decision basis for subsequent operations.
[0073] In one embodiment, when the node state is in the processing state, the node address of the second node is obtained, and the operation request of the second node is processed.
[0074] Specifically, the backend first checks the status of the first node. If the status is in the processing state, it is ready to pass control to the next node in the linked list. After confirming that the first node is in the processing state, the backend obtains the node address of the second node, which is obtained through the pointer information in the first node, pointing to the location of the second node in the memory. When the address of the second node is obtained, the backend sets the usage flag of the first node to complete. The update of this flag indicates that the first node is no longer needed and can be recycled into the node pool for reuse in subsequent operation requests. Next, the backend begins to process the operation request of the second node, which includes reading the data of the second node, performing corresponding operations, such as reading, writing, etc., and updating the status of the second node according to the results of the operation.
[0075] In one embodiment, when the backend exits the operation, the frontend recycles the first node to the node pool.
[0076] Specifically, after processing all related operation requests, the backend will mark the operation completed and notify the frontend that the operation has ended. The frontend receives the operation completion notification from the backend and updates the status of the first node, which means that the node is no longer involved in any active operation requests and can be recycled. The frontend removes the first node from the current linked list and resets its pointer information to the default value, that is, a null pointer.
[0077] See also Figure 3 , Figure 3 is a flowchart of a backend performing a flag check on a first node provided by an embodiment of the present application; Figure 3 As shown, a reading and writing method of a multi-core storage device provided in an embodiment of the present application includes but is not limited to steps S310-S320, and each step is introduced in turn below.
[0078] Step S310: Check the usage flag of the first node.
[0079] Step S320: When the usage mark of the first node is completed, the address data of the buffer of the first node is uploaded, and the first node is released, and the head node of the linked list points to the second node.
[0080] In one embodiment, after the backend completes all operations on the first node, the frontend executes step S310 to check the use flag of the node. If the use flag of the first node is "completed", it means that all related operation requests have been processed. The frontend will execute step S320 to upload the data in the buffer address of the first node to a specified location, such as a storage system or database of a server. After the data upload is completed, the frontend will release the resources occupied by the first node, ensuring that the system resources are effectively managed and preventing resource leakage. After releasing the first node, the frontend updates the head node pointer of the linked list to point to the second node.
[0081] Based on the reading and writing methods of the multi-core storage device in the above-mentioned embodiments, overall embodiments of the reading and writing methods of the multi-core storage device of the present application are respectively proposed below.
[0082] like Figure 4 As shown, Figure 4 is a schematic diagram of the overall flow of a reading and writing method of a multi-core storage device executed by a front-end side provided by an embodiment of the present application, Figure 4 The overall process includes but is not limited to the following steps.
[0083] Step S4001, enter the reading process.
[0084] Step S4002: Apply for the first node, and the linked list head points to the first node.
[0085] Step S4003: pre-process the first node.
[0086] Step S4004: Send the read request and the first node address to the backend through inter-core communication.
[0087] Step S4005: Determine whether there are any read operations to be processed. If so, execute step S4006; if not, execute step S4010.
[0088] Step S4006: Apply for a second node and pre-process the second node.
[0089] Step S4007: point the pointer of the first node to the second node, and update the node state of the first node.
[0090] Step S4008: Determine whether the use mark is completed, if so, execute step S4009, if not, execute step S4005.
[0091] Step S4009: Upload the address data of the buffer of the first node, release the first node, and the head node of the linked list points to the second node.
[0092] Step S4010: Determine whether the use flag is completed, if so, execute step S4011, if not, execute step S4010.
[0093] Step S4011: upload the address data of the buffer of the first node, release the first node, and the head node of the linked list points to the second node.
[0094] Step S4012: Determine whether all nodes have been completed, if so, execute step S4013, if not, execute step S4010.
[0095] Step S4013: End.
[0096] In one embodiment, the read process is first entered, and then the first node is applied for, and the head of the linked list is pointed to the first node. Then the first node is preprocessed, the node state of the first node is set to the waiting state, the logical address of the first node is set to the first preset value, the buffer address of the first node is set to the second preset value, and the use flag of the first node is set to incomplete. The read request and the first node address are sent to the back end through inter-core communication to check whether there are any read operations to be processed. If so, the second node is applied for, the second node is preprocessed, the pointer of the first node is pointed to the second node, the node state of the first node is updated, and the use flag of the first node is checked to see whether it is completed. If so, the address data of the buffer of the first node is uploaded, and the first node is released. The head node of the linked list points to the second node. If not, it is determined whether there are any read operations to be processed. If there is no read operation to be processed, determine whether the use flag of the first node is completed. If not, continue to wait. If so, upload the address data of the buffer of the first node, release the first node, and point the head node of the linked list to the second node. Then determine whether all nodes are completed. If not, continue to determine whether the use flag of the first node is completed. If so, end the process.
[0097] See also Figure 5 , Figure 5 A flowchart for obtaining the first read-write command is provided for an embodiment of the present application; Figure 5 As shown, including but not limited to steps S510-S540, each step is introduced in turn below.
[0098] Step S510: Get the first read / write command.
[0099] Step S520: Apply for an idle node from the node pool.
[0100] Step S530: pre-process the node content.
[0101] Step S540: Send the node address to the backend via message queue communication, and the node serves as the head of the linked list.
[0102] See also Figure 6 , Figure 6 A flowchart of obtaining multiple read and write requests for the same read and write information provided by an embodiment of the present application; Figure 6 As shown, including but not limited to steps S610-S650, each step is introduced in turn below.
[0103] Step S610: Acquire multiple read and write requests for the same read and write information.
[0104] Step S620: Apply for an idle node from the node pool.
[0105] Step S630: pre-process the node.
[0106] Step S640: Add the node to the end of the linked list.
[0107] Step S650: Set the node status of the previous node to processing.
[0108] See also Figure 7 , Figure 7 A flowchart of querying the node status of a first node provided by an embodiment of the present application; Figure 7 As shown, including but not limited to steps S710-S740, each step is introduced in turn below.
[0109] Step S710: query the node status of the first node.
[0110] Step S720: If the node status is processing, obtain the address of the second node.
[0111] Step S730: Set the usage flag of the first node to completed.
[0112] Step S740: Process the read and write request of the second node.
[0113] like Figure 8 As shown, Figure 8 is a schematic diagram of the overall flow of a multi-core storage device reading and writing method executed by the back-end side provided by an embodiment of the present application, Figure 8 The overall process includes but is not limited to the following steps.
[0114] Step S8001: Loop and wait for messages.
[0115] Step S8002: Receive a request to enter the read process, and obtain the first node address linked list head to point to the first node.
[0116] Step S8003: Parse the first node to obtain a logical address.
[0117] Step S8004: Obtain the physical address corresponding to the logical address through the mapping table.
[0118] Step S8005: Obtain the node status of the first node.
[0119] Step S8006: Determine whether the node status is processing, if so, execute step S8007, if not, execute step S8012.
[0120] Step S8007: Apply for a second node and pre-process the second node.
[0121] Step S8008: Parse the second node to obtain a logical address.
[0122] Step S8009: Obtain the physical address corresponding to the logical address through the mapping table.
[0123] Step S8010: Determine whether the linked list header has read data, if so, execute step S8011, if not, execute step S8005.
[0124] Step S8011: The head node of the linked list points to the second node, and the node status is completed.
[0125] Step S8012: Determine whether the node status is waiting, if so, execute step S8010, if not, execute step S8013.
[0126] Step S8013: Determine whether the use flag is completed, if so, execute step S8014, if not, execute step S8013.
[0127] Step S8014: The head node of the linked list points to the second node, and the node status is completed.
[0128] Step S8015: Are all nodes completed? If so, execute step S8016; if not, execute step S8013.
[0129] Step S8016: End.
[0130] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute the reading and writing method of the multi-core storage device described above. Figures 1 to 8 The method steps in .
[0131] It is worth noting that since the computer-readable storage medium of the embodiment of the present application can execute the reading and writing method of the multi-core storage device of any of the above-mentioned embodiments, the specific implementation method and technical effects of the computer-readable storage medium of the embodiment of the present application can refer to the specific implementation method and technical effects of the reading and writing method of the multi-core storage device of any of the above-mentioned embodiments.
[0132] In addition, an embodiment of the present application further provides a computer program product, including a computer program or a computer instruction, the computer program or the computer instruction is stored in a computer-readable storage medium, the processor of the computer device reads the computer program or the computer instruction from the computer-readable storage medium, and the processor executes the computer program or the computer instruction, so that the computer device executes the above-described reading and writing method of the multi-core storage device. Exemplarily, the execution of the above-described Figures 1 to 8 The method steps in .
[0133] It is worth noting that since the computer program product of the embodiments of the present application can execute the reading and writing methods of the multi-core storage device of any of the above-mentioned embodiments, the specific implementation methods and technical effects of the computer program product of the embodiments of the present application can refer to the specific implementation methods and technical effects of the reading and writing methods of the multi-core storage device of any of the above-mentioned embodiments.
[0134] It will be appreciated by those skilled in the art that all or some of the steps and systems in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0135] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0136] In several embodiments provided in the present application, it should be understood that the disclosed systems, apparatuses and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of apparatuses or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0137] It should also be understood that the various implementations provided in the embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0138] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above implementation mode. Technical personnel familiar with the field can also make various equivalent modifications or substitutions under the shared conditions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A method for reading and writing a multi-core storage device, characterized in that: include: The front end receives a first operation request, applies for a first node from a preset node pool according to the first operation request, pre-processes information of the first node, and sends the first node and the first operation request to the back end through a preset message queue, wherein the pre-processing includes setting a node state of the first node to a waiting state, setting a logical address of the first node to a first preset value, setting a buffer address of the first node to a second preset value, and setting a use flag of the first node to unfinished; The backend parses the first node according to the first operation request to obtain node data corresponding to the first node; When the front end receives the second operation request, it applies for a second node from a preset node pool according to the second operation request, and generates a linked list according to the first node and the second node, wherein the linked list head points to the first node; The backend obtains the node status of the first node, and when the node status is a processing status, parses the second node to obtain node data corresponding to the second node; Checking a usage flag of the first node; When the use mark of the first node is completed, the address data of the buffer of the first node is uploaded, and the first node is released, and the head node of the linked list points to the second node.
2. The reading and writing method according to claim 1, characterized in that: After the backend obtains the node status of the first node, the method further includes: When the node state is a waiting state, the backend continuously polls the node state and flash operation result of the first node, wherein the waiting state indicates that the first node is the last node of the linked list and a new node is being generated.
3. The reading and writing method according to claim 1, characterized in that: After the backend obtains the node status of the first node, the method further includes: When the node state is the end state, the backend exits the operation after waiting for the flash result processing of all nodes to be completed. The end state indicates that the first node is the last node of the linked list and no new node will be added, thus terminating the linked list.
4. The reading and writing method according to claim 1, characterized in that: After applying for a second node from a preset node pool according to the second operation request, the method further includes: The first node is provided with pointer information and points to the address of the second node, and the pointer information is a null pointer by default.
5. The reading and writing method according to claim 1, characterized in that: The backend parses the first node according to the first operation request, including: The backend receives the first operation request and the first node; Acquire the logical address of the first node, convert the logical address into a physical address through a preset mapping table, and asynchronously read the information of the first node from the flash memory; The information of the first node is monitored in a polling manner and the use flag of the first node is updated.
6. The reading and writing method according to claim 1, characterized in that: When the node state is a processing state, the method further includes: A node address of a second node is obtained, and an operation request of the second node is processed.
7. The reading and writing method according to claim 3, characterized in that: include: When the backend exits the operation, the frontend recycles the first node to the node pool.
8. The reading and writing method according to claim 1, characterized in that: Also includes: When the first operation request is processed and completed or the operation attribute is switched, the communication between the front end and the back end in the linked list is ended, and the front end and the back end return to the message queue to communicate in the message queue.
Citation Information
Patent Citations
Method, system and equipment for reading flash memory data and medium
CN116661684A