CN102955793B - The method and apparatus processing file carrier space - Google Patents

The method and apparatus processing file carrier space Download PDF

Info

Publication number
CN102955793B
CN102955793B CN201110242680.4A CN201110242680A CN102955793B CN 102955793 B CN102955793 B CN 102955793B CN 201110242680 A CN201110242680 A CN 201110242680A CN 102955793 B CN102955793 B CN 102955793B
Authority
CN
China
Prior art keywords
files
blocks
junk data
carrier
flag bit
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.)
Active
Application number
CN201110242680.4A
Other languages
Chinese (zh)
Other versions
CN102955793A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201110242680.4A priority Critical patent/CN102955793B/en
Publication of CN102955793A publication Critical patent/CN102955793A/en
Application granted granted Critical
Publication of CN102955793B publication Critical patent/CN102955793B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

The invention discloses a kind of method and apparatus processing file carrier space, belong to field of computer technology.Described method includes: obtain the summation of the junk data blocks of files of the file of storage in carrier;Judge that whether the summation of described junk data blocks of files is more than or equal to the threshold value preset;If it is, the effective document block copy stored on predeterminated position by described carrier is to the position of junk data blocks of files, and delete described effective document block accordingly.By to the process of junk data in file, improving the ratio that valid data are shared in the carrier, to improve the utilization rate of carrier in the embodiment of the present invention.

Description

