CN105159612A - Distribution method of free space of disk - Google Patents

Distribution method of free space of disk Download PDF

Info

Publication number
CN105159612A
CN105159612A CN201510561597.1A CN201510561597A CN105159612A CN 105159612 A CN105159612 A CN 105159612A CN 201510561597 A CN201510561597 A CN 201510561597A CN 105159612 A CN105159612 A CN 105159612A
Authority
CN
China
Prior art keywords
space
file
disk
retaining space
retaining
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
Application number
CN201510561597.1A
Other languages
Chinese (zh)
Inventor
刘相乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry Co Ltd
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 Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201510561597.1A priority Critical patent/CN105159612A/en
Publication of CN105159612A publication Critical patent/CN105159612A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a distribution method of the free space of a disk, and is suitable for distributing the free space of the disk by a file system. The distribution method has the main characteristics that a strategy that the space reservation and delay distribution are combined is adopted, so that the distributed space in a file growth process is possibly on one section of continuous address, disk fragments are reduced, and seek time is shortened.

Description

A kind of method that disk slack space distributes
Technical field
The present invention relates to computer memory technical field, particularly relate to the management of file system to disk space and the distribution of free space.
Background technology
In the read-write operation of file system to file, in order to improve read-write efficiency, the mode of general employing asynchronous write, namely in internal memory, a slice buffer memory is distributed, file data, first buffer memory is in the buffer, namely be the write operation to data in buffer memory to the write operation of file, then by concrete thread of writing with a brush dipped in Chinese ink, the data in buffer memory write with a brush dipped in Chinese ink on disk at certain time point.Before writing with a brush dipped in Chinese ink during this period of time in may carry out repeatedly write operation to file, namely repeated dispensing space, also for ease of the data block making same file as far as possible continuous, best bet is when disk block will be distributed to until write operation, the disk space size of additional data is deducted from space free count, but in fact not allocation space in free space bitmap.On the contrary, additional data is kept in internal memory always, until when writing with a brush dipped in Chinese ink thread decision refreshing Write post to disk, just allocation of space gone out.
Disk seek time is the principal element affecting file system performance always.Therefore as far as possible the spatial strategy of file system allows newly assigned piece of and then original, makes the layout of file on disk as far as possible continuously, to reduce disk seek time, improves the performance of sequential access file.But when disk block applied for by the file of two under same catalogue simultaneously, these two files will weave in.Therefore need take certain method to avoid this situation and combine with the strategy postponing to distribute, make the data block of same file as far as possible continuously.
Summary of the invention
In order to solve the problems of the technologies described above, the invention provides a kind of mode of retaining space that utilizes and distribute with the delay of file system the method combined, ensure that the continuity of the allocation space that file obtains in propagation process as much as possible, make the disk space address of file data continuous as far as possible, reduce file fragmentation, reduce seek time when reading and writing data.
In order to reach the object of the invention, the invention provides a kind of disk slack space distribution method, it is characterized in that, for file arranges retaining space, the delay of file system distributes use above-mentioned retaining space, is be physically one section of continuation address to make the space distributed in file propagation process.
Further, described retaining space refers to that file system is that file increases and needs the physical address space that retains on disk, one section of continuous space of its and then end address position of described file.
Further, described retaining space is with the form tissue of key-value pair on disk unit, and each key-value pair and described file are associated together by No. inode.
Further, calculate according to the growth number of times of file the size needing the retaining space arranged.
Further, described retaining space has maximal value and minimum value, and the size of the retaining space that the described growth number of times according to file calculates compares with described maximal value, wherein gets the size of smaller as new retaining space.
Further, if the retaining space of file has not been assigned with, then, when carrying out new retaining space and distributing, the continuous space that above-mentioned unappropriated retaining space is connected with described end of file address has merged the distribution for new retaining space.
Further, described postpone to distribute refer to file increase need to distribute new disk space time, reserve the space increasing and need, on disk, do not give its allocation space immediately, until just real allocation space during file data rule.
Further, described file data rule refers to that file system is when to file write operation, first writes in the buffer memory of internal memory by data, by the time certain time point again unification write on disk unit.
Further, for the file stall that newly creates distribute the disk space of size needed for reserved file time, if when described disk does not have a free space, then search retaining space and changed into common disk slack space and carry out reserved distribution.
Further, described file system postpone to distribute employ above-mentioned retaining space after be the new retaining space of described file application.
In order to reach the object of the invention, present invention also offers a kind of disk slack space distributor, it is characterized in that, comprising: processor; For storing the storer of the executable program of described processor; Wherein, described processor is configured to for performing said method.
Accompanying drawing explanation
Accompanying drawing is used to provide the further understanding to technical solution of the present invention, and forms a part for instructions, is used from and explains technical scheme of the present invention, do not form the restriction to technical solution of the present invention with the embodiment one of the application.
Fig. 1 shows the retaining space application flow chart of the file according to one embodiment of the invention;
Fig. 2 shows the allocation flow figure of the disk slack space according to one embodiment of the invention.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly understand, hereinafter will be described in detail to embodiments of the invention by reference to the accompanying drawings.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combination in any mutually.
Can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing.Further, although show logical order in flow charts, in some cases, can be different from the step shown or described by order execution herein.
In order to illustrate better, first clear and definite two concepts: retaining space and headspace.
Retaining space described in this explanation, referring to that file system is that file increases the physical address space needing to retain on disk, is one section of continuous space of the end address position of and then current file.
Described headspace, it postpones the concept in distribution, refer to disk space file being carried out to write operation and need to reserve in advance when increasing the address space of file, really not distribute on disk, when file system write with a brush dipped in Chinese ink be cached to disk time just real allocation space, the operation such as merging and adjustment may have been carried out owing to having carried out repeatedly free space to distribute at the preceding document writing with a brush dipped in Chinese ink buffer memory in these addresses by scope now.
The corresponding retaining space structure of each file, this structure is organized with the form of B+tree, and the index of B+tree is No. inode of file, and this B+tree is designated as retaining space B+tree in the present invention.Retaining space is with the form tissue of key-value pair on disk unit, and each key-value pair and specific file are associated together by No. inode (file identification).
Disk space shared by file becomes certain proportional relation with the growth number of times of file, and it is larger that file increases number of times used disk space more.The growth number of times of label record file is set, determines the size of retaining space when arranging retaining space to file according to the growth number of times of file.The retaining space of file has a minimum value and a maximal value, is set to minimum value when arranging retaining space to file first time, arranges retaining space size until the maximal value that presets according to the growth number of times of file later.The growth number of times of this explanation file is designated as GrowNum, and retaining space minimum value is designated as MinVal, and retaining space maximal value is designated as MaxVal.
With reference to accompanying drawing 1, according to one embodiment of the invention, retaining space creates or is allocated in file first time after file increases to be needed, again to disk application space, to carry out different operations according to different situations:
(1) if file first time arranges retaining space, then whether inquiry judging has the continuous free space be connected with this file end address.If had, then compare the size of this section of continuous free space and MinVal, if the continuous free space of this section is less than or equal to MinVal, then continuous for this section free space is set to retaining space; If the continuous free space of this section is greater than MinVal, then the space distributing MinVal size from this section of space is used as retaining space.
If the continuous free space that this end of file does not have address to be connected, then this no longer arranges retaining space.
(2) if this file is not first time arrange retaining space, then whether the retaining space of inquiry judging file finishes using.
If the retaining space of this file is finished using, then whether inquiry judging has the continuous space be connected with this file end address, and calculates the size of the new retaining space needing to arrange according to GrowNum.If free space is less than or equal to the size of the retaining space calculated continuously, then this section of continuous space is set to the retaining space of file, otherwise the size of the retaining space that Distribution Calculation goes out is used as retaining space from this section of space.
If the continuous free space that this end of file does not have address to be connected, then this no longer arranges retaining space.
(3) if the retaining space of file has not been assigned with, then whether inquiry judging has the continuous space be connected with this file end address, and calculates the size of the new retaining space needing to arrange according to GrowNum.If have continuous print space and the size sum of the size in this section of space and original retaining space remainder is less than or equal to the size that the new needs that calculate are arranged, these two sections of spaces are merged and is used for retaining space, if have continuous print space and the size sum of the size in this section of space and retaining space remainder is greater than the size of the new retaining space calculated, then to merge with retaining space remainder be used for new retaining space by distributing a part in continuous space.
If this end of file do not have address be connected continuous free space, then using original retaining space remainder as new retaining space.
Further, the described size calculating the retaining space needing to arrange according to GrowNum refers to and first calculates a value according to GrowNum and the rule preset, then compares with MaxVal, gets the size of little person wherein as new retaining space.
Further, described in the rule that presets refer to, the proportionate relationship between the size of predetermined GrowNum and retaining space size, namely GrowNum is larger, then retaining space is larger.
With reference to accompanying drawing 2, according to one embodiment of the invention, as follows to the flow process of file allocation disk slack space:
(1) the new file created is determined whether, if so, then calculation document requisite space, the inquiry whether available free space of disk.If the available free space of disk, then for postponing the disk space distributing size needed for reserved file; If disk does not have free space, then inquiry also headspace from retaining space B+tree, namely retaining space is changed into common disk slack space, regarded as common disk space to use, and for postponing the disk space distributing size needed for reserved file.If also there is no space in retaining space B+tree, the disk is already full, distribute unsuccessfully.
(2) if not the new file created, then calculation document increases requisite space, and compares the size of this value and retaining space.If the size of retaining space equals the size that this sub-distribution needs, by retaining space all as this allocation of space; If the size of retaining space is less than this sub-distribution requisite space, retaining space is all used for this sub-distribution, then reserves not enough segment space by inquiry disk slack space; If the size of retaining space is greater than this sub-distribution requisite space, after meeting size needed for this sub-distribution, remaining space is continued the retaining space as this file.
(3) if when data are write with a brush dipped in Chinese ink disk by file system, the operation of headspace is had in above-mentioned (1) or (2), then real batch operation is carried out to reserved disk space, and data are write with a brush dipped in Chinese ink in the space of above-mentioned distribution.
Further, the method for the described application retaining space with reference to the accompanying drawings in 1 is the new retaining space of described file application.
In the exemplary embodiment, additionally provide a kind of non-transitory computer-readable recording medium comprising instruction, such as, comprise the storer of instruction, above-mentioned instruction can be performed by the processor of a device to complete said method.Such as, described non-transitory computer-readable recording medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk and optical data storage devices etc.
Although the embodiment disclosed by the present invention is as above, the embodiment that described content only adopts for ease of understanding the present invention, and be not used to limit the present invention.Those of skill in the art belonging to any the present invention; under the prerequisite not departing from the spirit and scope disclosed by the present invention; any amendment and change can be carried out in the form implemented and details; but scope of patent protection of the present invention, the scope that still must define with appending claims is as the criterion.

