WO2015021755A1 - Data storage method and apparatus - Google Patents

Data storage method and apparatus Download PDF

Info

Publication number
WO2015021755A1
WO2015021755A1 PCT/CN2014/071240 CN2014071240W WO2015021755A1 WO 2015021755 A1 WO2015021755 A1 WO 2015021755A1 CN 2014071240 W CN2014071240 W CN 2014071240W WO 2015021755 A1 WO2015021755 A1 WO 2015021755A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage space
target data
physical address
virtual address
storage
Prior art date
Application number
PCT/CN2014/071240
Other languages
French (fr)
Chinese (zh)
Inventor
蒲贵友
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015021755A1 publication Critical patent/WO2015021755A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation

Definitions

  • the priority of the Chinese patent application is hereby incorporated by reference.
  • the present invention relates to the field of storage technologies, and in particular, to a data storage method and apparatus.
  • tiered storage technology emerges as the times require.
  • tiered storage stores some data with higher importance and higher access frequency to higher performance storage devices based on attributes such as importance of data and frequency of access. Other data that are less important and less frequently accessed are stored in lower performance storage devices. Thereby, the space occupied by non-critical data on higher performance storage devices is reduced.
  • the embodiments of the present invention provide a data storage method and device, which are used to solve the problem that the hierarchical storage system recorded in the prior art has more mapping relationships and larger memory consumption.
  • the storage device includes a controller and a first memory, and the method includes:
  • the write data request including target data and a length of the target data
  • the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space.
  • the virtual address of the first storage space is pre-allocated;
  • the target data is written to the first storage space according to a physical address of the first storage space.
  • the storage device further includes a second memory, where the storage performance of the second memory is different from the first memory, the method further includes: monitoring the The degree of heat and cold of the target data;
  • the physical address of the first storage space is recorded.
  • the first storage when the hot and cold degree of the target data is lower than the preset threshold, the first storage according to the record The physical address of the space, the target data is migrated into the storage space of the first memory.
  • the virtual address of the second storage space is recorded.
  • the data access request is received, where the data access request includes the target data and a virtual address of the first storage space;
  • a second aspect provides a data storage storage device, where the storage device includes a controller and a first memory, and the controller includes:
  • a receiving unit configured to receive a write data request, where the write data request includes target data and a length of the target data
  • a searching unit configured to search for a first storage space that is free in the first memory, where the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space and the first storage space The physical address is the same, the virtual address of the first storage space is pre-allocated, and the writing unit is configured to write the target data into the first storage space according to the physical address of the first storage space.
  • the storage device further includes a second memory, where the storage performance of the second memory is different from the first memory
  • the controller further includes: a monitoring unit And monitoring the degree of coldness and heat of the target data; when the degree of cold and heat of the target data reaches a preset threshold, searching for the target data in the second memory according to the length of the target data An idle second storage space of the same length, the virtual address of the second storage space being the same as the physical address of the second storage space;
  • mapping establishing unit configured to establish a mapping relationship between a virtual address of the first storage space and a physical address of the second storage space
  • a migration unit configured to migrate the target data from the first storage to the free storage space of the second storage according to the mapping relationship.
  • the migration unit is also used to:
  • the migration unit is further configured to: move a physical address of the space, and migrate the target data to the first memory In storage space.
  • the migration unit is further configured to:
  • the migration unit is further configured to:
  • the controller further includes a reading unit
  • the data access request For receiving a data access request, the data access request includes the target data and a virtual address of the first storage space; obtaining a physical address of the first storage space according to a virtual address of the first storage space; The physical address of the first storage space accesses the target data.
  • the virtual address of the storage space of the storage data is preset to be the same as the physical address of the space, and the mapping relationship between the virtual address and the physical address of the storage space is not required, only in the physical
  • the storage space is assigned a virtual address that is different from the physical address.
  • the mapping between the virtual address and the physical address needs to be recorded. Therefore, the mapping relationship of the record is less, due to the mapping of the record. There is less relationship.
  • the mapping relationship that needs to be queried is less. Therefore, not only the record of the mapping relationship is reduced, but also the query efficiency is improved.
  • DRAWINGS 1 is a schematic diagram of a hierarchical storage system in the prior art
  • FIG. 3 is a second flowchart of data storage in an embodiment of the present invention.
  • FIG. 4 is a first schematic diagram of a data storage device according to an embodiment of the present invention.
  • FIG. 5 is a second schematic diagram of a data storage device according to an embodiment of the present invention. detailed description
  • system and “network” are used interchangeably herein.
  • the term “and/or” in this context is merely an association describing the associated object, indicating that there can be three relationships, for example, A and / or B, which can mean: A exists separately, while A and B exist, exist alone B these three situations.
  • the character "/" in this article generally indicates that the contextual object is an "or" relationship.
  • the tiered storage system generally includes: a client, a controller, and at least two storage devices of different speed levels, wherein the client is responsible for initiating user operations, such as: IO (Input/Output) access to the storage space, storage The data storage is released; the controller is responsible for managing the storage space of the storage device, the migration of data between the at least two storage devices, and the actual access control of the client 10; the storage device provides storage space for the data, as shown in FIG. 1 Shown.
  • IO Input/Output
  • Step 200 Receive a write data request, where the write data request includes the target data and the length of the target data;
  • Step 210 Search for the idle first storage space in the first memory, where the first storage space is large
  • the small and the target data have the same length, and the virtual address of the first storage space is the same as the physical address of the first storage space, and the virtual address of the first storage space is pre-allocated;
  • Step 220 Write the target data into the first storage space according to the physical address of the first storage space.
  • the data storage method is applied to a storage device, where the storage device includes a controller and a first memory.
  • the execution body of steps 200-220 can be implemented in various ways. The following is an example in which the execution subject is a controller.
  • the mapping relationship between the virtual address and the physical address of each storage space of the storage data needs to be recorded, and then the virtual address of any free space is obtained by the client, and When the physical address is determined according to the obtained virtual address of the allocated storage space, the mapping relationship between the virtual address of the storage space of each stored data and the actual address needs to be searched to determine the physical address.
  • the mapping relationship between the virtual address and the physical address of the storage space is not necessarily recorded. It is only necessary to record the mapping relationship between the virtual address and the actual address of the storage space where the virtual address and the physical address are different. Therefore, the mapping relationship of the record is reduced, and when the virtual address obtained by the client determines the physical address, only If the mapping between the virtual address and the physical address is different, the mapping between the virtual address and the physical address is not included. If yes, the physical address determined by the mapping is further processed. When the mapping relationship between the obtained virtual addresses is obtained, the subsequent operations on the physical addresses that are the same as the obtained virtual addresses can be directly performed. Therefore, not only the recording of the mapping relationship is reduced, but also the query efficiency is improved.
  • the storage space of the first storage device is 100 G, divided into 100 spaces, and the identification numbers are respectively identified by B0-B99, wherein the initial virtual address and the physical address of each space in the B0-B99 space are the same, for example, B0.
  • the initial virtual address of the space is VA0X000010
  • the physical address is PA0X000010
  • the initial virtual address of the B1 space is VA0X000011
  • the physical address is PA0 00001 1.
  • VA PA ⁇ ⁇ ⁇ ⁇ 0 i ⁇ l .
  • the client reads the data stored in the B9 space, because there is no mapping relationship, the data can be read directly to the same physical address as the virtual address of the B9 space, without querying the mapping relationship, and the prior art
  • the mapping between the virtual address and the physical address of each space in the B0-B9 space needs to be recorded. If the client reads the data stored in the B9 space, the physics of the B9 space is obtained due to the 10 mapping relationships of the query records. The address, then, goes to read the data, so the query is less efficient.
  • the data may be migrated to other storage devices.
  • the virtual address of the space occupied by the data is unchanged, but the physical address changes, that is, Said, the virtual address of the space occupied by the data is not the same as the physical address.
  • the target data has multiple ways in the migration, optionally, monitoring the degree of hot and cold of the target data, and then, when the temperature of the target data reaches a preset threshold, according to the length of the target data in the second memory Finding an idle second storage space that is the same length as the target data, the virtual address of the second storage space is the same as the physical address of the second storage space, and finally, establishing the virtual address of the first storage space and the physical address of the second storage space And mapping the relationship between the target data and the idle storage space of the second storage according to the mapping relationship, wherein the performance of the first storage device is different from the performance of the second storage device.
  • the virtual address of the first storage space may be the same as or different from the physical address. Therefore, the target data stored in the first storage space of the first storage device is migrated to the second storage of the second storage device. After the space is determined, the mapping relationship between the virtual address and the physical address is recorded in the first storage space; if there is no record, the mapping relationship between the virtual address of the first storage space and the physical address of the second storage space is recorded; Recording, changing the mapping relationship between the virtual address and the physical address corresponding to the first storage space record to the virtual address and the second storage space of the first storage space In the above process, when the target data is stored in the first storage device, if the virtual address and the physical address of the first storage space are the same, the first storage occupied by the target data in the first storage device is recorded.
  • mapping relationship between the virtual address of the space and the physical address of the second storage space occupied by the second storage device When the target data is stored in the first storage device, the virtual address and the physical address of the first storage space are not In the same case, the mapping relationship between the virtual address of the first storage space and the physical address of the first storage space is changed to a mapping relationship between the virtual address of the first storage space and the physical address of the second storage space.
  • the physical address of the first storage space is also recorded.
  • the virtual address of the second storage space is further recorded.
  • the target data may be moved back to the first storage device, and the specific implementation manner may be multiple.
  • the target data is lower than the preset temperature.
  • the target data is migrated into the storage space of the first memory according to the physical address of the recorded first storage space.
  • the virtual address of the first storage space occupied by the recorded target data of the migration is removed from the first storage device, and is occupied when the second storage device is occupied.
  • the mapping relationship between the physical addresses of the second storage space is deleted.
  • the first storage space in the first storage device should be moved back to the first storage device.
  • the mapping relationship needs to be recorded again (in this case, when the migration to the first storage space, the virtual address and the physical address match), the second storage space virtual address is deleted from the recorded virtual address, and the virtual The address is added to the free and matching address record, and the physical address of the first storage space is deleted from the recorded physical address.
  • the first storage ⁇ ⁇ , ⁇ 1 is simulated, the second storage ⁇ ⁇ , ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ .
  • the virtual address of the first storage space is VA0X000010, and the physical address is PA0X000010.
  • the target data is migrated from the first storage device to the second storage device, in the second storage device.
  • the virtual address of the occupied second storage space is VA0X000011, and the physical address is PA0X000011.
  • the target data already carries the virtual address. Therefore, after the target data is migrated from the first storage device to the second storage device, The virtual address of the occupied second storage space is VA0X000010, and the physical address is PA0X000011.
  • the virtual address and the physical address of the space occupied by the second storage device do not match, and the mapping relationship between VA0X000010 and PA0X000011 is recorded, and It is also possible to record the physical address PA0X000010 of the first storage space in the idle state, and the virtual address of the second storage space in the idle state.
  • the mapping relationship between the recorded VA0X000010 and PA0X000011 and the recorded VA0X000011 are deleted, and when the migration to the first storage space is performed, If the physical address of the third storage space is not PA0X000010, the physical address of the third storage space is not deleted, but the physical storage address of the third storage space is not deleted. At this time, to change the mapping relationship of the recorded VA0X000010 to PA0X000011 to the mapping relationship of VA0X000010 to the physical address of the third storage space, it is also necessary to record the virtual address of the third storage space.
  • the search is performed from the recorded free physical address.
  • any storage space in the storage device may be released.
  • the release is performed, it is determined whether there is a mapping relationship including a virtual address in the recorded mapping relationship, for example, in the ⁇ . Address, address g gf ⁇ in the record - If a mapping relationship exists, the mapping relationship is deleted first, and it is determined whether there is a physical address in the recorded physical address that is the same as the released virtual address. If yes, the physical address in the record is deleted, and the physical address is added to the physical address. The virtual address is matched with the physical address; otherwise, the released virtual address is added to the recorded virtual address, and then it is determined whether there is a virtual address in the recorded virtual address that is the same as the released physical address. , the virtual address in the record is deleted, and the virtual address is added to the record whose virtual address matches the physical address; otherwise, the released virtual address is added to the recorded physical address.
  • the controller may also record that the virtual address is a non-idle state, the physical address of the space where the corresponding physical address is an idle state, and the record virtual address is an idle state, and the corresponding physical address is a non-idle state.
  • the virtual address of the space therefore, after releasing the space (release the virtual address), if the same physical address as the released virtual address is not idle, the controller adds the released virtual address to the recorded virtual address, if released The physical address (found by the mapping relationship) is the same virtual address that is not idle, and the controller adds the released physical address to the recorded physical address.
  • the client can also read the data, and send a data access request to the controller, where the data access request includes the target data and a virtual address of the first storage space; after receiving the request, the controller, according to the first storage space
  • the virtual address obtains the physical address of the first storage space; and accesses the target data according to the physical address of the first storage space, wherein when the physical address of the first storage space is obtained according to the virtual address of the first storage space, the record may be determined first Whether a mapping relationship including the obtained virtual address exists in the mapping relationship, and if so, determining the physical address according to the mapping relationship; otherwise, determining that the same address as the obtained virtual address is a physical address.
  • the first storage device is 100G, and is divided into 100 spaces, and is respectively identified by B0-B99.
  • the virtual address and the physical address of each space in the B10-B99 space are the same, wherein the B0-B9 space is in the space.
  • mapping relationship of the virtual address including B2 exists in the mapping relationship of the record, the determination is performed.
  • the data is read in the B2 space corresponding to the physical address; when the client pre-fetches the data in the B5 space, it is determined whether there is a mapping relationship including the virtual address of the B5 in the three mapping relationships recorded, because of the mapping relationship in the record There is no mapping relationship including the virtual address of B5. Therefore, it is considered that the physical address of B5 is the same as the virtual address, and therefore, data is read from a space corresponding to the same physical address as the virtual address of B5.
  • FIG. 3 wherein the storage space of the first memory A is The physical address of 10 spaces is idle, and the virtual address and physical address of the A0-A2 space are different.
  • the virtual address and physical address of the A3-A9 space are the same):
  • Step 300 The controller receives a write data request.
  • the write data request includes the target data and the length of the target data.
  • Step 310 The controller determines, in A, that the AO is the first storage space that is idle;
  • the size of the AO space is the same as the length of the target data, and the virtual address of the AO space is the same as the physical address, and the virtual address is pre-allocated.
  • Step 320 The controller writes the target data to A0 according to the physical address of the AO space;
  • Step 330 The controller determines to migrate the target data from A0 to the B0 space in B when the controller determines that the hot and cold degree of the target data reaches a preset threshold.
  • the length of the B0 space is the same as the length of the target data, and the virtual address of the B0 space is the same as the physical address;
  • Step 340 The controller establishes a mapping relationship between the virtual address of the A0 space and the physical address of the B0 space.
  • Step 350 The controller moves the target data from the A0 space to the B0 space in B according to the mapping relationship.
  • an embodiment of the present invention further provides a storage device, which specifically includes:
  • the controller 40 and the first memory 41, the controller 40 further includes:
  • the receiving unit 400 is configured to receive a write data request, where the write data request includes the target data and a length of the target data;
  • the searching unit 410 is configured to search for a free first storage space in the first memory, where the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space.
  • the virtual address of the first storage space is pre-allocated;
  • the writing unit 420 is configured to write the target data into the first storage space according to the physical address of the first storage space.
  • the storage device further includes a second memory 42, the storage performance of the second memory 42 is different from that of the first memory 41, and the controller 40 further includes:
  • the monitoring unit 430 is configured to monitor the degree of coldness and heat of the target data.
  • the second memory is searched for the second idle length that is the same as the length of the target data according to the length of the target data.
  • Storage space, the virtual address of the second storage space is the same as the physical address of the second storage space;
  • mapping establishing unit 440 configured to establish a mapping relationship between a virtual address of the first storage space and a physical address of the second storage space
  • the migration unit 450 is configured to migrate the target data from the first storage to the idle storage space of the second storage according to the mapping relationship.
  • the migration unit 450 is further configured to: record a physical address of the first storage space.
  • the migration unit 450 is further configured to: when the cold and hot course of the target data is low and thousands of days. Report: the first storage 13 ⁇ 4 ⁇ object ⁇ ; Weng Qian To the storage space of the first memory.
  • the migration unit 450 is further configured to: record a virtual address of the second storage space.
  • the migration unit 450 is further configured to: release the second storage space according to the virtual address of the second storage space.
  • the controller 40 further includes a reading unit 460, configured to receive a data access request, where the data access request includes the target data and a virtual address of the first storage space; and obtain the first storage according to the virtual address of the first storage space.
  • the physical address of the space accesses the target data according to the physical address of the first storage space.
  • FIG. 5 it is a structural diagram of another storage device according to an embodiment of the present invention.
  • the storage device includes at least one memory 501, a communication bus 502, a controller 503, and at least one communication interface 504.
  • the communication bus 502 is used to implement the connection and communication between the above components, and the communication interface 504 is used to connect and communicate with external devices.
  • the memory 501 is configured to store program code to be executed.
  • the program code may include: a receiving unit 5011, a searching unit 5012, and a writing unit 5013. When the unit is executed by the controller 503, the following functions are implemented:
  • the receiving unit 5011 is configured to receive a write data request, where the write data request includes the target data and the length of the target data;
  • the searching unit 5012 is configured to search, in the first memory, the idle first storage space, where the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space.
  • the virtual address of the first storage space is pre-allocated;
  • the writing unit 5013 is configured to write the target data into the first storage space according to the physical address of the first storage space.
  • the virtual address of the storage space storing the data is preset to be the same as the physical address of the space, and the virtual address and the object of the storage space need not be recorded.
  • There is a date in the object J ⁇ l 1
  • the virtual address is not the same as the physical address. In this case, the mapping between the virtual address and the physical address needs to be recorded. Therefore, the mapping relationship is less.
  • the specific method is as follows: receiving the write data request, writing the data request including the target data, and Length of the target data; searching for the first storage space that is free in the first memory, the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space, The virtual address of a storage space is pre-allocated; according to the physical address of the first storage space, the target data is written into the first storage space, and since the mapping relationship of the record is small, when the physical address is determined according to the virtual address, the query is required.
  • the mapping relationship is less, therefore, not only reduces the record of the mapping relationship, but also improves the query efficiency.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus functions in one or more blocks of a flow or a flow diagram and/or block diagram of a flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions in one or more blocks of the flowchart or in a flow or block of the flowchart.

