WO2016095103A1 - 存储空间管理方法及装置 - Google Patents

存储空间管理方法及装置 Download PDF

Info

Publication number
WO2016095103A1
WO2016095103A1 PCT/CN2014/093948 CN2014093948W WO2016095103A1 WO 2016095103 A1 WO2016095103 A1 WO 2016095103A1 CN 2014093948 W CN2014093948 W CN 2014093948W WO 2016095103 A1 WO2016095103 A1 WO 2016095103A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
nvm
storage space
lbp
feature
Prior art date
Application number
PCT/CN2014/093948
Other languages
English (en)
French (fr)
Inventor
薛常亮
黄文龙
朱冠宇
徐君
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201480045225.7A priority Critical patent/CN105900082B/zh
Priority to PCT/CN2014/093948 priority patent/WO2016095103A1/zh
Priority to EP14908138.2A priority patent/EP3223167B1/en
Publication of WO2016095103A1 publication Critical patent/WO2016095103A1/zh
Priority to US15/625,385 priority patent/US10261715B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the embodiments of the present invention relate to information storage technologies, and in particular, to a storage space management method and apparatus.
  • Non-Volatile Memory NVM
  • NVM non-volatile Memory
  • NVM has the same read/write performance, byte-addressable, and bit-by-bit rewrite capability as dynamic random access memory (English: Dynamic Random Access Memory, DRAM). At the same time, NVM also features greater storage density and capacity, as well as data loss without loss. However, some NVMs still have the problem of short service life and large wear, that is, frequent write operations cause damage to physical blocks in the NVM, which in turn invalidates the NVM. In addition, NVM also has a phenomenon that the write operation consumes too much energy.
  • Embodiments of the present invention provide a storage space management method and apparatus to reduce the power consumption of a write operation while extending the service life of the NVM.
  • an embodiment of the present invention provides a storage space management method, where the method is applied to a non-volatile memory NVM, including:
  • a feature set of the storage space of the NVM Determining, in a feature set of the storage space of the NVM, a first image feature having the highest similarity with an image feature of the data, wherein the feature set includes a free block in a storage space according to the NVM
  • M image features the size of each free block in the storage space is the same as the size of the data, and the free block includes an invalid data block in the storage space of the NVM and an area in which data is not written,
  • the M is the number of free blocks in the storage space of the NVM, and M is a natural number;
  • the data is written into a free block having the first image feature.
  • the determining, in the feature set of the storage space of the NVM, the first image feature having the highest similarity with the image feature of the data Previously the method further includes:
  • the image features of the M free blocks in the storage space of the NVM are separately calculated.
  • the calculating the image features of the M free blocks in the storage space of the NVM separately includes:
  • the acquiring an image feature of the data to be written into the NVM includes:
  • the feature set includes a plurality of B+ trees, and the nodes of the multiple B+ trees are configured by the NVM Forming, by the M image features of the free block in the storage space, the determining, in the feature set of the storage space of the NVM, the first image feature having the highest similarity with the image feature of the data, including:
  • a first image feature that determines that the Euclidean distance from the image feature of the data is the smallest is the first image feature that is most similar to the image feature of the data.
  • any one of the possible implementations of the first to fourth possible implementations of the first aspect in a fifth possible implementation manner of the first aspect, After entering the free block having the first image feature, the method further includes:
  • the status of the free block with the first image feature is marked as used.
  • any one of the possible implementation manners of the first to fifth possible implementation manners of the first aspect, in a sixth possible implementation manner of the first aspect, the method further includes:
  • an embodiment of the present invention provides a storage space management apparatus, where the apparatus is applied to a non-volatile memory NVM, including:
  • An obtaining module configured to acquire image features of data to be written into the NVM
  • a determining module configured to determine, in a feature set of the storage space of the NVM, a first image feature having the highest similarity with an image feature of the data acquired by the acquiring module, where the feature set includes According to the M image features obtained by the free block in the storage space of the NVM, the size of each free block in the storage space is the same as the size of the data, and the free block includes the storage space of the NVM.
  • a management module configured to write the data into a free block having the first image feature determined by the determining module.
  • the acquiring module is further configured to:
  • the image features of the M free blocks in the storage space of the NVM are separately calculated.
  • the acquiring module is configured to separately calculate M idles in a storage space of the NVM
  • the image characteristics of the block are specifically:
  • the acquiring module is configured to acquire image features of data to be written into the NVM, specifically:
  • the feature set includes a plurality of B+ trees, and the nodes of the multiple B+ trees are configured by the NVM
  • the M image features of the free block in the storage space are formed, and the determining module is specifically configured to:
  • a first image feature that determines that the Euclidean distance from the image feature of the data is the smallest is the first image feature that is most similar to the image feature of the data.
  • the state of the free block marked with the first image feature is used.
  • the management module is further used to :
  • the acquiring module is further configured to acquire the image feature of the recovered invalid data block, where the invalid data block is the NVM And storing, in the storage space, a block in which the data stored in the data block is in an invalid state; and updating the feature set of the storage space of the NVM according to the image feature of the invalid data block.
  • the idle block with high similarity to the image feature of the data to be written into the NVM is determined for writing the data, so that the data is written.
  • the problem of wear and energy consumption is taken into account when the storage space is allocated, and the write operation energy consumption of the free block in the storage space of the NVM can be reduced, thereby reducing the power consumption of the write operation while expanding the service life of the NVM.
  • FIG. 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram of another application scenario according to an embodiment of the present disclosure.
  • FIG. 3 is a schematic flowchart of a storage space management method according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of an LBP operator extraction in another storage space management method according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of an example of a B+ tree index in another storage space management method according to an embodiment of the present disclosure
  • FIG. 6 is a schematic flowchart diagram of still another storage space management method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic flowchart of Embodiment 4 of a storage space management method according to an embodiment of the present disclosure
  • FIG. 8 is a schematic structural diagram of a storage space management apparatus according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic diagram of still another application scenario according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram of another storage space management apparatus according to an embodiment of the present invention.
  • NVM Phase Change Memory
  • PCM Phase Change Memory
  • RRAM Resistive Random Access Memory
  • MRAM Magnetic Random Access Memory
  • the embodiments of the present invention are directed to improvements and innovations in storage space allocation and management of NVM for future NVM-oriented file systems.
  • the idle block with high similarity to the image feature of the data to be written into the NVM is determined for writing the data, so that the data is written.
  • the problem of wear and energy consumption is taken into account when the storage space is allocated, and the write operation energy consumption of the free block in the storage space of the NVM can be reduced, thereby reducing the power consumption of the write operation while expanding the service life of the NVM.
  • the NVM is used as an external memory.
  • the application scenario includes a host, memory, multiple channels of NVM, and an NVM controller.
  • the central processing unit (English: Central Processing Unit, CPU for short) reads and writes data in the NVM through the NVM controller.
  • the single-machine or server chassis 20 includes a bottom plate 21 on which a chip such as a south bridge 211, a central processing unit 212, and a memory 213 are mounted for use with other expansion cards (for example).
  • the expansion card 22 and the expansion card 23) shown in FIG. 1 are controlled to implement the function of the host;
  • the NVM controller (not shown in FIG. 1) is also a chip, such as a field programmable gate array (English: Field-Programmable Gate) Array (abbreviation: FPGA) and Application Specific Integrated Circuit (ASIC), etc., through the programming of the NVM controller to complete the read and write requests of the receiving host, and various access and control of the NVM.
  • FPGA Field-Programmable Gate
  • ASIC Application Specific Integrated Circuit
  • the corresponding chip of the NVM controller can be set on a printed circuit board (English: Printed Circuit Board, PCB for short) on each printed circuit board (PCB).
  • the final form is an NVM device box, that is, Figure 1
  • the NVM chip and the NVM controller may be formed as an expansion card, and connected to the backplane 21 via a bus and interface standard (English: Peripheral Component Interface Express, PCIe) interface 25.
  • the NVM is directly mounted to the memory bus.
  • the application scenario includes a host, memory, multiple channels of NVM, and an NVM controller.
  • the host CPU reads and writes data in the NVM through the NVM controller.
  • the single-machine or server chassis 20 includes a bottom plate 21 on which a chip such as a south bridge 211, a central processing unit 212, and a memory 213 are mounted for use with other expansion cards (for example, as shown in FIG. 2).
  • the expansion card 22 and the expansion card 23) are controlled to implement the functions of the host;
  • the NVM controller (not shown in FIG. 2) is also a chip, such as an FPGA and an ASIC, and the receiving host is programmed by programming the NVM controller. Read and write requests and various accesses and controls for NVM.
  • the corresponding chip of the NVM controller can be set on a PCB with each NVM and connected through PCB traces.
  • the final form is an NVM dual in-line memory module (English: Dual-Inline Memory Modules, DIMM for short).
  • the NVM 214 shown in FIG. 2 is connected to a central processing unit (CPU) 212 via a memory bus.
  • CPU central processing unit
  • FIG. 3 is a schematic flowchart diagram of a storage space management method according to an embodiment of the present invention.
  • the embodiment of the present invention provides a storage space management method, which is applied to an NVM, wherein the NVM of the embodiment of the present invention can address by byte (Byte), and write data in units of bits (bits).
  • the method may be performed by a storage space management device, and the device may be independently configured or integrated in a communication device, wherein the communication device may be any terminal device such as a desktop computer, a notebook computer, or a server.
  • the method includes:
  • each data to be written to the NVM filled with '0' and/or '1' can be regarded as It is a black and white image, so the image features of the data to be written to the NVM can be extracted.
  • the data to be written into the NVM may be the original data to be written, or the data obtained after the original data to be written is subjected to the segmentation process, or the data obtained after the original data to be written is zero-padded.
  • the invention is not limited.
  • the feature set includes M image features obtained according to the free blocks in the storage space of the NVM.
  • the size of each free block in the storage space is the same as the size of the above data.
  • the free block may include an invalid data block in the storage space of the NVM and an area in which data is not written, M is the number of free blocks in the storage space of the NVM, and M is a natural number.
  • the first image feature is one of the M image features obtained by the free block in the storage space of the NVM.
  • the free block having the highest similarity with the image feature of the above data can be determined by querying the feature set of the storage space.
  • the structure of the feature set of the storage space is not limited in the embodiment of the present invention.
  • NVM of the embodiment of the present invention can address in Bytes, data is written in a non-volatile storage medium in units of bits, and therefore, the above data is compared bit by bit and has the first image feature.
  • the idle block with high similarity to the image feature of the data to be written into the NVM is determined for writing the data, so that the data is written.
  • the problem of wear and energy consumption is taken into account when the storage space is allocated, and the write operation energy consumption of the free block in the storage space of the NVM can be reduced, thereby reducing the power consumption of the write operation while expanding the service life of the NVM.
  • the method may further include: respectively calculating image features of the M free blocks in the storage space of the NVM.
  • the NVM is composed of physical blocks including free blocks.
  • the storage space of the NVM is allocated and managed, that is, the physical blocks of the NVM are allocated and managed.
  • image features of all physical blocks in the NVM may be extracted, or only image features of the free blocks may be extracted. But consider all the image features of a physical block as a whole.
  • separately calculating the image features of the M free blocks in the storage space of the NVM may include: traversing the free block i in the storage space of the NVM by using a preset window, and obtaining a local binary mode of the free block i.
  • LBP Local Binary Pattern, abbreviated as: LBP
  • X i (LBP i1 , LBP i2 , . . . , LBP iN ), where N is determined according to the size of the free block i and the size of the preset window LBP in is the LBP operator corresponding to each preset window in the free block i.
  • the LBP operator is a traditional feature extraction operator with high efficiency and fast computing speed.
  • the LBP operator is in a preset window of 3*3 size, and the 8-bit binary number generated by clockwise sorting around 8 points of the center point is converted into a decimal number and encoded.
  • Called LBP operator code ie
  • the embodiment of the present invention incorporates the percentage of '0' and '1' in the image feature description of the free block. , ie, P i , represents the ratio of '0' to '1' in the free block i.
  • the corresponding image features are extracted according to the above method for all the free blocks in the storage space, and the feature set including the image features of all the free blocks is obtained, and the feature set is as follows:
  • P represents the ratio of the number of bits occupied by 0 and 1 in the data to be written to the NVM.
  • a B+ tree is established based directly on the image characteristics of each free block.
  • establishing a feature set of the storage space of the NVM may include: performing clustering processing on image features of all the free blocks in the NVM by using a K-means clustering algorithm to form a K
  • the Euclidean distance of the image feature of each free block in the class to the reference point is calculated;
  • the B+ tree is constructed according to the Euclidean distance.
  • the number of B+ trees is K.
  • the implementation is more efficient and more targeted when determining the first image feature with the highest similarity to the image features of the above data.
  • the feature set may include a plurality of B+ trees (not limited to K), and the nodes of the plurality of B+ trees are composed of M image features of the free blocks in the storage space of the NVM.
  • S302 may include: determining a first B+ tree according to an Euclidean distance from an image feature of the data to a root node of each B+ tree in the plurality of B+ trees, wherein the first B+ tree is a B+ tree a B+ tree with a minimum Euclidean distance from the root node to the image feature of the above data; calculating an image feature of the data and an Euclidean distance of each node in the first B+ tree; determining a first Euclidean distance from the image feature of the data
  • the image feature is the first image feature having the highest similarity to the image feature of the data.
  • each B+ tree calculates the Euclidean distance of the image feature of the data to be written to the NVM to the root node of each B+ tree, and according to the European style
  • the image feature of the data to be written into the NVM is divided into the first B+ tree with the smallest Euclidean distance for similar search; then, in the first B+ tree, by calculating the image feature of the data to be written into the NVM to the node
  • the Euclidean distance determines the free block with the highest similarity to the image feature of the data to be written to the NVM.
  • the portion labeled "1" indicates that the image feature that can be extracted in this free block will be represented as a contour feature, thereby representing the free block with the contour feature.
  • the free block is represented by the image feature only by the example shown in FIG. 5, and the present invention is not limited thereto.
  • the method may further include: marking that the state of the free block having the first image feature is used. Therefore, when allocating free blocks for data to be written to the NVM, the free blocks allocated in the feature set are no longer considered.
  • the method of the embodiment of the present invention may further include: when recovering the invalid data block in the storage space of the NVM, acquiring an image feature of the recovered invalid data block;
  • the image feature of the data block updates the feature set of the NVM's storage space.
  • the invalid data block is a block in which the data stored in the data block in the storage space of the NVM is in an invalid state.
  • the condition for reclaiming invalid data blocks in the storage space of the NVM may include reaching a preset time and the number of invalid data blocks reaching a preset value.
  • the preset time and/or the preset value may be set according to actual needs, and the invention is not limited.
  • the manner of establishing the feature set of the storage space in this embodiment is the same as that in the foregoing embodiment, and details are not described herein again.
  • FIG. 6 is a schematic flowchart of still another storage space management method according to an embodiment of the present invention. As shown in FIG. 6, the free block is allocated, and the method includes:
  • S602. Determine whether a free block has been allocated to data to be written to the NVM.
  • FIG. 7 is a schematic flowchart diagram of still another storage space management method according to an embodiment of the present invention. As shown in FIG. 7, the invalid data block is recovered, and the method includes:
  • the step may further be: determining whether the number of invalid data blocks reaches a preset value.
  • the extraction step is the same as S301, and details are not described herein again.
  • the feature set is updated according to the recovered invalid data block, so the update of the feature set is not performed frequently, and therefore, the storage performance of the NVM can be guaranteed.
  • FIG. 8 is a schematic structural diagram of a storage space management apparatus according to an embodiment of the present invention.
  • a storage space management apparatus provided by an embodiment of the present invention is applied to an NVM.
  • the storage space management apparatus 80 includes an acquisition module 81, a determination module 82, and a management module 83.
  • the obtaining module 81 is configured to acquire image features of data to be written into the NVM.
  • the determining module 82 is configured to determine, in the feature set of the storage space of the NVM, a first image feature that has the highest similarity with the image feature of the data acquired by the obtaining module 81, where the feature set includes the storage space according to the NVM.
  • the M image features obtained by the free block, the size of each free block in the storage space is the same as the size of the data, the free block includes the invalid data block in the storage space of the NVM and the area where the data is not written, and M is the storage space of the NVM.
  • the number of free blocks in the middle, M is a natural number.
  • Management module 83 is operative to write data into a free block having a first image feature determined by determination module 82.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the obtaining module 81 may be further configured to separately calculate image features of the M free blocks in the storage space of the NVM.
  • the feature set may include a plurality of B+ trees, and the nodes of the plurality of B+ trees are composed of M image features of the free blocks in the storage space of the NVM.
  • the determining module 82 is specifically configured to: determine a first B+ tree according to an Euclidean distance of an image feature of the data to a root node of each B+ tree in the plurality of B+ trees, where the first B+ tree is a root node of each B+ tree a B+ tree having the smallest Euclidean distance to the image feature of the data; computing the image feature of the data and the Euclidean distance of each node in the first B+ tree; determining the first image feature having the smallest Euclidean distance from the image feature of the data as the AND data The first image feature with the highest similarity of the image features.
  • the management module 83 can also be configured to mark the state of the free block having the first image feature as used after writing the data into the free block having the first image feature.
  • the management module 83 can also be configured to: recover invalid data blocks in the storage space of the NVM.
  • the obtaining module 81 may further be configured to acquire the image feature of the recovered invalid data block, where the invalid data block is the data stored in the data block in the storage space of the NVM. a block in an invalid state; and, in accordance with an image feature of the invalid data block, updating a feature set of the storage space of the NVM.
  • FIG. 9 shows an overall schematic diagram of an embodiment of the present invention, an application, a virtual file system (English: Virtual File Systems, VFS for short), an NVM-oriented file system, and a data flow direction between NVMs, and arrows represent Data flow direction.
  • a virtual file system English: Virtual File Systems, VFS for short
  • an NVM-oriented file system an NVM-oriented file system
  • data flow direction between NVMs, and arrows represent Data flow direction.
  • the storage space management device is as shown in FIG. 8; the NVM-oriented file system provides a portable operating system interface (English: Portable Operating System Interface, POSIX interface for short), such as a VFS interface, which is not limited by the embodiment of the present invention.
  • POSIX interface Portable Operating System Interface
  • VFS interface VFS interface
  • the embodiment of the present invention is applicable regardless of whether it is a POSIX interface.
  • the storage interface and the NVM shown in FIG. 9 are schematic diagrams, and specific hardware examples refer to the hardware scenario of the embodiment of FIG. 1 or FIG. 2.
  • FIG. 10 is a schematic structural diagram of another storage space management apparatus according to an embodiment of the present invention.
  • a storage space management apparatus provided by an embodiment of the present invention is applied to an NVM.
  • the storage space management apparatus 100 includes a receiver 110 and a processor 120.
  • the receiver 110 is configured to receive data to be written into the NVM.
  • the processor 120 is configured to acquire image features of the data to be written in the NVM received by the receiver 110; and determine, in the feature set of the storage space of the NVM, the first image feature having the highest similarity with the image features of the data,
  • the feature set includes M image features obtained according to the free block in the storage space of the NVM, and the size of each free block in the storage space is the same as the size of the data, and the free block includes the NVM. Invalid data blocks and areas where data is not written in the storage space, M is the number of free blocks in the storage space of the NVM, M is a natural number; and data is written into the free block having the first image feature.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the processor 120 may be further configured to separately calculate image features of the M free blocks in the storage space of the NVM.
  • the processor 120 is configured to separately calculate the image features of the M free blocks in the storage space of the NVM, and may specifically: traverse the free block i in the storage space of the NVM by using a preset window, and obtain the LBP feature vector X of the free block i.
  • the feature set may include a plurality of B+ trees, and the nodes of the plurality of B+ trees are composed of M image features of the free blocks in the storage space of the NVM.
  • the processor 120 determines, in the feature set of the storage space of the NVM, that the first image feature having the highest similarity with the data image feature may be specifically: according to the image feature of the data to each B+ tree in the multiple B+ trees.
  • the Euclidean distance of the root node determines the first B+ tree, wherein the first B+ tree is the B+ tree with the smallest Euclidean distance from the root node of each B+ tree to the image feature of the data; the image feature of the calculated data and the first B+ tree
  • the Euclidean distance of each node; the first image feature that determines the Euclidean distance from the image feature of the data is the first image feature having the highest similarity to the image feature of the data.
  • the processor 120 may be further configured to mark the state of the free block having the first image feature as used after writing the data into the free block having the first image feature.
  • the processor 120 may be further configured to: recover an invalid data block in the storage space of the NVM; acquire an image feature of the recovered invalid data block, and the invalid data block is invalid in the data block stored in the storage space of the NVM. a block of state; and, according to the image of the invalid data block A feature set that updates the storage space of the NVM.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种存储空间管理方法及装置,应用于非易失性存储器NVM中。在包含NVM的存储空间中的空闲块的图像特征的特征集合中,确定与待写入上述NVM的数据的图像特征相似度高的空闲块,以供所述数据写入,这样在存储空间分配时就考虑到磨损及能耗的问题,可以减少NVM的存储空间中空闲块的写操作能耗,从而实现在扩展NVM使用寿命的同时,降低写操作能耗。

