Data access method, device and storage medium

文档序号:633583 发布日期:2021-05-11 浏览:8次 中文

阅读说明:本技术 数据访问方法、装置及存储介质 (Data access method, device and storage medium ) 是由 刘洋 于 2020-02-25 设计创作,主要内容包括:本申请公开了一种数据访问方法、装置及存储介质,属于数据存储技术领域。在本申请中,存储设备可以按照客户端发送的第一数据写请求中携带的业务逻辑空间的地址,确定目标硬盘,以及与业务逻辑空间对应的硬盘逻辑空间的地址,进而按照硬盘逻辑空间的地址,将目标数据写入目标硬盘中。也即是,客户端通过业务逻辑空间的地址来访问存储设备,在存储设备内部,将业务逻辑空间的地址转换为硬盘逻辑空间的地址,硬盘根据所述硬盘逻辑空间的地址写入数据,由此可见,只需要进行一次地址转换,节省了开销,也提高了数据读写效率。(The application discloses a data access method, a data access device and a storage medium, and belongs to the technical field of data storage. In the application, the storage device may determine the target hard disk and the address of the hard disk logical space corresponding to the service logical space according to the address of the service logical space carried in the first data write request sent by the client, and then write the target data into the target hard disk according to the address of the hard disk logical space. That is, the client accesses the storage device through the address of the service logic space, the address of the service logic space is converted into the address of the hard disk logic space in the storage device, and the hard disk writes data according to the address of the hard disk logic space.)

1. A data access method is applied to a storage device, the storage device comprises a plurality of hard disks, and the method comprises the following steps:

the storage device receives a first data writing request from a client, wherein the first data writing request carries target data to be written and an address of a business logic space corresponding to the target data;

the storage equipment determines a target hard disk in the plurality of hard disks and determines the address of the hard disk logic space corresponding to the service logic space according to the address of the service logic space;

and the storage equipment writes the target data into a physical space corresponding to the hard disk logical space in the target hard disk in an additional writing mode according to the determined address of the hard disk logical space.

2. The method of claim 1, wherein when the target data is written in the physical space corresponding to the logical space of the hard disk in the target hard disk in the additional writing manner, address translation in the hard disk is not performed.

3. The method of claim 1, wherein prior to the storage device receiving the first data write request from the client, further comprising:

and creating a corresponding relation between the business logic space and the hard disk logic space.

4. The method of any of claims 1-3, wherein the hard disk logical space corresponds to one or more erase blocks, and wherein data stored in the one or more erase blocks has the same degree of warmth or has the same life cycle.

5. The method of any of claims 1-3, wherein the method further comprises:

and adjusting the size of the hard disk logic space to enable the size of the hard disk logic space to be equal to integral multiple of the size of one erasing block.

6. An apparatus for accessing data, the apparatus being located in a storage device, the storage device including a plurality of hard disks, the apparatus comprising:

the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a first data writing request from a client, and the first data writing request carries target data to be written and an address of a business logic space corresponding to the target data;

the determining module is used for determining a target hard disk in the plurality of hard disks and determining the address of the hard disk logic space corresponding to the service logic space according to the address of the service logic space;

and the writing module is used for writing the target data into a physical space corresponding to the hard disk logical space in the target hard disk in an additional writing mode according to the determined address of the hard disk logical space.

7. The apparatus of claim 6, wherein address translation within the hard disk is not performed when the target data is written in the physical space corresponding to the logical space of the hard disk in the target hard disk by the additional writing.

8. The apparatus of claim 6, wherein the apparatus further comprises:

and the creating module is used for creating the corresponding relation between the service logic space and the hard disk logic space.

9. The apparatus of any of claims 6-8, wherein the hard disk logical space corresponds to one or more erase blocks, and wherein data stored in the one or more erase blocks has the same degree of cold and hot, or has the same life cycle.

10. The apparatus of any of claims 6-8, wherein the apparatus further comprises:

and the adjusting module is used for adjusting the size of the hard disk logic space so that the size of the hard disk logic space is equal to integral multiple of the size of one erasing block.

11. A computer-readable storage medium, characterized in that the storage medium has stored therein a computer program which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.

Technical Field

The present application relates to the field of data storage technologies, and in particular, to a data access method, an apparatus, and a storage medium.

Background