Claims (11)

1. a disk slack space distribution method, is characterized in that,
For file arranges retaining space;
The delay of file system distributes use above-mentioned retaining space, is be physically one section of continuation address to make the space distributed in file propagation process.
2. the method for claim 1, is characterized in that, described retaining space refers to that file system is that file increases the physical address space needing to retain on disk, and it is one section of continuous space of the end address position of and then described file.
3. method as claimed in claim 2, it is characterized in that, described retaining space is with the form tissue of key-value pair on disk unit, and each key-value pair and described file are associated together by No. inode.
4. the method for claim 1, is characterized in that, the growth number of times according to file calculates the size needing the retaining space arranged.
5. as right wants the method as described in 4, it is characterized in that, described retaining space has maximal value and minimum value, and the size of the retaining space that the described growth number of times according to file calculates compares with described maximal value, wherein gets the size of smaller as new retaining space.
6. method as claimed in claim 4, it is characterized in that, if the retaining space of file has not been assigned with, then, when carrying out new retaining space and distributing, the continuous space that above-mentioned unappropriated retaining space is connected with described end of file address has merged the distribution for new retaining space.
7. the method for claim 1, it is characterized in that, when described delay distributes the disk space referring to and need distribution new in file growth, reserve the space increasing needs, its allocation space is not given immediately, until just real allocation space during file data rule on disk.
8. method as claimed in claim 7, it is characterized in that, described file data rule refers to that file system is when to file write operation, first writes in the buffer memory of internal memory by data, by the time certain time point again unification write on disk unit.
9. the method for claim 1, it is characterized in that, for the file stall that newly creates distribute the disk space of size needed for reserved file time, if when described disk does not have a free space, then search retaining space and changed into common disk slack space and carry out reserved distribution.
10. the method for claim 1, described file system postpone to distribute employ above-mentioned retaining space after be the new retaining space of described file application.
11. 1 kinds of disk slack space distributors, is characterized in that, comprising:
Processor;
For storing the storer of the executable program of described processor;
Wherein, described processor is configured to the method for performing described in the claims 1-10.
CN201510561597.1A 2015-09-06 2015-09-06 Distribution method of free space of disk Pending CN105159612A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510561597.1A CN105159612A (en) 2015-09-06 2015-09-06 Distribution method of free space of disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510561597.1A CN105159612A (en) 2015-09-06 2015-09-06 Distribution method of free space of disk