Description

存储空间管理方法及装置 技术领域
本发明实施例涉及信息存储技术,尤其涉及一种存储空间管理方法及装置。
背景技术
近年来,为了满足应用的性能需求,基于新材料和新机制的非易失存储器(英文:Non-Volatile Memory,简称:NVM)不断取得新的突破,并日趋走向成熟的产业化道路。
NVM具备与动态随机存取存储器(英文:Dynamic Random Access Memory,简称:DRAM)相近的读写性能、按字节寻址及可按位改写的能力。与此同时,NVM还具备更大的存储密度和容量以及数据掉电不丢失的特性。但有些NVM仍存在着使用寿命短及磨损大的问题,即频繁的写操作导致NVM中物理块的损坏,进而使NVM失效。另外,NVM还存在写操作能耗过大的现象。
发明内容
本发明实施例提供一种存储空间管理方法及装置,以在扩展NVM使用寿命的同时,降低写操作能耗。
第一方面,本发明实施例提供一种存储空间管理方法,所述方法应用于非易失性存储器NVM中,包括:
获取待写入所述NVM中的数据的图像特征;
在所述NVM的存储空间的特征集合中,确定与所述数据的图像特征的相似度最高的第一图像特征,其中,所述特征集合中包含有根据所述NVM的存储空间中的空闲块获得的M个图像特征,所述存储空间中的各空闲块的大小与所述数据的大小相同,所述空闲块包括所述NVM的存储空间中的无效数据块和未写入数据的区域,所述M为所述NVM的存储空间中的空闲块数量,M为自然数;
将所述数据写入具有所述第一图像特征的空闲块中。
根据第一方面,在第一方面的第一种可能的实现方式中,所述在所述NVM的存储空间的特征集合中,确定与所述数据的图像特征的相似度最高的第一图像特征之前,所述方法还包括:
分别计算所述NVM的存储空间中的M个空闲块的图像特征。
根据第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述分别计算所述NVM的存储空间中的M个空闲块的图像特征包括:
采用预设窗口遍历所述NVM的存储空间中的空闲块i,获得所述空闲块i的局部二值模式LBP特征向量Xi,其中,Xi=(LBPi1,LBPi2,...,LBPiN),其中,所述N根据所述空闲块i的大小和所述预设窗口的大小确定,LBPin为所述空闲块i内每个预设窗口对应的LBP算子,
Figure PCTCN2014093948-appb-000001
J表示所述LBP算子转化成二进制的总位数,sj=0或1;
根据所述空闲块i的LBP特征向量Xi及所述空闲块i中0和1的比例Pi,获得所述空闲块i的图像特征Ti,其中,Ti=αXi+βPi,α和β表示权重,α+β=1。
根据第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述获取待写入所述NVM中的数据的图像特征,包括:
采用所述预设窗口遍历所述数据,获取所述数据的LBP特征向量X,其中,X=(LBP1,LBP2,...,LBPN),
Figure PCTCN2014093948-appb-000002
根据所述数据的LBP特征向量X及所述数据中0和1的比例P,获取所述数据的图像特征T,其中,T=αX+βP。
根据第一方面的第三种可能的实现方式,在第一方面的第四种可能的实现方式中,所述特征集合包括多个B+树,所述多个B+树的节点由所述NVM的存储空间中的空闲块的所述M个图像特征构成,所述在所述NVM的存储空间的特征集合中,确定与所述数据的图像特征的相似度最高的第一图像特征,包括:
根据所述数据的图像特征到所述多个B+树中各B+树的根结点的欧式距离确定第一B+树,其中,所述第一B+树为所述各B+树的根结点到所述数据的图像特征的欧式距离最小的B+树;
计算所述数据的图像特征与所述第一B+树中各节点的欧式距离;
确定与所述数据的图像特征的欧式距离最小的第一图像特征为所述与所述数据的图像特征的相似度最高的第一图像特征。
根据第一方面、第一方面的第一种至第四种可能的实现方式中任意一种可能的实现方式,在第一方面的第五种可能的实现方式中,所述将所述数据写入具有所述第一图像特征的空闲块中之后,所述方法还包括:
标记具有所述第一图像特征的空闲块的状态为已使用。
根据第一方面、第一方面的第一种至第五种可能的实现方式中任意一种可能的实现方式,在第一方面的第六种可能的实现方式中,所述方法还包括:
当对所述NVM的存储空间中的无效数据块进行回收时,获取回收的所述无效数据块的图像特征,所述无效数据块为所述NVM的存储空间中数据块所储存的数据处于无效状态的块;
根据所述无效数据块的图像特征,更新所述NVM的存储空间的特征集合。
第二方面,本发明实施例提供一种存储空间管理装置,所述装置应用于非易失性存储器NVM中,包括:
获取模块,用于获取待写入所述NVM中的数据的图像特征;
确定模块,用于在所述NVM的存储空间的特征集合中,确定与所述获取模块获取的所述数据的图像特征的相似度最高的第一图像特征,其中,所述特征集合中包含有根据所述NVM的存储空间中的空闲块获得的M个图像特征,所述存储空间中的各空闲块的大小与所述数据的大小相同,所述空闲块包括所述NVM的存储空间中的无效数据块和未写入数据的区域,所述M为所述NVM的存储空间中的空闲块数量,M为自然数;
管理模块,用于将所述数据写入具有所述确定模块确定的所述第一图像特征的空闲块中。
根据第二方面,在第二方面的第一种可能的实现方式中,所述获取模块还用于:
分别计算所述NVM的存储空间中的M个空闲块的图像特征。
根据第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述获取模块用于分别计算所述NVM的存储空间中的M个空闲 块的图像特征具体为:
采用预设窗口遍历所述NVM的存储空间中的空闲块i,获得所述空闲块i的局部二值模式LBP特征向量Xi,其中,Xi=(LBPi1,LBPi2,...,LBPiN),其中,所述N根据所述空闲块i的大小和所述预设窗口的大小确定,LBPin为所述空闲块i内每个预设窗口对应的LBP算子,
Figure PCTCN2014093948-appb-000003
J表示所述LBP算子转化成二进制的总位数,sj=0或1;
根据所述空闲块i的LBP特征向量Xi及所述空闲块i中0和1的比例Pi,获得所述空闲块i的图像特征Ti,其中,Ti=αXi+βPi,α和β表示权重,α+β=1。
根据第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述获取模块用于获取待写入所述NVM中的数据的图像特征,具体为:
采用所述预设窗口遍历所述数据,获取所述数据的LBP特征向量X,其中,X=(LBP1,LBP2,...,LBPN),
Figure PCTCN2014093948-appb-000004
根据所述数据的LBP特征向量X及所述数据中0和1的比例P,获取所述数据的图像特征T,其中,T=αX+βP。
根据第二方面的第三种可能的实现方式,在第二方面的第四种可能的实现方式中,所述特征集合包括多个B+树,所述多个B+树的节点由所述NVM的存储空间中的空闲块的所述M个图像特征构成,所述确定模块具体用于:
根据所述数据的图像特征到所述多个B+树中各B+树的根结点的欧式距离确定第一B+树,其中,所述第一B+树为所述各B+树的根结点到所述数据的图像特征的欧式距离最小的B+树;
计算所述数据的图像特征与所述第一B+树中各节点的欧式距离;
确定与所述数据的图像特征的欧式距离最小的第一图像特征为所述与所述数据的图像特征的相似度最高的第一图像特征。
根据第二方面、第二方面的第一种至第四种可能的实现方式中任意一种可能的实现方式,在第二方面的第五种可能的实现方式中,所述管理模块还用于:
将所述数据写入具有所述第一图像特征的空闲块中之后,标记具有所述第一图像特征的空闲块的状态为已使用。
根据第二方面、第二方面的第一种至第五种可能的实现方式中任意一种可能的实现方式,在第二方面的第六种可能的实现方式中,所述管理模块还用于:
回收所述NVM的存储空间中的无效数据块;
当所述管理模块对所述NVM的存储空间中的无效数据块进行回收时,所述获取模块还用于获取回收的所述无效数据块的图像特征,所述无效数据块为所述NVM的存储空间中数据块所储存的数据处于无效状态的块;及,根据所述无效数据块的图像特征,更新所述NVM的存储空间的特征集合。
本发明实施例在包含NVM的存储空间中的空闲块的图像特征的特征集合中,确定与待写入上述NVM的数据的图像特征相似度高的空闲块,以供所述数据写入,这样在存储空间分配时就考虑到磨损及能耗的问题,可以减少NVM的存储空间中空闲块的写操作能耗,从而实现在扩展NVM使用寿命的同时,降低写操作能耗。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例的附图。
图1为本发明实施例提供的一种应用场景示例图;
图2为本发明实施例提供的另一种应用场景示例图;
图3为本发明实施例提供的一种存储空间管理方法的流程示意图;
图4为本发明实施例提供的另一种存储空间管理方法中LBP算子提取示例图;
图5为本发明实施例提供的另一种存储空间管理方法中B+树索引示例图;
图6为本发明实施例提供的又一种存储空间管理方法的流程示意图;
图7为本发明实施例提供的再一种存储空间管理方法实施例四的流程示意图;
图8为本发明实施例提供的一种存储空间管理装置的结构示意图;
图9为本发明实施例提供的又一种应用场景示例图;
图10为本发明实施例提供的另一种存储空间管理装置的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。
目前研究的NVM主要有相变存储器(英文:Phase Change Memory,简称:PCM)、阻变存储器(英文:Resistive Random Access Memory,简称:RRAM)和磁存储器(英文:Magnetic Random Access Memory,简称:MRAM)等。
在现有技术中,对于存储介质空间的分配和管理,有基于位图或链表的空间管理和分配方法及PCM周期性磨损均衡方法及内存管理方法。其中,基于位图或链表的空间管理和分配方法在NVM空间的管理分配过程中,NVM介质的磨损和能耗需要附加额外的方法来解决;而PCM周期性磨损均衡方法及内存管理方法在NVM空间的管理分配过程中,会考虑减小NVM介质的磨损,但没有考虑能耗的问题。因此,本发明实施例在NVM的存储空间分配和管理过程中解决NVM应用到存储系统时的磨损及写能耗较大的问题。
本发明实施例针对未来面向NVM的文件系统的NVM的存储空间分配和管理的改进和创新。本发明实施例在包含NVM的存储空间中的空闲块的图像特征的特征集合中,确定与待写入上述NVM的数据的图像特征相似度高的空闲块,以供所述数据写入,这样在存储空间分配时就考虑到磨损及能耗的问题,可以减少NVM的存储空间中空闲块的写操作能耗,从而实现在扩展NVM使用寿命的同时,降低写操作能耗。
以下对本发明实施例的应用场景进行举例说明。
本发明实施例一种应用场景中,NVM作为外存使用。该应用场景包括主机、内存、多个通道的NVM以及NVM控制器。其中,主机中央处理器(英文:Central Processing Unit,简称:CPU)通过NVM控制器读写NVM中的数据。
例如,如图1所示,单机或服务器机框20内包含底板21,底板21上安装有南桥211、中央处理器212和内存213等芯片,用于对其他扩展卡(例 如图1所示的扩展卡22和扩展卡23)进行控制,实现主机的功能;NVM控制器(图1中未示出)也是一个芯片,如现场可编程门阵列(英文:Field-Programmable Gate Array,简称:FPGA)和专用集成电路(英文:Application Specific Integrated Circuit,简称:ASIC)等,通过对NVM控制器进行编程来完成接收主机的读写请求,并对NVM进行各种访问及控制。NVM控制器对应的芯片可以与各个NVM都设置在一个印刷电路板(英文:Printed Circuit Board,简称:PCB)上,通过PCB走线相连,最后呈现的形式是一个NVM设备盒,即图1所示的NVM设备盒24。或者,也可以将NVM芯片和NVM控制器做成一个扩展卡,通过总线和接口标准(英文:Peripheral Component Interface Express,简称:PCIe)接口25与底板21相连。
本发明实施例另一种应用场景中,NVM直接挂载到内存总线。该应用场景包括主机、内存、多个通道的NVM以及NVM控制器。其中,主机CPU通过NVM控制器读写NVM中的数据。
例如,如图2所示,单机或服务器机框20内包含底板21,底板21上安装有南桥211、中央处理器212和内存213等芯片,用于对其他扩展卡(例如图2所示的扩展卡22和扩展卡23)进行控制,实现主机的功能;NVM控制器(图2中未示出)也是一个芯片,如FPGA和ASIC等,通过对NVM控制器进行编程来完成接收主机的读写请求,并对NVM进行各种访问及控制。NVM控制器对应的芯片可以与各个NVM都设置在一个PCB上,通过PCB走线相连,最后呈现的形式是一个NVM双列直插式存储模块(英文:Dual-Inline Memory Modules,简称:DIMM),即图2所示的NVM214,通过内存总线与中央处理器(CPU)212相连。
图3为本发明实施例提供的一种存储空间管理方法的流程示意图。本发明实施例提供一种存储空间管理方法,该方法应用于NVM中,其中,本发明实施例的NVM能够按字节(Byte)寻址,将数据以位(bit)为单位写入非易失性存储介质中。该方法可以由存储空间管理装置执行,该装置可以独立设置,也可以集成在通信设备中,其中,通信设备可以为台式电脑、笔记本电脑或服务器等任意终端设备。如图3所示,该方法包括:
S301、获取待写入NVM中的数据的图像特征。
具体地,每一个写满了‘0’和/或‘1’的待写入NVM的数据可以看作 是一幅黑白图像,因此,可提取待写入NVM的数据的图像特征。
其中,待写入NVM中的数据可以为原始待写入数据,也可以为将原始待写入数据经过分割处理后得到的数据,或者,将原始待写入数据经过补零后得到的数据,本发明不予限制。
S302、在NVM的存储空间的特征集合中,确定与上述数据的图像特征的相似度最高的第一图像特征。
其中,特征集合中包含有根据NVM的存储空间中的空闲块获得的M个图像特征。存储空间中的各空闲块的大小与上述数据的大小相同。空闲块可包括NVM的存储空间中的无效数据块和未写入数据的区域,M为NVM的存储空间中的空闲块数量,M为自然数。第一图像特征为NVM的存储空间中的空闲块获得的M个图像特征中的其中一个。
由于NVM的存储空间的特征集合中包含了存储空间中各空闲块的图像特征,因此,可通过查询存储空间的特征集合,确定具有与上述数据的图像特征的相似度最高的空闲块。至于存储空间的特征集合的结构本发明实施例不予限制。
S303、将上述数据写入具有该第一图像特征的空闲块中。
由于本发明实施例的NVM能够按字节(Byte)寻址,将数据以位(bit)为单位写入非易失性存储介质中,因此,逐位比对上述数据和具有第一图像特征的空闲块,在比对过程中,仅需重写取值不同的位即可。
本发明实施例在包含NVM的存储空间中的空闲块的图像特征的特征集合中,确定与待写入上述NVM的数据的图像特征相似度高的空闲块,以供所述数据写入,这样在存储空间分配时就考虑到磨损及能耗的问题,可以减少NVM的存储空间中空闲块的写操作能耗,从而实现在扩展NVM使用寿命的同时,降低写操作能耗。
在上述基础上,在S302之前,该方法还可以包括:分别计算NVM的存储空间中的M个空闲块的图像特征。
具体地,NVM由物理块组成,物理块包括空闲块。对NVM的存储空间进行分配和管理,即对NVM的物理块进行分配和管理。该实施例中,可提取NVM中所有物理块的图像特征,也可以仅提取空闲块的图像特征。但对于一个物理块的所有图像特征作为一个整体考虑。
以下通过具体的实现方式对上述实施例进行解释。
一种实现方式中,分别计算NVM的存储空间中的M个空闲块的图像特征可以包括:采用预设窗口遍历NVM的存储空间中的空闲块i,获得空闲块i的局部二值模式(英文:Local Binary Pattern,简称:LBP)特征向量Xi,其中,Xi=(LBPi1,LBPi2,...,LBPiN),其中,N根据空闲块i的大小和预设窗口的大小确定,LBPin为空闲块i内每个预设窗口对应的LBP算子,
Figure PCTCN2014093948-appb-000005
J表示LBP算子转化成二进制的总位数,sj=0或1;根据空闲块i的LBP特征向量Xi及空闲块i中0和1的比例Pi,获得空闲块i的图像特征Ti,其中,Ti=αXi+βPi,α和β表示权重,α+β=1。具体地,Pi表示空闲块中0和1所占的比特位的数量的比例。α和β满足约束条件α+β=1,介于0和1之间。
其中,LBP算子是一种传统的、效率较高且运算速度较快的特征提取算子。例如,如图4所示,LBP算子是在3*3大小的预设窗口中,将围绕着中心点的8个点顺时针排序产生的8位二进制数并转换成十进制数后得到编码,称为LBP算子码,即
Figure PCTCN2014093948-appb-000006
同时,由于LBP特征向量与‘0’和/或‘1’的分布具有很强的相关性,所以,本发明实施例在空闲块的图像特征描述中融入了‘0’与‘1’的百分比,即Pi,表示空闲块i中‘0’与‘1’的比例。
因此,对存储空间中所有空闲块按照上述方法提取相应的图像特征,获得包含所有空闲块的图像特征的特征集合,该特征集合例如为如下所示:
Figure PCTCN2014093948-appb-000007
其中,Ti=αXi+βPi=(α·LBPi1,α·LBPi2,...,α·LBPiN,βPi)。
在上述基础上,S301可以包括:采用上述预设窗口遍历上述数据,获取该数据的LBP特征向量X,其中,X=(LBP1,LBP2,...,LBPN),
Figure PCTCN2014093948-appb-000008
根据该数据的LBP特征向量X及该数据中0和1的比例P,获取该数据的图像特征T,其中,T=αX+βP。具体地,P表示待写入NVM的数据中0和1所占的比特位的数量的比例。
特征集合的类型及个数可以根据实际需求限定。以下举例说明。
一种实现方式中,直接基于各空闲块的图像特征,建立一个B+树。
另一种实现方式中,基于各空闲块的图像特征,建立NVM的存储空间的特征集合可以包括:通过K-均值聚类算法对NVM中的所有空闲块的图像特征进行聚类处理,形成K个类,该K个类的中心点表示为Pk,k=1,2,…,K,其中,聚类处理时每个空闲块的图像特征作为一个整体考虑;以每个类的中心点作为参考点,计算类内每个空闲块的图像特征到参考点的欧氏距离;按照欧式距离构建B+树。该实现方式中,B+树的个数为K。相对于上一实现方式,该实现方式在确定与上述数据的图像特征的相似度最高的第一图像特征时,效率更高,针对性更强。
一种具体实施例中,特征集合可以包括多个B+树(不局限于K个),多个B+树的节点由NVM的存储空间中的空闲块的M个图像特征构成。该实施例中,S302可以包括:根据上述数据的图像特征到上述多个B+树中各B+树的根结点的欧式距离确定第一B+树,其中,该第一B+树为各B+树的根结点到上述数据的图像特征的欧式距离最小的B+树;计算上述数据的图像特征与该第一B+树中各节点的欧式距离;确定与上述数据的图像特征的欧式距离最小的第一图像特征为所述与上述数据的图像特征的相似度最高的第一图像特征。
例如,如图5所示,提取待写入NVM的数据的图像特征;在各B+树中,计算待写入NVM的数据的图像特征到各B+树的根结点的欧式距离,并根据欧式距离将待写入NVM的数据的图像特征划分到欧式距离最小的第一B+树中进行相似查找;然后,在第一B+树中,通过计算待写入NVM的数据的图像特征到给节点的欧式距离,确定与该待写入NVM的数据的图像特征相似度最高的空闲块。其中,标记为“1”的部分表示对这个空闲块中可以提取的图像特征,将表示成一种轮廓特征,从而用这个轮廓特征来表示该空闲块。这里仅以图5所示的示例来说明通过图像特征来表示空闲块,本发明不予限制。
在上述实施例的基础上,S303之后,该方法还可以包括:标记具有第一图像特征的空闲块的状态为已使用。从而实现在为其它待写入NVM的数据分配空闲块时,不再考虑特征集合中已分配出去的空闲块。
在执行如图3所示实施例的过程中,本发明实施例的方法还可以包括:当对NVM的存储空间中的无效数据块进行回收时,获取回收的无效数据块的图像特征;根据无效数据块的图像特征,更新NVM的存储空间的特征集合。其中,无效数据块为NVM的存储空间中数据块所储存的数据处于无效状态的块。
对NVM的存储空间中的无效数据块进行回收的条件可以包括达到预设时间和无效数据块的数量达到预设数值。其中,预设时间和/或预设数值可根据实际需求进行设置,本发明不予限制。该实施例中的存储空间的特征集合的建立方式同上述实施例,此处不再赘述。
例如,图6为本发明实施例提供的又一种存储空间管理方法的流程示意图。如图6所示,对空闲块进行分配,该方法包括:
S601、接收到数据块请求,该数据块请求中包含待写入NVM的数据。
S602、判断是否已给待写入NVM的数据分配空闲块。
若是,则执行S606,在已分配的空闲块中写入NVM的数据;若否,则执行S603。
S603、获取待写入NVM的数据的图像特征。
S604、根据待写入NVM的数据的图像特征,在存储空间的特征集合中进行匹配。
该步骤中,匹配与待写入NVM的数据的图像特征相似度高的空闲块。
S605、分配匹配到的空闲块给待写入NVM的数据。
S606、写入待写入NVM的数据。
S607、流程结束。
图7为本发明实施例提供的再一种存储空间管理方法的流程示意图。如图7所示,对无效数据块进行回收,该方法包括:
S701、判断是否达到预设时间。
可选地,该步骤还可以为:判断无效数据块的数量是否达到预设数值。
若是,执行S702;若否,执行S704。
S702、提取无效数据块的图像特征。
该提取步骤同S301,此处不再赘述。
S703、将无效数据块的图像特征更新到存储空间的特征集合中。
S704、继续收集无效数据块。
S705、流程结束。
因无效数据块的回收需满足预设条件,根据回收的无效数据块更新特征集合,故对特征集合的更新并非频繁进行,因此,可保证NVM的存储性能。
图8为本发明实施例提供的一种存储空间管理装置的结构示意图。本发明实施例提供的一种存储空间管理装置,该装置应用于NVM中。如图8所示,存储空间管理装置80包括:获取模块81、确定模块82和管理模块83。
其中,获取模块81用于获取待写入NVM中的数据的图像特征。确定模块82用于在NVM的存储空间的特征集合中,确定与获取模块81获取的数据的图像特征的相似度最高的第一图像特征,其中,特征集合中包含有根据NVM的存储空间中的空闲块获得的M个图像特征,存储空间中的各空闲块的大小与数据的大小相同,空闲块包括NVM的存储空间中的无效数据块和未写入数据的区域,M为NVM的存储空间中的空闲块数量,M为自然数。管理模块83用于将数据写入具有确定模块82确定的第一图像特征的空闲块中。
本实施例的装置,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
在上述实施例中,获取模块81还可以用于:分别计算NVM的存储空间中的M个空闲块的图像特征。
其中,获取模块81用于分别计算NVM的存储空间中的M个空闲块的图像特征可以具体为:采用预设窗口遍历NVM的存储空间中的空闲块i,获得空闲块i的LBP特征向量Xi,其中,Xi=(LBPi1,LBPi2,...,LBPiN),其中,N根据空闲块i的大小和预设窗口的大小确定,LBPin为空闲块i内每个预设窗口对应的LBP算子,
Figure PCTCN2014093948-appb-000009
J表示LBP算子转化成二进制的总位数,sj=0或1;根据空闲块i的LBP特征向量Xi及空闲块i中0和1的比例Pi,获得空闲块i的图像特征Ti,其中,Ti=αXi+βPi,α和β表示权重,α+β=1。
其中,获取模块81用于获取待写入NVM中的数据的图像特征,可以具体为:采用预设窗口遍历数据,获取数据的LBP特征向量X,其中,X=(LBP1,LBP2,...,LBPN),
Figure PCTCN2014093948-appb-000010
根据数据的LBP特征向量X及数据中0和1的比例P,获取数据的图像特征T,其中,T=αX+βP。
进一步地,特征集合可以包括多个B+树,多个B+树的节点由NVM的存储空间中的空闲块的M个图像特征构成。确定模块82可具体用于:根据数据的图像特征到上述多个B+树中各B+树的根结点的欧式距离确定第一B+树,其中,第一B+树为各B+树的根结点到数据的图像特征的欧式距离最小的B+树;计算数据的图像特征与第一B+树中各节点的欧式距离;确定与数据的图像特征的欧式距离最小的第一图像特征为所述与数据的图像特征的相似度最高的第一图像特征。
在上述基础上,管理模块83还可以用于:将数据写入具有第一图像特征的空闲块中之后,标记具有第一图像特征的空闲块的状态为已使用。
更进一步地,管理模块83还可以用于:回收NVM的存储空间中的无效数据块。当管理模块83对NVM的存储空间中的无效数据块进行回收时,获取模块81还可以用于获取回收的无效数据块的图像特征,无效数据块为NVM的存储空间中数据块所储存的数据处于无效状态的块;及,根据无效数据块的图像特征,更新NVM的存储空间的特征集合。
为便于理解,图9示出本发明实施例方案的整体示意,应用,虚拟文件系统(英文:Virtual File Systems,简称:VFS)、面向NVM的文件系统及NVM之间的数据流方向,箭头代表数据流方向。
其中,存储空间管理装置如图8所示;面向NVM的文件系统提供可移植操作系统接口(英文:Portable Operating System Interface,简称:POSIX接口),例如VFS接口,而本发明实施例并不对此限定,无论是否是POSIX接口,本发明实施例均适用。另外,图9中所示的存储接口和NVM为逻辑示意图,具体的硬件实例参考如图1或图2实施例的硬件场景。
图10为本发明实施例提供的另一种存储空间管理装置的结构示意图。本发明实施例提供的一种存储空间管理装置,该装置应用于NVM中。如图10所示,存储空间管理装置100包括:接收器110和处理器120。
其中,接收器110用于接收待写入NVM中的数据。处理器120用于获取接收器110所接收的待写入NVM中的数据的图像特征;在NVM的存储空间的特征集合中,确定与上述数据的图像特征的相似度最高的第一图像特征,其中,特征集合中包含有根据NVM的存储空间中的空闲块获得的M个图像特征,存储空间中的各空闲块的大小与数据的大小相同,空闲块包括NVM 的存储空间中的无效数据块和未写入数据的区域,M为NVM的存储空间中的空闲块数量,M为自然数;及将数据写入具有第一图像特征的空闲块中。
本实施例的装置,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
在上述实施例中,处理器120还可以用于:分别计算NVM的存储空间中的M个空闲块的图像特征。
其中,处理器120用于分别计算NVM的存储空间中的M个空闲块的图像特征可以具体为:采用预设窗口遍历NVM的存储空间中的空闲块i,获得空闲块i的LBP特征向量Xi,其中,Xi=(LBPi1,LBPi2,...,LBPiN),其中,N根据空闲块i的大小和预设窗口的大小确定,LBPin为空闲块i内每个预设窗口对应的LBP算子,
Figure PCTCN2014093948-appb-000011
J表示LBP算子转化成二进制的总位数,sj=0或1;根据空闲块i的LBP特征向量Xi及空闲块i中0和1的比例Pi,获得空闲块i的图像特征Ti,其中,Ti=αXi+βPi,α和β表示权重,α+β=1。
其中,处理器120用于获取待写入NVM中的数据的图像特征,可以具体为:采用预设窗口遍历数据,获取数据的LBP特征向量X,其中,X=(LBP1,LBP2,...,LBPN),
Figure PCTCN2014093948-appb-000012
根据数据的LBP特征向量X及数据中0和1的比例P,获取数据的图像特征T,其中,T=αX+βP。
进一步地,特征集合可以包括多个B+树,多个B+树的节点由NVM的存储空间中的空闲块的M个图像特征构成。处理器120在所述NVM的存储空间的特征集合中,确定与所述数据图像特征的相似度最高的第一图像特征可具体为:根据数据的图像特征到上述多个B+树中各B+树的根结点的欧式距离确定第一B+树,其中,第一B+树为各B+树的根结点到数据的图像特征的欧式距离最小的B+树;计算数据的图像特征与第一B+树中各节点的欧式距离;确定与数据的图像特征的欧式距离最小的第一图像特征为所述与数据的图像特征的相似度最高的第一图像特征。
在上述基础上,处理器120还可以用于:将数据写入具有第一图像特征的空闲块中之后,标记具有第一图像特征的空闲块的状态为已使用。
更进一步地,处理器120还可以用于:回收NVM的存储空间中的无效数据块;获取回收的无效数据块的图像特征,无效数据块为NVM的存储空间中数据块所储存的数据处于无效状态的块;及,根据无效数据块的图像特 征,更新NVM的存储空间的特征集合。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,本申请所提供的实施例仅仅是示意性的。所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。在本发明实施例、权利要求以及附图中揭示的特征可以独立存在也可以组合存在。在本发明实施例中以硬件形式描述的特征可以通过软件来执行,反之亦然。在此不做限定。