With the application of big data, the stream computing engine is becoming mainstream. For flow calculation, data continuously arrives in the calculation process, and the real-time requirement on processing is very high, so that sequential reading and writing operations on the data are a more efficient mode. At present, when data is read and written, the data is processed by a storage device and then can be read and written from a hard disk. However, current storage devices are generally used to process data in an organization manner such as blocks, files, and objects, and cannot process streaming data, which is a sequence of data that arrives continuously over time. Therefore, the organization of the data needs to be transformed before the data is processed by the storage device. In addition, most of the current hard disks adopt an access mode of Logical Block Address (LBA), and when data needs to be written into the hard disk after being processed by the storage device, conversion from an organization mode of the data in the storage device to an organization mode of the data on the hard disk needs to be performed. That is, in the current data access process, the logical address accessed by the client needs to be converted into the logical address for accessing the storage device, and the logical address for accessing the storage device needs to be converted into the logical address for accessing the hard disk, so that two conversions are brought, and the overhead is relatively large.

Disclosure of Invention

The application provides a data access method, a data access device and a storage medium, which can save expenses and improve data read-write efficiency.

The technical scheme is as follows:

in a first aspect, a data method is provided, where the method is applied to a storage device, where the storage device includes a plurality of hard disks, and the method includes: the storage device receives a first data writing request from a client, wherein the first data writing request carries target data to be written and an address of a business logic space corresponding to the target data; determining a target hard disk in the plurality of hard disks and determining an address of a hard disk logic space corresponding to the service logic space according to the address of the service logic space; and writing the target data into a physical space corresponding to the hard disk logical space in the target hard disk in an additional writing mode according to the determined address of the hard disk logical space.

In the application, the service logical space is created by requesting the storage device when the client needs to store data. The address of the business logic space may include an identification of the business logic space and an offset. The identifier of the service logic space is used for uniquely identifying the service logic space, and the offset is used for indicating the length information of the area in which data is currently written in the physical space allocated for the service logic space. The address of the hard disk logical space may also include an identification of the hard disk logical space and an offset. The offset included in the address of the hard disk logical space may be an offset included in the address of the business logical space.

The term "write-once" is understood to mean that data is written in a write-once manner, that is, the write-once manner means that the written data is organized in chronological order of writing. Moreover, after the process of a certain program writes data in this way, the subsequent process will not perform write operation on the area where the data is located any more, and only perform read operation.

According to the above description, the offset is used to indicate length information of an area in which data is currently written in a physical space allocated to the service logical space, and an address of the hard disk logical space includes an identifier of the hard disk logical space and the offset, so that the storage device can determine a start address from a physical space corresponding to the hard disk logical space in a target hard disk according to the address of the hard disk logical space, and further write target data from the start address.

In the application, the client accesses the storage device through the address of the service logic space, the storage device determines the address of the hard disk logic space through the address of the service logic space, and then accesses the target hard disk according to the address of the hard disk logic space. Based on the above description, the business logic space is for the client, the hard disk logic space is for the target hard disk, and both are logic spaces, but different definitions are added for the convenience of distinction. Therefore, it can be seen that the client accesses the storage device in the same way as the storage device accesses the target hard disk, and therefore, when the target data is written into the physical space corresponding to the logical space of the hard disk in the target hard disk in an additional writing way, address conversion in the hard disk is not performed. This saves overhead and increases the data write rate.

Since the service logic space is specific to the client, the hard disk logic space is specific to the hard disk, and the service logic space created by the client requesting the storage device is convenient for subsequent data access, and in general, the storage device may include a plurality of hard disks, in order to ensure reliability of subsequent data access, after the storage device creates the service logic space and the hard disk logic space, the identifier of the service logic space and the identifier of the hard disk logic space may be obtained, and the correspondence between the identifier of the service logic space and the identifier of the hard disk logic space may be stored. That is, the corresponding relationship between the service logical space and the hard disk logical space is created.

For some hard disks, when a certain erase block is full, all data in the entire erase block must be erased before new data can be written. For example, in a hard disk with NAND media, when a certain erase block is full of data, all data in the entire erase block must be erased to write new data. Thus, when the target hard disk is garbage collected, if all data in an erase block is invalid, the erase block can be directly erased. If part of data in an erase block is invalid and the remaining part of data is valid, the valid data needs to be moved. Since the valid data is originally written once, the move is written once again, and this phenomenon is called write amplification. In order to avoid write amplification in the garbage collection process, the hard disk logical space created in the target hard disk corresponds to one or more erase blocks, and the data stored in the one or more erase blocks have the same cold and hot degree or the same life cycle.

That is, the size of the physical space allocated by the target hard disk for the created logical space of the hard disk is an integer multiple of the size of one erase block. When the data stored in the one or more erase blocks have the same cooling degree or the same life cycle, the data in the same erase block will be changed into invalid data at the same time with a high probability, or both the data are valid data at the same time, and the situation that one part is invalid data and the other part is valid data is relatively rare, so that the situation of data migration is reduced during garbage collection, and further the write amplification is reduced.