Abstract

The present invention relates to the technical field of data storage, and discloses a data storage method and apparatus. During data storage, a virtual address of storage space for storing data is preset to be the same as a physical address of the storage space, a mapping relationship between the virtual address and the physical address of the storage space does not need to be recorded; a virtual address different from the physical address is allocated to the storage space only if the virtual address which is the same as the physical address is occupied, and in this case, the mapping relationship between the virtual address and the physical address needs to be recorded. Therefore, the number of the recorded mapping relationships is smaller; because the number of the recorded mapping relationships is reduced, the number of mapping relationships to be queried is reduced when the physical address is determined according to the virtual address, thereby reducing the recording of mapping relationships, and improving the query efficiency.

Description

一种数据存储的方法及装置 本申请要求于 2013年 8月 12日提交中国专利局、 申请号为  Method and device for data storage The application is submitted to the Chinese Patent Office on August 12, 2013, and the application number is
201310350179.9、 发明名称为 "一种数据存储的方法及装置" 的中国专利申请 的优先权, 其全部内容通过引用结合在本申请中。 技术领域 本发明涉及存储技术领域, 特别涉及一种数据存储的方法及装置。 The priority of the Chinese patent application is hereby incorporated by reference. The present invention relates to the field of storage technologies, and in particular, to a data storage method and apparatus.
背景技术 在当今的 IT ( Information Technology, 信息技术)管理中, 数据存储的挑 战往往是容量要求和性能要求, 面对越来越多的数据量, 访问、 存储和管理这 些数据已经变得越来越困难了, 管理维护成本也越来越高。 BACKGROUND In today's IT (Information Technology) management, the challenge of data storage is often the capacity requirements and performance requirements. In the face of more and more data volume, accessing, storing and managing these data has become increasingly The more difficult it is, the higher the cost of management and maintenance.
为了解决上述问题, 分级存储技术应运而生, 分级存储是根据数据的重要 性、 访问频率等属性, 将一些重要性较高、 访问频率较高的数据存储到性能较 高存储设备中, 而将另一些重要性较低、 访问频率较低的数据存储到性能较低 的存储设备中。 从而, 减少非重要数据在性能较高存储设备上所占用的空间。  In order to solve the above problems, tiered storage technology emerges as the times require. tiered storage stores some data with higher importance and higher access frequency to higher performance storage devices based on attributes such as importance of data and frequency of access. Other data that are less important and less frequently accessed are stored in lower performance storage devices. Thereby, the space occupied by non-critical data on higher performance storage devices is reduced.
现有技术中, 客户端在对存储设备中的存储空间进行写入操作时, 为存储 数据的空间分配的虚拟地址与物理地址不同, 因此, 需要记录存储数据的每一 个存储空间的虚拟地址和物理地址的映射关系, 因此, 记录的映射关系较多而 记录较多的映射关系对内存消耗很大, 会影响分级存储对存储系统性能的提 升, 甚至在某些情况下该种分级存储的实现还会带来存储性能的降低。 发明内容  In the prior art, when a client performs a write operation on a storage space in a storage device, a virtual address allocated to a space for storing data is different from a physical address, and therefore, a virtual address of each storage space in which data is stored needs to be recorded. The mapping relationship between the physical addresses and the records. Therefore, the mappings with more records are more expensive. This affects the performance of the storage system. Even in some cases, the implementation of the hierarchical storage. It also brings about a reduction in storage performance. Summary of the invention
本发明实施例提供一种数据存储的方法及装置, 用以解决现有技术中存在 的分级存储系统记录的映射关系较多、 内存消耗较大的问题。  The embodiments of the present invention provide a data storage method and device, which are used to solve the problem that the hierarchical storage system recorded in the prior art has more mapping relationships and larger memory consumption.
本发明实施例提供的具体技术方案如下:  The specific technical solutions provided by the embodiments of the present invention are as follows:
第一古而. #供一种翁: 存储古 所 翁: 存储古、; j ^ 用^存储 备中. 所述存储设备包括控制器和第一存储器, 所述方法包括: The first ancient and the #. For a kind of Weng: store ancient things Weng: store ancient,; j ^ use ^ to store the preparation. The storage device includes a controller and a first memory, and the method includes:
接收写数据请求, 所述写数据请求包括目标数据以及所述目标数据的长 度;  Receiving a write data request, the write data request including target data and a length of the target data;
在第一存储器中查找空闲的第一存储空间, 所述第一存储空间的大小与所 述目标数据的长度相同, 并且所述第一存储空间的虚拟地址与第一存储空间的 物理地址相同, 所述第一存储空间的虚拟地址是预先分配的;  Searching for a first storage space that is free in the first memory, the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space. The virtual address of the first storage space is pre-allocated;
根据所述第一存储空间的物理地址, 将所述目标数据写入所述第一存储空 间。  The target data is written to the first storage space according to a physical address of the first storage space.
结合第一方面, 在第一种可能的实现方式中, 所述存储设备还包括第二存 储器, 所述第二存储器的存储性能与所述第一存储器不同, 所述方法还包括: 监控所述目标数据的冷热程度;  With reference to the first aspect, in a first possible implementation, the storage device further includes a second memory, where the storage performance of the second memory is different from the first memory, the method further includes: monitoring the The degree of heat and cold of the target data;
当所述目标数据的冷热程度达到预设的阈值时,根据所述目标数据的长度 在所述第二存储器中查找与所述目标数据的长度相同的空闲的第二存储空间, 所述第二存储空间的虚拟地址与所述第二存储空间的物理地址相同;  When the degree of coldness and heat of the target data reaches a preset threshold, searching for, in the second memory, an idle second storage space having the same length as the target data according to the length of the target data, where the The virtual address of the second storage space is the same as the physical address of the second storage space;
建立所述第一存储空间的虚拟地址与第二存储空间的物理地址之间的映 射关系;  Establishing a mapping relationship between the virtual address of the first storage space and the physical address of the second storage space;
根据所述映射关系, 将所述目标数据从所述第一存储器迁移至所述第二存 储器的所述空闲的存储空间中。  And migrating the target data from the first memory to the free storage space of the second memory according to the mapping relationship.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中, 记 录所述第一存储空间的物理地址。  In conjunction with the first possible implementation of the first aspect, in a second possible implementation, the physical address of the first storage space is recorded.
结合第一方面的第二种可能的实现方式, 在第三种可能的实现方式中, 当 所述目标数据的冷热程度低于所述预设的阈值时,根据所述记录的第一存储空 间的物理地址, 将所述目标数据迁移至所述第一存储器的存储空间中。  With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner, when the hot and cold degree of the target data is lower than the preset threshold, the first storage according to the record The physical address of the space, the target data is migrated into the storage space of the first memory.
结合第一方面的第一至第三种可能的实现方式,在第四种可能的实现方式 中, 记录所述第二存储空间的虚拟地址。  In conjunction with the first to third possible implementations of the first aspect, in a fourth possible implementation, the virtual address of the second storage space is recorded.
厶第一古而 第四种^ Γ 规古 , 在第 种^ Γ 规古 中. 報 据所述第二存储空间的虚拟地址, 释放所述第二存储空间。 厶The first ancient and the fourth kind ^ Γ 规古, in the first kind Γ 规 古 古. And releasing the second storage space according to the virtual address of the second storage space.
结合第一方面的第一种可能的实现方式, 在第六种可能的实现方式中, 接 收数据访问请求, 所述数据访问请求包括所述目标数据以及所述第一存储空间 的虚拟地址;  In conjunction with the first possible implementation of the first aspect, in a sixth possible implementation, the data access request is received, where the data access request includes the target data and a virtual address of the first storage space;
根据所述第一存储空间的虚拟地址获得所述第一存储空间的物理地址; 根据所述第一存储空间的物理地址访问所述目标数据。  Obtaining a physical address of the first storage space according to the virtual address of the first storage space; accessing the target data according to a physical address of the first storage space.
第二方面, 提供一种数据存储存储设备, 所述存储设备包括控制器和第一 存储器, 所述控制器包括:  A second aspect provides a data storage storage device, where the storage device includes a controller and a first memory, and the controller includes:
接收单元, 用于接收写数据请求, 所述写数据请求包括目标数据以及所述 目标数据的长度;  a receiving unit, configured to receive a write data request, where the write data request includes target data and a length of the target data;
查找单元, 用于在第一存储器中查找空闲的第一存储空间, 所述第一存储 空间的大小与所述目标数据的长度相同, 并且所述第一存储空间的虚拟地址与 第一存储空间的物理地址相同, 所述第一存储空间的虚拟地址是预先分配的; 写入单元, 用于根据所述第一存储空间的物理地址, 将所述目标数据写入 所述第一存储空间。  a searching unit, configured to search for a first storage space that is free in the first memory, where the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space and the first storage space The physical address is the same, the virtual address of the first storage space is pre-allocated, and the writing unit is configured to write the target data into the first storage space according to the physical address of the first storage space.
结合第二方面, 在第一种可能的实现方式中, 所述存储设备还包括第二存 储器,所述第二存储器的存储性能与所述第一存储器不同,所述控制器还包括: 监控单元, 用于监控所述目标数据的冷热程度; 当所述目标数据的冷热程 度达到预设的阈值时,根据所述目标数据的长度在所述第二存储器中查找与所 述目标数据的长度相同的空闲的第二存储空间, 所述第二存储空间的虚拟地址 与所述第二存储空间的物理地址相同;  With reference to the second aspect, in a first possible implementation, the storage device further includes a second memory, where the storage performance of the second memory is different from the first memory, the controller further includes: a monitoring unit And monitoring the degree of coldness and heat of the target data; when the degree of cold and heat of the target data reaches a preset threshold, searching for the target data in the second memory according to the length of the target data An idle second storage space of the same length, the virtual address of the second storage space being the same as the physical address of the second storage space;
映射建立单元, 用于建立所述第一存储空间的虚拟地址与第二存储空间的 物理地址之间的映射关系;  a mapping establishing unit, configured to establish a mapping relationship between a virtual address of the first storage space and a physical address of the second storage space;
迁移单元, 用于根据所述映射关系, 将所述目标数据从所述第一存储器迁 移至所述第二存储器的所述空闲的存储空间中。  And a migration unit, configured to migrate the target data from the first storage to the free storage space of the second storage according to the mapping relationship.
厶第二古而 第一种^ Γ 规古 . 在第二种^ Γ 规古 中. 所 述迁移单元还用于: 厶The second ancient and the first type ^ Γ 规古. In the second ^ Γ 古 ancient. The migration unit is also used to:
记录所述第一存储空间的物理地址。  Recording a physical address of the first storage space.
结合第二方面的第二种可能的实现方式, 在第三种可能的实现方式中, 所 述迁移单元还用于: 存储空间的物理地址, 将所述目标数据迁移至所述第一存储器的存储空间中。  With the second possible implementation of the second aspect, in a third possible implementation, the migration unit is further configured to: move a physical address of the space, and migrate the target data to the first memory In storage space.
结合第二方面的第一至第三种可能的实现方式,在第四种可能的实现方式 中, 所述迁移单元还用于:  In conjunction with the first to third possible implementations of the second aspect, in a fourth possible implementation, the migration unit is further configured to:
记录所述第二存储空间的虚拟地址。  Recording a virtual address of the second storage space.
结合第二方面的第四种可能的实现方式, 在第五种可能的实现方式中, 所 述迁移单元还用于:  In conjunction with the fourth possible implementation of the second aspect, in a fifth possible implementation, the migration unit is further configured to:
根据所述第二存储空间的虚拟地址, 释放所述第二存储空间。  And releasing the second storage space according to the virtual address of the second storage space.
结合第二方面的第一种可能的实现方式, 在第六种可能的实现方式中, 所 述控制器还包括读取单元,  In conjunction with the first possible implementation of the second aspect, in a sixth possible implementation, the controller further includes a reading unit,
用于接收数据访问请求, 所述数据访问请求包括所述目标数据以及所述第 一存储空间的虚拟地址; 根据所述第一存储空间的虚拟地址获得所述第一存储 空间的物理地址; 根据所述第一存储空间的物理地址访问所述目标数据。  For receiving a data access request, the data access request includes the target data and a virtual address of the first storage space; obtaining a physical address of the first storage space according to a virtual address of the first storage space; The physical address of the first storage space accesses the target data.
本发明实施例中, 在存储数据时, 将存储数据的存储空间的虚拟地址预设成 该空间的物理地址相同, 不需要记录该存储空间的虚拟地址和物理地址的映射 关系, 只有在与物理地址相同的虚拟地址被占用时, 才给存储空间分配与物理 地址不相同的虚拟地址, 此时才需要记录虚拟地址和物理地址的映射关系, 因 此, 记录的映射关系较少, 由于记录的映射关系少了, 在根据虚拟地址确定物 理地址时,需要查询的映射关系就少了, 因此, 不仅降低了对映射关系的记录, 还提高了查询效率。 附图说明 图 1为现有技术中分级存储系统的示意图; In the embodiment of the present invention, when the data is stored, the virtual address of the storage space of the storage data is preset to be the same as the physical address of the space, and the mapping relationship between the virtual address and the physical address of the storage space is not required, only in the physical When the virtual address with the same address is occupied, the storage space is assigned a virtual address that is different from the physical address. In this case, the mapping between the virtual address and the physical address needs to be recorded. Therefore, the mapping relationship of the record is less, due to the mapping of the record. There is less relationship. When the physical address is determined according to the virtual address, the mapping relationship that needs to be queried is less. Therefore, not only the record of the mapping relationship is reduced, but also the query efficiency is improved. DRAWINGS 1 is a schematic diagram of a hierarchical storage system in the prior art;
图 2为本发明实施例中数据存储的第一流程图;  2 is a first flowchart of data storage in an embodiment of the present invention;
图 3为本发明实施例中数据存储的第二流程图;  3 is a second flowchart of data storage in an embodiment of the present invention;
图 4为本发明实施例中数据存储装置的第一示意图;  4 is a first schematic diagram of a data storage device according to an embodiment of the present invention;
图 5为本发明实施例中数据存储装置的第二示意图。 具体实施方式  FIG. 5 is a second schematic diagram of a data storage device according to an embodiment of the present invention. detailed description
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发明 实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于本发明中 的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其 他实施例, 都属于本发明保护的范围。  The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is a partial embodiment of the invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
另外, 本文中术语"系统"和"网络"在本文中常被可互换使用。 本文中术语 "和 /或",仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如, A和 /或 B, 可以表示: 单独存在 A, 同时存在 A和 B, 单独存在 B这三种情 况。 另外, 本文中字符 "/" , 一般表示前后关联对象是一种 "或" 的关系。  Additionally, the terms "system" and "network" are used interchangeably herein. The term "and/or" in this context is merely an association describing the associated object, indicating that there can be three relationships, for example, A and / or B, which can mean: A exists separately, while A and B exist, exist alone B these three situations. In addition, the character "/" in this article generally indicates that the contextual object is an "or" relationship.
分级存储系统一般包括: 客户端、 控制器和至少两个不同速度级别的存储 设备,其中,客户端负责发起用户的操作,如:对存储空间进行 IO( Input/Output, 写读)访问、 存储数据存储释放; 控制器负责管理存储设备的存储空间、 数据 在至少两个存储设备之间的迁移, 及客户端对 10实际的访问控制等; 存储设 备为数据提供存储的空间, 具体如图 1所示。  The tiered storage system generally includes: a client, a controller, and at least two storage devices of different speed levels, wherein the client is responsible for initiating user operations, such as: IO (Input/Output) access to the storage space, storage The data storage is released; the controller is responsible for managing the storage space of the storage device, the migration of data between the at least two storage devices, and the actual access control of the client 10; the storage device provides storage space for the data, as shown in FIG. 1 Shown.
下面结合附图对本发明优选的实施方式进行详细说明。  Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
参阅图 2所示, 本发明实施例中, 数据存储的第一详细流程如下: 步骤 200: 接收写数据请求, 写数据请求包括目标数据以及目标数据的长 度;  Referring to FIG. 2, in the embodiment of the present invention, the first detailed process of data storage is as follows: Step 200: Receive a write data request, where the write data request includes the target data and the length of the target data;
步骤 210: 在第一存储器中查找空闲的第一存储空间, 第一存储空间的大 小与目标数据的长度相同, 并且第一存储空间的虚拟地址与第一存储空间的物 理地址相同, 第一存储空间的虚拟地址是预先分配的; Step 210: Search for the idle first storage space in the first memory, where the first storage space is large The small and the target data have the same length, and the virtual address of the first storage space is the same as the physical address of the first storage space, and the virtual address of the first storage space is pre-allocated;
步骤 220:根据第一存储空间的物理地址,将目标数据写入第一存储空间。 本发明实施例中, 数据存储方法应用在存储设备中, 存储设备包括控制器 和第一存储器。  Step 220: Write the target data into the first storage space according to the physical address of the first storage space. In the embodiment of the present invention, the data storage method is applied to a storage device, where the storage device includes a controller and a first memory.
步骤 200-220的执行主体可以有多种方式, 下面以执行主体为控制器为例 进行说明。  The execution body of steps 200-220 can be implemented in various ways. The following is an example in which the execution subject is a controller.
现有技术中, 控制器将数据存储至存储空间时, 需要记录存储数据的每一 个存储空间的虚拟地址和物理地址对应的映射关系, 进而当客户端获取到任意 一空闲空间的虚拟地址, 并根据获取到的被分配的存储空间的虚拟地址确定物 理地址时, 需要查找记录的每一个存储数据的存储空间的虚拟地址和实际地址 的映射关系来确定物理地址。  In the prior art, when the controller stores the data in the storage space, the mapping relationship between the virtual address and the physical address of each storage space of the storage data needs to be recorded, and then the virtual address of any free space is obtained by the client, and When the physical address is determined according to the obtained virtual address of the allocated storage space, the mapping relationship between the virtual address of the storage space of each stored data and the actual address needs to be searched to determine the physical address.
而本发明实施例中, 控制器将数据存储至存储空间时, 存储数据的空间的 虚拟地址和物理地址是相同的, 此时, 该存储空间的虚拟地址和物理地址映射 关系不是必须记录的, 只需要记录虚拟地址和物理地址不相同的存储空间的虚 拟地址和实际地址的映射关系即可, 因此, 记录的映射关系减少了, 则当客户 端 居获取到的虚拟地址确定物理地址时,仅需要去查找记录的虚拟地址和物 理地址不相同的映射关系中, 是否存在包括获取的虚拟地址的映射关系, 若存 在时, 对根据映射关系查确定出的物理地址进行后续操作, 若不存在包括获取 的虚拟地址的映射关系时, 则直接对与获取的虚拟地址相同的物理地址进行后 续操作即可, 因此, 不仅降低了对映射关系的记录, 还提高了查询效率。  In the embodiment of the present invention, when the controller stores the data in the storage space, the virtual address and the physical address of the space for storing the data are the same. At this time, the mapping relationship between the virtual address and the physical address of the storage space is not necessarily recorded. It is only necessary to record the mapping relationship between the virtual address and the actual address of the storage space where the virtual address and the physical address are different. Therefore, the mapping relationship of the record is reduced, and when the virtual address obtained by the client determines the physical address, only If the mapping between the virtual address and the physical address is different, the mapping between the virtual address and the physical address is not included. If yes, the physical address determined by the mapping is further processed. When the mapping relationship between the obtained virtual addresses is obtained, the subsequent operations on the physical addresses that are the same as the obtained virtual addresses can be directly performed. Therefore, not only the recording of the mapping relationship is reduced, but also the query efficiency is improved.
例如,第一存储设备的存储空间为 100G,分为 100个空间,分别用 B0-B99 进行标识编号, 其中, B0-B99 空间中的每一个空间的初始虚拟地址和物理地 址相同, 例如, B0 空间的初始虚拟地址为 VA0X000010、 物理地址为 PA0X000010 , B1 空间的初始虚拟地址为 VA0X000011、 物理地址为 PA0 00001 1 . VA、 PA ^λ ^ΑΨΛ^^ ^ ^0 i ^l . ^ ^^ ^ 存储在 B0-B9空间时, 由于 B0-B9空间中的任意一空间的虚拟地址和物理地 址相同, 因此, 不需要进行记录, 而现有技术中, 需要记录存储数据的每一个 空间的虚拟地址和物理地址的映射关系, 因此, 映射关系较多。 For example, the storage space of the first storage device is 100 G, divided into 100 spaces, and the identification numbers are respectively identified by B0-B99, wherein the initial virtual address and the physical address of each space in the B0-B99 space are the same, for example, B0. The initial virtual address of the space is VA0X000010, the physical address is PA0X000010, the initial virtual address of the B1 space is VA0X000011, and the physical address is PA0 00001 1. VA, PA ^λ ^ΑΨΛ^^ ^ ^0 i ^l . ^ ^^ ^ When stored in the B0-B9 space, since the virtual address and the physical address of any space in the B0-B9 space are the same, no recording is required, and in the prior art, the virtual address of each space in which the data is stored needs to be recorded. The mapping relationship with physical addresses. Therefore, there are many mapping relationships.
同时, 若客户端读取 B9空间中存储的数据时, 由于没有记录的映射关系, 直接到与 B9空间的虚拟地址相同的物理地址去读取数据即可, 不用查询映射 关系, 而现有技术中, 需要记录 B0-B9空间中的每一空间的虚拟地址和物理地 址的映射关系, 若客户端读取 B9空间中存储的数据时, 由于查询记录的 10条 映射关系, 获取 B9空间的物理地址, 然后, 去读取数据, 因此, 查询效率较 低。  At the same time, if the client reads the data stored in the B9 space, because there is no mapping relationship, the data can be read directly to the same physical address as the virtual address of the B9 space, without querying the mapping relationship, and the prior art The mapping between the virtual address and the physical address of each space in the B0-B9 space needs to be recorded. If the client reads the data stored in the B9 space, the physics of the B9 space is obtained due to the 10 mapping relationships of the query records. The address, then, goes to read the data, so the query is less efficient.
本发明实施例中, 目标数据存储在第一存储设备后, 也可以迁移至其他存 储设备, 由于数据迁移后, 数据所占空间的虚拟地址是不变的, 但是物理地址 发生了变化, 也就是说, 数据所占空间的虚拟地址与物理地址不相同了。  In the embodiment of the present invention, after the target data is stored in the first storage device, the data may be migrated to other storage devices. After the data is migrated, the virtual address of the space occupied by the data is unchanged, but the physical address changes, that is, Said, the virtual address of the space occupied by the data is not the same as the physical address.
其中, 目标数据在迁移时有多种方式,可选的,监控目标数据的冷热程度, 然后, 当目标数据的冷热程度达到预设的阈值时, 根据目标数据的长度在第二 存储器中查找与目标数据的长度相同的空闲的第二存储空间, 第二存储空间的 虚拟地址与第二存储空间的物理地址相同, 最后, 建立第一存储空间的虚拟地 址与第二存储空间的物理地址之间的映射关系, 并根据映射关系, 将目标数据 从第一存储器迁移至第二存储器的空闲的存储空间中, 其中, 第一存储设备的 性能和第二存储设备的性能不同。  Wherein, the target data has multiple ways in the migration, optionally, monitoring the degree of hot and cold of the target data, and then, when the temperature of the target data reaches a preset threshold, according to the length of the target data in the second memory Finding an idle second storage space that is the same length as the target data, the virtual address of the second storage space is the same as the physical address of the second storage space, and finally, establishing the virtual address of the first storage space and the physical address of the second storage space And mapping the relationship between the target data and the idle storage space of the second storage according to the mapping relationship, wherein the performance of the first storage device is different from the performance of the second storage device.
在实际应用中, 第一存储空间的虚拟地址可能和物理地址相同, 也可能不 同, 因此, 将存储在第一存储设备的第一存储空间中的目标数据迁移至第二存 储设备的第二存储空间中后,先判断对应第一存储空间是否记录有虚拟地址和 物理地址的映射关系; 若没有记录, 则记录第一存储空间的虚拟地址和第二存 储空间的物理地址的映射关系; 若有记录, 则将对应第一存储空间记录的虚拟 地址和物理地址的映射关系, 更改为第一存储空间的虚拟地址和第二存储空间 上述过程也就是, 在目标数据存储在第一存储设备中时, 第一存储空间的 虚拟地址和物理地址相同的情况下, 则记录该目标数据在第一存储设备中时所 占用的第一存储空间的虚拟地址, 和在第二存储设备中时所占用的第二存储空 间的物理地址的映射关系, 在目标数据存储在第一存储设备中时, 第一存储空 间的虚拟地址和物理地址不相同的情况下,将记录的第一存储空间的虚拟地址 和第一存储空间的物理地址相对应的映射关系, 更改为第一存储空间的虚拟地 址和第二存储空间的物理地址的映射关系。 In a practical application, the virtual address of the first storage space may be the same as or different from the physical address. Therefore, the target data stored in the first storage space of the first storage device is migrated to the second storage of the second storage device. After the space is determined, the mapping relationship between the virtual address and the physical address is recorded in the first storage space; if there is no record, the mapping relationship between the virtual address of the first storage space and the physical address of the second storage space is recorded; Recording, changing the mapping relationship between the virtual address and the physical address corresponding to the first storage space record to the virtual address and the second storage space of the first storage space In the above process, when the target data is stored in the first storage device, if the virtual address and the physical address of the first storage space are the same, the first storage occupied by the target data in the first storage device is recorded. a mapping relationship between the virtual address of the space and the physical address of the second storage space occupied by the second storage device. When the target data is stored in the first storage device, the virtual address and the physical address of the first storage space are not In the same case, the mapping relationship between the virtual address of the first storage space and the physical address of the first storage space is changed to a mapping relationship between the virtual address of the first storage space and the physical address of the second storage space.
本发明实施例中, 在目标数据迁移至第二存储空间后, 还要记录第一存储 空间的物理地址。  In the embodiment of the present invention, after the target data is migrated to the second storage space, the physical address of the first storage space is also recorded.
本发明实施例中, 还包括记录第二存储空间的虚拟地址。  In the embodiment of the present invention, the virtual address of the second storage space is further recorded.
本发明实施例中, 目标数据在迁移至第二存储设备后, 还可以再回迁至第 一存储设备, 具体实现方式有多种, 可选的, 当目标数据的冷热程度低于预设 的阈值时, 根据记录的第一存储空间的物理地址, 将目标数据迁移至第一存储 器的存储空间中。  In the embodiment of the present invention, after the target data is migrated to the second storage device, the target data may be moved back to the first storage device, and the specific implementation manner may be multiple. Optionally, when the target data is lower than the preset temperature. At the threshold, the target data is migrated into the storage space of the first memory according to the physical address of the recorded first storage space.
此时, 再回迁至第一存储设备时, 要将记录的该迁移的目标数据迁出第一 存储设备中时所占用的第一存储空间的虚拟地址, 和在第二存储设备中时所占 用的第二存储空间的物理地址的映射关系删除, 此时, 为了减少记录的映射关 系, 要尽量回迁至第一存储设备在中的第一存储空间, 此时, 要先确定第一存 储设备中第一存储设备中的第一存储空间是否空闲, 若空闲, 回迁至第一存储 空间, 否则, 再回迁至其他处于空闲状态的空间, 若回迁的目标数据又存储至 第一存储空间时, 不需要再记录映射关系 (此时, 也就是说, 迁回至第一存储 空间时, 虚拟地址和物理地址就匹配了 ), 从记录的虚拟地址中删除第二存储 空间虚拟地址, 并将该虚拟地址添加到空闲且匹配的地址记录中去, 以及从记 录的物理地址中删除第一存储空间的物理地址。  At this time, when the migration to the first storage device is performed, the virtual address of the first storage space occupied by the recorded target data of the migration is removed from the first storage device, and is occupied when the second storage device is occupied. The mapping relationship between the physical addresses of the second storage space is deleted. In this case, in order to reduce the mapping relationship of the records, the first storage space in the first storage device should be moved back to the first storage device. Whether the first storage space in the first storage device is idle, and if it is idle, it is moved back to the first storage space; otherwise, it is moved back to another space in an idle state, and if the target data of the relocation is stored in the first storage space, The mapping relationship needs to be recorded again (in this case, when the migration to the first storage space, the virtual address and the physical address match), the second storage space virtual address is deleted from the recorded virtual address, and the virtual The address is added to the free and matching address record, and the physical address of the first storage space is deleted from the recorded physical address.
若回迁的目标数据存储至第一存储设备中的第三存储空间时, 则将第一存 储^ Ί、曰 1 拟 ,址 第二 储^ Ί、曰 Ί 物 ίϋ ό^ΐ Β^ ^ . 第一 储空间的虚拟地址与第三存储空间的物理地址之间的映射关系, 并从记录的虚 拟地址中删除在第二空间的虚拟地址, 并将该虚拟地址添加到空闲且匹配的地 址记录中去。 If the target data of the relocation is stored in the third storage space in the first storage device, the first storage ^ Ί, 曰 1 is simulated, the second storage Ί 曰Ί, 曰Ί ϋ ϋ 第 ΐ ^ ^ ^. One a mapping relationship between the virtual address of the storage space and the physical address of the third storage space, and deleting the virtual address in the second space from the recorded virtual address, and adding the virtual address to the idle and matching address record .
例如, 目标数据在第一存储设备中存储时, 第一存储空间的虚拟地址为 VA0X000010, 物理地址为 PA0X000010, 若目标数据从第一存储设备迁移至第 二存储设备时, 在第二存储设备中所占用的第二存储空间的虚拟地址为 VA0X000011 , 物理地址为 PA0X000011 , 而目标数据在迁移时, 目标数据已经 携带了虚拟地址, 因此, 目标数据从第一存储设备迁移至第二存储设备后, 所 占用的第二存储空间的虚拟地址为 VA0X000010, 物理地址为 PA0X000011 , 此时, 所占用的第二存储设备的空间的虚拟地址和物理地址不匹配, 要记录 VA0X000010到 PA0X000011的映射关系, 同时, 还可以记录为空闲状态的第 一存储空间的物理地址 PA0X000010, 及为空闲状态的第二存储空间的虚拟地 址。  For example, when the target data is stored in the first storage device, the virtual address of the first storage space is VA0X000010, and the physical address is PA0X000010. If the target data is migrated from the first storage device to the second storage device, in the second storage device. The virtual address of the occupied second storage space is VA0X000011, and the physical address is PA0X000011. When the target data is migrated, the target data already carries the virtual address. Therefore, after the target data is migrated from the first storage device to the second storage device, The virtual address of the occupied second storage space is VA0X000010, and the physical address is PA0X000011. At this time, the virtual address and the physical address of the space occupied by the second storage device do not match, and the mapping relationship between VA0X000010 and PA0X000011 is recorded, and It is also possible to record the physical address PA0X000010 of the first storage space in the idle state, and the virtual address of the second storage space in the idle state.
进一步的, 若迁移至第二存储设备的目标数据又回迁至第一存储设备, 此 时, 要删除记录的 VA0X000010 到 PA0X000011 的映射关系, 及记录的 VA0X000011 , 并在回迁至第一存储空间时所占用空间的物理地址为 PA0X000010 , 则不需要记录新的映射关系, 同时, 还要删除记录的 PA0X000010, 在回迁至第一存储设备的第三存储空间, 第三存储空间的物理 地址不是 PA0X000010时, 此时, 要将记录的 VA0X000010到 PA0X000011的 映射关系, 更改为 VA0X000010到第三存储空间的物理地址的映射关系, 还需 要记录第三存储空间的虚拟地址。  Further, if the target data migrated to the second storage device is moved back to the first storage device, the mapping relationship between the recorded VA0X000010 and PA0X000011 and the recorded VA0X000011 are deleted, and when the migration to the first storage space is performed, If the physical address of the third storage space is not PA0X000010, the physical address of the third storage space is not deleted, but the physical storage address of the third storage space is not deleted. At this time, to change the mapping relationship of the recorded VA0X000010 to PA0X000011 to the mapping relationship of VA0X000010 to the physical address of the third storage space, it is also necessary to record the virtual address of the third storage space.
本发明实施例中, 在数据回迁时, 确定回迁的数据第一次在第一存储设备 的空间是否空闲的方式有多种,可选的,从记录的空闲的物理地址中进行查找。  In the embodiment of the present invention, when data is fetched, there are multiple ways to determine whether the data to be relocated is free in the space of the first storage device for the first time. Optionally, the search is performed from the recorded free physical address.
本发明实施例中, 还可以对存储设备中的任意一存储空间进行释放, 在进 行释放时, 要判定记录的映射关系中是否存在包括虚拟地址的映射关系, 如 在 ϋ . 该 ϋ加 拟 ,址 物 ,址 g gf^ 记 中- 如果存在映射关系, 则先删除该映射关系, 并判断记录的物理地址中是否存在 与释放的虚拟地址相同的物理地址, 若是, 则将该记录中的物理地址删除, 并 将该物理地址添加到虚拟地址与物理地址匹配的记录中去; 否则将该释放的虚 拟地址添加到记录的虚拟地址当中去, 然后, 还要判断记录的虚拟地址中是否 存在与释放的物理地址相同的虚拟地址,若是,则将该记录中的虚拟地址删除, 并将虚拟地址添加到虚拟地址与物理地址匹配的记录中去; 否则将该释放的虚 拟地址添加到记录的物理地址当中去。 In the embodiment of the present invention, any storage space in the storage device may be released. When the release is performed, it is determined whether there is a mapping relationship including a virtual address in the recorded mapping relationship, for example, in the ϋ. Address, address g gf^ in the record - If a mapping relationship exists, the mapping relationship is deleted first, and it is determined whether there is a physical address in the recorded physical address that is the same as the released virtual address. If yes, the physical address in the record is deleted, and the physical address is added to the physical address. The virtual address is matched with the physical address; otherwise, the released virtual address is added to the recorded virtual address, and then it is determined whether there is a virtual address in the recorded virtual address that is the same as the released physical address. , the virtual address in the record is deleted, and the virtual address is added to the record whose virtual address matches the physical address; otherwise, the released virtual address is added to the recorded physical address.
本发明实施例中, 由于控制器还可以记录, 虚拟地址为非空闲状态、 对应 的物理地址为空闲状态的空间的物理地址, 及记录虚拟地址为空闲状态、 对应 的物理地址为非空闲状态的空间的虚拟地址, 因此, 在释放空间 (释放虚拟地 址)后, 若与释放的虚拟地址相同的物理地址非空闲, 则控制器将释放的虚拟 地址添加到记录的虚拟地址中, 若与释放的物理地址(通过映射关系找到)相 同的虚拟地址为非空闲, 则控制器将释放的物理地址添加到记录的物理地址 中。  In the embodiment of the present invention, the controller may also record that the virtual address is a non-idle state, the physical address of the space where the corresponding physical address is an idle state, and the record virtual address is an idle state, and the corresponding physical address is a non-idle state. The virtual address of the space, therefore, after releasing the space (release the virtual address), if the same physical address as the released virtual address is not idle, the controller adds the released virtual address to the recorded virtual address, if released The physical address (found by the mapping relationship) is the same virtual address that is not idle, and the controller adds the released physical address to the recorded physical address.
进一步的, 客户端还可以读取数据, 向控制器发送数据访问请求, 数据访 问请求包括目标数据以及第一存储空间的虚拟地址; 控制器在接收到请求后,, 其中, 根据第一存储空间的虚拟地址获得第一存储空间的物理地址; 并根据第 一存储空间的物理地址访问目标数据, 其中, 根据第一存储空间的虚拟地址获 得第一存储空间的物理地址时, 可以先确定记录的映射关系中是否存在包括获 取到的虚拟地址的映射关系, 若是, 则根据映射关系确定物理地址, 否则, 确 定与获取到的虚拟地址相同的地址为物理地址。  Further, the client can also read the data, and send a data access request to the controller, where the data access request includes the target data and a virtual address of the first storage space; after receiving the request, the controller, according to the first storage space The virtual address obtains the physical address of the first storage space; and accesses the target data according to the physical address of the first storage space, wherein when the physical address of the first storage space is obtained according to the virtual address of the first storage space, the record may be determined first Whether a mapping relationship including the obtained virtual address exists in the mapping relationship, and if so, determining the physical address according to the mapping relationship; otherwise, determining that the same address as the obtained virtual address is a physical address.
例如, 第一存储设备为 100G, 分为 100个空间, 分别用 B0-B99进行标识 编号,其中, B10-B99空间中的每一个空间的虚拟地址和物理地址相同,其中, B0-B9空间中存储有数据。 由于 B0-B2的虚拟地址和物理地址不同, B3-B9的 虚拟地址和物理地址相同,则只需要分别记录 B0-B2的虚拟地址和物理地址的 ϋ . 3备 ϋ . ^^-i?^ R^-RQ ^ ^ ^ ^- . 卢 在 预读取 B2空间中的数据时, 先确定记录的 3条映射关系中是否存在包括 B2 的虚拟地址的映射关系, 由于记录的映射关系中存在包括 B2的虚拟地址的映 射关系, 因此, 从确定的物理地址对应的 B2空间中读取数据; 客户端在预从 B5空间中的数据时,先确定记录的 3条映射关系中是否存在包括 B5的虚拟地 址的映射关系,由于记录的映射关系中不存在包括 B5的虚拟地址的映射关系, 因此, 认为 B5的物理地址与虚拟地址相同, 因此, 从与 B5的虚拟地址相同 的物理地址对应的空间中读取数据。 For example, the first storage device is 100G, and is divided into 100 spaces, and is respectively identified by B0-B99. The virtual address and the physical address of each space in the B10-B99 space are the same, wherein the B0-B9 space is in the space. There is data stored. Since the virtual address and physical address of B0-B2 are different, and the virtual address and physical address of B3-B9 are the same, only the virtual address and physical address of B0-B2 need to be recorded separately. 3 ϋ . ^^-i?^ R^-RQ ^ ^ ^ ^- . Lu Zai When pre-reading the data in the B2 space, it is first determined whether there is a mapping relationship including the virtual address of B2 in the three mapping relationships recorded. Since the mapping relationship of the virtual address including B2 exists in the mapping relationship of the record, the determination is performed. The data is read in the B2 space corresponding to the physical address; when the client pre-fetches the data in the B5 space, it is determined whether there is a mapping relationship including the virtual address of the B5 in the three mapping relationships recorded, because of the mapping relationship in the record There is no mapping relationship including the virtual address of B5. Therefore, it is considered that the physical address of B5 is the same as the virtual address, and therefore, data is read from a space corresponding to the same physical address as the virtual address of B5.
为了更好地理解本发明实施例, 以下给出具体应用场景, 针对数据存储、 迁移及回迁的过程, 做出进一步详细描述, 具体如图 3所示(其中, 第一存储 器 A的存储空间中有 10个空间的物理地址为空闲的, 且 A0-A2空间的虚拟地 址和物理地址不相同, A3-A9空间的虚拟地址和物理地址相同 ):  For a better understanding of the embodiments of the present invention, a specific application scenario is given below, and a detailed description is given for the process of data storage, migration, and relocation, as shown in FIG. 3 (wherein the storage space of the first memory A is The physical address of 10 spaces is idle, and the virtual address and physical address of the A0-A2 space are different. The virtual address and physical address of the A3-A9 space are the same):
步骤 300: 控制器接收写数据请求;  Step 300: The controller receives a write data request.
该步骤中, 写数据请求包括目标数据以及目标数据的长度。  In this step, the write data request includes the target data and the length of the target data.
步骤 310: 控制器在 A中确定 AO为空闲的第一存储空间;  Step 310: The controller determines, in A, that the AO is the first storage space that is idle;
在该步骤中, AO空间的大小与目标数据的长度相同, 并且 AO空间的虚拟 地址与物理地址相同, 及虚拟地址是预先分配的。  In this step, the size of the AO space is the same as the length of the target data, and the virtual address of the AO space is the same as the physical address, and the virtual address is pre-allocated.
步骤 320: 控制器根据 AO空间的物理地址, 将目标数据写入 A0;  Step 320: The controller writes the target data to A0 according to the physical address of the AO space;
步骤 330: 控制器确定目标数据的冷热程度达到预设的阈值时, 将目标数 据从 A0待迁移至 B中的 B0空间;  Step 330: The controller determines to migrate the target data from A0 to the B0 space in B when the controller determines that the hot and cold degree of the target data reaches a preset threshold.
在该步骤中, B0空间的长度与目标数据的长度相同, 且 B0空间的虚拟地 址与物理地址相同;  In this step, the length of the B0 space is the same as the length of the target data, and the virtual address of the B0 space is the same as the physical address;
步骤 340:控制器建立 A0空间的虚拟地址与 B0空间的物理地址之间的映 射关系;  Step 340: The controller establishes a mapping relationship between the virtual address of the A0 space and the physical address of the B0 space.
步骤 350: 控制器根据映射关系, 将目标数据从 A0空间待迁移至 B中的 B0空间; 步骤 370: 控制器确定目标数据的冷热程度低于预设的阈值时, 确定 AO 空间空闲时, 将目标数据回迁至 AO空间, 并删除 AO空间的虚拟地址与 B0空 间的物理地址之间的映射关系。 Step 350: The controller moves the target data from the A0 space to the B0 space in B according to the mapping relationship. Step 370: When the controller determines that the degree of coldness and heat of the target data is lower than a preset threshold, when determining that the AO space is idle, the target data is moved back to the AO space, and the virtual address of the AO space and the physical address of the B0 space are deleted. Mapping relations.
参阅图 4所示, 本发明实施例还提供一种存储设备, 具体包括:  Referring to FIG. 4, an embodiment of the present invention further provides a storage device, which specifically includes:
控制器 40和第一存储器 41 , 控制器 40还包括:  The controller 40 and the first memory 41, the controller 40 further includes:
接收单元 400, 用于接收写数据请求, 写数据请求包括目标数据以及目标 数据的长度;  The receiving unit 400 is configured to receive a write data request, where the write data request includes the target data and a length of the target data;
查找单元 410, 用于在第一存储器中查找空闲的第一存储空间, 第一存储 空间的大小与目标数据的长度相同, 并且第一存储空间的虚拟地址与第一存储 空间的物理地址相同, 第一存储空间的虚拟地址是预先分配的;  The searching unit 410 is configured to search for a free first storage space in the first memory, where the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space. The virtual address of the first storage space is pre-allocated;
写入单元 420, 用于根据第一存储空间的物理地址, 将目标数据写入第一 存储空间。  The writing unit 420 is configured to write the target data into the first storage space according to the physical address of the first storage space.
进一步的, 本发明实施例中, 存储设备还包括第二存储器 42, 第二存储器 42的存储性能与第一存储器 41不同, 控制器 40还包括:  Further, in the embodiment of the present invention, the storage device further includes a second memory 42, the storage performance of the second memory 42 is different from that of the first memory 41, and the controller 40 further includes:
监控单元 430, 用于监控目标数据的冷热程度; 当目标数据的冷热程度达 到预设的阈值时,根据目标数据的长度在第二存储器中查找与目标数据的长度 相同的空闲的第二存储空间, 第二存储空间的虚拟地址与第二存储空间的物理 地址相同;  The monitoring unit 430 is configured to monitor the degree of coldness and heat of the target data. When the degree of cold and heat of the target data reaches a preset threshold, the second memory is searched for the second idle length that is the same as the length of the target data according to the length of the target data. Storage space, the virtual address of the second storage space is the same as the physical address of the second storage space;
映射建立单元 440, 用于建立第一存储空间的虚拟地址与第二存储空间的 物理地址之间的映射关系;  a mapping establishing unit 440, configured to establish a mapping relationship between a virtual address of the first storage space and a physical address of the second storage space;
迁移单元 450, 用于根据映射关系, 将目标数据从第一存储器迁移至第二 存储器的空闲的存储空间中。  The migration unit 450 is configured to migrate the target data from the first storage to the idle storage space of the second storage according to the mapping relationship.
进一步的, 本发明实施例中, 迁移单元 450还用于: 记录第一存储空间的 物理地址。  Further, in the embodiment of the present invention, the migration unit 450 is further configured to: record a physical address of the first storage space.
进一步的, 本发明实施例中, 迁移单元 450还用于: 当目标数据的冷热程 唐低千 日十. 報: 第一 储 1¾Ί 物 目^;翁 £千 至第一存储器的存储空间中。 Further, in the embodiment of the present invention, the migration unit 450 is further configured to: when the cold and hot course of the target data is low and thousands of days. Report: the first storage 13⁄4Ί object ^; Weng Qian To the storage space of the first memory.
进一步的, 本发明实施例中, 迁移单元 450还用于: 记录第二存储空间的 虚拟地址。  Further, in the embodiment of the present invention, the migration unit 450 is further configured to: record a virtual address of the second storage space.
进一步的, 本发明实施例中, 迁移单元 450还用于: 根据第二存储空间的 虚拟地址, 释放第二存储空间。  Further, in the embodiment of the present invention, the migration unit 450 is further configured to: release the second storage space according to the virtual address of the second storage space.
本发明实施例中,控制器 40还包括读取单元 460,用于接收数据访问请求, 数据访问请求包括目标数据以及第一存储空间的虚拟地址; 根据第一存储空间 的虚拟地址获得第一存储空间的物理地址; 根据第一存储空间的物理地址访问 目标数据。  In the embodiment of the present invention, the controller 40 further includes a reading unit 460, configured to receive a data access request, where the data access request includes the target data and a virtual address of the first storage space; and obtain the first storage according to the virtual address of the first storage space. The physical address of the space; accesses the target data according to the physical address of the first storage space.
如图 5所示, 为本发明实施例提供的另一种存储设备的结构图, 存储设备 包括至少一个存储器 501 ,通信总线 502,控制器 503以及至少一个通信接口 504。  As shown in FIG. 5, it is a structural diagram of another storage device according to an embodiment of the present invention. The storage device includes at least one memory 501, a communication bus 502, a controller 503, and at least one communication interface 504.
其中, 通信总线 502用于实现上述组件之间的连接并通信, 通信接口 504用 于与外部设备连接并通信。  The communication bus 502 is used to implement the connection and communication between the above components, and the communication interface 504 is used to connect and communicate with external devices.
其中, 存储器 501用于存储需要执行的程序代码, 这些程序代码具体可以 包括: 接收单元 5011、 查找单元 5012、 写入单元 5013 , 当上述单元被控制器 503 执行时, 实现如下功能:  The memory 501 is configured to store program code to be executed. The program code may include: a receiving unit 5011, a searching unit 5012, and a writing unit 5013. When the unit is executed by the controller 503, the following functions are implemented:
接收单元 5011 ,用于接收写数据请求, 写数据请求包括目标数据以及目标 数据的长度;  The receiving unit 5011 is configured to receive a write data request, where the write data request includes the target data and the length of the target data;
查找单元 5012,用于在第一存储器中查找空闲的第一存储空间,第一存储 空间的大小与目标数据的长度相同, 并且第一存储空间的虚拟地址与第一存储 空间的物理地址相同, 第一存储空间的虚拟地址是预先分配的;  The searching unit 5012 is configured to search, in the first memory, the idle first storage space, where the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space. The virtual address of the first storage space is pre-allocated;
写入单元 5013 ,用于根据第一存储空间的物理地址,将目标数据写入第一 存储空间。  The writing unit 5013 is configured to write the target data into the first storage space according to the physical address of the first storage space.
综上所述, 本发明实施例中, 在存储数据时, 将存储数据的存储空间的虚 拟地址预设成该空间的物理地址相同, 不需要记录该存储空间的虚拟地址和物 0i ^^ ^ ^ . 有在 物 J 址 § l 1 拟 用日 . 給 储 间分配与物理地址不相同的虚拟地址, 此时才需要记录虚拟地址和物理地址的 映射关系, 因此, 记录的映射关系较少, 具体方法为: 接收写数据请求, 写数 据请求包括目标数据以及目标数据的长度; 在第一存储器中查找空闲的第一存 储空间, 第一存储空间的大小与目标数据的长度相同, 并且第一存储空间的虚 拟地址与第一存储空间的物理地址相同, 第一存储空间的虚拟地址是预先分配 的; 根据第一存储空间的物理地址, 将目标数据写入第一存储空间, 由于记录 的映射关系少了, 在根据虚拟地址确定物理地址时, 需要查询的映射关系就少 了, 因此, 不仅降低了对映射关系的记录, 还提高了查询效率。 In summary, in the embodiment of the present invention, when storing data, the virtual address of the storage space storing the data is preset to be the same as the physical address of the space, and the virtual address and the object of the storage space need not be recorded. ^ . There is a date in the object J § l 1 The virtual address is not the same as the physical address. In this case, the mapping between the virtual address and the physical address needs to be recorded. Therefore, the mapping relationship is less. The specific method is as follows: receiving the write data request, writing the data request including the target data, and Length of the target data; searching for the first storage space that is free in the first memory, the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space, The virtual address of a storage space is pre-allocated; according to the physical address of the first storage space, the target data is written into the first storage space, and since the mapping relationship of the record is small, when the physical address is determined according to the virtual address, the query is required. The mapping relationship is less, therefore, not only reduces the record of the mapping relationship, but also improves the query efficiency.
本发明是参照根据本发明实施例的方法、 设备(系统) 、 和计算机程序产 品的流程图和 /或方框图来描述的。应理解可由计算机程序指令实现流程图和 /或方框图中的每一流程和 /或方框、 以及流程图和 /或方框图中的流程和 / 或方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入 式处理机或其它可编程数据处理设备的处理器以产生一个机器,使得通过计算 个流程或多个流程和 /或方框图一个方框或多个方框中的功能的装置。  The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowcharts and/or block diagrams, and combinations of flow and/or blocks in the flowcharts and/or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, a special purpose computer, an embedded processor or other programmable data processing device to produce a machine such that a block or more is calculated by computing a flow or processes and/or block diagrams The function of the device in the box.
这些计算机程序指令也可存储在能引导计算机或其它可编程数据处理设 备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中 的指令产生包括指令装置的制造品, 该指令装置实现在流程图一个流程或多个 流程和 /或方框图一个方框或多个方框中的功能。  The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus functions in one or more blocks of a flow or a flow diagram and/or block diagram of a flowchart.
这些计算机程序指令也可装载到计算机或其它可编程数据处理设备上,使 得在计算机或其它可编程设备上执行一系列操作步骤以产生计算机实现的处 理,从而在计算机或其它可编程设备上执行的指令提供用于实现在流程图一个 流程或多个流程和 /或方框图一个方框或多个方框中的功能的步骤。  These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions in one or more blocks of the flowchart or in a flow or block of the flowchart.
尽管已描述了本发明的上述实施例,但本领域内的技术人员一旦得知了基 本创造性概念, 则可对这些实施例作出另外的变更和修改。 所以, 所附权利要 炎音欲解释 h i术 ^ 以 ¾:入太 日 n闱 ^所有 倏 ^ . 离本发明实施例的精神和范围。 这样, 倘若本发明实施例的这些修改和变型属 于本发明权利要求及其等同技术的范围之内, 则本发明也意图包含这些改动和 变型在内。 Although the above-described embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to the embodiments once they are aware of the basic inventive concept. Therefore, the attached right to the sound of the desire to explain hi surgery ^ to 3⁄4: into the sun n闱 ^ all 倏 ^. The spirit and scope of the embodiments of the present invention. Thus, it is intended that the present invention cover the modifications and modifications of the embodiments of the invention.