Claims (14)

  1. 一种存储空间管理方法,所述方法应用于非易失性存储器NVM中,其特征在于,包括:
    获取待写入所述NVM中的数据的图像特征;
    在所述NVM的存储空间的特征集合中,确定与所述数据的图像特征的相似度最高的第一图像特征,其中,所述特征集合中包含有根据所述NVM的存储空间中的空闲块获得的M个图像特征,所述存储空间中的各空闲块的大小与所述数据的大小相同,所述空闲块包括所述NVM的存储空间中的无效数据块和未写入数据的区域,所述M为所述NVM的存储空间中的空闲块数量,M为自然数;
    将所述数据写入具有所述第一图像特征的空闲块中。
  2. 根据权利要求1所述的方法,其特征在于,所述在所述NVM的存储空间的特征集合中,确定与所述数据的图像特征的相似度最高的第一图像特征之前,所述方法还包括:
    分别计算所述NVM的存储空间中的M个空闲块的图像特征。
  3. 根据权利要求2所述的方法,其特征在于,所述分别计算所述NVM的存储空间中的M个空闲块的图像特征包括:
    采用预设窗口遍历所述NVM的存储空间中的空闲块i,获得所述空闲块i的局部二值模式LBP特征向量Xi,其中,Xi=(LBPi1,LBPi2,...,LBPiN),其中,所述N根据所述空闲块i的大小和所述预设窗口的大小确定,LBPin为所述空闲块i内每个预设窗口对应的LBP算子,
    Figure PCTCN2014093948-appb-100001
    J表示所述LBP算子转化成二进制的总位数,sj=0或1;
    根据所述空闲块i的LBP特征向量Xi及所述空闲块i中0和1的比例Pi,获得所述空闲块i的图像特征Ti,其中,Ti=αXi+βPi,α和β表示权重,α+β=1。
  4. 根据权利要求3所述的方法,其特征在于,所述获取待写入所述NVM中的数据的图像特征,包括:
    采用所述预设窗口遍历所述数据,获取所述数据的LBP特征向量X,其中,X=(LBP1,LBP2,...,LBPN),
    Figure PCTCN2014093948-appb-100002
    根据所述数据的LBP特征向量X及所述数据中0和1的比例P,获取所 述数据的图像特征T,其中,T=αX+βP。
  5. 根据权利要求4所述的方法,其特征在于,所述特征集合包括多个B+树,所述多个B+树的节点由所述NVM的存储空间中的空闲块的所述M个图像特征构成,所述在所述NVM的存储空间的特征集合中,确定与所述数据图像特征的相似度最高的第一图像特征,包括:
    根据所述数据的图像特征到所述多个B+树中各B+树的根结点的欧式距离,确定第一B+树,其中,所述第一B+树为所述各B+树的根结点到所述数据的图像特征的欧式距离最小的B+树;
    计算所述数据的图像特征与所述第一B+树中各节点的欧式距离;
    确定与所述数据的图像特征的欧式距离最小的第一图像特征为所述与所述数据的图像特征的相似度最高的第一图像特征。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述将所述数据写入具有所述第一图像特征的空闲块中之后,所述方法还包括:
    标记具有所述第一图像特征的空闲块的状态为已使用。
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述方法还包括:
    当对所述NVM的存储空间中的无效数据块进行回收时,获取回收的所述无效数据块的图像特征,所述无效数据块为所述NVM的存储空间中数据块所储存的数据处于无效状态的块;
    根据所述无效数据块的图像特征,更新所述NVM的存储空间的特征集合。
  8. 一种存储空间管理装置,所述装置应用于非易失性存储器NVM中,其特征在于,包括:
    获取模块,用于获取待写入所述NVM中的数据的图像特征;
    确定模块,用于在所述NVM的存储空间的特征集合中,确定与所述获取模块获取的所述数据的图像特征的相似度最高的第一图像特征,其中,所述特征集合中包含有根据所述NVM的存储空间中的空闲块获得的M个图像特征,所述存储空间中的各空闲块的大小与所述数据的大小相同,所述空闲块包括所述NVM的存储空间中的无效数据块和未写入数据的区域,所述M为所述NVM的存储空间中的空闲块数量,M为自然数;
    管理模块,用于将所述数据写入具有所述确定模块确定的所述第一图像 特征的空闲块中。
  9. 根据权利要求8所述的装置,其特征在于,所述获取模块还用于:
    分别计算所述NVM的存储空间中的M个空闲块的图像特征。
  10. 根据权利要求9所述的装置,其特征在于,所述获取模块用于分别计算所述NVM的存储空间中的M个空闲块的图像特征具体为:
    采用预设窗口遍历所述NVM的存储空间中的空闲块i,获得所述空闲块i的局部二值模式LBP特征向量Xi,其中,Xi=(LBPi1,LBPi2,...,LBPiN),其中,所述N根据所述空闲块i的大小和所述预设窗口的大小确定,LBPin为所述空闲块i内每个预设窗口对应的LBP算子,
    Figure PCTCN2014093948-appb-100003
    J表示所述LBP算子转化成二进制的总位数,sj=0或1;
    根据所述空闲块i的LBP特征向量Xi及所述空闲块i中0和1的比例Pi,获得所述空闲块i的图像特征Ti,其中,Ti=αXi+βPi,α和β表示权重,α+β=1。
  11. 根据权利要求10所述的装置,其特征在于,所述获取模块用于获取待写入所述NVM中的数据的图像特征,具体为:
    采用所述预设窗口遍历所述数据,获取所述数据的LBP特征向量X,其中,X=(LBP1,LBP2,...,LBPN),
    Figure PCTCN2014093948-appb-100004
    根据所述数据的LBP特征向量X及所述数据中0和1的比例P,获取所述数据的图像特征T,其中,T=αX+βP。
  12. 根据权利要求11所述的装置,其特征在于,所述特征集合包括多个B+树,所述多个B+树的节点由所述NVM的存储空间中的空闲块的所述M个图像特征构成,所述确定模块具体用于:
    根据所述数据的图像特征到所述多个B+树中各B+树的根结点的欧式距离确定第一B+树,其中,所述第一B+树为所述各B+树的根结点到所述数据的图像特征的欧式距离最小的B+树;
    计算所述数据的图像特征与所述第一B+树中各节点的欧式距离;
    确定与所述数据的图像特征的欧式距离最小的第一图像特征为所述与所述数据的图像特征的相似度最高的第一图像特征。
  13. 根据权利要求8-12任一项所述的装置,其特征在于,所述管理模块还用于:
    将所述数据写入具有所述第一图像特征的空闲块中之后,标记具有所述第一图像特征的空闲块的状态为已使用。
  14. 根据权利要求8-13任一项所述的装置,其特征在于,所述管理模块还用于:
    回收所述NVM的存储空间中的无效数据块;
    当所述管理模块对所述NVM的存储空间中的无效数据块进行回收时,所述获取模块还用于获取回收的所述无效数据块的图像特征,所述无效数据块为所述NVM的存储空间中数据块所储存的数据处于无效状态的块;及,根据所述无效数据块的图像特征,更新所述NVM的存储空间的特征集合。