In the embodiment of the present application, not only the write amplification in the garbage collection process can be reduced by the above method, but also the write amplification can be reduced by other methods. For example, in the process of creating a hard disk logic space in a target hard disk, the size of the hard disk logic space in the target hard disk is adjusted so that the size of the hard disk logic space is equal to an integral multiple of the size of one erase block.

In a second aspect, a data access apparatus is provided, the data access apparatus having a function of implementing the behavior of the data access method in the first aspect. The data access device comprises one or more modules, and the one or more modules are used for realizing the data access method provided by the first aspect.

In a third aspect, a storage device is provided, where the storage device includes a processor and a memory, and the memory is used to store a program for executing the data access method provided in the first aspect, and store data used to implement the data access method provided in the first aspect. The processor is configured to execute programs stored in the memory. The operating means of the memory device may further comprise a communication bus for establishing a connection between the processor and the memory.

In a fourth aspect, there is provided a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to perform the data access method of the first aspect described above.

In a fifth aspect, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the data access method of the first aspect described above.

The technical effects obtained by the above second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the first aspect, and are not described herein again.

The technical scheme provided by the application can at least bring the following beneficial effects:

in this embodiment of the application, the storage device may determine the target hard disk and the address of the hard disk logical space corresponding to the service logical space according to the address of the service logical space carried in the first data write request sent by the client, and further write the target data into the target hard disk according to the address of the hard disk logical space. That is, the client accesses the storage device through the address of the service logic space, the address of the service logic space is converted into the address of the hard disk logic space in the storage device, and the hard disk writes data according to the address of the hard disk logic space.

Drawings

Fig. 1 is an architecture diagram of a memory system according to an embodiment of the present application;

FIG. 2 is a diagram illustrating a data erasing procedure according to an embodiment of the present disclosure;

FIG. 3 is a schematic diagram of another data erasing process provided by an embodiment of the present application;

FIG. 4 is a flow chart of a data access method provided by an embodiment of the present application;

FIG. 5 is a diagram of another memory system according to an embodiment of the present application;

fig. 6 is a schematic structural diagram of a data access device according to an embodiment of the present application.

Detailed Description

To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

Before explaining the data access method provided by the embodiment of the present application in detail, an implementation environment related to the embodiment of the present application is described.

Referring to fig. 1, fig. 1 is a diagram illustrating a storage system architecture according to a data access method provided by an embodiment of the present application. As shown in fig. 1, the system includes a client 01 and a storage device 02, and a communication connection is established between the client 01 and the storage device 02.

The client 01 may send a data read request or a data write request to the storage device 02.

The storage device 02 may include a processor 021, a memory 022, and a hard disk 023.

The processor 021 may be a general-purpose Central Processing Unit (CPU), a Network Processor (NP), a microprocessor, or may be one or more integrated circuits such as an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof configured to implement the present invention. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.

In particular implementations, a storage device may include multiple processors 021, as one embodiment. Each of these processors may be a single-core processor or a multi-core processor. A processor herein may refer to one or more devices, circuits, and/or devices that include a processing core for processing data (e.g., computer program instructions).

The memory 022 has an operating system installed thereon, and the processor 021 can implement reading and writing of data by running the operating system. In addition, the memory 022 can store the program codes of the present application, and the processor 021 can control the execution of the program codes. That is, the memory 022 is used for storing program codes for executing the scheme of the present application, and the processor 021 can execute the program codes stored in the memory 022 to implement the data access method provided in the embodiment of fig. 4 below.

The memory 022 may be, but is not limited to, a read-only memory (ROM), a Random Access Memory (RAM), an electrically erasable programmable read-only memory (EEPROM), an optical disk (including a compact disk read-only memory (CD-ROM), a compact disk, a laser disk, a digital versatile disk, a blu-ray disk, etc.), a magnetic disk storage medium, or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 022 may be self-contained and coupled to the processor 021. The memory 022 may also be integrated with the processor 021.

The storage device 02 may be a storage array or a server. When the storage device 02 is a storage array, it includes a controller and several hard disks, the processor 021 and the memory 022 may be located in the controller of the storage array, and the controller is connected with several hard disks through a backend interface card. When the storage device 02 is a server, the processor 021, the memory 022 and the several hard disks are all located inside the server. The product form of the storage device 02 is not limited in this embodiment, and fig. 1 is only a schematic diagram of a part of the components included in the device.