Publications (1)

Publication Number Publication Date
CN105159612A true CN105159612A (en) 2015-12-16

Family

ID=54800486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510561597.1A Pending CN105159612A (en) 2015-09-06 2015-09-06 Distribution method of free space of disk

Country Status (1)

Country Link
CN (1) CN105159612A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442555A (en) * 2019-07-26 2019-11-12 华中科技大学 A kind of method and system of the reduction fragment of selectivity reserved space
CN110663019A (en) * 2017-05-26 2020-01-07 微软技术许可有限责任公司 File system for Shingled Magnetic Recording (SMR)
CN112559390A (en) * 2016-09-23 2021-03-26 华为数字技术(成都)有限公司 Data write-in control method and storage device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101556557A (en) * 2009-05-14 2009-10-14 浙江大学 Object file organization method based on object storage device
CN103116552A (en) * 2013-03-18 2013-05-22 华为技术有限公司 Method and device for distributing storage space in distributed type storage system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101556557A (en) * 2009-05-14 2009-10-14 浙江大学 Object file organization method based on object storage device
CN103116552A (en) * 2013-03-18 2013-05-22 华为技术有限公司 Method and device for distributing storage space in distributed type storage system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
翟超: "基于对象存储的日志文件系统研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
覃灵军: "基于对象的主动存储关键技术研究", 《中国博士学位论文全文数据库 信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559390A (en) * 2016-09-23 2021-03-26 华为数字技术(成都)有限公司 Data write-in control method and storage device
CN112559390B (en) * 2016-09-23 2023-06-06 成都华为技术有限公司 Data writing control method and storage device
CN110663019A (en) * 2017-05-26 2020-01-07 微软技术许可有限责任公司 File system for Shingled Magnetic Recording (SMR)
CN110663019B (en) * 2017-05-26 2023-11-14 微软技术许可有限责任公司 File system for Shingled Magnetic Recording (SMR)
CN110442555A (en) * 2019-07-26 2019-11-12 华中科技大学 A kind of method and system of the reduction fragment of selectivity reserved space
CN110442555B (en) * 2019-07-26 2021-08-31 华中科技大学 Method and system for reducing fragments of selective reserved space