The method and apparatus processing file carrier space
Technical field
The present invention relates to field of computer technology, particularly to a kind of method and apparatus processing file carrier space.
Background technology
In a computer, most files use Linked Storage Structure.File Linked Storage Structure is by unordered being saved on actual storage carrier of file, and logically the data message of this file is still that order dependent.Concrete, seeing Fig. 1, a file is divided into the blocks of files of some regular lengths, and in the carrier, each piece all comprises certain redundancy in scattered storage, for preserving necessary information order dependent on this Documents Logical.
In file chain structure, operation is deleted or modified all can make some file data information become junk data, so that some blocks of files become junk data blocks of files, these junk data blocks of files are mixed in and make the size of carrier become big in effective blocks of files, and the ratio shared by valid data reduces, the space availability ratio of document carrier is made to reduce.
Summary of the invention
In order to improve the space availability ratio of document carrier, embodiments provide a kind of method and apparatus processing file carrier space.Described technical scheme is as follows:
On the one hand, it is provided that a kind of method processing file carrier space, described method includes:
In antivirus software scanning carrier, the blocks of files of the All Files of storage, obtains the summation of the junk data blocks of files of the file of storage in carrier;The blocks of files of described file includes that redundancy, described redundancy include that junk data flag bit, described junk data flag bit are used for distinguishing valid data and junk data;
Judge that whether the summation of described junk data blocks of files is more than or equal to the threshold value preset;
If it is, described carrier is stored on predeterminated position effective document block copy to the position of junk data blocks of files, and delete described effective document block accordingly;
In described antivirus software scanning carrier, the blocks of files of the All Files of storage, obtains the summation of the junk data blocks of files of the file of storage in carrier, including:
Described antivirus software, when killing virus, first backs up described blocks of files and the address of described blocks of files, prior pointer, backpointer and described junk data flag bit;Described address is that described blocks of files position in described carrier, described prior pointer and described backpointer refer to described blocks of files position in described file respectively;
Obtain described junk data flag bit;
According to described junk data flag bit, calculate the summation of junk data blocks of files in described carrier;
The described effective document block copy that described carrier is stored on predeterminated position to the position of junk data blocks of files, including:
Start to scan backward the blocks of files of the All Files of storage described carrier from address zero;
When scanning described junk data blocks of files, copy last effective blocks of files in described carrier the position of described junk data blocks of files to, and revise the prior pointer of described effective document block, backpointer.
Described junk data flag bit includes: the first preset value and/or the second preset value, when described junk data flag bit is the first preset value, in described carrier, the blocks of files of corresponding storage is valid data blocks of files, when described junk data flag bit is the second preset value, in described carrier, the blocks of files of corresponding storage is junk data blocks of files.
On the other hand, it is provided that a kind of device processing file carrier space, being provided with antivirus software, described device includes:
Acquisition module, for scanning the blocks of files of the All Files of storage in carrier, obtains the summation of the junk data blocks of files of the file of storage in carrier;The blocks of files of described file includes that redundancy, described redundancy include that junk data flag bit, described junk data flag bit are used for distinguishing valid data and junk data;
Judge module, for judging that whether the summation of described junk data blocks of files is more than or equal to the threshold value preset;
Perform module, for if it is, the effective document block copy that stored on predeterminated position by described carrier is to the position of junk data blocks of files, and delete described effective document block accordingly;
Described acquisition module, specifically for:
When killing virus, first back up described blocks of files and the address of described blocks of files, prior pointer, backpointer and described junk data flag bit;Described address is that described blocks of files position in described carrier, described prior pointer and described backpointer refer to described blocks of files position in described file respectively;
Obtain described junk data flag bit;
According to described junk data flag bit, calculate the summation of junk data blocks of files in described carrier;
Described execution module, specifically for:
Start to scan backward the blocks of files of the All Files of storage described carrier from address zero;
When scanning described junk data blocks of files, copy last effective blocks of files in carrier the position of described junk data blocks of files to, and revise the prior pointer of described effective document block, backpointer.
Described junk data flag bit includes: the first preset value and/or the second preset value, when described junk data flag bit is the first preset value, in described carrier, the blocks of files of corresponding storage is valid data blocks of files, when described junk data flag bit is the second preset value, in described carrier, the blocks of files of corresponding storage is junk data blocks of files.
The technical scheme that the embodiment of the present invention provides, by the process of junk data in file, improving the ratio that valid data are shared in the carrier, to improve the utilization rate of carrier.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, the accompanying drawing used required in embodiment or description of the prior art will be briefly described below, apparently, accompanying drawing in describing below is only some embodiments of the present invention, for those of ordinary skill in the art, on the premise of not paying creative work, it is also possible to obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the mode schematic diagram of file storage in prior art;
Fig. 2 is the flow chart of a kind of method processing file carrier space that the embodiment of the present invention 1 provides;
Fig. 3 is the flow chart of a kind of method processing file carrier space that the embodiment of the present invention 2 provides;
Fig. 4 is the schematic diagram of a kind of carrier structure that the embodiment of the present invention 2 provides;
Fig. 5 is the schematic diagram of the another kind of carrier structure that the embodiment of the present invention 2 provides;
Fig. 6 is the schematic diagram of a kind of device processing file carrier space that the embodiment of the present invention 3 provides.
Detailed description of the invention
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment 1
See Fig. 2, embodiments provide a kind of method processing file carrier space, including:
101: obtain the summation of the junk data blocks of files of the file of storage in carrier;
102: judge that whether the summation of described junk data blocks of files is more than or equal to the threshold value preset;If it is, the effective document block copy stored on predeterminated position by carrier is to the position of junk data blocks of files, and delete this effective document block accordingly.
In the present embodiment, one file is divided into the blocks of files of some regular lengths, scattered storage is in the carrier, each piece all comprises certain redundancy, for preserving necessary information order dependent on this Documents Logical, and blocks of files is divided into valid data blocks of files and junk data blocks of files.
Wherein, obtain the summation of the junk data blocks of files of the file of storage in carrier, including:
In scanning carrier, the blocks of files of the All Files of storage, obtains the flag bit representing junk data blocks of files;
According to the flag bit of described junk data blocks of files, calculate the summation of junk data blocks of files in described carrier.
In the present embodiment, the position of the effective document block copy that described carrier is stored on predeterminated position to junk data blocks of files, including:
Start to scan backward the blocks of files of the All Files of storage described carrier from address zero;
When scanning described junk data blocks of files, copy last effective blocks of files in carrier the position of described junk data blocks of files to, and revise pointer before and after described effective document block.
In the present embodiment, the blocks of files of file includes that redundancy, described redundancy include: junk data flag bit.
In the present embodiment, described junk data flag bit includes: the first preset value and/or the second preset value, when described junk data flag bit is the first preset value, in described carrier, the blocks of files of corresponding storage is valid data blocks of files, when described junk data flag bit is the second preset value, in described carrier, the blocks of files of corresponding storage is junk data blocks of files.
The embodiment of the method that the present invention provides provides the benefit that: by the process of junk data in file, improving the ratio that valid data are shared in the carrier, to improve the utilization rate of carrier.
Embodiment 2
See Fig. 3, embodiments provide a kind of method processing file carrier space, including:
Step 201: the blocks of files of the All Files of storage in antivirus software scanning carrier, obtains the summation of junk data blocks of files.
In the present embodiment, junk data flag bit is increased in the redundancy of file, for distinguishing junk data and valid data, described junk data flag bit includes: the first preset value and/or the second preset value, when described junk data flag bit is the first preset value, in described carrier, the blocks of files of corresponding storage is valid data blocks of files, and when described junk data flag bit is the second preset value, in described carrier, the blocks of files of corresponding storage is junk data blocks of files.Wherein, second preset value can be " 1 ", thus represent that this document data block is junk data with " 1 ", first preset value can be " 0 ", thus represent that this document data block is valid data with " 0 ", when file does not carries out any operation, each data file block is valid data, its flag bit is all " 0 ", after file is modified or is deleted, some data reforms into junk data, now when storing this document, the flag bit of data blocks of files is modified, the flag bit of the address line shared by junk data is revised as " 1 ", represent that it is junk data.This can certainly be not specifically limited at this present embodiment by other representation.See Fig. 4, increase the carrier structure after flag bit, address is blocks of files position in the carrier, file data blocks is the unit that file is divided, such as No. 4 files-1, represent that this document block is first blocks of files of No. 4 files, No. 3 files-1, represent that this document block is first blocks of files of No. 3 files, No. 3 files-2, representing that this document block is second blocks of files of No. 3 files, prior pointer and backpointer refer to file data blocks position in this document respectively, and it is junk data or junk data that flag bit identifies this document data block.
Wherein, antivirus software is when killing virus, first all information of file are backed up, including blocks of files, address, prior pointer, backpointer and flag bit etc., obtain the flag information representing junk data block on flag bit, such as " 1 ", according to the flag bit of junk data block, calculate the quantity of junk data blocks of files in this document.
The storage mediums such as the carrier in the present embodiment includes, computer hard disc, portable hard drive, CD.
Step 202: judge whether the summation of junk data blocks of files is more than or equal to the threshold value preset, if it is, perform step 203, otherwise, flow process terminates.
Wherein, in order to accelerate the processing speed of antivirus software, not being just to carry out immediately performing junk data reclaimer operation when junk data blocks of files being detected, but carry out junk data process after junk data stores certain quantity again, arrange the document carrier space.When the junk data blocks of files in file is not up to some, showing that the junk data in file has only taken up few space, such as 1% or 10%, then being not required to it is processed, in order to avoid affecting the execution speed of antivirus software.
Further, the threshold value preset can preset according to the needs of manufacturer, as, set the threshold value preset as 30%, then when the junk data blocks of files in file accounts for more than the 30% of All Files block summation, then carry out junk data process, at this present embodiment, this is not specifically limited.
Step 203: the position of the effective document block copy of this document that carrier is stored on predeterminated position to junk data blocks of files, and delete this effective document block accordingly.
In the present embodiment preferably, after the quantity of junk data blocks of files meets default threshold value, blocks of files from address zero starts scanning file backward, when the junk data blocks of files scanned in file, copy last effective blocks of files in carrier the position of junk data blocks of files to, and revise pointer before and after described effective document block, keep the Ordered Dependency of file, delete backing up last effective document block in carrier simultaneously., until there is not junk data blocks of files in carrier in so repeatable operation.
nullAs shown in Figure 4 above,Scanning file data block is started from address zero,When the flag bit that the flag bit scanning address zero is exactly junk data blocks of files,By last effective document block of storage on carrier,No. 4 file-M of file data blocks in i.e. address N copy the position of the file data blocks of address zero to,Delete the valid data block that there is address N simultaneously,Scanning is started the most again from address zero,Scanning the file data blocks that address is " 1 " is junk data block,Then by last the effective document block in now carrier,No. 4 file-M-1 of file data blocks in i.e. address N-1 copy the position of the file data blocks that address is " 1 " to,Repeat aforesaid operations,Until carrier does not has junk data blocks of files,See Fig. 5,Carrier structure after the junk data blocks of files of above-mentioned Fig. 4 is processed,After junk data blocks of files processes,From address " 0 " to address " N-4 ",Remaining only valid data blocks of files in carrier,Substantially increase the utilization rate of carrier,So that document carrier can vacate unnecessary space for other file.
The embodiment of the method that the present invention provides provides the benefit that: by the process of junk data in file, improving the ratio that valid data are shared in the carrier, to improve the utilization rate of carrier.
Embodiment 3
See Fig. 6, embodiments provide a kind of device processing file carrier space, including: acquisition module 301, judge module 302, execution module 303.
Acquisition module 301, for obtaining the summation of the junk data blocks of files of the file of storage on carrier;
Judge module 302, for judging that whether the summation of described junk data blocks of files is more than or equal to the threshold value preset;
Perform module 303, for if it is, the effective document block copy that stored on predeterminated position by carrier is to the position of junk data blocks of files, and delete described effective document block accordingly.
Described acquisition module 301, specifically for:
In scanning carrier, all of blocks of files of storage, obtains the flag bit representing junk data blocks of files;
According to the flag bit of described junk data blocks of files, calculate the summation of junk data blocks of files in described carrier.
Described execution module 303, specifically for:
Start to scan backward the blocks of files of the All Files of storage carrier from address zero;
When scanning described junk data blocks of files, copy last effective blocks of files in carrier the position of described junk data blocks of files to, and revise pointer before and after described effective document block.
The blocks of files of described file includes that redundancy, described redundancy include: junk data flag bit.
Described junk data flag bit includes: the first preset value and/or the second preset value, when described junk data flag bit is the first preset value, in described carrier, the blocks of files of corresponding storage is valid data blocks of files, when described junk data flag bit is the second preset value, in described carrier, the blocks of files of corresponding storage is junk data blocks of files.
The device embodiment that the present invention provides provides the benefit that: by the process of junk data in file, improving the ratio that valid data are shared in the carrier, to improve the utilization rate of carrier.
The device that the present embodiment provides, specifically can belong to same design with embodiment of the method, and it implements process and refers to embodiment of the method, repeats no more here.
Completely or partially can being completed by the hardware that programmed instruction is relevant of the technique scheme that the embodiment of the present invention provides, described program can be stored in the storage medium that can read, and this storage medium includes: the various media that can store program code such as ROM, RAM, magnetic disc or CD.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all within the spirit and principles in the present invention, any modification, equivalent substitution and improvement etc. made, should be included within the scope of the present invention.