In addition to this, a communication bus and a communication interface (not shown in fig. 1) may be included in the storage device 02. Wherein a communication bus is used for transferring information between the various components comprised by the storage device 02.

A communication interface for communicating with other devices or a communication network, such as ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.

The data access method provided by the embodiments of the present application is explained in detail below. The method provided by the embodiment of the application is applied to the storage device, and the storage device comprises a plurality of hard disks. Because the embodiment of the application mainly realizes data access through the logical space, that is, the client accesses the data in the storage device through the logical space. Therefore, for ease of understanding, the process of a client requesting the creation of a logical space will first be described.

The storage device receives a first logic space creating request from a client, wherein the first logic space creating request carries the size of a first logic space. The storage device creates a service logic space, allocates an identifier for the service logic space, and sends the identifier of the service logic space to the client. Then, the storage device may further determine a target hard disk from the plurality of hard disks according to the size of the first logical space, create a hard disk logical space in the target hard disk, allocate an identifier to the created hard disk logical space, and allocate a corresponding physical space from the target hard disk to the created hard disk logical space, where the size of the physical space is the same as the size of the first logical space.

In the case that the storage device includes a memory, a processor, and a hard disk, the storage device creates a hard disk logical space in the target hard disk, and an implementation process of allocating a corresponding physical space for the created hard disk logical space from the target hard disk may be: and the processor runs the operating system installed on the memory to send a second logic space creating request to the target hard disk, wherein the second logic space creating request carries the size of the first logic space. In this way, after the target hard disk receives the second logical space creation request, the hard disk logical space may be created, an identifier may be allocated to the created hard disk logical space, and a physical space corresponding to the created hard disk logical space may be allocated, where the size of the physical space is equal to the size of the first logical space. The target hard disk may then send an identification of the created logical space of the hard disk to the processor.

Since the sizes of data currently stored in different hard disks in the plurality of hard disks included in the storage device may be different, that is, the sizes of the remaining storage spaces (or physical spaces) of the plurality of hard disks may be different, when the storage device determines a target hard disk from the plurality of hard disks included according to the size of the first logical space, the size of the remaining storage space of each hard disk in the plurality of hard disks may be determined, and a hard disk whose size of the remaining storage space is greater than or equal to the size of the first logical space is selected from the plurality of hard disks as the target hard disk.

Further, one or more hard disks may be used as the remaining storage space having a size greater than or equal to the size of the first logical space. If the number of the storage devices is multiple, the storage device may further select a hard disk with a size of the remaining storage space larger than or equal to the first logical space size from the multiple hard disks as a target hard disk according to a load balancing algorithm.

For some hard disks, when a certain erase block is full, all data in the entire erase block must be erased before new data can be written. For example, in a hard disk with NAND media, when a certain erase block is full of data, all data in the entire erase block must be erased to write new data. Thus, when the target hard disk is garbage collected, if all data in an erase block is invalid, the erase block can be directly erased. If part of data in an erase block is invalid and the remaining part of data is valid, the valid data needs to be moved. Since the valid data is originally written once, the move is written once again, and this phenomenon is called write amplification. In order to avoid write amplification in the garbage collection process, the hard disk logical space created in the target hard disk corresponds to one or more erase blocks, and the data stored in the one or more erase blocks have the same cold and hot degree or the same life cycle. That is, the size of the physical space allocated by the target hard disk for the created logical space of the hard disk is an integer multiple of the size of one erase block. When the data stored in the one or more erase blocks have the same cooling degree or the same life cycle, the data in the same erase block will be changed into invalid data at the same time with a high probability, or both the data are valid data at the same time, and the situation that one part is invalid data and the other part is valid data is relatively rare, so that the situation of data migration is reduced during garbage collection, and further the write amplification is reduced.

It should be noted that the size of the logical space created in the target hard disk may not be an integer multiple of the size of one erase block. In this case, a certain erase block may correspond to two hard disk logical spaces, and in order to reduce the data moving during garbage collection and further reduce write amplification, the cold and hot degrees of the data stored in this erase block may be the same or the life cycles are the same. That is, the hot and cold degrees of the data corresponding to the two hard disk logical spaces may be the same, or the life cycles may be the same. In other words, when the target hard disk allocates the corresponding physical spaces for the two hard disk logical spaces, the physical spaces corresponding to the two hard disk logical spaces are continuous. Of course, in some cases, the difference between the cold and hot levels of the data stored in this erase block is less than a certain threshold, or the difference between the life cycles is less than a certain threshold.