PCT/CN2014/093948 2014-12-16 2014-12-16 存储空间管理方法及装置 WO2016095103A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201480045225.7A CN105900082B (zh) 2014-12-16 2014-12-16 存储空间管理方法及装置
PCT/CN2014/093948 WO2016095103A1 (zh) 2014-12-16 2014-12-16 存储空间管理方法及装置
EP14908138.2A EP3223167B1 (en) 2014-12-16 2014-12-16 Storage space management method and device
US15/625,385 US10261715B2 (en) 2014-12-16 2017-06-16 Storage space management method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/093948 WO2016095103A1 (zh) 2014-12-16 2014-12-16 存储空间管理方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/625,385 Continuation US10261715B2 (en) 2014-12-16 2017-06-16 Storage space management method and apparatus

Publications (1)

Publication Number Publication Date
WO2016095103A1 true WO2016095103A1 (zh) 2016-06-23

Family

ID=56125567

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/093948 WO2016095103A1 (zh) 2014-12-16 2014-12-16 存储空间管理方法及装置

Country Status (4)

Country Link
US (1) US10261715B2 (zh)
EP (1) EP3223167B1 (zh)
CN (1) CN105900082B (zh)
WO (1) WO2016095103A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078920B (zh) * 2019-11-22 2021-09-03 北京云宽志业网络技术有限公司 数据处理方法、装置、设备和计算机可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101854341A (zh) * 2009-03-31 2010-10-06 国际商业机器公司 用于数据流的模式匹配方法和装置
US20120131240A1 (en) * 2010-11-23 2012-05-24 International Business Machines Corporation Sliding write window mechanism for writing data
CN103930890A (zh) * 2013-10-30 2014-07-16 华为技术有限公司 数据处理方法、装置及重删处理器

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080288436A1 (en) * 2007-05-15 2008-11-20 Harsha Priya N V Data pattern matching to reduce number of write operations to improve flash life
TWI366828B (en) * 2007-09-27 2012-06-21 Phison Electronics Corp Wear leveling method and controller using the same
CN101183337A (zh) * 2007-12-12 2008-05-21 中兴通讯股份有限公司 基于nand flash移动终端存储介质的空间管理方法
US9501421B1 (en) * 2011-07-05 2016-11-22 Intel Corporation Memory sharing and page deduplication using indirect lines
JP6123975B2 (ja) * 2011-07-29 2017-05-10 パナソニックIpマネジメント株式会社 特徴量抽出装置及び特徴量抽出方法
KR20140008702A (ko) * 2012-07-11 2014-01-22 삼성전자주식회사 불휘발성 메모리 장치 및 그것의 쓰기 방법
WO2014010763A1 (ko) * 2012-07-11 2014-01-16 한양대학교 산학협력단 쓰기 데이터 패턴 인식에 의한 플래시 메모리 관리 장치 및 방법
US9395924B2 (en) * 2013-01-22 2016-07-19 Seagate Technology Llc Management of and region selection for writes to non-volatile memory
US9305647B2 (en) * 2013-10-31 2016-04-05 Huawei Technologies Co., Ltd. Write operation method and device for phase change memory
JP6544900B2 (ja) * 2014-09-17 2019-07-17 キヤノン株式会社 オブジェクト識別装置、オブジェクト識別方法及びプログラム

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101854341A (zh) * 2009-03-31 2010-10-06 国际商业机器公司 用于数据流的模式匹配方法和装置
US20120131240A1 (en) * 2010-11-23 2012-05-24 International Business Machines Corporation Sliding write window mechanism for writing data
CN103930890A (zh) * 2013-10-30 2014-07-16 华为技术有限公司 数据处理方法、装置及重删处理器

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3223167A4 *