Claims (4)

1. the method processing file carrier space, it is characterised in that described method includes:
In antivirus software scanning carrier, the blocks of files of the All Files of storage, obtains the summation of the junk data blocks of files of the file of storage in carrier;The blocks of files of described file includes that redundancy, described redundancy include that junk data flag bit, described junk data flag bit are used for distinguishing valid data and junk data;
Judge that whether the summation of described junk data blocks of files is more than or equal to the threshold value preset;
If it is, the effective document block copy stored on predeterminated position by described carrier is to the position of junk data blocks of files, and delete described effective document block accordingly;
In described antivirus software scanning carrier, the blocks of files of the All Files of storage, obtains the summation of the junk data blocks of files of the file of storage in carrier, including:
Described antivirus software, when killing virus, first backs up described blocks of files and the address of described blocks of files, prior pointer, backpointer and described junk data flag bit;Described address is that described blocks of files position in described carrier, described prior pointer and described backpointer refer to described blocks of files position in described file respectively;
Obtain described junk data flag bit;
According to described junk data flag bit, calculate the summation of junk data blocks of files in described carrier;
The described effective document block copy that described carrier is stored on predeterminated position to the position of junk data blocks of files, including:
Start to scan backward the blocks of files of the All Files of storage described carrier from address zero;
When scanning described junk data blocks of files, copy last effective blocks of files in described carrier the position of described junk data blocks of files to, and revise the prior pointer of described effective document block, backpointer.
Method the most according to claim 1, it is characterized in that, described junk data flag bit includes: the first preset value and/or the second preset value, when described junk data flag bit is the first preset value, in described carrier, the blocks of files of corresponding storage is valid data blocks of files, when described junk data flag bit is the second preset value, in described carrier, the blocks of files of corresponding storage is junk data blocks of files.
3. process a device for file carrier space, antivirus software be installed, it is characterised in that described device includes:
Acquisition module, for scanning the blocks of files of the All Files of storage in carrier, obtains the summation of the junk data blocks of files of storage in carrier;The blocks of files of described file includes that redundancy, described redundancy include that junk data flag bit, described junk data flag bit are used for distinguishing valid data and junk data;
Judge module, for judging that whether the summation of described junk data blocks of files is more than or equal to the threshold value preset;
Perform module, for if it is, the effective document block copy of the described file stored on predeterminated position by described carrier is to the position of junk data blocks of files, and delete described effective document block accordingly;
Described acquisition module, specifically for:
When killing virus, first back up described blocks of files and the address of described blocks of files, prior pointer, backpointer and described junk data flag bit;Described address is that described blocks of files position in described carrier, described prior pointer and described backpointer refer to described blocks of files position in described file respectively;
Obtain described junk data flag bit;
According to described junk data flag bit, calculate the summation of junk data blocks of files in described carrier;
Described execution module, specifically for:
Start to scan backward the blocks of files of the All Files of storage described carrier from address zero;
When scanning described junk data blocks of files, copy last effective blocks of files in described carrier the position of described junk data blocks of files to, and revise the prior pointer of described effective document block, backpointer.
Device the most according to claim 3, it is characterized in that, described junk data flag bit includes: the first preset value and/or the second preset value, when described junk data flag bit is the first preset value, in described carrier, the blocks of files of corresponding storage is valid data blocks of files, when described junk data flag bit is the second preset value, in described carrier, the blocks of files of corresponding storage is junk data blocks of files.
CN201110242680.4A 2011-08-23 2011-08-23 The method and apparatus processing file carrier space Active CN102955793B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110242680.4A CN102955793B (en) 2011-08-23 2011-08-23 The method and apparatus processing file carrier space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110242680.4A CN102955793B (en) 2011-08-23 2011-08-23 The method and apparatus processing file carrier space