Similar Documents

Publication Publication Date Title
US9665493B2 (en) Increased cache performance with multi-level queues of complete tracks
US11061788B2 (en) Storage management method, electronic device, and computer program product
CN110297603B (en) Method and device for improving random writing performance based on solid state disk and computer equipment
US20130007370A1 (en) Method and apparatus for minimizing working memory contentions in computing systems
US20190004703A1 (en) Method and computer system for managing blocks
CN111563052B (en) Caching method and device for reducing read delay, computer equipment and storage medium
CN111522507B (en) Low-delay file system address space management method, system and medium
US10884913B2 (en) Memory management
US11449402B2 (en) Handling of offline storage disk
US20170316027A1 (en) Online file system check
CN105159612A (en) Distribution method of free space of disk
US20170123975A1 (en) Centralized distributed systems and methods for managing operations
US20200133810A1 (en) Method for managing multiple disks, electronic device and computer program product
CN105373484A (en) Memory distribution, storage and management method in network communication chip
CN110287129B (en) L2P table updating and writing management method and device based on solid state disk
US10489351B2 (en) Heuristic journal reservations
CN111061690A (en) RAC-based database log file reading method and device
US10180901B2 (en) Apparatus, system and method for managing space in a storage device
CN110347338A (en) Mix internal storage data exchange and processing method, system and readable storage medium storing program for executing
CN110737607A (en) Method and device for managing HMB memory, computer equipment and storage medium
CN105354153A (en) Implement method for data exchange and cache of tightly-coupled heterogeneous multi-processor
CN112764662B (en) Method, apparatus and computer program product for storage management
CN116069685B (en) Storage system write control method, device, equipment and readable storage medium
CN108519860B (en) SSD read hit processing method and device
CN104252415B (en) Method and system for redistributing data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20151216