For example, as shown in fig. 2, for an erase block, if data corresponding to the same service logic space is written in the erase block, that is, the cold and hot degrees of the data written in the erase block are the same, after the physical space corresponding to the service logic space is subsequently released, the erase block may be directly erased. However, as shown in fig. 3, for an erase block, if data corresponding to two service logic spaces are written in the erase block, and if the cold and hot degrees of the data corresponding to the two service logic spaces are different, after a physical space corresponding to one service logic space is subsequently released, the data corresponding to the other service logic space is still valid, and then the erase block cannot be directly erased. If it is desired to erase this erase block, valid data needs to be moved. Therefore, in the embodiment of the application, the cold and hot degrees of the data stored in the same erase block are set to be the same or similar, so that the write amplification in the garbage collection process can be reduced.

In the embodiment of the present application, not only the write amplification in the garbage collection process can be reduced by the above method, but also the write amplification can be reduced by other methods. For example, in the process of creating a hard disk logic space in a target hard disk, the size of the hard disk logic space in the target hard disk is adjusted so that the size of the hard disk logic space is equal to an integral multiple of the size of one erase block.

Two implementations for adjusting the size of the logical space of the target hard disk will be described next.

In a first implementation manner, before the storage device creates the hard disk logical space in the target hard disk, the storage device may determine whether the size of the first logical space is an integer multiple of the size of one erase block. If not, the storage device may determine a second logical space size equal to an integer multiple of the size of one erase block. And then, according to the size of the second logic space, determining a target hard disk from the plurality of hard disks, further creating a hard disk logic space in the target hard disk, and allocating a corresponding physical space for the created hard disk logic space from the target hard disk. That is, the size of the physical space is the same as the size of the second logical space.

In a second implementation manner, before the storage device creates the hard disk logical space in the target hard disk, the storage device may determine whether the size of the first logical space is an integer multiple of the size of one erase block. If not, the storage device may send a configuration recommendation message to the client, where the configuration recommendation message carries a second recommended logical space size to be recommended, and the second recommended logical space size is an integer multiple of the size of one erase block. And if the storage equipment receives a recommendation approval response sent by the client, determining a target hard disk from the plurality of hard disks according to the size of the second logic space, further creating a hard disk logic space in the target hard disk, and allocating a corresponding physical space for the created hard disk logic space from the target hard disk. That is, the size of the physical space is the same as the size of the second logical space.

In the above two implementations, the second logical space size may be larger than the first logical space size, and a difference from the first logical space size is smaller than a size of one erase block.

In the two implementation manners, the implementation manner of selecting the target hard disk by the storage device according to the second logical space size is the same as the implementation manner of selecting the target hard disk according to the first logical space size. Moreover, the implementation manner of creating a hard disk logic space in the target hard disk by the storage device according to the first logic space size and allocating a corresponding physical space to the hard disk logic space is the same as the implementation manner of creating a hard disk logic space in the target hard disk according to the first logic space size and allocating a corresponding physical space to the hard disk logic space, which is not described in detail herein for the embodiment of the present application.

In addition, for the second implementation described above, if the client does not agree to create the hard disk logical space according to the second logical space size, the storage device may implement the reduction of write amplification in a manner that data with the same or similar cold and hot degrees or with the same or similar life cycles are stored on the same erase block.

In general, there is a reserved space in the hard disk, and this reserved space can be used to place the moved valid data during garbage collection. However, if the processing is performed according to the method, the moving of the effective data in the garbage recovery process can be avoided, so that the size of the reserved space can be reduced, more data can be stored through the hard disk, and the cost is reduced.

Based on the above creation process of the logical space, it can be known that the business logical space is for the client, the hard disk logical space is for the hard disk, and the business logical space that the client requests the storage device to create is for facilitating subsequent data access, and in general, the storage device may include a plurality of hard disks, so to ensure reliability of subsequent data access, after the storage device acquires the identifier of the business logical space and the identifier of the hard disk logical space, the storage device may store the correspondence between the identifier of the business logical space and the identifier of the hard disk logical space. That is, the corresponding relationship between the service logical space and the hard disk logical space is created. And after the storage device determines the target hard disk from the plurality of hard disks, the storage device can also store the corresponding relation between the identifier of the target hard disk and the identifier of the service logic space. Or, optionally, the storage device may store the identifier of the service logic space, the identifier of the target hard disk, and the corresponding relationship of the identifier of the hard disk logic space. Moreover, for the target hard disk, the target hard disk may store a mapping relationship between the hard disk logical space and the physical space allocated for the hard disk logical space. That is, the mapping relationship between the identifier of the hard disk logical space and the address range of the physical space allocated to the hard disk logical space is stored.

