CN109086002A - Space management, device, computer installation and the storage medium of storage object - Google Patents
Space management, device, computer installation and the storage medium of storage object Download PDFInfo
- Publication number
- CN109086002A CN109086002A CN201810689511.7A CN201810689511A CN109086002A CN 109086002 A CN109086002 A CN 109086002A CN 201810689511 A CN201810689511 A CN 201810689511A CN 109086002 A CN109086002 A CN 109086002A
- Authority
- CN
- China
- Prior art keywords
- storage
- space
- storage object
- target
- unit
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0644—Management of space entities, e.g. partitions, extents, pools
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention provides a kind of space management of storage object, comprising: reception space management instruction obtains the target storage space of the space management instruction instruction management;Obtain storage object, the storage unit and free memory locations of the storage object in the target storage space;Storage object, the storage unit of the storage object and the free memory locations are saved in key value database;It is that the newly-increased storage object distributes memory space according to the free memory locations if receiving to increase the instruction that storage object distributes memory space newly.The invention also discloses space management device, computer installation and the computer readable storage mediums of a kind of storage object.The speed for obtaining the storage space information of storage object can be improved in the present invention, so as to timely carry out memory allocation to newly-increased storage object.
Description
Technical field
The present invention relates to technical field of memory more particularly to a kind of space allocation methods of storage object, device, computer
Device and storage medium.
Background technique
In a computer, it usually needs all types of files is stored, or to the object of application assigned into
Row storage.At this time, it may be necessary to be allocated to the storage address of file or be allocated to the storage address of object.When can store
Space is larger, when the content of storage is more, possibly timely can not carry out space distribution for storage object and therefore need one kind
Effectively management and the quickly mechanism of distribution memory space.
Summary of the invention
In view of the foregoing, it is necessary to the space management of storage object a kind of, device, computer installation are provided and deposited
The speed for obtaining the storage space information of storage object can be improved, so as to timely to newly-increased storage pair in storage media
As carrying out memory allocation.
The present invention provides a kind of space management of storage object, which comprises
Reception space management instruction obtains the target storage space of the space management instruction instruction management;
Obtaining the storage object in the target storage space, the storage unit of the storage object and free time deposits
Storage unit;
Storage object, the storage unit of the storage object and the free time are saved in key value database
Storage unit;
It is described new according to the free memory locations if receiving to increase the instruction that storage object distributes memory space newly
Increase storage object and distributes memory space.
It is described to be stored according to the free memory locations for the newly-increased storage object distribution in the present invention is preferably implemented
Space, comprising:
Obtain the size of each storage unit in the size and the target storage space of the newly-increased storage object;
According to the big subtotal of each storage unit in the size of the newly-increased storage object and the target storage space
It calculates to number of memory cells;
According to it is described to number of memory cells be that the newly-increased storage object distribution is continuous from the free memory locations
Storage unit.
In a preferred embodiment of the invention, the method also includes:
It is released in the target storage in the presence of storage object if detecting, updates and released in the key value database
The information for the storage object put.
In the present invention is preferably implemented, the key value database is LevelDB or RocksDB.
In the present invention is preferably implemented, it is described obtain in the target storage space storage object, described stored pair
The storage unit and free memory locations of elephant, comprising:
The storage unit that the target storage space includes is numbered;
Obtain in the target storage space storage object, the number and sky of the storage unit of the storage object
The number of not busy storage unit;
It is then described that storage object, the storage unit of the storage object and the institute are saved in key value database
State free memory locations, comprising:
Storage object, the number of the storage unit of the storage object and the institute are saved in key value database
State the number of free memory locations.
In a preferred embodiment of the invention, the storage unit in the target storage space divides in the following way:
The size for obtaining the target storage space determines that the target storage space carries out the substantially single of space management
Member;
If the target storage space is divided into according to the basic unit that the target storage space carries out space management
Dry storage unit.
In a preferred embodiment of the invention, the determination target storage space carries out the basic unit packet of space management
It includes:
Obtain the size of the target storage object of the target storage space;
Determine that the target storage space carries out space according to the size of the target storage object of the target storage space
The basic unit of management.
The present invention also provides a kind of space management device of storage object, described device includes:
First obtains module, instructs for reception space management, obtains the target of the space management instruction instruction management
Memory space;
Second obtains module, for obtaining the storage object in the target storage space, the storage object
Storage unit and free memory locations;
Preserving module, for saving the storage list of the storage object, the storage object in key value database
The first and described free memory locations;
Distribution module, if being deposited for receiving to increase the instruction that storage object distributes memory space newly according to the free time
Storage unit is that the newly-increased storage object distributes memory space.
In a preferred embodiment of the invention, the distribution module is the newly-increased storage pair according to the free memory locations
As distribution memory space includes:
Obtain the size of each storage unit in the size and the target storage space of the newly-increased storage object;
According to the big subtotal of each storage unit in the size of the newly-increased storage object and the target storage space
It calculates to number of memory cells;
According to it is described to number of memory cells be that the newly-increased storage object distribution is continuous from the free memory locations
Storage unit.
In a preferred embodiment of the invention, described device further include:
Update module, if being released for detecting in the target storage in the presence of storage object, in the key assignments number
According to the information for updating the storage object discharged in library.
In a preferred embodiment of the invention, the key value database is LevelDB or RocksDB.
In a preferred embodiment of the invention, the second acquisition module is specifically used for:
The storage unit that the target storage space includes is numbered;
Obtain in the target storage space storage object, the number and sky of the storage unit of the storage object
The number of not busy storage unit;
Then the preserving module is specifically used for:
Storage object, the number of the storage unit of the storage object and the institute are saved in key value database
State the number of free memory locations.
In a preferred embodiment of the invention, described device further includes division module, and the division module is used for:
The size for obtaining the target storage space determines that the target storage space carries out the substantially single of space management
Member;
If the target storage space is divided into according to the basic unit that the target storage space carries out space management
Dry storage unit.
In a preferred embodiment of the invention, the division module determines that the target storage space carries out the base of space management
This unit includes:
Obtain the size of the target storage object of the target storage space;
Determine that the target storage space carries out space according to the size of the target storage object of the target storage space
The basic unit of management.
The present invention also provides a kind of computer installation, the computer installation includes memory and processor, the storage
Device is for storing at least one instruction, and the processor is for executing at least one described instruction to realize institute in any embodiment
The space management for the storage object stated.
The present invention also provides a kind of computer readable storage mediums, which is characterized in that the computer readable storage medium
It is stored at least one instruction, at least one described instruction realizes storage pair described in any embodiment when being executed by processor
The space management of elephant.
Found out by above technical scheme, the present invention is instructed by reception space management, is obtained the space management and is referred to
Show the target storage space of management;Obtain the storage of the storage object, the storage object in the target storage space
Unit and free memory locations;The storage list of the storage object, the storage object is saved in key value database
The first and described free memory locations;If receiving to increase the instruction that storage object distributes memory space newly, according to the free time
Storage unit is that the newly-increased storage object distributes memory space.Since the storage object in target storage space being all stored in
In key value database, due to key value database have the characteristics that search it is rapid, so, can quickly obtain storage object
Storage space information realizes the purpose for improving the speed for the storage space information for obtaining storage object.Also, according to key assignments data
Free memory locations in the energy quick obtaining target storage space of library, so can fast and accurately be distributed when distribution memory space
Memory space realizes the purpose that memory allocation is timely carried out to newly-increased storage object.
Meanwhile the present invention will not be occupied it is not necessary that the storage space information of storage object to be recorded in memory or hard disk
More memories avoid reducing system performance.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of the space management of storage object provided in an embodiment of the present invention;
Fig. 2 is the functional block diagram of the space management device of storage object provided in an embodiment of the present invention;
Fig. 3 is that the structure of the computer installation of the preferred embodiment for the space management that the present invention realizes storage object is shown
It is intended to.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real
Applying mode, the present invention is described in further detail.
As shown in FIG. 1, FIG. 1 is a kind of flow charts of the space management of storage object provided in an embodiment of the present invention.
The sequence of step can change in the flow chart according to different requirements, and certain steps can be omitted.
S11, reception space management instruction obtain the target storage space of the space management instruction instruction management.
Method of the present invention can be used in memory space being managed storage object.Specifically, to storage object
It is managed and including but not limited to the storage space information of storage object (also referred to as address space information) is saved and is
Storage object distributes memory space.
Above-mentioned target storage space is the virtual memory space or amount of physical memory that can carry out data storage, such as
Above-mentioned target storage space can be one or more disks.
S12: storage object, the storage unit and sky of the storage object in the target storage space are obtained
Not busy storage unit.
Wherein, obtain target storage space in storage object can be acquisition storage object in target storage space
In storage object title, or information such as size of storage object.
The memory space of above-mentioned acquisition storage object specifically can be acquisition storage object in target storage space
The storage address stored.
Above-mentioned free memory locations are the storage units for not having to store storage object in target storage space.
Obtain free memory locations specifically can be obtain in target storage space without storing storage object, and can be into
The access unit address of row object storage.
Several storage units can be divided into typically for a target storage space, storage object can be according to it
Size occupies one or more storage units.
Optionally, in an alternative embodiment of the invention, described to obtain in the target storage space storage object, described
The storage unit and free memory locations of storage object, comprising:
The storage unit that the target storage space includes is numbered;
Obtain in the target storage space storage object, the number and sky of the storage unit of the storage object
The number of not busy storage unit;
Said memory cells are storage units included in target storage space.
Above-mentioned number can be the number of the forms such as number, letter, for being identified to each storage unit.
Then after the storage unit that target storage space includes is numbered, obtains and stored in target storage space
Object, the storage object storage unit number and free memory locations number.
Optionally, in an alternative embodiment of the invention, the storage unit in the target storage space is in the following way
It divides:
The size for obtaining the target storage space determines that the target storage space carries out the substantially single of space management
Member;
If the target storage space is divided into according to the basic unit that the target storage space carries out space management
Dry storage unit.
The size of above-mentioned acquisition target storage space specifically can be the total capacity for obtaining target storage space.
Above-mentioned target storage space carries out the basic unit of space management, specifically can be and divides target storage space
Minimum operation unit when operation such as match, store.
The basic unit that above-mentioned target storage space carries out space management can be default unit, for example, target storage is empty
Between carry out space management basic unit be 1MB.
Target storage space is divided into several deposit by the above-mentioned basic unit for carrying out space management according to target storage space
Storage unit is specifically: target storage space being divided into several storage units, the size of each storage unit is deposited equal to target
Store up the basic unit that space carries out space management.
For example, target storage space is one piece of disk, the size of the disk is 1GB.If the disk carries out space management
Basic unit is 1MB, then the disk is divided into 1024 storage units.
For another example, target storage space is one piece of disk, and the size of the disk is 500MB.It is deposited if the disk carries out space
The basic unit of storage is 5MB, then the disk is divided into 100 storage units.
Then each storage list that can be to after division is numbered in the above-mentioned storage unit for including by target storage space
Member assigns a number.
Further, the basic unit of the determination target storage space progress space management includes:
Obtain the size of the target storage object of the target storage space;
Determine that the target storage space carries out space according to the size of the target storage object of the target storage space
The basic unit of management.
Above-mentioned target storage object can be the storage object that will be stored in target storage space.
For example, target storage object is all the data of 10M or more, then target storage space carries out the substantially single of space management
Member can be determined as 10M.
In the present embodiment, the division of basic unit is carried out according to the size of the target storage object of target storage space,
It avoids the basic unit that target storage space is carried out to space management from dividing too large or too small, is conducive to carry out space pipe
Reason.
S13: the storage object, the storage unit of the storage object and described are saved in key value database
Free memory locations.
Wherein, key value database, also referred to as kv (key-value) storing data library.Kv database is a kind of non-relational
Database, the data in key value database carry out tissue, index and storage according to the form of key-value pair.
Specifically, can record the object oriented of storage object in key value database, and storage object has been deposited
Store up address.
The storage unit of storage object has been a kind of one-to-one data organization form due to storage object and,
It is saved using key value database, meets the organizational form of data to be saved.After being stored by kv database,
It can also quickly be searched from kv database.
By key value database to the storage unit and sky of storage object, storage object in target storage space
Not busy storage unit is saved, and does not need to record in memory, is released more resources for memory, is not also needed frequently to go
It is inquired in memory, improves the performance of system.Also, according to the characteristics of key value database storing data and quickly search
The characteristics of, information that can quickly in access key value database, so as to which which is rapidly obtained in target storage space
A little storage units are occupied, which storage unit is unoccupied.
Optionally, the key value database is LevelDB or RocksDB.
Wherein, above-mentioned LevelDB is a kind of key value database of open source, therefore is easier to obtain in practical applications, is made
Has the advantages that low-cost high-efficiency with LevelDB.
In LevelDB, key and value can be the byte arrays of random length.And it is possible to according to the word of key
Allusion quotation sequential storage, can also be according to other customized sequential storages.In LevelDB database, the progress that can also read fastly
The lookup of data.
In RocksDB, key and value can be the byte arrays of random length.Also, RocksDB supports efficient
Lookup and range searching, support the random write of high load, high load update operation or both combination.Therefore, it uses
RocksDB can support the fast reading and writing for the storage space information in target storage space.
Meanwhile if step S12 obtains in the target storage space storage list of storage object, the storage object
Member and free memory locations, comprising: the storage unit that the target storage space includes is numbered;Obtain the target
The number of storage object, the number of the storage unit of the storage object and free memory locations in memory space;
Then step S13 saved in key value database storage object, the storage unit of the storage object with
And the free memory locations, comprising:
Storage object, the number of the storage unit of the storage object and the institute are saved in key value database
State the number of free memory locations.
For example, the object oriented of storage object be a, the number of the occupied storage unit of a is (1,5,8), then by a with
And its number of occupied storage unit is stored in key value database by way of key-value, specifically, in key assignments
A- > (1,5,8) can be saved as in database.Also, the storage object of the storage unit of other numbers is saved as sky.
It is also possible to save a bitmap in kv database, whether each storage unit is recorded by bitmap
Storage object is stored.
Specifically, bitmap is a kind of data structure, in bitmap, each can be set to 0 or 1, for indicating
One meaning.For example, a bitmap is saved in kv database, wherein 0 indicates that the position is unoccupied (i.e. without storage times
What object), wherein 1 indicates that the position is occupied (i.e. storage object).
S14 is institute according to the free memory locations if receiving to increase the instruction that storage object distributes memory space newly
State newly-increased storage object distribution memory space.
Above-mentioned newly-increased storage object is the storage object for applying being stored in target storage space.
It is deposited due to saving stored storage unit and free time in target storage space in key value database
Storage unit, therefore the information (number of such as free memory locations of free memory locations can be directly obtained from key value database
Or address), without searching which storage unit one by one as sky.
When distributing storage unit for newly-increased storage object, the storage unit of any free time can be distributed into newly-increased storage
Object.
It, can be by newly-increased storage meanwhile after giving some or multiple memory allocations to newly-increased storage object
Object and for its distribution storage unit be stored in key value database.
Preferably, if receiving the instruction of storage file or receiving the instruction of new Object when running program, triggering
To increase the instruction that storage object distributes memory space newly.
Due to when saving file, or when operation program new Object, it may be necessary to open up new memory space into
Row storage.Therefore, at this time to increase the instruction that storage object distributes memory space newly, thus for the object distribution storage for needing to store
Space.
Optionally, in an alternative embodiment of the invention, it is described according to the free memory locations be it is described it is newly-increased storage pair
As distributing memory space, comprising:
Obtain the size of each storage unit in the size and the target storage space of the newly-increased storage object;
According to the big subtotal of each storage unit in the size of the newly-increased storage object and the target storage space
It calculates to number of memory cells;
According to it is described to number of memory cells be that the newly-increased storage object distribution is continuous from the free memory locations
Storage unit.
The size of above-mentioned each storage unit specifically can be the basic unit of target storage space progress space management
The size of storage unit.Therefore, the storage newly-increased storage object can be calculated according to the size of newly-increased storage object and has needs altogether
How many a storage units.
For example, the size of newly-increased storage object is 5MB, the size of each storage unit is 1MB among target storage, then deposits
It stores up the newly-increased storage object and needs 5 storage units, i.e., be 5 to number of memory cells.
When carrying out the distribution of storage unit, the free memory locations of serial number can be distributed to newly-increased storage pair
As.
For example, the number of free memory locations is 20 to 30, then in distribution, the storage list that can be 20 to 25 by number
Member is distributed to newly-increased storage object and is stored.
In the present embodiment, continuous storage unit is distributed for newly-increased storage object to be conducive to improve data storage and reading
Efficiency.
Optionally, in an alternative embodiment of the invention, the method also includes:
It is released in the target storage in the presence of storage object if detecting, updates and released in the key value database
The information for the storage object put.
Wherein, storage object, which is released, removes from current storage location including storage object, deletes from target storage space
It removes.
For example, the object oriented of storage object is a, the number of the occupied storage unit of a is (1,5,8), if detection
To after being released storage object a, by the a- saved in key value database > (1,5,8) information deletion.
In the present embodiment, after the storage object of used memory space is released, in key value database
Information is updated, so that saving newest information in key value database always, is conducive to improve the target storage sky got
Between among store information authenticity.
The space management of storage object provided by the invention is instructed by reception space management, obtains the space pipe
The target storage space of reason instruction instruction management;It obtains the storage object in the target storage space, described stored pair
The storage unit and free memory locations of elephant;The storage object, the storage object are saved in key value database
Storage unit and the free memory locations;If receiving the instruction for distributing memory space for newly-increased storage object, according to
The free memory locations are that the newly-increased storage object distributes memory space.Due to by the storage object in target storage space
All it is stored in key value database, since key value database has the characteristics that lookup is rapid, so, it can quickly obtain and deposit
The storage space information of object is stored up, realizes the purpose for improving the speed for the storage space information for obtaining storage object.Also, according to
Free memory locations in key value database energy quick obtaining target storage space, so when distribution memory space, it can be quickly quasi-
True distribution memory space realizes the purpose that memory allocation is timely carried out to newly-increased storage object.
Meanwhile the present invention will not be occupied it is not necessary that the storage space information of storage object to be recorded in memory or hard disk
More memories avoid reducing system performance.
As shown in Fig. 2, Fig. 2 is the functional block diagram of the space management device of storage object provided in an embodiment of the present invention.
The space management device of the storage object includes that the first acquisition module 210, second obtains module 220,230 and of preserving module
Distribution module 240.The so-called module of the present invention refer to it is a kind of can be performed by the processor by computer installation and can be complete
At the series of computation machine program segment of fixed function, it is stored in the memory of computer installation.In the present embodiment, about
The function of each module will be described in detail in subsequent embodiment.
First obtains module 210, instructs for reception space management, obtains the mesh of the space management instruction instruction management
Mark memory space.
Device of the present invention can be used in memory space being managed storage object.Specifically, to storage object
It is managed and including but not limited to the storage space information of storage object (also referred to as address space information) is saved and is
Storage object distributes memory space.
Above-mentioned target storage space is the virtual memory space or amount of physical memory that can carry out data storage, such as
Above-mentioned target storage space can be one or more disks.
Second obtains module 220, for obtaining the storage object in the target storage space, the storage object
Storage unit and free memory locations.
Wherein, obtain target storage space in storage object can be acquisition storage object in target storage space
In storage object title, or information such as size of storage object.
The memory space of above-mentioned acquisition storage object specifically can be acquisition storage object in target storage space
The storage address stored.
Above-mentioned free memory locations are the storage units for not having to store storage object in target storage space.
Obtain free memory locations specifically can be obtain in target storage space without storing storage object, and can be into
The access unit address of row object storage.
Several storage units can be divided into typically for a target storage space, storage object can be according to it
Size occupies one or more storage units.
Optionally, in an alternative embodiment of the invention, described second module is obtained specifically for including: to deposit the target
The storage unit that storage space includes is numbered;Obtain in the target storage space storage object, the storage object
Storage unit number and free memory locations number;
Said memory cells are storage units included in target storage space.
Above-mentioned number can be the number of the forms such as number, letter, for being identified to each storage unit.
Then after the storage unit that target storage space includes is numbered, obtains and stored in target storage space
Object, the storage object storage unit number and free memory locations number.
Optionally, in an alternative embodiment of the invention, described device further include: division module.Division module is used for mesh
Storage unit in mark memory space is divided.
Specifically, division module can be used for:
The size for obtaining the target storage space determines that the target storage space carries out the substantially single of space management
Member;
If the target storage space is divided into according to the basic unit that the target storage space carries out space management
Dry storage unit.
The size of above-mentioned acquisition target storage space specifically can be the total capacity for obtaining target storage space.
Above-mentioned target storage space carries out the basic unit of space management, specifically can be and divides target storage space
Minimum operation unit when operation such as match, store.
The basic unit that above-mentioned target storage space carries out space management can be default unit, for example, target storage is empty
Between carry out space management basic unit be 1MB.
Target storage space is divided into several deposit by the above-mentioned basic unit for carrying out space management according to target storage space
Storage unit is specifically: target storage space being divided into several storage units, the size of each storage unit is deposited equal to target
Store up the basic unit that space carries out space management.
For example, target storage space is one piece of disk, the size of the disk is 1GB.If the disk carries out space management
Basic unit is 1MB, then the disk is divided into 1024 storage units.
For another example, target storage space is one piece of disk, and the size of the disk is 500MB.It is deposited if the disk carries out space
The basic unit of storage is 5MB, then the disk is divided into 100 storage units.
Then each storage list that can be to after division is numbered in the above-mentioned storage unit for including by target storage space
Member assigns a number.
Further, the division module determines that the basic unit of the target storage space progress space management can wrap
It includes:
Obtain the size of the target storage object of the target storage space;
Determine that the target storage space carries out space according to the size of the target storage object of the target storage space
The basic unit of management.
Above-mentioned target storage object can be the storage object that will be stored in target storage space.
For example, target storage object is all the data of 10M or more, then target storage space carries out the substantially single of space management
Member can be determined as 10M.
In the present embodiment, the division of basic unit is carried out according to the size of the target storage object of target storage space,
It avoids the basic unit that target storage space is carried out to space management from dividing too large or too small, is conducive to carry out space pipe
Reason.
Preserving module 230, for saving the storage of the storage object, the storage object in key value database
Unit and the free memory locations.
Wherein, key value database, also referred to as kv (key-value) storing data library.Kv database is a kind of non-relational
Database, the data in key value database carry out tissue, index and storage according to the form of key-value pair.
Specifically, can record the object oriented of storage object in key value database, and storage object has been deposited
Store up address.
The storage unit of storage object has been a kind of one-to-one data organization form due to storage object and,
It is saved using key value database, meets the organizational form of data to be saved.After being stored by kv database,
It can also quickly be searched from kv database.
By key value database to the storage unit and sky of storage object, storage object in target storage space
Not busy storage unit is saved, and does not need to record in memory, is released more resources for memory, is not also needed frequently to go
It is inquired in memory, improves the performance of system.Also, according to the characteristics of key value database storing data and quickly search
The characteristics of, information that can quickly in access key value database, so as to which which is rapidly obtained in target storage space
A little storage units are occupied, which storage unit is unoccupied.
Optionally, the key value database is LevelDB or RocksDB.
Wherein, above-mentioned LevelDB is a kind of key value database of open source, therefore is easier to obtain in practical applications, is made
Has the advantages that low-cost high-efficiency with LevelDB.
In LevelDB, key and value can be the byte arrays of random length.And it is possible to according to the word of key
Allusion quotation sequential storage, can also be according to other customized sequential storages.In LevelDB database, the progress that can also read fastly
Data search.
In RocksDB, key and value can be the byte arrays of random length.Also, RocksDB supports efficient
Lookup and range searching, support the random write of high load, high load update operation or both combination.Therefore, it uses
RocksDB can support the fast reading and writing for the storage space information in target storage space.
Meanwhile if the second acquisition module is specifically used for: the storage unit that the target storage space includes is numbered;
It is single to obtain in the target storage space storage object, the number of the storage unit of the storage object and idle storage
The number of member;
Then preserving module 230 is specifically used for: the storage object, the storage object are saved in key value database
Storage unit number and the free memory locations number.
For example, the object oriented of storage object be a, the number of the occupied storage unit of a is (1,5,8), then by a with
And its number of occupied storage unit is stored in key value database by way of key-value, specifically, in key assignments
A- > (1,5,8) can be saved as in database.Also, the storage object of the storage unit of other numbers is saved as sky.
It is also possible to save a bitmap in kv database, whether each storage unit is recorded by bitmap
Storage object is stored.
Specifically, bitmap is a kind of data structure, in bitmap, each can be set to 0 or 1, for indicating
One meaning.For example, a bitmap is saved in kv database, wherein 0 indicates that the position is unoccupied (i.e. without storage times
What object), wherein 1 indicates that the position is occupied (i.e. storage object).
Distribution module 240, if for receiving to increase the instruction that storage object distributes memory space newly, according to the free time
Storage unit is that the newly-increased storage object distributes memory space.
Above-mentioned newly-increased storage object is the storage object for applying being stored in target storage space.
It is deposited due to saving stored storage unit and free time in target storage space in key value database
Storage unit, therefore the information (number of such as free memory locations of free memory locations can be directly obtained from key value database
Or address), without searching which storage unit one by one as sky.
When distributing storage unit for newly-increased storage object, the storage unit of any free time can be distributed into newly-increased storage
Object.
It, can be by newly-increased storage meanwhile after giving some or multiple memory allocations to newly-increased storage object
Object and for its distribution storage unit be stored in key value database.
Preferably, if receiving the instruction of storage file or receiving the instruction of new Object when running program, triggering
To increase the instruction that storage object distributes memory space newly.
Due to when saving file, or when operation program new Object, it may be necessary to open up new memory space into
Row storage.Therefore, at this time to increase the instruction that storage object distributes memory space newly, thus for the object distribution storage for needing to store
Space.
Optionally, in an alternative embodiment of the invention, the distribution module is described new according to the free memory locations
Increase storage object and distribute memory space, comprising:
Obtain the size of each storage unit in the size and the target storage space of the newly-increased storage object;
According to the big subtotal of each storage unit in the size of the newly-increased storage object and the target storage space
It calculates to number of memory cells;
According to it is described to number of memory cells be that the newly-increased storage object distribution is continuous from the free memory locations
Storage unit.
The size of above-mentioned each storage unit specifically can be the basic unit of target storage space progress space management
The size of storage unit.Therefore, the storage newly-increased storage object can be calculated according to the size of newly-increased storage object and has needs altogether
How many a storage units.
For example, the size of newly-increased storage object is 5MB, the size of each storage unit is 1MB among target storage, then deposits
It stores up the newly-increased storage object and needs 5 storage units, i.e., be 5 to number of memory cells.
When carrying out the distribution of storage unit, the free memory locations of serial number can be distributed to newly-increased storage pair
As.
For example, the number of free memory locations is 20 to 30, then in distribution, the storage list that can be 20 to 25 by number
Member is distributed to newly-increased storage object and is stored.
In the present embodiment, continuous storage unit is distributed for newly-increased storage object to be conducive to improve data storage and reading
Efficiency.
Optionally, in an alternative embodiment of the invention, described device further includes update module, and the update module is also used
In:
It is released in the target storage in the presence of storage object if detecting, updates and released in the key value database
The information for the storage object put.
Wherein, storage object, which is released, removes from current storage location including storage object, deletes from target storage space
It removes.
For example, the object oriented of storage object is a, the number of the occupied storage unit of a is (1,5,8), if detection
To after being released storage object a, by the a- saved in key value database > (1,5,8) information deletion.
In the present embodiment, after the storage object of used memory space is released, in key value database
Information is updated, so that saving newest information in key value database always, is conducive to improve the target storage sky got
Between among store information authenticity.
The space management device of storage object provided by the invention obtains module reception space management instruction by first, obtains
Take the target storage space of the space management instruction instruction management;Second acquisition module obtains in the target storage space
Storage object, the storage unit and free memory locations of the storage object;Preserving module is protected in key value database
Deposit storage object, the storage unit of the storage object and the free memory locations;If it is newly-increased for receiving
Storage object distributes the instruction of memory space, and distribution module is that the newly-increased storage object is distributed according to the free memory locations
Memory space.Since the storage object in target storage space to be all stored in key value database, since key value database has
Have the characteristics that lookup is rapid, so, the storage space information of storage object can be quickly obtained, realizes and improves acquisition storage
The purpose of the speed of the storage space information of object.Also, according in key value database energy quick obtaining target storage space
Free memory locations, so can fast and accurately distribute memory space when distribution memory space, realization timely deposits newly-increased
Store up the purpose that object carries out memory allocation.
Meanwhile the present invention will not be occupied it is not necessary that the storage space information of storage object to be recorded in memory or hard disk
More memories avoid reducing system performance.
The above-mentioned integrated unit realized in the form of software function module, can store and computer-readable deposit at one
In storage media.Above-mentioned software function module is stored in a storage medium, including some instructions are used so that a computer
It is each that equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the present invention
The part steps of embodiment the method.
As shown in figure 3, Fig. 3 is the computer dress of the preferred embodiment for the space management that the present invention realizes storage object
The structural schematic diagram set.The computer installation include at least one sending device 31, at least one processor 32, at least one
Processor 33, at least one reception device 34 and at least one communication bus.Wherein, the communication bus is for realizing these
Connection communication between component.
The computer installation be it is a kind of can according to the instruction for being previously set or store, it is automatic carry out numerical value calculate with/
Or the equipment of information processing, hardware include but is not limited to microprocessor, specific integrated circuit (Application Specific
Integrated Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), number
Word processing device (Digital Signal Processor, DSP), embedded device etc..The computer installation may also include net
Network equipment and/or user equipment.Wherein, the network equipment includes but is not limited to single network server, multiple network services
The server group of device composition or being made of a large amount of hosts or network server based on cloud computing (Cloud Computing)
Cloud, wherein cloud computing is one kind of distributed computing, a super virtual meter consisting of a loosely coupled set of computers
Calculation machine.
The computer installation may be, but not limited to, any one and can be set with user by keyboard, touch tablet or acoustic control
The modes such as standby carry out the electronic product of human-computer interaction, for example, the terminals such as tablet computer, smart phone, monitoring device.
Network locating for the computer installation includes, but are not limited to internet, wide area network, Metropolitan Area Network (MAN), local area network, virtual
Dedicated network (Virtual Private Network, VPN) etc..
Wherein, the reception device 34 and the sending device 31 can be wired sending port, or wirelessly set
It is standby, for example including antenna assembly, for carrying out data communication with other equipment.
The memory 32 is for storing program code.The memory 32, which can be, does not have physical form in integrated circuit
The circuit with store function, such as RAM (Random-Access Memory, random access memory), FIFO (First In
First Out, push-up storage) etc..Alternatively, the memory 32 is also possible to the memory with physical form, such as
Memory bar, TF card (Trans-flash Card), smart media card (smart media card), safe digital card (secure
Digital card), storage facilities such as flash memory cards (flash card) etc..
The processor 33 may include one or more microprocessor, digital processing unit.The processor 33 is adjustable
With the program code stored in memory 32 to execute relevant function.For example, each unit described in Fig. 3 is stored in institute
The program code in memory 32 is stated, and as performed by the processor 33, to realize a kind of space management side of storage object
Method.The processor 33 is also known as central processing unit (CPU, Central Processing Unit), is one piece of ultra-large collection
It is arithmetic core (Core) and control core (Control Unit) at circuit.
In several embodiments provided by the present invention, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the module
It divides, only a kind of logical function partition, there may be another division manner in actual implementation.
The module as illustrated by the separation member may or may not be physically separated, aobvious as module
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.Some or all of the modules therein can be selected to realize the mesh of this embodiment scheme according to the actual needs
's.
It, can also be in addition, each functional module in each embodiment of the present invention can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds software function module.
It is obvious to a person skilled in the art that invention is not limited to the details of the above exemplary embodiments, Er Qie
In the case where without departing substantially from spirit or essential attributes of the invention, the present invention can be realized in other specific forms.Therefore, no matter
From the point of view of which point, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the present invention is by appended power
Benefit requires rather than above description limits, it is intended that all by what is fallen within the meaning and scope of the equivalent elements of the claims
Variation is included in the present invention.Any attached associated diagram label in claim should not be considered as right involved in limitation to want
It asks.Furthermore, it is to be understood that one word of " comprising " does not exclude other units or steps, odd number is not excluded for plural number.It is stated in system claims
Multiple units or device can also be implemented through software or hardware by a unit or device.Second equal words are used to table
Show title, and does not indicate any particular order.
Finally it should be noted that the above examples are only used to illustrate the technical scheme of the present invention and are not limiting, although reference
Preferred embodiment describes the invention in detail, those skilled in the art should understand that, it can be to of the invention
Technical solution is modified or equivalent replacement, without departing from the spirit and scope of the technical solution of the present invention.
Claims (10)
1. a kind of space management of storage object, which is characterized in that the described method includes:
Reception space management instruction obtains the target storage space of the space management instruction instruction management;
Obtain storage object, the storage unit of the storage object and the idle storage list in the target storage space
Member;
The storage object, the storage unit of the storage object and the idle storage are saved in key value database
Unit;
It is that described increase newly is deposited according to the free memory locations if receiving to increase the instruction that storage object distributes memory space newly
It stores up object and distributes memory space.
2. the method as described in claim 1, which is characterized in that it is described according to the free memory locations be the newly-increased storage
Object distributes memory space, comprising:
Obtain the size of each storage unit in the size and the target storage space of the newly-increased storage object;
According in the size of the newly-increased storage object and the target storage space each storage unit size calculate to
Number of memory cells;
According to it is described to number of memory cells be that the newly-increased storage object distribution is continuously deposited from the free memory locations
Storage unit.
3. the method as described in claim 1, which is characterized in that the method also includes:
If detecting have that storage object is released in target storage, updates and discharged in the key value database
The information of storage object.
4. the method as described in claim 1, which is characterized in that the key value database is LevelDB or RocksDB.
5. method according to any one of claims 1 to 4, which is characterized in that described to obtain in the target storage space
Storage object, the storage unit and free memory locations of the storage object, comprising:
The storage unit that the target storage space includes is numbered;
Obtain in the target storage space that storage object, the number of the storage unit of the storage object and free time deposit
The number of storage unit;
It is then described that storage object, the storage unit of the storage object and the sky are saved in key value database
Not busy storage unit, comprising:
Storage object, the number of the storage unit of the storage object and the sky are saved in key value database
The number of not busy storage unit.
6. method as claimed in claim 5, which is characterized in that the storage unit in the target storage space passes through such as lower section
Formula divides:
The size for obtaining the target storage space determines that the target storage space carries out the basic unit of space management;
The target storage space is divided into several deposit according to the basic unit that the target storage space carries out space management
Storage unit.
7. method as described in any of claims 6, which is characterized in that the determination target storage space carries out empty
Between the basic unit that manages include:
Obtain the size of the target storage object of the target storage space;
Determine that the target storage space carries out space management according to the size of the target storage object of the target storage space
Basic unit.
8. a kind of space management device of storage object, which is characterized in that described device includes:
First obtains module, instructs for reception space management, obtains the target storage of the space management instruction instruction management
Space;
Second obtains module, for obtaining the storage of the storage object in the target storage space, the storage object
Unit and free memory locations;
Preserving module, for saved in key value database storage object, the storage unit of the storage object with
And the free memory locations;
Distribution module, if for receiving to increase the instruction that storage object distributes memory space newly, it is single according to the idle storage
Member is that the newly-increased storage object distributes memory space.
9. a kind of computer installation, which is characterized in that the computer installation includes memory and processor, and the memory is used
In storing at least one instruction, the processor is for executing at least one described instruction to realize as appointed in claim 1 to 7
The space management of storage object described in one.
10. a kind of computer readable storage medium, is stored thereon with computer instruction, it is characterised in that: the computer instruction
The space management of the storage object as described in any one of claims 1 to 7 is realized when being executed by processor.
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810689511.7A CN109086002A (en) | 2018-06-28 | 2018-06-28 | Space management, device, computer installation and the storage medium of storage object |
| PCT/CN2018/108126 WO2020000734A1 (en) | 2018-06-28 | 2018-09-27 | Space management method and apparatus for storage object, and computer apparatus and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810689511.7A CN109086002A (en) | 2018-06-28 | 2018-06-28 | Space management, device, computer installation and the storage medium of storage object |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN109086002A true CN109086002A (en) | 2018-12-25 |
Family
ID=64834784
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201810689511.7A Pending CN109086002A (en) | 2018-06-28 | 2018-06-28 | Space management, device, computer installation and the storage medium of storage object |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN109086002A (en) |
| WO (1) | WO2020000734A1 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112631658A (en) * | 2021-01-13 | 2021-04-09 | 成都国科微电子有限公司 | Instruction sending method, chip and electronic equipment |
| WO2023124423A1 (en) * | 2021-12-31 | 2023-07-06 | 深圳市兆珑科技有限公司 | Storage space allocation method and apparatus, and terminal device and storage medium |
Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101162441A (en) * | 2007-11-09 | 2008-04-16 | 华为技术有限公司 | Data access device and method |
| CN101556557A (en) * | 2009-05-14 | 2009-10-14 | 浙江大学 | Object file organization method based on object storage device |
| CN102915340A (en) * | 2012-02-29 | 2013-02-06 | 浙江工商大学 | Expanded B+ tree-based object file system |
| CN103064639A (en) * | 2012-12-28 | 2013-04-24 | 华为技术有限公司 | Method and device for storing data |
| WO2013094041A1 (en) * | 2011-12-21 | 2013-06-27 | 株式会社日立製作所 | Computer system and management system |
| CN105630410A (en) * | 2015-12-03 | 2016-06-01 | 上海磁宇信息科技有限公司 | Method for dynamically managing file memory area by nonvolatile random access memory chip |
| CN106874459A (en) * | 2017-02-14 | 2017-06-20 | 北京奇虎科技有限公司 | Stream data storage method and device |
| CN107229429A (en) * | 2017-06-27 | 2017-10-03 | 郑州云海信息技术有限公司 | A kind of memory space management and device |
| CN107861685A (en) * | 2017-06-20 | 2018-03-30 | 平安科技(深圳)有限公司 | Virtual disk wiring method and device, storage medium based on copy-on-write |
| CN107967122A (en) * | 2017-11-22 | 2018-04-27 | 郑州云海信息技术有限公司 | A kind of method for writing data of block device, device and medium |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103268318B (en) * | 2013-04-16 | 2016-04-13 | 华中科技大学 | A kind of distributed key value database system of strong consistency and reading/writing method thereof |
| CN104424119B (en) * | 2013-08-26 | 2018-07-06 | 联想(北京)有限公司 | Memory space configuration method and device |
| CN104778264A (en) * | 2015-04-22 | 2015-07-15 | 北京科电高技术公司 | Memory distributing method for key/value database |
| CN105224677B (en) * | 2015-10-16 | 2018-10-30 | 上海晶赞科技发展有限公司 | A kind of database operation method and device |
| CN107357794B (en) * | 2016-05-10 | 2020-06-05 | 北京京东尚科信息技术有限公司 | Method and device for optimizing data storage structure of key value database |
-
2018
- 2018-06-28 CN CN201810689511.7A patent/CN109086002A/en active Pending
- 2018-09-27 WO PCT/CN2018/108126 patent/WO2020000734A1/en not_active Ceased
Patent Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101162441A (en) * | 2007-11-09 | 2008-04-16 | 华为技术有限公司 | Data access device and method |
| CN101556557A (en) * | 2009-05-14 | 2009-10-14 | 浙江大学 | Object file organization method based on object storage device |
| WO2013094041A1 (en) * | 2011-12-21 | 2013-06-27 | 株式会社日立製作所 | Computer system and management system |
| CN102915340A (en) * | 2012-02-29 | 2013-02-06 | 浙江工商大学 | Expanded B+ tree-based object file system |
| CN103064639A (en) * | 2012-12-28 | 2013-04-24 | 华为技术有限公司 | Method and device for storing data |
| CN105630410A (en) * | 2015-12-03 | 2016-06-01 | 上海磁宇信息科技有限公司 | Method for dynamically managing file memory area by nonvolatile random access memory chip |
| CN106874459A (en) * | 2017-02-14 | 2017-06-20 | 北京奇虎科技有限公司 | Stream data storage method and device |
| CN107861685A (en) * | 2017-06-20 | 2018-03-30 | 平安科技(深圳)有限公司 | Virtual disk wiring method and device, storage medium based on copy-on-write |
| CN107229429A (en) * | 2017-06-27 | 2017-10-03 | 郑州云海信息技术有限公司 | A kind of memory space management and device |
| CN107967122A (en) * | 2017-11-22 | 2018-04-27 | 郑州云海信息技术有限公司 | A kind of method for writing data of block device, device and medium |
Non-Patent Citations (1)
| Title |
|---|
| MOSHE BAR: "《Linux技术内幕》", 30 September 2001 * |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112631658A (en) * | 2021-01-13 | 2021-04-09 | 成都国科微电子有限公司 | Instruction sending method, chip and electronic equipment |
| WO2023124423A1 (en) * | 2021-12-31 | 2023-07-06 | 深圳市兆珑科技有限公司 | Storage space allocation method and apparatus, and terminal device and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2020000734A1 (en) | 2020-01-02 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10095418B1 (en) | Automatic tiering of storage using dynamic grouping | |
| CN108804031B (en) | Optimal record lookup | |
| EP3958107A1 (en) | Storage system, memory management method, and management node | |
| CN105589812B (en) | Disk fragments method for sorting, device and host | |
| US6871272B2 (en) | Data sorting in information storage systems | |
| US9626224B2 (en) | Optimizing available computing resources within a virtual environment | |
| US9280300B2 (en) | Techniques for dynamically relocating virtual disk file blocks between flash storage and HDD-based storage | |
| CN110471894A (en) | A kind of data prefetching method, device, terminal and storage medium | |
| CN109614377A (en) | File deletion method, device, device and storage medium of distributed file system | |
| CN105302830B (en) | A method and device for caching map tiles | |
| CN108932150B (en) | Caching method, device and media based on SSD and disk hybrid storage | |
| CN111782135B (en) | Data storage method, system, data node and computer readable storage medium | |
| CN108304259B (en) | Memory management method and system | |
| KR101686346B1 (en) | Cold data eviction method using node congestion probability for hdfs based on hybrid ssd | |
| CN110990301A (en) | Sequential reading method and related device of multi-plane storage medium | |
| CN109086002A (en) | Space management, device, computer installation and the storage medium of storage object | |
| CN110245129A (en) | Distributed global data deduplication method and device | |
| CN107544848B (en) | Cluster expansion method, apparatus, electronic equipment and storage medium | |
| CN101783814A (en) | Metadata storing method for mass storage system | |
| CN106528703A (en) | Deduplication mode switching method and apparatus | |
| CN111007988A (en) | A RAID internal wear leveling method, system, terminal and storage medium | |
| CN116955212A (en) | Memory defragmentation method, device, equipment and storage medium | |
| WO2014147840A1 (en) | Access control program, disk device, and access control method | |
| Liu et al. | Macss: A metadata-aware combo storage system | |
| Godavari et al. | File Semantic Aware Primary Storage Deduplication System |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181225 |
|
| RJ01 | Rejection of invention patent application after publication |