CN108345427B - Hard disk data storage method and device - Google Patents

Hard disk data storage method and device Download PDF

Info

Publication number
CN108345427B
CN108345427B CN201710055969.2A CN201710055969A CN108345427B CN 108345427 B CN108345427 B CN 108345427B CN 201710055969 A CN201710055969 A CN 201710055969A CN 108345427 B CN108345427 B CN 108345427B
Authority
CN
China
Prior art keywords
target
data
stored
storage segment
base address
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
CN201710055969.2A
Other languages
Chinese (zh)
Other versions
CN108345427A (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201710055969.2A priority Critical patent/CN108345427B/en
Priority to PCT/CN2017/106787 priority patent/WO2018137366A1/en
Publication of CN108345427A publication Critical patent/CN108345427A/en
Application granted granted Critical
Publication of CN108345427B publication Critical patent/CN108345427B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • H04N5/91Television signal processing therefor

Abstract

The embodiment of the invention provides a method and a device for storing hard disk data, wherein the hard disk comprises a plurality of storage sections, and the length of each storage section is the same; the method comprises the following steps: receiving data to be stored; determining a target file identifier corresponding to the data to be stored; determining a target base address corresponding to the target file identifier according to a corresponding relation between the pre-stored file identifier and the base address of the storage section; storing the data to be stored to a target storage section corresponding to the target base address; the length of the target storage segment is not more than the length of the data of the complete file corresponding to the target file identification. By applying the technical scheme provided by the embodiment of the invention, the storage performance of the hard disk is improved.

Description

Hard disk data storage method and device
Technical Field
The invention relates to the technical field of computers, in particular to a hard disk data storage method and device.
Background
With the development of computer technology, people store more and more data in computers.
At present, computers generally store data of files according to the order of logical addresses of solid state disks. However, the data that the computer receives the file is random, for example: after the computer receives a part of data of one file A, a part of data of another file B and another part of data of the file A, the storage area occupied by the same file in the hard disk of the computer is likely to be discontinuous.
Based on the above situation, when a stored file needs to be deleted and the storage area occupied by the stored file is recovered, a Trim command is performed on the hard disk of the computer, and the storage area occupied by the stored file is likely to be discontinuous, and the Trim command cannot mark the discontinuous storage area as pre-deleted, so that the stored file cannot be immediately deleted, that is, the storage area occupied by the stored file cannot be immediately recovered, and thus the computer cannot immediately store data of a newly received file by using the storage area occupied by the stored file, and the storage performance of the hard disk is reduced.
Disclosure of Invention
The embodiment of the invention aims to provide a hard disk data storage method and device so as to improve the storage performance of a hard disk. The specific technical scheme is as follows:
on one hand, the embodiment of the invention discloses a hard disk data storage method, wherein the hard disk comprises a plurality of storage sections, and the length of each storage section is the same; the method comprises the following steps:
receiving data to be stored;
determining a target file identifier corresponding to the data to be stored;
determining a target base address corresponding to the target file identifier according to a corresponding relation between the pre-stored file identifier and the base address of the storage section;
storing the data to be stored to a target storage section corresponding to the target base address; the length of the target storage segment is not more than the length of the data of the complete file corresponding to the target file identification.
Optionally, the step of determining the target file identifier corresponding to the data to be stored includes:
recording the time point of receiving the data to be stored;
determining a target time period to which the time point belongs;
and determining a target file identifier corresponding to the target time period according to the corresponding relation between the pre-stored time period corresponding to the data to be stored and the file identifier.
Optionally, the step of storing the data to be stored in the target storage segment corresponding to the target base address includes:
if the target storage segment corresponding to the target base address stores the data of the complete file corresponding to the target file identification, marking the target storage segment as pre-deletion;
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
Optionally, the step of marking the target storage segment as pre-deleted includes:
generating a pre-deleting command according to the target base address and the length of the target storage segment;
and marking the target storage segment as pre-deletion according to the pre-deletion command.
Optionally, the method further includes:
receiving a deleting instruction carrying the target file identifier;
determining a target base address corresponding to the target file identifier carried in the deletion instruction according to a pre-stored corresponding relationship between the file identifier and the base address;
and marking the target storage segment corresponding to the target base address as pre-deletion.
Optionally, the step of storing the data to be stored in the target storage segment corresponding to the target base address includes:
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
On the other hand, the embodiment of the invention discloses a hard disk data storage device, wherein the hard disk comprises a plurality of storage sections, and the length of each storage section is the same; the device comprises:
the data receiving unit is used for receiving data to be stored;
the identification determining unit is used for determining the identification of the target file corresponding to the data to be stored;
the first address determining unit is used for determining a target base address corresponding to the target file identifier according to the corresponding relation between the pre-stored file identifier and the base address of the storage segment;
the data storage unit is used for storing the data to be stored to a target storage segment corresponding to the target base address; the length of the target storage segment is not more than the length of the data of the complete file corresponding to the target file identification.
Optionally, the identifier determining unit is specifically configured to:
recording the time point of receiving the data to be stored;
determining a target time period to which the time point belongs;
and determining a target file identifier corresponding to the target time period according to the corresponding relation between the pre-stored time period corresponding to the data to be stored and the file identifier.
Optionally, the data storage unit is specifically configured to:
if the target storage segment corresponding to the target base address stores the data of the complete file corresponding to the target file identification, marking the target storage segment as pre-deletion;
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
Optionally, the data storage unit is further configured to:
generating a pre-deleting command according to the target base address and the length of the target storage segment;
and marking the target storage segment as pre-deletion according to the pre-deletion command.
Optionally, the apparatus further comprises:
the instruction receiving unit is used for receiving a deleting instruction carrying the target file identifier;
a second address determining unit, configured to determine, according to a correspondence between a pre-stored file identifier and a base address, a target base address corresponding to the target file identifier carried in the delete instruction;
and the pre-deletion marking unit is used for marking the target storage segment corresponding to the target base address as pre-deletion.
Optionally, the data storage unit is specifically configured to:
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
The embodiment of the invention provides a method and a device for storing hard disk data, wherein a hard disk comprises a plurality of storage sections, and the length of each storage section is the same; when receiving data to be stored, determining a target file identifier corresponding to the data to be stored; determining a target base address corresponding to the target file identifier according to a corresponding relation between the pre-stored file identifier and the base address; storing the data to be stored to a target storage section corresponding to the target base address; the length of the target storage segment is not greater than the length of the data of the complete file corresponding to the target file identifier, that is, the complete files corresponding to the target file identifier are all stored in the target storage segment. Therefore, in the embodiment of the invention, the storage areas occupied by the same file in the hard disk are continuous and are a storage segment, and the storage area occupied by one file can be immediately recycled, so that the storage performance of the hard disk is improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a hard disk data storage method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a hard disk used in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a hard disk data storage device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For the purpose of illustrating the present invention, the following definitions describe the words appearing in the examples of the present invention:
trim command: an instruction introduced in ATA (Advanced Technology Attachment) -7 protocol, which is a pre-delete data method designed based on the characteristics of solid state disks.
The present invention will be described in detail below with reference to specific examples.
Referring to fig. 1, fig. 1 is a schematic flow chart of a hard disk data storage method according to an embodiment of the present invention, where fig. 2 can be referred to, and fig. 2 is a schematic structural diagram of a hard disk used according to an embodiment of the present invention, when formatting a hard disk, the hard disk can be divided into a plurality of storage segments, where each storage segment has the same length and is a preset length; specifically, the method comprises the following steps:
s101: receiving data to be stored;
here, the data to be stored may be video data, text data, or the like.
S102: determining a target file identifier corresponding to data to be stored;
here, the target file identification may be a target file name.
In other embodiments of the present invention, data may be stored according to a certain rule, that is, data is received and stored once every a period of time, and at this time, the length of data stored in a period of time is certain, and for this reason, a corresponding relationship between a period of time corresponding to each type of data and a file identifier may be stored in advance, where a total length of data to be stored received in a period of time corresponding to a file identifier is equal to a length of one storage segment, so as to ensure that all data to be stored received in a period of time corresponding to a file identifier are stored in one storage segment, thereby forming a complete file, and ensuring that storage areas occupied by the same file in a hard disk are continuous.
In this case, when the data to be stored is received, the time point of receiving the data to be stored may be recorded, the target time period to which the time point belongs may be determined, and then the target file identifier corresponding to the target time period may be determined according to the correspondence between the time period corresponding to the pre-stored data to be stored and the file identifier.
For example, the data to be stored is video data, and currently there are 2 paths of video data, which are: the corresponding relation between the time period corresponding to the pre-stored A-path video data and the file identifier is as follows: [1:00-2:00, file identification: "1" ], [2:00-3:00, file identification: "3" ], [3:00-4:00, file identification: "5" ] and the like; the corresponding relation between the time period corresponding to the pre-stored B-path video data and the file identifier is as follows: [1:00-2:00, file identification: "2" ], [2:00-3:00, file identification: "4" ], [3:00-4:00, file identification: "6" ] and the like;
if 1:30 receives the data A to be stored of the A-path video data1And 1:30 belongs to the time period of 1:00-2:00, so that 1:00-2:00 is determined as a target time period, and the file identifier: "1"]Determining data A to be stored1The corresponding target file is marked as "1";
if 1:30 receives the data B to be stored of the B-path video data1And 1:30 belongs to the time period of 1:00-2:00, so that 1:00-2:00 is determined as a target time period, and the file identifier: "2"]Determining data B to be stored1The corresponding target file is identified as "2".
S103: determining a target base address corresponding to the target file identifier according to the corresponding relation between the pre-stored file identifier and the base address of the storage section;
here, the base address is a starting logical address of one memory segment, and each file identifier and the base address are in a one-to-one correspondence relationship. When the target base address is determined, the preset length of the memory segment is divided when the hard disk formatting is combined, and the target memory segment is easily determined.
S104: and storing the data to be stored to a target storage segment corresponding to the target base address.
Here, the length of the target storage segment is not greater than the length of the data of the complete file corresponding to the target file identifier, so as to ensure that one complete file can be stored in one storage segment. Here, the complete file includes a file header and a file trailer.
In other embodiments of the present invention, after the target storage segment is full of data, a file tail corresponding to the target file identifier is added to the tail of the stored data in the target storage segment, at this time, the data writing in the target storage segment is finished, and the target storage segment stores the complete file, that is, the length of the target storage segment is equal to the length of the data of the complete file corresponding to the target file identifier. Therefore, only one file is stored in one storage segment, and the storage area occupied by the same file in the hard disk is continuous, so that the storage performance of the hard disk is improved.
In other embodiments of the present invention, data may be stored according to a certain rule, that is, data is received and stored once every a period of time, at this time, the length of data stored in a period of time is certain, but the length of data stored in a period of time may increase or decrease due to some factors, such as environment and device status, and at this time, the corresponding relationship between the period of time corresponding to the pre-stored data to be stored and the file identifier needs to be updated, so as to facilitate the storage of data next time.
For example, the correspondence between the time period corresponding to the pre-stored a-way video data and the file identifier is: [1:00-2:00, file identification: "1" ], [2:00-3:00, file identification: "3" ], [3:00-4:00, file identification: "5" ] and the like; when the ratio is 1:50, if the target storage segment corresponding to the file identifier '1' is full, the file tail corresponding to the tail file identifier '1' of the stored data is stored in the target storage segment; and simultaneously updating the time period corresponding to the path A video data and the corresponding relation of the file identifier as follows: [1:50-2:50, file identification: "3" ], [2:50-3:50, file identification: "5" ] and the like.
In other embodiments of the present invention, when the data to be stored is stored in the target storage segment, the target storage segment may not store the data, or may already store the data; if the target storage segment does not store data, the data to be stored can be directly stored in the target storage segment;
if the target storage segment stores data, the stored data is not data of a complete file, that is, the target storage segment does not include a file tail, and if the data to be stored and the stored data in the target storage segment are data of the same data segment, for example, data of 1:00-2:00 which are video data of a way, the data to be stored can be directly stored in the target storage segment; if the data to be stored and the stored data in the target storage segment are not data of the same data segment, for example, the data to be stored is 1:00-2:00 of the video data of the a-way, and the stored data in the target storage segment is 1:00-2:00 of the video data of the B-way, the stored data in the target storage segment needs to be deleted to store the data to be stored in order to ensure the storage of the data. For example, a pre-delete command, such as a Trim command, may be generated according to the target base address and the length of the target memory segment, where the Trim command includes the target base address and the length of the target memory segment, where the length of the target memory segment is the preset length, and may also be understood as the length of the data stored in the target memory segment; the stored data in the target storage segment occupy continuous storage areas, the target storage segment can be marked as pre-deleted according to the Trim command, and here, the method for marking the target storage segment as pre-deleted according to the Trim command is the prior art, and the embodiment of the invention is not repeated;
if data is stored in the target storage segment, for example, when the hard disk is fully written, the data stored in the target storage segment is data of a complete file, that is, the target storage segment includes a file tail, the complete file stored in the target storage segment can be understood as an old file, and the data to be stored is data of a new file. For example, a pre-delete command, such as a Trim command, may be generated according to the target base address and the length of the target storage segment, where data in the target storage segment is data of a complete file, the target storage segments corresponding to the complete file are consecutive, and the target storage segment may be marked as pre-delete according to the Trim command.
After the target storage segment is marked as pre-deleted, a garbage recovery program is operated, all the stored data in the target storage segment are deleted, namely the target storage segment is recovered, and the data to be stored are stored in the target storage segment. At the moment, the target storage segment can be immediately recycled, and the storage efficiency of the data to be stored is improved.
In other embodiments of the present invention, a user may also actively delete a file stored in the hard disk, when a deletion instruction input by the user is received, the deletion instruction includes a target file identifier, a target base address corresponding to the target file identifier carried in the deletion instruction is directly determined by combining a pre-stored correspondence between the file identifier and the base address, and a target storage segment corresponding to the target base address is marked as pre-deleted.
In this case, in order to save the storage space of the hard disk, the garbage collection program can be directly operated to collect the target storage segment, and after the data to be stored is received, the data to be stored is directly stored in the target storage segment; in addition, in order to avoid the problem of data being deleted by mistake due to user misoperation, and meanwhile, considering that new data does not need to be stored in the target storage segment currently, the target storage segment may not be recycled temporarily, and when receiving data to be stored, which needs to be stored in the target storage segment, the garbage recycling program is operated to recycle the target storage segment and store the data to be stored in the target storage segment.
In other embodiments of the present invention, in order to ensure the storage of data, when data is rewritten in the target storage segment, the target storage segment may be marked as pre-deleted, a garbage collection program is run, the target storage segment is collected, and then the data to be stored is stored in the target storage segment.
By applying the embodiment, the hard disk comprises a plurality of storage sections, and the length of each storage section is the same; when receiving data to be stored, determining a target file identifier corresponding to the data to be stored; determining a target base address corresponding to the target file identifier according to a corresponding relation between the pre-stored file identifier and the base address; storing the data to be stored to a target storage section corresponding to the target base address; the length of the target storage segment is not greater than the length of the data of the complete file corresponding to the target file identifier, that is, the complete files corresponding to the target file identifier are all stored in the target storage segment. Therefore, in the embodiment of the invention, the storage areas occupied by the same file in the hard disk are continuous and are a storage segment, and the storage area occupied by one file can be immediately recycled, so that the storage performance of the hard disk is improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a hard disk data storage device according to an embodiment of the present invention, where the hard disk includes a plurality of storage segments, and each storage segment has the same length; the device comprises:
a data receiving unit 301, configured to receive data to be stored;
an identifier determining unit 302, configured to determine an identifier of a target file corresponding to the data to be stored;
a first address determining unit 303, configured to determine, according to a correspondence between a pre-stored file identifier and a base address of a storage segment, that the target file identifier corresponds to a target base address;
a data storage unit 304, configured to store the data to be stored in a target storage segment corresponding to the target base address; the length of the target storage segment is not more than the length of the data of the complete file corresponding to the target file identification.
In other embodiments of the present invention, the identifier determining unit 302 may be specifically configured to:
recording the time point of receiving the data to be stored;
determining a target time period to which the time point belongs;
and determining a target file identifier corresponding to the target time period according to the corresponding relation between the pre-stored time period corresponding to the data to be stored and the file identifier.
In other embodiments of the present invention, the data storage unit 304 may be specifically configured to:
if the target storage segment corresponding to the target base address stores the data of the complete file corresponding to the target file identification, marking the target storage segment as pre-deletion;
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
In other embodiments of the present invention, the data storage unit 304 may further be configured to:
generating a pre-deleting command according to the target base address and the length of the target storage segment;
and marking the target storage segment as pre-deletion according to the pre-deletion command.
In other embodiments of the present invention, the hard disk data storage device may further include:
an instruction receiving unit (not shown in fig. 3) configured to receive a deletion instruction carrying the target file identifier;
a second address determining unit (not shown in fig. 3), configured to determine, according to a correspondence between a pre-stored file identifier and a base address of a storage segment, a target base address corresponding to the target file identifier carried in the delete instruction;
and a pre-delete marking unit (not shown in fig. 3) for marking the target storage segment corresponding to the target base address as pre-delete.
In other embodiments of the present invention, the data storage unit 304 may be specifically configured to:
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
By applying the embodiment, the hard disk comprises a plurality of storage sections, and the length of each storage section is the same; when receiving data to be stored, determining a target file identifier corresponding to the data to be stored; determining a target base address corresponding to the target file identifier according to a corresponding relation between the pre-stored file identifier and the base address; storing the data to be stored to a target storage section corresponding to the target base address; the length of the target storage segment is not greater than the length of the data of the complete file corresponding to the target file identifier, that is, the complete files corresponding to the target file identifier are all stored in the target storage segment. Therefore, in the embodiment of the invention, the storage areas occupied by the same file in the hard disk are continuous and are a storage segment, and the storage area occupied by one file can be immediately recycled, so that the storage performance of the hard disk is improved.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A hard disk data storage method is characterized in that the hard disk comprises a plurality of storage sections, and the length of each storage section is the same; the method comprises the following steps:
receiving data to be stored;
determining a target file identifier corresponding to the data to be stored;
determining a target base address corresponding to the target file identifier according to a corresponding relation between the pre-stored file identifier and the base address of the storage section;
storing the data to be stored to a target storage section corresponding to the target base address; the length of the target storage segment is not more than the length of the data of the complete file corresponding to the target file identification;
the step of determining the target file identifier corresponding to the data to be stored includes:
recording the time point of receiving the data to be stored;
determining a target time period to which the time point belongs;
and determining a target file identifier corresponding to the target time period according to a corresponding relation between the pre-stored time period corresponding to the data to be stored and the file identifier, wherein the length of the target storage segment is equal to the total length of the data received in the target time period.
2. The method according to claim 1, wherein the step of storing the data to be stored in the target storage segment corresponding to the target base address comprises:
if the target storage segment corresponding to the target base address stores the data of the complete file corresponding to the target file identification, marking the target storage segment as pre-deletion;
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
3. The method of claim 2, wherein the step of marking the target memory segment as pre-deleted comprises:
generating a pre-deleting command according to the target base address and the length of the target storage segment;
and marking the target storage segment as pre-deletion according to the pre-deletion command.
4. The method of claim 1, further comprising:
receiving a deleting instruction carrying the target file identifier;
determining a target base address corresponding to the target file identifier carried in the deletion instruction according to a pre-stored corresponding relationship between the file identifier and the base address;
and marking the target storage segment corresponding to the target base address as pre-deletion.
5. The method according to claim 4, wherein the step of storing the data to be stored in the target storage segment corresponding to the target base address comprises:
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
6. A hard disk data storage device is characterized in that the hard disk comprises a plurality of storage sections, and the length of each storage section is the same; the device comprises:
the data receiving unit is used for receiving data to be stored;
the identification determining unit is used for determining the identification of the target file corresponding to the data to be stored;
the first address determining unit is used for determining a target base address corresponding to the target file identifier according to the corresponding relation between the pre-stored file identifier and the base address of the storage segment;
the data storage unit is used for storing the data to be stored to a target storage segment corresponding to the target base address; the length of the target storage segment is not more than the length of the data of the complete file corresponding to the target file identification;
the identifier determining unit is specifically configured to:
recording the time point of receiving the data to be stored;
determining a target time period to which the time point belongs;
and determining a target file identifier corresponding to the target time period according to a corresponding relation between the pre-stored time period corresponding to the data to be stored and the file identifier, wherein the length of the target storage segment is equal to the total length of the data received in the target time period.
7. The apparatus of claim 6, wherein the data storage unit is specifically configured to:
if the target storage segment corresponding to the target base address stores the data of the complete file corresponding to the target file identification, marking the target storage segment as pre-deletion;
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
8. The apparatus of claim 7, wherein the data storage unit is further configured to:
generating a pre-deleting command according to the target base address and the length of the target storage segment;
and marking the target storage segment as pre-deletion according to the pre-deletion command.
9. The apparatus of claim 6, further comprising:
the instruction receiving unit is used for receiving a deleting instruction carrying the target file identifier;
a second address determining unit, configured to determine, according to a correspondence between a pre-stored file identifier and a base address, a target base address corresponding to a target file identifier carried in the delete instruction;
and the pre-deletion marking unit is used for marking the target storage segment corresponding to the target base address as pre-deletion.
10. The apparatus of claim 9, wherein the data storage unit is specifically configured to:
running a garbage collection program, and deleting the data stored in the target storage segment;
and storing the data to be stored to the target storage segment.
CN201710055969.2A 2017-01-25 2017-01-25 Hard disk data storage method and device Active CN108345427B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710055969.2A CN108345427B (en) 2017-01-25 2017-01-25 Hard disk data storage method and device
PCT/CN2017/106787 WO2018137366A1 (en) 2017-01-25 2017-10-19 Method and device for storing data of hard disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710055969.2A CN108345427B (en) 2017-01-25 2017-01-25 Hard disk data storage method and device