Optionally, when the logical space requested to be created by the client has a data protection attribute, the first logical space creation request needs to carry the data protection attribute in addition to the first logical space size, where the data protection attribute may include multiple copies, Erasure Codes (ECs), and the like. Taking multiple copies as an example, in the process of creating a logical space by the storage device according to the above method, the number of selected target hard disks may be multiple, that is, the multiple selected target hard disks correspond to the multiple copies one to one. Thereafter, a hard disk logical space may be created on each of the plurality of target hard disks in the same manner as described above. And further storing the corresponding relation between the identification of the business logic space and the identification of the target hard disk and the identification of the hard disk logic space so as to establish the corresponding relation between the business logic space and the hard disk logic space in the plurality of target hard disks.

It should be noted that, when the data protection attribute is EC or another attribute, the process of creating the logical space by the storage device may be different from the above process, but the main idea is the same, and the logical space is obtained by appropriately modifying according to the characteristics of the different data protection attributes based on the above process.

After the process of creating a logical space requested by a client is described, a data access method provided by the embodiment of the present application is described next. Referring to fig. 4, fig. 4 is a flowchart of a data access method according to an embodiment of the present application. The method comprises the following steps.

Step 401: the storage device receives a first data writing request from a client, wherein the first data writing request carries target data to be written and an address of a service logic space corresponding to the target data.

Based on the above description, the service logical space is created by the request storage device when the client needs to store data. The address of the business logic space may include an identification of the business logic space and an offset. The identifier of the service logic space is used for uniquely identifying the service logic space, and the offset is used for indicating the length information of the area in which data is currently written in the physical space allocated for the service logic space.

Step 402: and the storage equipment determines a target hard disk in the plurality of hard disks and determines the address of the hard disk logic space corresponding to the service logic space according to the address of the service logic space.

In the process of creating the logic space by the storage device, the corresponding relationship between the identifier of the service logic space and the identifier of the target hard disk and the identifier of the hard disk logic space is stored, so that the storage device can determine the identifier of the target hard disk and the identifier of the hard disk logic space from the corresponding relationship according to the identifier of the service logic space.

It should be noted that the address of the hard disk logical space may also include an identifier and an offset of the hard disk logical space. The offset included in the address of the hard disk logical space may be an offset included in the address of the business logical space.

Step 403: and the storage equipment writes the target data into a physical space corresponding to the hard disk logical space in the target hard disk in an additional writing mode according to the determined address of the hard disk logical space.

The term "write-once" is understood to mean that data is written in a write-once manner, that is, the write-once manner means that the written data is organized in chronological order of writing. Moreover, after the process of a certain program writes data in this way, the subsequent process will not perform write operation on the area where the data is located any more, and only perform read operation.

According to the above description, the offset is used to indicate length information of an area in which data is currently written in a physical space allocated to the service logical space, and an address of the hard disk logical space includes an identifier of the hard disk logical space and the offset, so that the storage device can determine a start address from a physical space corresponding to the hard disk logical space in a target hard disk according to the address of the hard disk logical space, and further write target data from the start address.

Under the condition that the storage device comprises a memory, a processor and a hard disk, the implementation process that the storage device writes target data into a physical space corresponding to a hard disk logic space in a target hard disk in an additional writing mode according to the determined address of the hard disk logic space is as follows: and the processor runs the operating system installed on the memory to send a second data writing request to the target hard disk, wherein the second data writing request carries the target data and the determined address of the hard disk logic space. And after the target hard disk receives the second data writing request, writing the target data into the physical space corresponding to the hard disk logical space in an additional writing mode according to the address of the hard disk logical space.

Since the target hard disk stores the mapping relationship between the identifier of the hard disk logical space and the address range of the physical space allocated to the hard disk logical space, after the target hard disk receives the second data write request, the address range of the physical space allocated to the hard disk logical space can be determined from the mapping relationship according to the identifier of the hard disk logical space. And determining a starting address from the address range according to the offset included in the address of the hard disk logical space, and writing target data from the starting address.

In the embodiment of the application, the client accesses the storage device through the address of the service logic space, the storage device determines the address of the hard disk logic space through the address of the service logic space, and then accesses the target hard disk according to the address of the hard disk logic space. Based on the above description, the business logic space is for the client, the hard disk logic space is for the target hard disk, and both are logic spaces, but different definitions are added for the convenience of distinction. Therefore, it can be seen that the client accesses the storage device in the same way as the storage device accesses the target hard disk, and therefore, when the target data is written into the physical space corresponding to the logical space of the hard disk in the target hard disk in an additional writing way, address conversion in the hard disk is not performed. This saves overhead and increases the data write rate.

