CN103500077A - File storage method and device - Google Patents

File storage method and device Download PDF

Info

Publication number
CN103500077A
CN103500077A CN201310486128.9A CN201310486128A CN103500077A CN 103500077 A CN103500077 A CN 103500077A CN 201310486128 A CN201310486128 A CN 201310486128A CN 103500077 A CN103500077 A CN 103500077A
Authority
CN
China
Prior art keywords
file
size
free space
subspaces
subspace
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.)
Granted
Application number
CN201310486128.9A
Other languages
Chinese (zh)
Other versions
CN103500077B (en
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.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology 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 Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201310486128.9A priority Critical patent/CN103500077B/en
Publication of CN103500077A publication Critical patent/CN103500077A/en
Application granted granted Critical
Publication of CN103500077B publication Critical patent/CN103500077B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a file storage method and device. The file storage method includes the steps of obtaining files in a cache space of a disc, detecting the sizes of the files, comparing the sizes of the files with the sizes of multiple subspaces, and storing the files into the subspace, with the size larger than the sizes of the files, among the multiple subspaces, wherein the disc comprises a storage space and the cache space, and the storage space comprises the multiple subspaces. Through the file storage method and device, the files can be automatically stored into the subspaces, with available space larger than the files, of the disc.

Description

File memory method and device
Technical field
The present invention relates to internet arena, in particular to a kind of file memory method and device.
Background technology
The hard disk of computing machine, video recorder and video camera etc. can have one or more disk, the capacity of the storage space of each disk is changeless, like this, when the files such as backup file of file on certain disk storage copied files or line, tend to the situation that occurs that disk has been filled with, at this moment, the user wants to continue to deposit above-mentioned file and just must manually it be moved in other available disk.
For example, the backup file that file A is file B on line, its size is 2GB, now, the free space of computing machine C dish is 1GB, and the free space of computing machine D dish is 3GB, like this, when computing machine C coils at storage file A, there will be the warning of C dish free space deficiency, now, if the user wants to continue storage file A, must manually file A be moved in other available disk, in the free space D dish that is 3GB.
For in correlation technique when the free space of certain disk is not enough, manually migrated file arrives the problem of other available disk, not yet proposes at present effective solution.
Summary of the invention
Fundamental purpose of the present invention is to provide a kind of file memory method and device, and to solve in correlation technique when certain disk free space is not enough, manually migrated file arrives the problem of other available disks.
To achieve these goals, according to an aspect of the present invention, provide a kind of file memory method.The method comprises: obtain the file in the spatial cache of disk, wherein, described disk comprises storage space and described spatial cache, and described storage space comprises a plurality of subspaces; Detect the size of described file; The free space of described file and described a plurality of subspaces is carried out to the size contrast; And described file is stored to free space in described a plurality of subspace is greater than in a sub spaces of described file.
Further, the size that detects described file comprises: the size that detects the file in described spatial cache at interval of Preset Time.After the size of the file at interval of Preset Time, detecting described spatial cache, described file memory method also comprises: whether the size that judges described file is greater than preset value, wherein, when the size of described file is greater than described preset value, the free space of described file and described a plurality of subspaces is carried out to the size contrast.
Further, after whether the size that judges described file is greater than described preset value, described file memory method also comprises: if judge described file, be not more than described preset value, whether the creation-time that judges described file surpasses the Preset Time value, wherein, if the creation-time of described file surpasses described Preset Time value, the free space of described file and described a plurality of subspaces is carried out to the size contrast.
Further, after the creation-time of described file surpasses the Preset Time value, described method also comprises: whether the form that judges described file meets predetermined compressed format; If, and the form of described file meets described predetermined compressed format, described file is compressed.
Further, the free space of described file and described a plurality of subspaces being carried out to the size contrast comprises: the free space to described a plurality of subspaces is sorted according to size; The subspace of free space minimum in described file and described a plurality of subspace is started, free space according to each sub spaces in sequence and described a plurality of subspaces is contrasted one by one, until find the subspace that free space is greater than described file size, wherein, described file being stored to the sub spaces that free space in described a plurality of subspace is greater than described file comprises: described file is stored in the subspace found.
To achieve these goals, according to a further aspect in the invention, provide a kind of file storage device.This device comprises: acquiring unit, and for the file of the spatial cache that obtains disk, wherein, described disk comprises storage space and described spatial cache, described storage space comprises a plurality of subspaces; Detecting unit, for detection of the size of described file; The contrast unit, carry out the size contrast for the free space by described file and described a plurality of subspaces; And storage unit, for described file being stored to described a plurality of subspaces free space, be greater than in a sub spaces of described file.
Further, described detecting unit is for detecting the size of the file of described spatial cache at interval of Preset Time, described device also comprises: the first judging unit, for after the size of the file that detects described spatial cache at interval of Preset Time, whether the size that judges described file is greater than preset value, wherein, described contrast unit, for when the size of described file is greater than described preset value, carries out the size contrast by the free space of described file and described a plurality of subspaces.
Further, described device also comprises: the second judging unit, for after whether the size that judges described file is greater than described preset value, when judging described file and be not more than described preset value, the creation-time that judges described file surpasses the Preset Time value, wherein, when described contrast unit surpasses described Preset Time value for the creation-time at described file, the free space of described file and described a plurality of subspaces is carried out to the size contrast.
Further, described device also comprises: the 3rd judging unit, after surpassing the Preset Time value for the creation-time at described file, judges whether the form of described file meets predetermined compressed format; And compression unit, meet described predetermined compressed format for the form at described file, described file is compressed.
Further, described contrast unit comprises: order module, sorted according to size for the free space to described a plurality of subspaces; The contrast module, for the subspace of described file and described a plurality of subspaces free space minimum is started, free space according to each sub spaces in sequence and described a plurality of subspaces is contrasted one by one, until find the subspace that free space is greater than described file size, wherein, described storage unit is for being stored to by described file the subspace found.
By the present invention, adopt the file in the spatial cache that obtains disk, wherein, disk comprises storage space and spatial cache, storage space comprises a plurality of subspaces; Detect the size of file; File and a plurality of subspace are carried out to the size contrast; And file is stored in a plurality of subspaces in a sub spaces that is greater than file, solved in the correlation technique free space at certain disk when not enough, manually migrated file is to the problem of other available disk, and then reached the effect in automatic document storing is greater than file size disk subspace to free space.
The accompanying drawing explanation
The accompanying drawing that forms the application's a part is used to provide a further understanding of the present invention, and schematic description and description of the present invention the present invention does not form inappropriate limitation of the present invention for explaining.In the accompanying drawings:
Fig. 1 is the file storage device according to first embodiment of the invention;
Fig. 2 is the file storage device according to second embodiment of the invention;
Fig. 3 is the file storage device according to third embodiment of the invention;
Fig. 4 is the file storage device according to fourth embodiment of the invention;
Fig. 5 is the file storage device according to fifth embodiment of the invention;
Fig. 6 is the file memory method according to first embodiment of the invention;
Fig. 7 is the file memory method according to second embodiment of the invention; And
Fig. 8 is the file memory method according to third embodiment of the invention.
Embodiment
It should be noted that, in the situation that do not conflict, embodiment and the feature in embodiment in the application can combine mutually.Describe below with reference to the accompanying drawings and in conjunction with the embodiments the present invention in detail.
In order to make those skilled in the art better understand the present invention program, below in conjunction with the accompanying drawing in the embodiment of the present invention, to being clearly and completely described in the embodiment of the present invention, obviously, described embodiment is only the embodiment of a part of the present invention, rather than whole embodiment.Embodiment based in the present invention, do not make under the creative work prerequisite the every other embodiment obtained those of ordinary skills, all should belong to protection scope of the present invention.
It should be noted that, the term " first " in instructions of the present invention and claims and above-mentioned accompanying drawing, " second " etc. are for distinguishing similar object, and needn't be for describing specific order or precedence.The data that should be appreciated that such use suitably can exchanged in situation, so as embodiments of the invention described herein can with except diagram here or describe those order enforcement.In addition, term " comprises " and " having " and their any distortion, is intended to be to cover not exclusive comprising.
According to embodiments of the invention, a kind of file storage device is provided, this document memory storage is greater than in a sub spaces of file for a plurality of subspaces that automatically file are stored to disk.
Fig. 1 is the file storage device according to first embodiment of the invention.
As shown in Figure 1, this document memory storage comprises: acquiring unit 10, detecting unit 20, contrast unit 30 and storage unit 40.
Acquiring unit 10 is for the file of the spatial cache that obtains disk, and acquiring unit 10 can obtain one or more file in the spatial cache of disk at every turn.Wherein, disk can be a disk of any hard disk, and each disk comprises spatial cache and storage space.Spatial cache is to have a fixedly logic magnetic disc space of access path.Storage space is the unlimited Virtual Space of store data, this storage space comprises one or more subspace, every sub spaces can have the fixedly physical space of access path for one, like this, in storage during this document, can by one fixedly access path find the sub spaces of storage this document.
It should be noted that, in embodiments of the present invention, above-mentioned file can be for copied files or database file or from the backup file of the Internet download.It should be noted that, in embodiments of the present invention, above-mentioned disk can comprise the disk arbitrarily such as fixed disk, mechanical disk and hybrid magnetic disc.
Detecting unit 20 is for detection of the size of file, and wherein, detecting unit 20 can detect the size of file itself at any time, also can detect at any time the size of the variant of file.Detecting unit 20 can detect the size of the byte number of file with file by employing.In embodiments of the present invention, detect the size of files by detecting unit 20, can predict this document needs great storage space, like this, can find free space to be greater than the subspace of storage space of file with storage this document.
Contrast unit 30 is for carrying out the size contrast by file and a plurality of subspace.The size of the file that contrast unit 30 can detect the size of the free space of any one subspace and detecting unit 20 is contrasted, when the free space of subspace is greater than file big or small, by this subspace of access in the fixedly access path of this subspace, and store this document in this subspace, when the free space of subspace is not more than file big or small, the size that continues file that the size of the free space of next subspace and detecting unit 20 are detected is contrasted, until find free space to be greater than the subspace of this document size.Like this, the contrast effect by contrast unit 30, can filter out free space and be greater than the subspace of file size with storage file.
Storage unit 40 is greater than in a sub spaces of file for file being stored to a plurality of subspaces free space.
Like this, pass through the embodiment of the present invention, adopt detecting unit 20 and contrast unit 30, can obtain free space according to the size of the size of the free space of a plurality of subspaces and file or variant file corresponding to file and be greater than the subspace of file or variant file size with storage this document or this variant file, detecting unit 20 and contrast unit 30 have been avoided so not adopting and the direct problem of the free space deficiency of this subspace when a sub spaces storage file, and then reached the effect of the subspace in automatic document storing is greater than file or variant file size disk to free space.
Fig. 2 is the file storage device according to second embodiment of the invention.
As shown in Figure 2, this embodiment can be used as preferred implementation embodiment illustrated in fig. 1, the file storage device of this embodiment, except the acquiring unit 10, detecting unit 20, contrast unit 30 and the storage unit 40 that comprise the first embodiment, also comprises the first judging unit 50.
Identical with in the first embodiment of the effect of acquiring unit 10 and storage unit 40, do not repeat them here.
In embodiments of the present invention, detecting unit 20 is for detecting the size of the file of spatial cache at interval of Preset Time, wherein, Preset Time can be time span arbitrarily, for example, Preset Time can be 1 hour, and now, detecting unit 20 is for the size at interval of detecting the file of spatial cache in 1 hour.
After the size of the first judging unit 50 for the file detect spatial cache at interval of Preset Time, judge whether the size of file is greater than preset value.Wherein, preset value can be set according to the size of spatial cache or the size of storage space or the size (that is, the size of disk) of spatial cache and storage space, and for example, preset value can be 20% of spatial cache size.
In embodiments of the present invention, when contrast unit 30 is greater than preset value for the size at file, the free space of file and a plurality of subspaces is carried out to the size contrast, when the size of file is not more than preset value, first this document is not done to any processing.
Like this, in embodiments of the present invention, judgement effect by the first judging unit 50, can the file of spatial cache tentatively be filtered, and the file that file size is greater than certain value is carried out to priority processing, that is the file that, file size is greater than to certain value is preferentially contrasted and is stored by storage unit 40 by contrast unit 30.
Fig. 3 is the file storage device according to third embodiment of the invention.
As shown in Figure 3, this embodiment can be used as preferred implementation embodiment illustrated in fig. 2, the file storage device of this embodiment, except the acquiring unit 10 that comprises the second embodiment, detecting unit 20, contrast unit 30, storage unit 40 and the first judging unit 50, also comprises the second judging unit 60.
Identical with in the second embodiment of the effect of acquiring unit 10, detecting unit 20, storage unit 40 and the first judging unit 50, do not repeat them here.
After whether the second judging unit 60 is greater than preset value for the size judging file, when judging file and be not more than preset value, judge whether the creation-time of file surpasses the Preset Time value.Wherein, the Preset Time value is the time value arranged arbitrarily, and for example, the Preset Time value can be 2 hours.The second judging unit 60 can be judged in conjunction with the current time when whether the creation-time that judges file surpasses the Preset Time value.
In embodiments of the present invention, when contrast unit 30 surpasses the Preset Time value for the creation-time at file, the free space of file and a plurality of subspaces is carried out to the size contrast.
Like this, in embodiments of the present invention, excessively overstock at spatial cache and causing the crowded of spatial cache by the file that adopts the second judging unit 60 can prevent that file size is not more than preset value, and then can alleviate the pressure of spatial cache.In addition, can not be contrasted on time and be stored in the subspace of corresponding storage space by the file that adopts the second judging unit 60 also can prevent that file size is not more than preset value, and then reached the effect that is contrasted in time and store this document.
Fig. 4 is the file storage device according to fourth embodiment of the invention.
As shown in Figure 4, this embodiment can be used as preferred implementation embodiment illustrated in fig. 3, the file storage device of this embodiment, except the acquiring unit 10, detecting unit 20, contrast unit 30, storage unit 40, the first judging unit 50 and the second judging unit 60 that comprise the 3rd embodiment, also comprises the 3rd judging unit 70 and compression unit 80.
Identical with in the 3rd embodiment of the effect of acquiring unit 10, detecting unit 20, storage unit 40 and the first judging unit 50, do not repeat them here.
When the 3rd judging unit 70 surpasses the Preset Time value for the creation-time at file, judge whether the form of file meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the 3rd judging unit 70 can be the text file format such as .log/.txt for the form that judges file.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
Preferably, in embodiments of the present invention, after the 3rd judging unit 70 can also be greater than preset value for the size judging file, whether the form that the size that judges file is greater than the file of preset value meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the 3rd judging unit 70 can be the text file format such as .log/.txt for the form that judges file.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
Compression unit 80 meets predetermined compressed format for the form at file, that is, while meeting the text file format such as .log/.txt, file is compressed.The compression that meets the file process compression unit 80 of default compressed format can obtain taking the variant file that storage space diminishes.Preferably, in embodiments of the present invention, compression unit 80 can be encrypted compression to file.
In embodiments of the present invention, contrast unit 30 is for the size of the free space that contrasts a plurality of subspaces with take the size of the variant file (that is, compressed file) of the file that storage space is less.
Like this, in embodiments of the present invention, by adopting the 3rd judging unit 70 and compression unit 80, can automatically obtain taking the compressed file that storage space is less, and then reach the effect of saving storage space.
Fig. 5 is the file storage device according to fifth embodiment of the invention.
As shown in Figure 5, this embodiment can be used as preferred implementation embodiment illustrated in fig. 1, the file storage device of this embodiment comprises acquiring unit 10, detecting unit 20, contrast unit 30 and the storage unit 40 of the first embodiment, wherein, in embodiments of the present invention, contrast unit 30 comprises order module 301 and contrast module 302.
Identical with in the first embodiment of the effect of acquiring unit 10 and detecting unit 20, do not repeat them here.
Order module 301 is for being sorted according to the free space size to a plurality of subspaces, and order module 301 is also for being numbered a plurality of subspaces according to sequence, the mode of this numbering is various, and for example, numbering can be arabic numeral numbering or alpha code etc.In embodiments of the present invention, order module 301 can be for to a plurality of subspaces, according to free space, order is from small to large sorted, also can be for to a plurality of subspaces, according to free space, order is from big to small sorted.Like this, by adopting sequencing unit 301, the order of a plurality of subspaces that contrast module 302 can sequence in advance according to sequencing unit 301 compares the size of the free space of the size of file and a plurality of subspaces successively, realize the problem of orderly comparison, and then reached the effect that improves relative efficiency.
In embodiments of the present invention, contrast module 302 starts for the subspace by file and a plurality of subspaces free space minimum, according to the sequence in advance of order module 301 and the free space of each sub spaces in a plurality of subspace, contrasted one by one, until find the subspace that free space is greater than file size.For example, suppose free space minimum in a plurality of subspaces subspace be numbered 1, the subspace that free space time is minimum be numbered 2, and subspace is numbered according to ascending its of its free space the increasing sequence that tolerance is 1, contrast module 302 can be for starting the size of free space file size and a plurality of subspace is compared from the minimum subspace of numbering, a plurality of subspace, until find free space to be greater than the subspace of file size.
In embodiments of the present invention, storage unit 40 is for being stored to file the subspace found.
Like this, in embodiments of the present invention, by adopting order module 301 and contrast module 302, realized the problem of orderly comparison, and then reached the effect that improves relative efficiency.
It should be noted that, in the of the present invention first to the 5th embodiment, this document memory storage can also comprise updating block.This updating block for upgrading the interval of the date created of whole storage files after storage unit 40 has been stored file.Particularly, in the time of within the interval of date created at date created of this stored file, do not upgrade the interval of this date created; In the time of outside the interval of date created at date created of this stored file, according to the interval of the date created of the interval updating file of the date created of this document and this date created.For example, the interval of supposing the date created of file is on October 1,1 day to 2013 January in 2000, and when the date created of stored file is on October 5th, 2013, the interval of upgrading above-mentioned date created is on October 5,1 day to 2013 January in 2000.
Like this, in the present invention, by adopting updating block, when locating file, can search in the interval of corresponding date created according to the date created of file, reach the effect that improves ff efficiency.
According to embodiments of the invention, a kind of file memory method is provided, this document storage means is greater than in a sub spaces of file for a plurality of subspaces free space that automatically file is stored to disk.This document storage means may operate on computer-processing equipment.It should be noted that, the file memory method that the embodiment of the present invention provides can be carried out by the file storage device of the embodiment of the present invention, and the file storage device of the embodiment of the present invention also can be for carrying out the file memory method of the embodiment of the present invention.
Fig. 6 is the file memory method according to first embodiment of the invention.
As shown in Figure 6, this document storage means comprises that following step S101 is to step S104:
Step S101, obtain the file in the spatial cache of disk.
Obtain one or more file in the spatial cache that file in the spatial cache of disk can obtain disk at every turn.Wherein, disk can be a disk of any hard disk, and each disk comprises spatial cache and storage space.Spatial cache is to have a fixedly logic magnetic disc space of access path.Storage space is the unlimited Virtual Space of store data, this storage space comprises one or more subspace, every sub spaces can have the fixedly physical space of access path for one, like this, in storage during this document, can by one fixedly access path find the sub spaces of storage this document.
It should be noted that, in embodiments of the present invention, above-mentioned file can be for copied files or database file or from the backup file of the Internet download.It should be noted that, in embodiments of the present invention, above-mentioned disk can comprise the disk arbitrarily such as fixed disk, mechanical disk and hybrid magnetic disc.
Step S102, the size of detection file.
The size that detects file can detect the size of file itself at any time, also can detect at any time the size of the variant file of file, for example, can detect at any time the size of compressed file.Detect the size of described file and can pass through to detect the size of the byte number of file with file.Like this, in embodiments of the present invention, by detecting the size of file, can predict this document needs great storage space, thereby can find free space to be greater than the subspace of storage space of file with storage this document.
Step S103, carry out the size contrast by the free space of file and a plurality of subspaces.
Big or small contrast is carried out in file and a plurality of subspace can be contrasted the size of the size of the free space of any one subspace and the file detected, when the free space of subspace is greater than file big or small, by this subspace of access in the fixedly access path of this subspace, and store this document in this subspace, when the free space of subspace is not more than file big or small, continue the size of the free space of next subspace and the size of the file detected are contrasted, until find free space to be greater than the subspace of this document size.Like this, by file and a plurality of subspace are carried out to the size contrast, can filter out free space and be greater than the subspace of file size with storage file.
Step S104, be stored to free space in a plurality of subspaces by file and be greater than in a sub spaces of file.
Like this, pass through the embodiment of the present invention, adopt step S102 and step S103, can obtain free space according to the size of the size of the free space of a plurality of subspaces and file or variant file corresponding to file and be greater than the subspace of file or variant file size with storage this document or this variant file, step S102 and step S103 have been avoided so not adopting and the direct problem of the free space deficiency of this subspace when a sub spaces storage file, and then reached the effect of the subspace in automatic document storing is greater than file or variant file size disk to free space.
In embodiments of the present invention, preferably, step S103 can comprise:
Sorted according to the free space size in a plurality of subspaces.
Sorted according to the free space size in a plurality of subspaces, and according to sequence, a plurality of subspaces are numbered, the mode of this numbering is various, and for example, numbering can be arabic numeral numbering or alpha code etc.In embodiments of the present invention, to a plurality of subspaces, according to free space, order is from small to large sorted, also can be for to a plurality of subspaces, according to free space, order is from big to small sorted.Like this, the order by a plurality of subspaces of sequencing in advance compares the size of the free space of the size of file and a plurality of subspaces successively, has realized the problem of orderly comparison, and then has reached the effect that improves relative efficiency.
Free space according to each sub spaces in sequence and a plurality of subspaces is contrasted one by one.
In embodiments of the present invention, the subspace of free space minimum in file and a plurality of subspace is started, free space according to each sub spaces in pre-sorting and a plurality of subspace is contrasted one by one, until find the subspace that free space is greater than file size.For example, suppose free space minimum in a plurality of subspaces subspace be numbered 1, the subspace that free space time is minimum be numbered 2, and subspace is numbered according to ascending its of its free space the increasing sequence that tolerance is 1, contrast module 302 can be for starting the size of free space file size and a plurality of subspace is compared from the minimum subspace of numbering, a plurality of subspace, until find free space to be greater than the subspace of file size.
Further, in embodiments of the present invention, preferably, step S104 can be for being stored to file in the subspace found.
Like this, in embodiments of the present invention, by being sorted according to the free space size in a plurality of subspaces and being contrasted one by one according to sequence and the free space of each sub spaces in a plurality of subspaces, realized the problem of orderly comparison, and then reached the effect that improves relative efficiency.
Fig. 7 is the file memory method according to second embodiment of the invention.
As shown in Figure 7, this document storage means comprises that following step S201 is to step S205, and this embodiment can be used as preferred implementation embodiment illustrated in fig. 6.
Step S201, the step S101 with embodiment illustrated in fig. 6, do not repeat them here.
Step S202, at interval of the size of the file in Preset Time detection spatial cache.
In embodiments of the present invention, the size that detects file can be for detecting the size of the file in spatial cache at interval of Preset Time, wherein, Preset Time can be time span arbitrarily, for example, Preset Time can be 1 hour, and now, the size that detects file can be the size at interval of detecting the file in spatial cache in 1 hour.
Step S203, judge whether the size of file is greater than preset value.
In embodiments of the present invention, after the size of the file at interval of Preset Time, detecting spatial cache, whether the size that can judge file is greater than preset value, wherein, preset value can be according to the size of the size of the size of spatial cache or storage space or spatial cache and storage space (, the size of disk) set, for example, preset value can be 20% of spatial cache size.After the size of judging file is greater than preset value, execution step S204, otherwise execution step S201.
Step S204, carry out the size contrast by the free space of file and a plurality of subspaces.
In embodiments of the present invention, when the size of judging file is greater than preset value, the free space of file and a plurality of subspaces is carried out to the size contrast, when the size of file is not more than preset value, first this document is not done to any processing.
Step S205, with step S104 embodiment illustrated in fig. 6, do not repeat them here.
Like this, in embodiments of the present invention, by step S203, can the file of spatial cache tentatively be filtered, and the file that file size is greater than certain value is carried out to priority processing, that is, the file that file size is greater than to certain value, preferentially by step S204 and step S205, carries out respectively the free space of file and a plurality of subspaces is carried out to the size contrast and file is stored to free space in a plurality of subspaces being greater than in a sub spaces of file.
Fig. 8 is the file memory method according to third embodiment of the invention.
As shown in Figure 8, this document storage means comprises that following step S301 is to step S303, step S3041 and step S3042 and step S305, and this embodiment can be used as preferred implementation embodiment illustrated in fig. 7.
Step S301, to step S303, with step S201 embodiment illustrated in fig. 7 and step S203, does not repeat them here respectively.
Step S3041, judge whether the creation-time of file surpasses the Preset Time value.
After whether the size that judges file is greater than preset value, that is, when step S303 judges file and is not more than preset value, judge whether the creation-time of file surpasses the Preset Time value.Wherein, the Preset Time value is the time value arranged arbitrarily, and for example, the Preset Time value can be 2 hours.When whether the creation-time that judges file surpasses the Preset Time value, can be judged in conjunction with the current time.
Step S3042, carry out the size contrast by the free space of file and a plurality of subspaces.
In embodiments of the present invention, when the creation-time of judging file at step S3041 surpasses the Preset Time value, the free space of file and a plurality of subspaces is carried out to size and contrast.
Step S305, the step S205 with embodiment illustrated in fig. 7, do not repeat them here.
Like this, in embodiments of the present invention, can prevent by step S3041 that file that file size is not more than preset value from excessively overstocking at spatial cache and cause the crowded of spatial cache, and then can alleviate the pressure of spatial cache.In addition, also can prevent that by step S3041 the file that file size is not more than preset value from can not be contrasted on time and store in the subspace of corresponding storage space, and then reach the effect that is contrasted in time and store this document.
In embodiments of the present invention, preferably, the creation-time of judging file at step S3041 is over after the Preset Time value, and this document storage means can also comprise:
Whether the form that judges file meets predetermined compressed format.
When the creation-time of file surpasses the Preset Time value, judge whether the form of file meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the form that judges file meets whether the form that predetermined compressed format can judge file is the text file format such as .log/.txt.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
Further preferably, in embodiments of the present invention, after the size of judging file is greater than preset value, whether the form that the size that also can judge file is greater than the file of preset value meets predetermined compressed format.Wherein, this predetermined compressed format can comprise the text file format such as .log/.txt, that is, whether the 3rd judging unit 70 can be the text file format such as .log/.txt for the form that judges file.When the form of the file text file format such as be .log/.txt, file can automatic Compression, otherwise file can not automatic Compression.
File is compressed.
Form at file meets predetermined compressed format, that is, while meeting the text file format such as .log/.txt, file is compressed.The file that meets default compressed format can obtain taking through overcompression the variant file that storage space diminishes.Further preferably, in embodiments of the present invention, can be encrypted compression to file.
Preferably, in embodiments of the present invention, step S3042 can and take the size of the variant file (that is, compressed file) of the file that storage space is less for the size of the free space that contrasts a plurality of subspaces.
Like this, in embodiments of the present invention, by the form that judges file, whether meet predetermined compressed format and file is compressed, can automatically obtain taking the compressed file that storage space is less, and then reaching the effect of saving storage space.
It should be noted that, in the step shown in the process flow diagram of accompanying drawing, can in the computer system such as one group of computer executable instructions, carry out, and, although there is shown logical order in flow process, but in some cases, can carry out step shown or that describe with the order be different from herein.
Obviously, those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with general calculation element, they can concentrate on single calculation element, perhaps be distributed on the network that a plurality of calculation elements form, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in memory storage and be carried out by calculation element, perhaps they are made into respectively to each integrated circuit modules, perhaps a plurality of modules in them or step being made into to the single integrated circuit module realizes.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.

Claims (10)

1. a file memory method, is characterized in that, comprising:
Obtain the file in the spatial cache of disk, wherein, described disk comprises storage space and described spatial cache, and described storage space comprises a plurality of subspaces;
Detect the size of described file;
The free space of described file and described a plurality of subspaces is carried out to the size contrast; And
Described file is stored to free space in described a plurality of subspace to be greater than in a sub spaces of described file.
2. file memory method according to claim 1, is characterized in that,
The size that detects described file comprises: the size that detects the file in described spatial cache at interval of Preset Time;
After the size of the file at interval of Preset Time, detecting described spatial cache, described file memory method also comprises: whether the size that judges described file is greater than preset value,
Wherein, when the size of described file is greater than described preset value, the free space of described file and described a plurality of subspaces is carried out to the size contrast.
3. file memory method according to claim 2, is characterized in that,
After whether the size that judges described file is greater than described preset value, described file memory method also comprises: be not more than described preset value if judge described file, judge whether the creation-time of described file surpasses the Preset Time value,
Wherein, if the creation-time of described file surpasses described Preset Time value, the free space of described file and described a plurality of subspaces is carried out to the size contrast.
4. file memory method according to claim 3, is characterized in that, after the creation-time of described file surpasses the Preset Time value, described method also comprises:
Whether the form that judges described file meets predetermined compressed format; And
If the form of described file meets described predetermined compressed format, described file is compressed.
5. file memory method according to claim 1, is characterized in that, the free space of described file and described a plurality of subspaces carried out to the size contrast and comprise:
Free space to described a plurality of subspaces is sorted according to size;
The subspace of free space minimum in described file and described a plurality of subspace is started, contrasted one by one according to sequence and the free space of each sub spaces in described a plurality of subspaces, until find the subspace that free space is greater than described file size,
Wherein, described file being stored to the sub spaces that free space in described a plurality of subspace is greater than described file comprises: described file is stored in the subspace found.
6. a file storage device, is characterized in that, comprising:
Acquiring unit, for the file of the spatial cache that obtains disk, wherein, described disk comprises storage space and described spatial cache, described storage space comprises a plurality of subspaces;
Detecting unit, for detection of the size of described file;
The contrast unit, carry out the size contrast for the free space by described file and described a plurality of subspaces; And
Storage unit, be greater than in a sub spaces of described file for described file being stored to described a plurality of subspaces free space.
7. file storage device according to claim 6, is characterized in that, described detecting unit is for detecting the size of the file of described spatial cache at interval of Preset Time, and described device also comprises:
The first judging unit, after the size for the file detect described spatial cache at interval of Preset Time, judge whether the size of described file is greater than preset value,
Wherein, described contrast unit, for when the size of described file is greater than described preset value, carries out the size contrast by the free space of described file and described a plurality of subspaces.
8. file storage device according to claim 7, is characterized in that, described device also comprises:
The second judging unit, after whether being greater than described preset value for the size judging described file, when judging described file and be not more than described preset value, judge that the creation-time of described file surpasses the Preset Time value,
Wherein, when described contrast unit surpasses described Preset Time value for the creation-time at described file, the free space of described file and described a plurality of subspaces is carried out to the size contrast.
9. file storage device according to claim 8, is characterized in that, described device also comprises:
The 3rd judging unit, after surpassing the Preset Time value for the creation-time at described file, judge whether the form of described file meets predetermined compressed format; And
Compression unit, meet described predetermined compressed format for the form at described file, and described file is compressed.
10. file storage device according to claim 6, is characterized in that, described contrast unit comprises:
Order module, sorted according to size for the free space to described a plurality of subspaces;
The contrast module, for the subspace of described file and described a plurality of subspaces free space minimum is started, free space according to each sub spaces in sequence and described a plurality of subspaces is contrasted one by one, until find the subspace that free space is greater than described file size
Wherein, described storage unit is for being stored to by described file the subspace found.
CN201310486128.9A 2013-10-16 2013-10-16 File memory method and device Active CN103500077B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310486128.9A CN103500077B (en) 2013-10-16 2013-10-16 File memory method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310486128.9A CN103500077B (en) 2013-10-16 2013-10-16 File memory method and device

Publications (2)

Publication Number Publication Date
CN103500077A true CN103500077A (en) 2014-01-08
CN103500077B CN103500077B (en) 2016-08-10

Family

ID=49865293

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310486128.9A Active CN103500077B (en) 2013-10-16 2013-10-16 File memory method and device

Country Status (1)

Country Link
CN (1) CN103500077B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103838521A (en) * 2014-02-28 2014-06-04 华为技术有限公司 Data processing method and data processing device
CN105740425A (en) * 2016-01-29 2016-07-06 宇龙计算机通信科技(深圳)有限公司 File storage method and apparatus
CN106408684A (en) * 2016-09-30 2017-02-15 北京新能源汽车股份有限公司 Fault information storage method and device
CN111767009A (en) * 2020-06-24 2020-10-13 中国工商银行股份有限公司 Disk cleaning method, device and equipment
CN111782616A (en) * 2020-07-14 2020-10-16 武汉空心科技有限公司 File storage method for work platform sub-package
CN113722279A (en) * 2021-08-19 2021-11-30 北京达佳互联信息技术有限公司 Method, device and equipment for determining size of folder and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0682306A2 (en) * 1994-05-11 1995-11-15 International Business Machines Corporation Data storage system and method
CN101446924A (en) * 2008-12-16 2009-06-03 成都市华为赛门铁克科技有限公司 Method and system for storing and obtaining data
CN101675428A (en) * 2006-12-22 2010-03-17 Nxp股份有限公司 A method for storing data as well as a transponder, a read/write-device, a computer readable medium including a program element and such a program element adapted to perform this method
CN103064639A (en) * 2012-12-28 2013-04-24 华为技术有限公司 Method and device for storing data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0682306A2 (en) * 1994-05-11 1995-11-15 International Business Machines Corporation Data storage system and method
EP0682306A3 (en) * 1994-05-11 1996-02-28 Ibm Data storage system and method.
CN101675428A (en) * 2006-12-22 2010-03-17 Nxp股份有限公司 A method for storing data as well as a transponder, a read/write-device, a computer readable medium including a program element and such a program element adapted to perform this method
CN101446924A (en) * 2008-12-16 2009-06-03 成都市华为赛门铁克科技有限公司 Method and system for storing and obtaining data
CN103064639A (en) * 2012-12-28 2013-04-24 华为技术有限公司 Method and device for storing data

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103838521A (en) * 2014-02-28 2014-06-04 华为技术有限公司 Data processing method and data processing device
CN103838521B (en) * 2014-02-28 2017-02-08 华为技术有限公司 Data processing method and data processing device
CN105740425A (en) * 2016-01-29 2016-07-06 宇龙计算机通信科技(深圳)有限公司 File storage method and apparatus
CN106408684A (en) * 2016-09-30 2017-02-15 北京新能源汽车股份有限公司 Fault information storage method and device
CN106408684B (en) * 2016-09-30 2019-10-18 北京新能源汽车股份有限公司 A kind of method and device of fault message storage
CN111767009A (en) * 2020-06-24 2020-10-13 中国工商银行股份有限公司 Disk cleaning method, device and equipment
CN111782616A (en) * 2020-07-14 2020-10-16 武汉空心科技有限公司 File storage method for work platform sub-package
CN113722279A (en) * 2021-08-19 2021-11-30 北京达佳互联信息技术有限公司 Method, device and equipment for determining size of folder and storage medium
CN113722279B (en) * 2021-08-19 2024-03-01 北京达佳互联信息技术有限公司 Method, device, equipment and storage medium for determining size of folder

Also Published As

Publication number Publication date
CN103500077B (en) 2016-08-10

Similar Documents

Publication Publication Date Title
CN103500077A (en) File storage method and device
CN106547612B (en) Multitasking method and device
US9569457B2 (en) Data processing method and apparatus for distributed systems
US9823945B2 (en) Method and apparatus for managing application program
CN105653524B (en) Data storage method, device and system
US9632773B2 (en) System, method for cleaning memory space and terminal device with memory space cleaning function
CN105677742A (en) Method and apparatus for storing files
CN105117289A (en) Task allocation method, device and system based on cloud testing platform
US20160098148A1 (en) Parallel touch point detection using processor graphics
US9298561B1 (en) Systems and methods for prioritizing restoration speed with deduplicated backups
CN107608860B (en) Method, device and equipment for classified storage of error logs
CN106354817B (en) Log processing method and device
CN109800181B (en) Disk-based data writing method, data writing device and terminal equipment
CN105183564A (en) Equipment scheduling method, device and system based on cloud testing platform
CN110825694A (en) Data processing method, device, equipment and storage medium
WO2016183918A1 (en) Method and device for processing storage space
CN111813517B (en) Task queue allocation method and device, computer equipment and medium
CN109597707A (en) Clone volume data copying method, device and computer readable storage medium
CN104202428A (en) Distributed file storage system and method
CN107609133A (en) Journal file dump method, device, equipment and its computer-readable recording medium
CN103543901A (en) Method and device for generating menus
CN106202170A (en) Photo management method and photo management systems
ES2812771T3 (en) Data storage method and apparatus for mobile terminal
CN108052284B (en) Distributed data storage method and device
CN104902089A (en) Method for sequencing mobile terminal applications

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: File storage method and device

Effective date of registration: 20190531

Granted publication date: 20160810

Pledgee: Shenzhen Black Horse World Investment Consulting Co., Ltd.

Pledgor: Beijing Guoshuang Technology Co.,Ltd.

Registration number: 2019990000503

CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Patentee after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Beijing city Haidian District Shuangyushu Area No. 76 Zhichun Road cuigongfandian 8 layer A

Patentee before: Beijing Guoshuang Technology Co.,Ltd.