Publications (2)

Publication Number Publication Date
CN108345427A CN108345427A (en) 2018-07-31
CN108345427B true CN108345427B (en) 2020-09-04

Family

ID=62962239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710055969.2A Active CN108345427B (en) 2017-01-25 2017-01-25 Hard disk data storage method and device

Country Status (2)

Country Link
CN (1) CN108345427B (en)
WO (1) WO2018137366A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112463746B (en) * 2020-12-11 2023-11-03 杭州海康汽车软件有限公司 File storage and generation method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102084332A (en) * 2008-04-06 2011-06-01 弗森-艾奥公司 Apparatus, system, and method for converting a storage request into an append data storage command
CN103905789A (en) * 2012-12-27 2014-07-02 杭州海康威视数字技术股份有限公司 Dynamic analysis data preservation, searching and after-analyzing method and device thereof
US8943295B1 (en) * 2003-04-24 2015-01-27 Netapp, Inc. System and method for mapping file block numbers to logical block addresses
CN106033324A (en) * 2015-03-09 2016-10-19 杭州海康威视数字技术股份有限公司 Data storage method and device
CN106254805A (en) * 2016-07-28 2016-12-21 浙江大华技术股份有限公司 Storage method, device and the videocorder of a kind of Video data

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005267111A (en) * 2004-03-17 2005-09-29 Hitachi Ltd Storage control system and method for controlling storage control system
US20080031590A1 (en) * 2006-08-04 2008-02-07 Kulas Charles J Digital video recording of multiple associated channels
CN102325244B (en) * 2011-08-26 2014-02-19 杭州海康威视数字技术股份有限公司 Method for rapidly positioning videos by time, video storage control device and positioning device
CN105243027A (en) * 2015-09-24 2016-01-13 华为技术有限公司 Method for storing data in storage device and memory controller

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8943295B1 (en) * 2003-04-24 2015-01-27 Netapp, Inc. System and method for mapping file block numbers to logical block addresses
CN102084332A (en) * 2008-04-06 2011-06-01 弗森-艾奥公司 Apparatus, system, and method for converting a storage request into an append data storage command
CN103905789A (en) * 2012-12-27 2014-07-02 杭州海康威视数字技术股份有限公司 Dynamic analysis data preservation, searching and after-analyzing method and device thereof
CN106033324A (en) * 2015-03-09 2016-10-19 杭州海康威视数字技术股份有限公司 Data storage method and device
CN106254805A (en) * 2016-07-28 2016-12-21 浙江大华技术股份有限公司 Storage method, device and the videocorder of a kind of Video data