In some embodiments, the storage device may also write metadata corresponding to the business logic space to the target hard disk, and particularly, after the business logic space is closed, the metadata needs to be written to the target hard disk, so as to persist the metadata. The metadata includes information about the logical space of the hard disk, such as the total size of the logical space of the hard disk, the size of the currently written data, the end position of the currently written data, and so on. The process of writing metadata into the storage device is similar to the process of writing the target data, and is not described in detail in this embodiment of the present application.

It should be noted that the physical space corresponding to the metadata corresponding to the service logical space on the target hard disk may be different from the physical space corresponding to the address of the hard disk logical space on the target hard disk. That is, the storage device may create a logical space in the target hard disk, where a physical space corresponding to the logical space is different from a physical space corresponding to a logical space of the hard disk, and the physical space corresponding to the logical space is used for storing the metadata corresponding to the business logical space.

The steps 401 and 403 are implemented by the storage device writing data according to the logical space. The process of reading data from the logical space by the storage device is described next.

The storage device receives a first data reading request from a client, wherein the first data reading request carries the length of data to be read and the address of a service logic space corresponding to the data to be read. And determining a target hard disk in the plurality of hard disks according to the address of the service logic space, and determining the address of the hard disk logic space corresponding to the service logic space. And then, the storage device can read data from the physical space corresponding to the hard disk logical space in the target hard disk according to the length of the data to be read and the address of the hard disk logical space.

It should be noted that, during the data reading process, the address of the service logical space also includes the identification and offset of the service logical space. But unlike the data writing process, the offset is used to indicate length information between the start address of the data to be read and the start address of the physical space allocated for the service logical space. The storage device determines a target hard disk in the plurality of hard disks and determines an address of the hard disk logical space corresponding to the service logical space according to the address of the service logical space, which is the same as the manner in step 402.

The implementation process of the storage device reading data from the physical space corresponding to the hard disk logical space in the target hard disk according to the length of the data to be read and the address of the hard disk logical space may be as follows: the storage device determines a starting address from a physical space corresponding to the hard disk logical space in a target hard disk according to the address of the hard disk logical space, and then reads data from the starting address according to the length of the data to be read.

Under the condition that the storage device comprises a memory, a processor and a hard disk, the implementation process of determining a starting address from a physical space corresponding to a hard disk logic space in a target hard disk by the storage device according to the address of the hard disk logic space is as follows: and the processor runs an operating system installed on the memory to send a second data reading request to the target hard disk, wherein the second data reading request carries the length of the data to be read and the determined address of the hard disk logic space. And after the target hard disk receives the second data reading request, determining a starting address from a physical space corresponding to the hard disk logic space in the target hard disk according to the address of the hard disk logic space.

Since the target hard disk stores the mapping relationship between the identifier of the hard disk logical space and the address range of the physical space allocated to the hard disk logical space, after the target hard disk receives the second data read request, the address range of the physical space allocated to the hard disk logical space can be determined from the mapping relationship according to the identifier of the hard disk logical space. And determining a starting address from the address range according to the offset included in the address of the hard disk logical space.

The same as the data writing process, when reading data from the physical space corresponding to the hard disk logic space in the target hard disk, the address conversion in the hard disk is not carried out, thereby saving the expenditure and improving the data reading speed.

It should be noted that, after the storage device creates the service logic space and the hard disk logic space, the states of the service logic space and the hard disk logic space are defaulted to the open state. However, when the physical space corresponding to the subsequent hard disk logical space is full of data, the client requests to close the service logical space, or the service logical space is closed due to an exception, the storage device may set both the state of the service logical space and the state of the hard disk logical space on the target hard disk to be a closed state. Thus, data cannot be written subsequently through the service logical space and the hard disk logical space on the target hard disk, but data can also be read normally.

Since the target hard disk may maintain the resources periodically, the storage device not only sets the state of the service logical space to the off state, but also sets the state of the hard disk logical space on the target hard disk to the off state. Therefore, when the target hard disk maintains resources, the physical space corresponding to the logical space of the hard disk in the closed state is not maintained, and the resources are saved.

If the client requests to delete the service logic space, the storage device may set the state of the service logic space and the state of the hard disk logic space to be deleted states, and release the corresponding physical space. In this way, when garbage collection is performed, the physical space corresponding to the logical space of the hard disk in the deleted state can be erased.