Claims

权利要求 Rights request
1、 一种数据存储方法, 所述数据存储方法应用在存储设备中, 所述存 储设备包括控制器和第一存储器, 其特征在于, 所述方法包括: 1. A data storage method, the data storage method is applied in a storage device, the storage device includes a controller and a first memory, characterized in that the method includes:
接收写数据请求, 所述写数据请求包括目标数据以及所述目标数据的 长度; Receive a write data request, the write data request including target data and the length of the target data;
在第一存储器中查找空闲的第一存储空间, 所述第一存储空间的大小 与所述目标数据的长度相同, 并且所述第一存储空间的虚拟地址与第一存 储空间的物理地址相同, 所述第一存储空间的虚拟地址是预先分配的; 根据所述第一存储空间的物理地址, 将所述目标数据写入所述第一存 储空间。 Searching for a free first storage space in the first memory, the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the physical address of the first storage space, The virtual address of the first storage space is allocated in advance; the target data is written into the first storage space according to the physical address of the first storage space.
2、 根据权利要求 1所述的方法, 其特征在于, 所述存储设备还包括第 二存储器, 所述第二存储器的存储性能与所述第一存储器不同, 所述方法 还包括: 2. The method according to claim 1, wherein the storage device further includes a second memory, and the storage performance of the second memory is different from that of the first memory. The method further includes:
监控所述目标数据的冷热程度; Monitor the hotness and coldness of the target data;
当所述目标数据的冷热程度达到预设的阈值时, 根据所述目标数据的 长度在所述第二存储器中查找与所述目标数据的长度相同的空闲的第二存 储空间, 所述第二存储空间的虚拟地址与所述第二存储空间的物理地址相 同; When the degree of hotness and coldness of the target data reaches a preset threshold, a free second storage space that is the same length as the target data is searched for in the second memory according to the length of the target data, and the third The virtual address of the second storage space is the same as the physical address of the second storage space;
建立所述第一存储空间的虚拟地址与第二存储空间的物理地址之间的 映射关系; Establish a mapping relationship between the virtual address of the first storage space and the physical address of the second storage space;
根据所述映射关系, 将所述目标数据从所述第一存储器迁移至所述第 二存储器的所述空闲的存储空间中。 According to the mapping relationship, the target data is migrated from the first memory to the free storage space of the second memory.
3、 根据权利要求 2所述的方法, 其特征在于, 所述方法还包括: 记录所述第一存储空间的物理地址。 3. The method according to claim 2, wherein the method further includes: recording the physical address of the first storage space.
4、 根据权利要求 3所述的方法, 其特征在于, 所述方法还包括: 当所述目标数据的冷热程度低于所述预设的阈值时, 根据所述记录的 第一存储空间的物理地址, 将所述目标数据迁移至所述第一存储器的存储 空间中。 4. The method according to claim 3, characterized in that, the method further includes: when the hot and cold degree of the target data is lower than the preset threshold, according to the recorded The physical address of the first storage space is used to migrate the target data to the storage space of the first memory.
5、 根据权利要求 2-4任一权利要求所述的方法, 其特征在于, 所述方 法还包括: 5. The method according to any one of claims 2 to 4, characterized in that, the method further includes:
记录所述第二存储空间的虚拟地址。 Record the virtual address of the second storage space.
6、 根据权利要求 5所述的方法, 其特征在于, 所述方法还包括: 根据所述第二存储空间的虚拟地址, 释放所述第二存储空间。 6. The method according to claim 5, wherein the method further includes: releasing the second storage space according to the virtual address of the second storage space.
7、 根据权利要求 2所述的方法, 其特征在于, 所述方法还包括: 接收数据访问请求, 所述数据访问请求包括所述目标数据以及所述第 一存储空间的虚拟地址; 7. The method according to claim 2, wherein the method further includes: receiving a data access request, the data access request including the target data and the virtual address of the first storage space;
根据所述第一存储空间的虚拟地址获得所述第一存储空间的物理地 址; Obtain the physical address of the first storage space according to the virtual address of the first storage space;
根据所述第一存储空间的物理地址访问所述目标数据。 Access the target data according to the physical address of the first storage space.
8、 一种存储设备, 所述存储设备包括控制器和第一存储器, 其特征在 于, 所述控制器包括: 8. A storage device, the storage device includes a controller and a first memory, characterized in that the controller includes:
接收单元, 用于接收写数据请求, 所述写数据请求包括目标数据以及 所述目标数据的长度; A receiving unit configured to receive a write data request, where the write data request includes target data and the length of the target data;
查找单元, 用于在第一存储器中查找空闲的第一存储空间, 所述第一 存储空间的大小与所述目标数据的长度相同, 并且所述第一存储空间的虚 拟地址与第一存储空间的物理地址相同, 所述第一存储空间的虚拟地址是 预先分配的; A search unit configured to search for a free first storage space in the first memory, where the size of the first storage space is the same as the length of the target data, and the virtual address of the first storage space is the same as the first storage space. have the same physical address, and the virtual address of the first storage space is pre-allocated;
写入单元, 用于根据所述第一存储空间的物理地址, 将所述目标数据 写入所述第一存储空间。 A writing unit, configured to write the target data into the first storage space according to the physical address of the first storage space.
9、 根据权利要求 8所述的存储设备, 其特征在于, 所述存储设备还包 括第二存储器, 所述第二存储器的存储性能与所述第一存储器不同, 所述 控制器还包括: 监控单元, 用于监控所述目标数据的冷热程度; 当所述目标数据的冷 热程度达到预设的阈值时, 根据所述目标数据的长度在所述第二存储器中 查找与所述目标数据的长度相同的空闲的第二存储空间, 所述第二存储空 间的虚拟地址与所述第二存储空间的物理地址相同; 9. The storage device according to claim 8, wherein the storage device further includes a second memory, the storage performance of the second memory is different from that of the first memory, and the controller further includes: A monitoring unit configured to monitor the hot and cold degree of the target data; when the hot and cold degree of the target data reaches a preset threshold, search the second memory for the target data according to the length of the target data. A free second storage space with the same length of data, and the virtual address of the second storage space is the same as the physical address of the second storage space;
映射建立单元, 用于建立所述第一存储空间的虚拟地址与第二存储空 间的物理地址之间的映射关系; A mapping establishment unit configured to establish a mapping relationship between the virtual address of the first storage space and the physical address of the second storage space;
迁移单元, 用于根据所述映射关系, 将所述目标数据从所述第一存储 器迁移至所述第二存储器的所述空闲的存储空间中。 A migration unit, configured to migrate the target data from the first memory to the free storage space of the second memory according to the mapping relationship.
10、 根据权利要求 9所述的存储设备, 其特征在于, 所述迁移单元还 用于: 10. The storage device according to claim 9, characterized in that the migration unit is also used for:
记录所述第一存储空间的物理地址。 Record the physical address of the first storage space.
11、 根据权利要求 10所述的存储设备, 其特征在于, 所述迁移单元还 用于: 11. The storage device according to claim 10, characterized in that the migration unit is also used for:
当所述目标数据的冷热程度低于所述预设的阈值时, 根据所述记录的 第一存储空间的物理地址, 将所述目标数据迁移至所述第一存储器的存储 空间中。 When the hot and cold degree of the target data is lower than the preset threshold, the target data is migrated to the storage space of the first memory according to the recorded physical address of the first storage space.
12、 根据权利要求 9-11任一权利要求所述的存储设备, 其特征在于, 所述迁移单元还用于: 12. The storage device according to any one of claims 9-11, characterized in that the migration unit is also used for:
记录所述第二存储空间的虚拟地址。 Record the virtual address of the second storage space.
13、 根据权利要求 12所述的存储设备, 其特征在于, 所述迁移单元还 用于: 13. The storage device according to claim 12, characterized in that the migration unit is also used for:
根据所述第二存储空间的虚拟地址, 释放所述第二存储空间。 The second storage space is released according to the virtual address of the second storage space.
14、 根据权利要求 9所述的存储设备, 其特征在于, 所述存储设备 还包括读取单元, 用于接收数据访问请求, 所述数据访问请求包括所述 目标数据以及所述第一存储空间的虚拟地址; 根据所述第一存储空间的 虚拟地址获得所述第一存储空间的物理地址; 根据所述第一存储空间的 物理地址访问所述目标数据。 14. The storage device according to claim 9, wherein the storage device further includes a reading unit configured to receive a data access request, the data access request including the target data and the first storage space. the virtual address of the first storage space; obtain the physical address of the first storage space according to the virtual address of the first storage space; obtain the physical address of the first storage space according to the The physical address accesses the target data.
PCT/CN2014/071240 2013-08-12 2014-01-23 Data storage method and apparatus WO2015021755A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310350179.9 2013-08-12
CN201310350179.9A CN103440208B (en) 2013-08-12 2013-08-12 A kind of method that data store and device