Also Published As

Publication number Publication date
US20170285956A1 (en) 2017-10-05
EP3223167A4 (en) 2017-09-27
CN105900082A (zh) 2016-08-24
US10261715B2 (en) 2019-04-16
EP3223167A1 (en) 2017-09-27
EP3223167B1 (en) 2018-11-21
CN105900082B (zh) 2019-05-24

Similar Documents

Publication Publication Date Title
US10545864B2 (en) Memory system and method for controlling nonvolatile memory
US12038834B2 (en) Memory system and method for controlling nonvolatile memory during command processing without replacing defective blocks
TWI627536B (zh) 用於具有調適分割之一共用快取之系統及方法
US11874815B2 (en) Key-value storage device and method of operating the same
US20190087327A1 (en) Memory system and method for controlling nonvolatile memory
US20200218474A1 (en) Method and apparatus for performing multi-object transformations on a storage device
US11995003B2 (en) Method of data caching and device caching data
WO2017041570A1 (zh) 向缓存写入数据的方法及装置
US10203899B2 (en) Method for writing data into flash memory apparatus, flash memory apparatus, and storage system
US20200225882A1 (en) System and method for compaction-less key-value store for improving storage capacity, write amplification, and i/o performance
CN111581126A (zh) 一种基于ssd的日志数据保存方法、装置、设备和介质
US20150006793A1 (en) Storage system and operating method thereof
US9880930B2 (en) Method for operating controller and method for operating device including the same
WO2016095103A1 (zh) 存储空间管理方法及装置
CN113126908A (zh) 被配置为支持多流的存储装置及其操作方法
US10782906B1 (en) Memory subsystem interface to relate data and to retrieve related data
US11880593B2 (en) Host, operating method of host and storage system
US11392547B2 (en) Using prefix-delete operations for data containers
US11366611B2 (en) Apparatus for transmitting map information in a memory system
US12039053B2 (en) Secure processor, operating method thereof, and storage device including same
US20240303196A1 (en) Memory device and method for scheduling block request
CN116893877A (zh) 主机装置的操作方法及存储装置的操作方法
CN110908592A (zh) 存储器管理方法以及存储控制器
CN113126909A (zh) 使用已删除记录跨度的光标查找操作

Legal Events

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

Ref document number: 14908138

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2014908138

Country of ref document: EP