Since the logical space and the log provided by the embodiment of the present application have some similar characteristics, the logical space may be referred to as a persistent log (plog), and a method for operating on the logical space is referred to as a plog interface. That is, both the processor and the hard disk of the storage device are provided with a plog interface. For example, in the storage system shown in fig. 5, the hard disk is exemplified by a Solid State Drive (SSD), the client is installed on the user host, the storage device provides a plog interface for the user host, and the SSD disk also provides a plog interface. Therefore, when the client needs to access data in the storage device, the client can interact with the storage device based on a plog interface provided by the storage device for the user host, and the inside of the storage device can also transmit data based on the plog interface, so that the unification of access modes is ensured, conversion of data organization modes is not needed, the data reading and writing efficiency is very high, the storage device does not need to manage physical space in a hard disk, complex tasks such as garbage collection are not needed to be processed, and the storage system is greatly simplified.

In some embodiments, for the storage system shown in fig. 5, the user host and the storage device may be both provided with an intelligent network card, so that data can be read and written directly through the intelligent network card in the following process without the participation of a processor in the storage device. That is, when data is written in, the client may send the data to the intelligent network card of the storage device through the intelligent network card in the user host, and the intelligent network card of the storage device may identify the received data, so as to write in the hard disk. The same is true for reading data. Therefore, in the process of realizing data reading and writing through the intelligent network card, the processor of the storage device can also process other tasks in parallel.

It should be noted that, although data reading and writing can be implemented by the smart network card, the operations at the control plane also require the participation of the processor of the storage device, for example, the operations of creating, deleting, closing, etc. of the logical space also require the participation of the processor of the storage device.

In this embodiment of the application, the storage device may determine the target hard disk and the address of the hard disk logical space corresponding to the service logical space according to the address of the service logical space carried in the first data write request sent by the client, and further write the target data into the target hard disk according to the address of the hard disk logical space. That is, the client accesses the storage device through the address of the service logic space, the address of the service logic space is converted into the address of the hard disk logic space in the storage device, and the hard disk writes data according to the address of the hard disk logic space.

Fig. 6 is a schematic structural diagram of a data access apparatus provided in an embodiment of the present application, which is located in a storage device and executed by a processor 021 calling a program code in a memory 022. The apparatus may be implemented as part or all of a memory device in software, hardware, or a combination of both. The storage device may include a plurality of hard disks. Referring to fig. 6, the apparatus includes: a receiving module 601, a determining module 602, and a writing module 603.

A receiving module 601, configured to receive a first data write request from a client, where the first data write request carries target data to be written and an address of a service logic space corresponding to the target data;

a determining module 602, configured to determine, according to an address of a service logic space, a target hard disk in the multiple hard disks and an address of a hard disk logic space corresponding to the service logic space;

and a writing module 603, configured to write the target data into a physical space corresponding to the hard disk logical space in the target hard disk in an additional writing manner according to the determined address of the hard disk logical space.

Optionally, when the target data is written into the physical space corresponding to the logical space of the hard disk in the target hard disk in the additional writing manner, address conversion in the hard disk is not performed.

Optionally, the apparatus further comprises:

and the creating module is used for creating the corresponding relation between the service logic space and the hard disk logic space.

Optionally, the hard disk logical space corresponds to one or more erase blocks, and the data stored in the one or more erase blocks have the same cold and hot degree or the same life cycle.

Optionally, the apparatus further comprises:

and the adjusting module is used for adjusting the size of the hard disk logic space so that the size of the hard disk logic space is equal to integral multiple of the size of one erasing block.

In this embodiment of the application, the storage device may determine the target hard disk and the address of the hard disk logical space corresponding to the service logical space according to the address of the service logical space carried in the first data write request sent by the client, and further write the target data into the target hard disk according to the address of the hard disk logical space. That is, the client accesses the storage device through the address of the service logic space, the address of the service logic space is converted into the address of the hard disk logic space in the storage device, and the hard disk writes data according to the address of the hard disk logic space.

It should be noted that: in the data access device provided in the above embodiment, when accessing data, only the division of the above functional modules is exemplified, and in practical applications, the above function distribution may be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the data access device and the data access method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments and are not described herein again.

In the above embodiments, the implementation may be wholly or partly realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., Digital Versatile Disk (DVD)), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others. It is noted that the computer-readable storage medium referred to herein may be a non-volatile storage medium, in other words, a non-transitory storage medium.

It is to be understood that reference herein to "at least one" means one or more and "a plurality" means two or more. In the description of the present application, "/" indicates an OR meaning, for example, A/B may indicate A or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in order to facilitate clear description of technical solutions of the embodiments of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same items or similar items having substantially the same functions and actions. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.

The above-mentioned embodiments are provided not to limit the present application, and any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:内存芯片,内存模块以及用来假性存取其记忆库的方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类