Publications (1)

Publication Number Publication Date
WO2015021755A1 true WO2015021755A1 (en) 2015-02-19

Family

ID=49693899

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/071240 WO2015021755A1 (en) 2013-08-12 2014-01-23 Data storage method and apparatus

Country Status (2)

Country Link
CN (1) CN103440208B (en)
WO (1) WO2015021755A1 (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103440208B (en) * 2013-08-12 2016-02-03 华为技术有限公司 A kind of method that data store and device
CN108231109B (en) * 2014-06-09 2021-01-29 华为技术有限公司 Method, device and system for refreshing Dynamic Random Access Memory (DRAM)
US9158681B1 (en) * 2014-09-02 2015-10-13 Sandisk Technologies Inc. Process and apparatus to reduce declared capacity of a storage device by conditionally trimming
GB2541038B (en) * 2014-12-23 2019-01-16 Intel Corp Apparatus and method for managing a virtual graphics processor unit (VGPU)
CN106326140B (en) * 2015-06-30 2020-06-02 华为技术有限公司 Data copying method, direct memory access controller and computer system
CN105487817B (en) * 2015-11-26 2019-09-10 上海新储集成电路有限公司 A kind of customizable data storage method and system
CN106020717B (en) * 2016-05-05 2020-10-27 联想(北京)有限公司 Data processing method and electronic equipment
US10877885B2 (en) 2016-06-30 2020-12-29 Huawei Technologies Co., Ltd. Electronic device data operation method and electronic device for improved electronic device storage
CN107092439B (en) * 2017-03-07 2020-02-21 华为技术有限公司 Data storage method and equipment
CN107483893B (en) * 2017-09-08 2020-07-07 中国地质大学(武汉) Multi-point collaborative updating and storing method and system for smart city video data
CN111241090B (en) * 2019-12-23 2023-11-10 华为技术有限公司 Method and device for managing data index in storage system
CN114860163B (en) * 2020-04-28 2023-08-22 华为技术有限公司 Storage system, memory management method and management node
CN114185818B (en) * 2022-02-15 2022-08-02 摩尔线程智能科技(北京)有限责任公司 GPU (graphics processing Unit) memory access self-adaptive optimization method and device based on extended page table

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008922A (en) * 2007-01-26 2007-08-01 浙江大学 Segmentation and paging data storage space management method facing heterogeneous polynuclear system
US7877524B1 (en) * 2007-11-23 2011-01-25 Pmc-Sierra Us, Inc. Logical address direct memory access with multiple concurrent physical ports and internal switching
US8443167B1 (en) * 2009-12-16 2013-05-14 Western Digital Technologies, Inc. Data storage device employing a run-length mapping table and a single address mapping table
CN103440208A (en) * 2013-08-12 2013-12-11 华为技术有限公司 Data storage method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008922A (en) * 2007-01-26 2007-08-01 浙江大学 Segmentation and paging data storage space management method facing heterogeneous polynuclear system
US7877524B1 (en) * 2007-11-23 2011-01-25 Pmc-Sierra Us, Inc. Logical address direct memory access with multiple concurrent physical ports and internal switching
US8443167B1 (en) * 2009-12-16 2013-05-14 Western Digital Technologies, Inc. Data storage device employing a run-length mapping table and a single address mapping table
CN103440208A (en) * 2013-08-12 2013-12-11 华为技术有限公司 Data storage method and device

Also Published As

Publication number Publication date
CN103440208A (en) 2013-12-11
CN103440208B (en) 2016-02-03

Similar Documents

Publication Publication Date Title
WO2015021755A1 (en) Data storage method and apparatus
US10324832B2 (en) Address based multi-stream storage device access
US9292217B2 (en) Logical volume space sharing
US9817765B2 (en) Dynamic hierarchical memory cache awareness within a storage system
EP2791796B1 (en) Dynamic storage tiering in a virtual environment
US8966188B1 (en) RAM utilization in a virtual environment
CN107111452B (en) Data migration method and device applied to computer system and computer system
WO2015014109A1 (en) Method for processing input/output request, host, server, and virtual machine
US8001323B2 (en) Network storage system, management method therefor, and control program product therefor
WO2017107414A1 (en) File operation method and device
WO2016026433A1 (en) Data processing method and data processing apparatus
CN109804359A (en) For the system and method by write back data to storage equipment
WO2017148242A1 (en) Method for accessing shingled magnetic recording (smr) hard disk, and server
WO2014089828A1 (en) Method for accessing storage device and storage device
US20130110308A1 (en) Information Handling System Storage Device Management Information Access
TW202101227A (en) Apparatus and method and computer program product for handling flash physical-resource sets
WO2016115920A1 (en) Storage management method and apparatus and streaming media system
TW202015044A (en) Data management method and storage controller using the same
WO2021062982A1 (en) Method and apparatus for managing hmb memory, and computer device and storage medium
WO2019120226A1 (en) Data access prediction method and apparatus
US20220413729A1 (en) Tiered Storage System with Defragmentation Based on Weighted Flash Fragmentation Factor
WO2016206070A1 (en) File updating method and storage device
WO2014190700A1 (en) Method of memory access, buffer scheduler and memory module
TW202141280A (en) Method and apparatus and computer program product for managing data storage
TWI553478B (en) Device capable of using external volatile memory and device capable of releasing internal volatile memory

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14836231

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14836231

Country of ref document: EP

Kind code of ref document: A1