Publications (2)

Publication Number Publication Date
CN102955793A CN102955793A (en) 2013-03-06
CN102955793B true CN102955793B (en) 2016-08-03

Family

ID=47764607

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110242680.4A Active CN102955793B (en) 2011-08-23 2011-08-23 The method and apparatus processing file carrier space

Country Status (1)

Country Link
CN (1) CN102955793B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009068597A1 (en) * 2007-11-29 2009-06-04 International Business Machines Corporation Memory management
CN102073464A (en) * 2011-01-14 2011-05-25 南开大学 Method for creating allocation-on-demand incremental volume
CN102084330A (en) * 2008-04-06 2011-06-01 弗森-艾奥公司 Apparatus, system, and method for efficient mapping of virtual and physical addresses

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009068597A1 (en) * 2007-11-29 2009-06-04 International Business Machines Corporation Memory management
CN102084330A (en) * 2008-04-06 2011-06-01 弗森-艾奥公司 Apparatus, system, and method for efficient mapping of virtual and physical addresses
CN102073464A (en) * 2011-01-14 2011-05-25 南开大学 Method for creating allocation-on-demand incremental volume

Also Published As

Publication number Publication date
CN102955793A (en) 2013-03-06

Similar Documents

Publication Publication Date Title
US8812595B2 (en) Scanning a message-list
US8204907B1 (en) Systems and methods for collecting file access history information
US8458232B1 (en) Systems and methods for identifying data files based on community data
WO2018006587A1 (en) File storage method, terminal, and storage medium
CN102087604A (en) Computer and method for acquiring hardware configuration information
CN105787037A (en) Repeated data deleting method and device
CN105630834A (en) Method and device for realizing deletion of repeated data
CN111949220A (en) Abnormal power failure recovery method for storage device and storage device
CN114371814B (en) Data processing method and device and solid state disk
CN111045686A (en) Method for improving application decompilation speed, intelligent terminal and storage medium
CN1629817A (en) Copying method, copying method and block identification data acquisition method
CN112596949B (en) High-efficiency SSD (solid State disk) deleted data recovery method and system
CN102955793B (en) The method and apparatus processing file carrier space
US9465805B1 (en) Systems and methods for archiving related items
EP2990983B1 (en) Method and apparatus for scanning files
CN107273303B (en) Flash memory data management system and method, flash memory chip and storage device
CN105138471B (en) Mirrored procedure treating method and apparatus
CN113806107B (en) Object copying method, device, equipment and storage medium
CN106201344B (en) Information processing method and electronic equipment
JP2009199215A (en) Method for collecting use history of usb storage, computer program, and usb storage
US9122637B1 (en) Systems and methods for enhancing electronic discovery searches
WO2015058628A1 (en) File access method and device
US20120233224A1 (en) Data processing
US9104518B2 (en) Wireless communication terminal and method for securely running industry software
CN111309682B (en) Recycle bin file cleaning method and device based on distributed file system

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