Also Published As

Publication number Publication date
CN108345427A (en) 2018-07-31
WO2018137366A1 (en) 2018-08-02

Similar Documents

Publication Publication Date Title
CN102779180B (en) The operation processing method of data-storage system, data-storage system
CN102929884B (en) A kind of method and device that shrinks virtual disk image file
CN107481762B (en) Trim processing method and device of solid state disk
CN110018989B (en) Snapshot comparison method and device
CN109542358A (en) A kind of cold and hot data separation method of solid state hard disk, device and equipment
CN104461390A (en) Method and device for writing data into imbricate magnetic recording SMR hard disk
JP2008242503A (en) Memory management apparatus and method, and program
JP2006235960A (en) Method for increasing speed of garbage collection
CN111651127B (en) Monitoring data storage method and device based on shingled magnetic recording disk
CN109033338B (en) Method and system for generating database file of automobile communication protocol
CN110647514B (en) Metadata updating method and device and metadata server
CN103678337A (en) Data eliminating method, device and system
CN106383666B (en) Data storage method and device
CN102609492B (en) Metadata management method supporting variable table modes
CN104065906A (en) Video recording method and device of digital video recording equipment
CN114237984A (en) Recovery method and system of Trim data under abnormal power failure and solid state disk
CN114840449B (en) Data storage method, device, equipment and storage medium based on MCU chip flash
CN108345427B (en) Hard disk data storage method and device
CN103176920A (en) Nor flash power down protection method and Nor flash power down protection device
CN112800007B (en) Directory entry expansion method and system suitable for FAT32 file system
CN113282521A (en) Method and device for prolonging service life of smart card
CN113835639A (en) I/O request processing method, device, equipment and readable storage medium
CN110795282B (en) Data rollback method, device, equipment and storage medium
US9535796B2 (en) Method, apparatus and computer for data operation
CN101866346A (en) Method and terminal for updating terminal media library

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant