WO2018137366A1 - 一种硬盘数据存储方法及装置 - Google Patents
一种硬盘数据存储方法及装置 Download PDFInfo
- Publication number
- WO2018137366A1 WO2018137366A1 PCT/CN2017/106787 CN2017106787W WO2018137366A1 WO 2018137366 A1 WO2018137366 A1 WO 2018137366A1 CN 2017106787 W CN2017106787 W CN 2017106787W WO 2018137366 A1 WO2018137366 A1 WO 2018137366A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target
- data
- stored
- storage segment
- file identifier
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0652—Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/76—Television signal recording
- H04N5/91—Television signal processing therefor
Definitions
- the present application relates to the field of computer technology, and in particular, to a hard disk data storage method and apparatus.
- computers generally store file data in the order of logical addresses of SSDs.
- the data received by the computer is random. For example, after the computer receives a part of the data of the file A, it receives another part of the data of the other file B, and then receives another part of the data of the file A, which results in the same
- the storage area occupied by files on the computer's hard disk is likely to be discontinuous.
- the purpose of the embodiment of the present application is to provide a hard disk data storage method and device to improve the storage performance of the hard disk.
- the specific technical solutions are as follows:
- the embodiment of the present application discloses a hard disk data storage method, where the hard disk includes multiple storage segments, and each storage segment has the same length; the method includes:
- the data to be stored is stored to a target storage segment corresponding to the target base address; the length of the target storage segment is not greater than the length of data of the complete file corresponding to the target file identifier.
- the step of determining the target file identifier corresponding to the data to be stored includes:
- the step of storing the data to be stored to a target storage segment corresponding to the target base address includes:
- target storage segment corresponding to the target base address stores data of a complete file corresponding to the target file identifier, marking the target storage segment as pre-delete;
- the to-be-stored data is stored to the target storage segment.
- the step of marking the target storage segment as pre-delete includes:
- the target storage segment is marked as pre-deleted according to the pre-delete command.
- the method further includes:
- the target storage segment corresponding to the target base address is marked as pre-delete.
- the step of storing the data to be stored to a target storage segment corresponding to the target base address includes:
- the to-be-stored data is stored to the target storage segment.
- the embodiment of the present application discloses a hard disk data storage device, where the hard disk includes multiple storage segments, each of which has the same length; the device includes:
- a data receiving unit configured to receive data to be stored
- An identifier determining unit configured to determine an object file identifier corresponding to the to-be-stored data
- a first address determining unit configured to determine, according to a correspondence between a pre-stored file identifier and a base address of the storage segment, the target file identifier corresponding to the target base address;
- a data storage unit configured to store the to-be-stored data to a target storage segment corresponding to the target base address; the length of the target storage segment is not greater than a length of data of the complete file corresponding to the target file identifier.
- the identifier determining unit is specifically configured to:
- the data storage unit is specifically configured to:
- target storage segment corresponding to the target base address stores data of a complete file corresponding to the target file identifier, marking the target storage segment as pre-delete;
- the to-be-stored data is stored to the target storage segment.
- the data storage unit is further configured to:
- the target storage segment is marked as pre-deleted according to the pre-delete command.
- the apparatus further includes:
- An instruction receiving unit configured to receive a deletion instruction that carries the target file identifier
- a second address determining unit configured to determine, according to a correspondence between the file identifier and the base address that are stored in advance, a target base address corresponding to the target file identifier carried in the deletion instruction;
- a pre-delete tag unit is configured to mark the target storage segment corresponding to the target base address as pre-delete.
- the data storage unit is specifically configured to:
- the to-be-stored data is stored to the target storage segment.
- an embodiment of the present application discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus; wherein the processor, the communication interface, and the memory complete each other through the communication bus.
- the memory is configured to store a computer program
- the processor is configured to implement the foregoing hard disk data storage method steps when the computer program stored on the memory is executed.
- the embodiment of the present application discloses a computer program, which is used to implement the foregoing hard disk data storage method steps at runtime.
- the embodiment of the present application discloses a storage medium for storing a computer program, and the computer program is implemented to implement the foregoing hard disk data storage method steps.
- the hard disk includes a plurality of storage segments, each of the storage segments has the same length; when receiving the data to be stored, determining the target file identifier corresponding to the data to be stored; Corresponding relationship between the file identifier and the base address, determining the target file identifier corresponding to the target base address; storing the data to be stored to the target storage segment corresponding to the target base address; wherein the length of the target storage segment is not greater than the complete file corresponding to the target file identifier The length of the data, that is, the complete file corresponding to the target file identifier is stored in the target storage segment.
- the storage area occupied by the same file in the hard disk is continuous, and is a storage. Segments can immediately reclaim the storage area occupied by a file, improving the storage performance of the hard disk.
- implementing any of the products or methods of the present application necessarily does not necessarily require all of the advantages described above to be achieved at the same time.
- FIG. 1 is a schematic flowchart of a hard disk data storage method according to an embodiment of the present application
- FIG. 2 is a schematic structural diagram of a hard disk used in an embodiment of the present application.
- FIG. 3 is a schematic structural diagram of a hard disk data storage device according to an embodiment of the present disclosure.
- FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
- Trim Command An instruction introduced in the ATA (Advanced Technology Attachment)-7 protocol, which is a pre-delete data method based on SSD characteristics.
- FIG. 1 is a schematic flowchart of a hard disk data storage method according to an embodiment of the present disclosure.
- FIG. 2 is a schematic structural diagram of a hard disk used in an embodiment of the present application. When the hard disk is formatted, it can be divided into multiple storage segments, each of which has the same length and is a preset length; the method includes:
- the data to be stored may be recorded data, text data, or the like.
- S102 Determine an object file identifier corresponding to the data to be stored.
- the target file identifier can be the target file name.
- the data may be stored according to a certain rule, for example, receiving and storing data once every other time, and the length of the data received and stored in a period of time is certain, for which reason Corresponding relationship between the time period corresponding to each data and the file identifier is pre-stored, wherein the total length of the data to be stored received in the corresponding time period of the file identifier is equal to the length of one storage segment, so as to ensure receiving within the corresponding time period of the file identifier All the data to be stored is stored in a storage segment to form a complete file, ensuring that the storage area occupied by the same file on the hard disk is continuous.
- a certain rule for example, receiving and storing data once every other time, and the length of the data received and stored in a period of time is certain, for which reason Corresponding relationship between the time period corresponding to each data and the file identifier is pre-stored, wherein the total length of the data to be stored received in the corresponding time period of the file identifier is equal to the
- the time point at which the data to be stored is received may be recorded, and the target time period to which the time point belongs may be determined, and then the corresponding time period corresponding to the data to be stored and the correspondence of the file identifier according to the pre-stored data to be stored. Relationship, determining the target file identifier corresponding to the target time period.
- the data to be stored is recorded data, and there are currently two channels of video data, which are: A channel video data and B channel video data, and the corresponding relationship between the time period corresponding to the A channel video data stored in advance 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"], etc.
- the correspondence between the time period corresponding to the pre-stored B-channel recording data and the file identifier is: [1:00-2:00, file identification: "2"], [2:00-3:00, file identification: " 4"], [3:00-4:00, file identification: "6”], etc.;
- 1:30 receives the data A 1 to be stored in the A channel recording data, 1:30 belongs to the time period of 1:00-2:00, so 1:00-2:00 is determined as the target time period, according to the advance a video data corresponding to the stored path [1: 00-2: 00, file identifier: "1"], a 1 is determined to be storing data corresponding to the target file identifier is "1";
- 1:30 receives the data to be stored B 1 of the B-channel recording data, 1:30 belongs to the time period of 1:00-2:00, so 1:00-2:00 is determined as the target time period, according to the advance B channel data corresponding to the video storage [1: 00-2: 00, file identifier: "2"], B 1 is determined corresponding to data to be stored in the target file identified as "2.”
- S103 Determine, according to the correspondence between the pre-stored file identifier and the base address of the storage segment, the target file identifier corresponding to the target base address;
- the base address is the starting logical address of a storage segment, and each file identifier and the base address have a one-to-one correspondence.
- S104 Store 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 greater than the length of the data of the complete file corresponding to the target file identifier, so as to ensure that a complete file can be stored in one storage segment.
- the complete file includes the file header and the end of the file.
- the file tail corresponding to the target file identifier is added to the tail of the stored data in the target storage segment, and the target storage segment writes the data end, 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. In this way, the waste of the storage area is avoided, and only one file is stored in one storage segment, and the storage area occupied by the same file in the hard disk is continuous, which improves the storage performance of the hard disk.
- data may be stored according to a certain rule, that is, data is received and stored once every other time, and the length of data stored in a time period is certain, but may also be due to Some factors, such as the environment and device status, cause the length of the stored data to increase or decrease in a period of time.
- a certain rule that is, data is received and stored once every other time
- the length of data stored in a time period is certain, but may also be due to Some factors, such as the environment and device status, cause the length of the stored data to increase or decrease in a period of time.
- the corresponding relationship between the time period corresponding to the data to be stored and the file identifier needs to be updated, so that the next time Storage of data.
- the correspondence between the time period corresponding to the pre-stored A-channel recording 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"], etc.; when 1:50, the target storage segment corresponding to the file identifier "1" is full, then it is already in the target storage segment.
- the end of the stored data is added with the file identifier corresponding to the file identifier "1";
- the corresponding relationship between the time period corresponding to the A-channel recording data and the file identifier is: [1:50-2:50, file identifier: "3"], [2:50-3:50, file identification: "5"] and so on.
- the data to be stored when the data to be stored is stored in the target storage segment, the data may or may not be stored in the target storage segment; if the data is not stored in the target storage segment, the data may be directly Store the data to be stored in the target storage segment;
- the stored data is not the data of the complete file, that is, the target storage segment does not include the file tail, and if the data to be stored is the same data segment as the stored data in the target storage segment.
- Data for example, data of 1:00-2:00 of the A-channel recording data
- the data to be stored is directly stored in the target storage segment; if the data to be stored is not the same data segment as the data stored in the target storage segment, for example, the data to be stored is the 1:00-2:00 of the A-channel recording data.
- the data stored in the target storage segment is the 1:00-2:00 data of the B channel recording data, in order to ensure the storage of the data, the stored data in the target storage segment needs to be deleted to store the data to be stored.
- a pre-delete command may be generated according to the target base address and the length of the target storage segment, such as a Trim command, where the Trim command includes a target base address and a length of the target storage segment, where the length of the target storage segment is the preset length. It can also be understood as the length of the data stored in the target storage segment; the stored data in the target storage segment occupies a continuous storage area, and the target storage segment can be marked as pre-deleted according to the Trim command.
- the target storage segment is determined according to the Trim command.
- the method of the pre-deletion reference may be made to the related art.
- the data stored in the target storage segment is the data of the complete file, that is, the target storage segment includes the file tail, and the target storage segment may be stored.
- the complete file can be understood as the data of the old file, and the data to be stored is the data of the new file.
- the data of the old file can be deleted, and the data of the new file is stored.
- a pre-delete command may be generated according to the target base address and the length of the target storage segment, for example, the Trim command
- the data in the target storage segment is the data of the complete file
- the target storage segment corresponding to the complete file is continuous, according to the Trim command.
- the target bucket can be marked as pre-deleted.
- the garbage collection program is executed to delete the stored data in the target storage segment, that is, the target storage segment is reclaimed, and the data to be stored is stored in the target storage segment.
- the target storage segment can be immediately reclaimed, which improves the storage efficiency of the data to be stored.
- the user may also actively delete the file stored in the hard disk.
- the deletion instruction includes the target file identifier, and the correspondence between the pre-stored file identifier and the base address. The relationship directly determines the target base address corresponding to the target file identifier carried in the delete instruction, and marks the target storage segment corresponding to the target base address as pre-delete.
- the garbage collection program can be directly run to recover the target storage segment.
- the data to be stored is directly stored in the target storage segment; Misoperation, which causes the problem of accidental deletion of data, and considering that it is not necessary to store new data in the target storage segment at present, the target storage segment may not be temporarily reclaimed.
- the garbage collection program is executed, the target storage segment is reclaimed, and the data to be stored is stored in the target storage segment, which is not limited in this embodiment.
- the target storage segment in order to ensure data storage, when rewriting data to the target storage segment, the target storage segment may be marked as pre-deleted, the garbage collection program is run, and the target storage segment is reclaimed. Store the data to be stored in the target bucket.
- the hard disk includes multiple storage segments, each of which has the same length; when receiving the data to be stored, determining the target file identifier corresponding to the data to be stored; according to the correspondence between the pre-stored file identifier and the base address, Determining the target file identifier corresponding to the target base address; storing the data to be stored to the target storage segment corresponding to the target base address; wherein, 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 target file
- the complete file corresponding to the identifier is stored in the target bucket.
- FIG. 3 is a schematic structural diagram of a hard disk data storage device according to an embodiment of the present disclosure.
- the hard disk includes multiple storage segments, each of which has the same length; the device includes:
- a data receiving unit 301 configured to receive data to be stored
- the identifier determining unit 302 is configured to determine a target file identifier corresponding to the data to be stored
- the first address determining unit 303 is configured to determine, according to the correspondence between the file identifier stored in advance and the base address of the storage segment, the target file identifier corresponding to the target base address;
- the data storage unit 304 is configured to store 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 greater than the length of the data of the complete file corresponding to the target file identifier.
- the identifier determining unit 302 may be specifically configured to:
- the target file identifier corresponding to the target time period is determined according to the corresponding relationship between the time period corresponding to the data to be stored and the file identifier.
- the data storage unit 304 may be specifically configured to:
- the target storage segment is marked as pre-deleted
- the data storage unit 304 can also be used to:
- the hard disk data storage device may further include:
- An instruction receiving unit configured to receive a deletion instruction that carries an identifier of the target file
- a second address determining unit configured to determine, according to a correspondence between the pre-stored file identifier and the base address of the storage segment, a target base address corresponding to the target file identifier carried in the deletion instruction;
- a pre-delete tag unit is used to mark the target storage segment corresponding to the target base address as pre-delete.
- the data storage unit 304 may be specifically configured to:
- the hard disk includes multiple storage segments, each of which has the same length; when receiving the data to be stored, determining the target file identifier corresponding to the data to be stored; according to the correspondence between the pre-stored file identifier and the base address, Determining the target file identifier corresponding to the target base address; storing the data to be stored to the target storage segment corresponding to the target base address; wherein, 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 target file
- the complete file corresponding to the identifier is stored in the target bucket.
- FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404. 401.
- the communication interface 402 and the memory 403 complete communication with each other through the communication bus 404.
- the processor 401 is configured to implement a hard disk data storage method when executing a computer program stored on the memory 403.
- the hard disk includes multiple storage segments, and each storage segment has the same length; the hard disk data storage method includes:
- the data to be stored is stored to a target storage segment 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.
- the hard disk includes multiple storage segments, each of which has the same length; when receiving the data to be stored, determining the target file identifier corresponding to the data to be stored; according to the correspondence between the pre-stored file identifier and the base address, Determining the target file identifier corresponding to the target base address; storing the data to be stored to the target storage segment corresponding to the target base address; wherein, 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 target file
- the complete file corresponding to the identifier is stored in the target bucket.
- the communication bus 404 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus.
- the communication bus can be divided into an address bus, a data bus, a control bus, and the like. In Fig. 4, only one thick line is shown, but it does not mean that there is only one bus or one type of bus.
- the communication interface 402 is used for communication between the above electronic device and other devices.
- the memory 403 may include a RAM (Random Access Memory), and may also include NVM (Non-Volatile Memory), such as at least one disk storage.
- the memory 403 may also be at least one storage device located away from the foregoing processor.
- the processor 401 may be a general-purpose processor, including a CPU (Central Processing Unit), an NP (Network Processor), and the like; or may be a DSP (Digital Signal Processing) or an ASIC (Application). Specific Integrated Circuit, FPGA (Field-Programmable Gate Array) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component.
- CPU Central Processing Unit
- NP Network Processor
- DSP Digital Signal Processing
- ASIC Application.
- FPGA Field-Programmable Gate Array
- other programmable logic device discrete gate or transistor logic device, discrete hardware component.
- the embodiment of the present application discloses a computer program for implementing a hard disk data storage method at runtime.
- the hard disk includes multiple storage segments, and each storage segment has the same length;
- the hard disk data storage method includes:
- the data to be stored is stored to a target storage segment 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.
- the hard disk includes multiple storage segments, each of which has the same length; when receiving the data to be stored, determining the target file identifier corresponding to the data to be stored; according to the correspondence between the pre-stored file identifier and the base address, Determining the target file identifier corresponding to the target base address; storing the data to be stored to the target storage segment corresponding to the target base address; wherein, 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 target file
- the complete file corresponding to the identifier is stored in the target bucket.
- the embodiment of the present application provides a storage medium.
- the storage medium is used to store a computer program, and the computer program is implemented to implement a hard disk data storage method.
- the hard disk includes multiple storage segments, and each storage segment has the same length; the hard disk data storage method includes:
- the data to be stored is stored to a target storage segment 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.
- the hard disk includes multiple storage segments, each of which has the same length; when receiving the data to be stored, determining the target file identifier corresponding to the data to be stored; according to the correspondence between the pre-stored file identifier and the base address, Determining the target file identifier corresponding to the target base address; storing the data to be stored to the target storage segment corresponding to the target base address; wherein, 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 target file
- the complete file corresponding to the identifier is stored in the target bucket.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种硬盘数据存储方法及装置,所述硬盘包括多个存储段,每个存储段的长度相同;所述方法包括:接收待存储数据(S101);确定所述待存储数据对应的目标文件标识(S102);根据预先存储的文件标识和存储段的基地址的对应关系,确定所述目标文件标识对应目标基地址(S103);将所述待存储数据存储至所述目标基地址对应的目标存储段(S104);所述目标存储段的长度不大于所述目标文件标识对应的完整文件的数据的长度。该方案提高了硬盘的存储性能。
Description
本申请要求于2017年1月25日提交中国专利局、申请号为201710055969.2发明名称为“一种硬盘数据存储方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及计算机技术领域,特别是涉及一种硬盘数据存储方法及装置。
随着计算机技术的发展,人们将越来越多的数据存储在计算机中。
目前,计算机一般为按照固态硬盘的逻辑地址顺序存储文件的数据。然而,计算机接收文件的数据是随机的,例如:计算机接收到了一个文件A的一部分数据后,又接收到了另一文件B的一部分数据,然后又接收到了文件A的另一部分数据,这导致同一个文件在计算机的硬盘中占用的存储区域很可能是不连续的。
基于上述情况,当需要删除一个已存储文件,回收这个已存储文件占用的存储区域时,对计算机的硬盘进行Trim命令,若这个已存储文件占用的存储区域是不连续的,Trim命令无法将不连续的存储区域标记为预删除,也就无法立即删除这个已存储文件,无法立即回收这个已存储文件占用的存储区域,进而使得计算机无法立即利用这个已存储文件占用的存储区域存储新接收的文件的数据,降低了硬盘的存储性能。
发明内容
本申请实施例的目的在于提供一种硬盘数据存储方法及装置,以提高硬盘的存储性能。具体技术方案如下:
一方面,本申请实施例公开了一种硬盘数据存储方法,所述硬盘包括多个存储段,每个存储段的长度相同;所述方法包括:
接收待存储数据;
确定所述待存储数据对应的目标文件标识;
根据预先存储的文件标识和存储段的基地址的对应关系,确定所述目标文件标识对应目标基地址;
将所述待存储数据存储至所述目标基地址对应的目标存储段;所述目标存储段的长度不大于所述目标文件标识对应的完整文件的数据的长度。
在本申请的一个实施例中,所述确定所述待存储数据对应的目标文件标识的步骤,包括:
记录接收所述待存储数据的时间点;
确定所述时间点所属的目标时间段;
根据预先存储的所述待存储数据对应的时间段和文件标识的对应关系,确定所述目标时间段对应的目标文件标识。
在本申请的一个实施例中,所述将所述待存储数据存储至所述目标基地址对应的目标存储段的步骤,包括:
若所述目标基地址对应的目标存储段中存储有所述目标文件标识对应的完整文件的数据,将所述目标存储段标记为预删除;
运行垃圾回收程序,将所述目标存储段中已存储的数据删除;
将所述待存储数据存储至所述目标存储段。
在本申请的一个实施例中,所述将所述目标存储段标记为预删除的步骤,包括:
根据所述目标基地址和所述目标存储段的长度,生成预删除命令;
根据所述预删除命令,将所述目标存储段标记为预删除。
在本申请的一个实施例中,所述方法还包括:
接收携带所述目标文件标识的删除指令;
根据预先存储的文件标识和基地址的对应关系,确定所述删除指令中携带的所述目标文件标识对应的目标基地址;
将所述目标基地址对应的目标存储段标记为预删除。
在本申请的一个实施例中,所述将所述待存储数据存储至所述目标基地址对应的目标存储段的步骤,包括:
运行垃圾回收程序,将所述目标存储段中已存储的数据删除;
将所述待存储数据存储至所述目标存储段。
二方面,本申请实施例公开了一种硬盘数据存储装置,所述硬盘包括多个存储段,每个存储段的长度相同;所述装置包括:
数据接收单元,用于接收待存储数据;
标识确定单元,用于确定所述待存储数据对应的目标文件标识;
第一地址确定单元,用于根据预先存储的文件标识和存储段的基地址的对应关系,确定所述目标文件标识对应目标基地址;
数据存储单元,用于将所述待存储数据存储至所述目标基地址对应的目标存储段;所述目标存储段的长度不大于所述目标文件标识对应的完整文件的数据的长度。
在本申请的一个实施例中,所述标识确定单元,具体用于:
记录接收所述待存储数据的时间点;
确定所述时间点所属的目标时间段;
根据预先存储的所述待存储数据对应的时间段和文件标识的对应关系,确定所述目标时间段对应的目标文件标识。
在本申请的一个实施例中,所述数据存储单元,具体用于:
若所述目标基地址对应的目标存储段中存储有所述目标文件标识对应的完整文件的数据,将所述目标存储段标记为预删除;
运行垃圾回收程序,将所述目标存储段中已存储的数据删除;
将所述待存储数据存储至所述目标存储段。
在本申请的一个实施例中,所述数据存储单元,还用于:
根据所述目标基地址和所述目标存储段的长度,生成预删除命令;
根据所述预删除命令,将所述目标存储段标记为预删除。
在本申请的一个实施例中,所述装置还包括:
指令接收单元,用于接收携带所述目标文件标识的删除指令;
第二地址确定单元,用于根据预先存储的文件标识和基地址的对应关系,确定所述删除指令中携带的所述目标文件标识对应的目标基地址;
预删除标记单元,用于将所述目标基地址对应的目标存储段标记为预删除。
在本申请的一个实施例中,所述数据存储单元,具体用于:
运行垃圾回收程序,将所述目标存储段中已存储的数据删除;
将所述待存储数据存储至所述目标存储段。
三方面,本申请实施例公开了一种电子设备,包括处理器、通信接口、存储器和通信总线;其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信;
所述存储器,用于存放计算机程序;
所述处理器,用于执行所述存储器上所存放的计算机程序时,实现上述的硬盘数据存储方法步骤。
四方面,本申请实施例公开了一种计算机程序,所述计算机程序用于在运行时实现上述的硬盘数据存储方法步骤。
五方面,本申请实施例公开了一种存储介质,所述存储介质用于存储计算机程序,所述计算机程序被运行时实现上述的硬盘数据存储方法步骤。
本申请实施例提供的一种硬盘数据存储方法及装置,硬盘包括多个存储段,每个存储段的长度相同;当接收到待存储数据,确定待存储数据对应的目标文件标识;根据预先存储的文件标识和基地址的对应关系,确定目标文件标识对应目标基地址;将待存储数据存储至目标基地址对应的目标存储段;其中,目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度,也就是,目标文件标识对应的完整文件都存储在了目标存储段中。可见,本申请实施例中,同一个文件在硬盘中占用的存储区域是连续的,为一个存储
段,可以立即回收一个文件占用的存储区域,提高了硬盘的存储性能。当然,实施本申请的任一产品或方法必不一定需要同时达到以上所述的所有优点。
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种硬盘数据存储方法的一种流程示意图;
图2为本申请实施例使用的一种硬盘的结构示意图;
图3为本申请实施例提供的一种硬盘数据存储装置的一种结构示意图;
图4为本申请实施例提供的电子设备的一种结构示意图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为便于说明本申请,下面对本申请实施例中出现的词进行定义说明:
Trim命令:ATA(Advanced Technology Attachment,高级技术附件)-7协议中引入的指令,该指令为基于固态硬盘特质而设计的预删除数据方法。
下面通过具体实施例,对本申请进行详细说明。
参考图1,图1为本申请实施例提供的一种硬盘数据存储方法的一种流程示意图,其中,可参考图2,图2为本申请实施例使用的一种硬盘的结构示意图,在对硬盘进行格式化时,可以划分成多个存储段,每个存储段的长度相同,为预设长度;该方法包括:
S101:接收待存储数据;
这里,待存储数据可以为录像数据、文本数据等。
S102:确定待存储数据对应的目标文件标识;
这里,目标文件标识可以为目标文件名。
在本申请的其他实施例中,数据可以按照一定的规律存储,例如,每隔一段时间接收并存储一次数据,在一个时间段内接收并存储的数据的长度是一定的,基于该原因,可以预先存储每种数据对应的时间段和文件标识的对应关系,其中,文件标识对应的时间段内接收的待存储数据的总长度等于一个存储段的长度,以保证文件标识对应的时间段内接收的所有待存储数据均存储在一个存储段中,构成一个完整的文件,保证同一个文件在硬盘中占用的存储区域是连续的。
这种情况下,当接收到待存储数据时,可以记录接收待存储数据的时间点,确定该时间点所属的目标时间段,进而根据预先存储的待存储数据对应的时间段和文件标识的对应关系,确定目标时间段对应的目标文件标识。
例如,待存储数据为录像数据,当前有2路录像数据,分别为:A路录像数据和B路录像数据,预先存储的A路录像数据对应的时间段和文件标识的对应关系为:[1:00-2:00,文件标识:“1”]、[2:00-3:00,文件标识:“3”]、[3:00-4:00,文件标识:“5”]等等;预先存储的B路录像数据对应的时间段和文件标识的对应关系为:[1:00-2:00,文件标识:“2”]、[2:00-3:00,文件标识:“4”]、[3:00-4:00,文件标识:“6”]等等;
若1:30接收到A路录像数据的待存储数据A1,1:30属于1:00-2:00这一时间段,因此将1:00-2:00确定为目标时间段,根据预先存储的A路录像数据对应的[1:00-2:00,文件标识:“1”],确定待存储数据A1对应的目标文件标识为“1”;
若1:30接收到B路录像数据的待存储数据B1,1:30属于1:00-2:00这一时间段,因此将1:00-2:00确定为目标时间段,根据预先存储的B路录像数据对应的[1:00-2:00,文件标识:“2”],确定待存储数据B1对应的目标文件标识为“2”。
S103:根据预先存储的文件标识和存储段的基地址的对应关系,确定目标文件标识对应目标基地址;
这里,基地址为一个存储段的起始逻辑地址,每一文件标识和基地址为一一对应的关系。确定了目标基地址,再结合硬盘格式化时划分存储段的预
设长度,很容易确定出目标存储段。
S104:将待存储数据存储至目标基地址对应的目标存储段。
这里,目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度,以保证一个存储段中能够存储一个完整文件。这里,完整文件包括文件头和文件尾。
在本申请的其他实施例中,目标存储段写满数据后,在目标存储段中已存储数据的尾部添加目标文件标识对应的文件尾,此时目标存储段写数据结束,目标存储段中存储了完整文件,也就是,目标存储段的长度等于目标文件标识对应的完整文件的数据的长度。这样,避免了存储区域的浪费,保证了一个存储段中仅存储一个文件,同一个文件在硬盘中占用的存储区域是连续的,提高了硬盘的存储性能。
在本申请的其他实施例中,数据可以按照一定的规律存储,也就是,每隔一段时间接收并存储一次数据,此时在一个时间段内存储的数据的长度是一定的,但也可能因一些因素,如环境、设备状态等因素,导致一个时间段内存储数据的长度增长或减少,此时就需要更新预先存储的待存储数据对应的时间段和文件标识的对应关系,以便于下次数据的存储。
例如,预先存储的A路录像数据对应的时间段和文件标识的对应关系为:[1:00-2:00,文件标识:“1”]、[2:00-3:00,文件标识:“3”]、[3:00-4:00,文件标识:“5”]等等;当1:50时,文件标识“1”对应的目标存储段写满,则在目标存储段中已存储数据的尾部添加文件标识“1”对应的文件尾;同时更新A路录像数据对应的时间段和文件标识的对应关系为:[1:50-2:50,文件标识:“3”]、[2:50-3:50,文件标识:“5”]等等。
在本申请的其他实施例中,在将待存储数据存储至目标存储段中时,目标存储段中可能没有存储数据,也可能已存储了数据;若目标存储段中没有存储数据,则可以直接将待存储数据存储至目标存储段中;
若目标存储段中已存储有数据,该已存储的数据不是完整文件的数据,也就是,目标存储段中不包括文件尾,若待存储数据与目标存储段中已存储数据为同一数据段的数据,例如均为A路录像数据的1:00-2:00的数据,则可以
直接将待存储数据存储至目标存储段中;若待存储数据与目标存储段中已存储数据不为同一数据段的数据,例如待存储数据为A路录像数据的1:00-2:00的数据,目标存储段中已存储数据为B路录像数据的1:00-2:00的数据,则为了保证数据的存储,需要将目标存储段中已存储数据删除,以存储待存储数据。例如,可以根据目标基地址和目标存储段的长度,生成预删除命令,例如Trim命令,该Trim命令包括目标基地址和目标存储段的长度,这里,目标存储段的长度为上述预设长度,也可以理解为目标存储段中存储的数据的长度;目标存储段中已存储数据占用连续的存储区域,根据该Trim命令可以将目标存储段标记为预删除,这里,根据Trim命令将目标存储段标记为预删除的方法可参考相关技术,本申请实施例对此不再赘述;
若目标存储段中已存储有数据,例如硬盘写满时,目标存储段中已存储的数据为完整文件的数据,也就是,目标存储段中包括文件尾,则可以将目标存储段中已存储完整文件可以理解为老的文件的数据,待存储数据为新的文件的数据,为了保证数据的存储,可以将老的文件的数据删除,存储新的文件的数据。例如,可以根据目标基地址和目标存储段的长度,生成预删除命令,例如Trim命令,目标存储段中的数据为完整文件的数据,完整文件对应的目标存储段为连续的,根据该Trim命令可以将目标存储段标记为预删除。
在将目标存储段标记为预删除后,运行垃圾回收程序,将目标存储段中的已存储的数据都删除,也就是回收目标存储段,进而将待存储数据存储至目标存储段。此时,可以立即回收目标存储段,提高了待存储数据的存储效率。
在本申请的其他实施例中,用户也可以主动删除硬盘中存储的文件,当接收到用户输入的删除指令时,该删除指令中包括目标文件标识,结合预先存储的文件标识和基地址的对应关系,直接确定出删除指令中携带的目标文件标识对应目标基地址,将目标基地址对应的目标存储段标记为预删除。
这种情况下,为了节约硬盘的存储空间,可以直接运行垃圾回收程序,回收目标存储段,当接收到待存储数据后,直接将待存储数据存储至目标存储段中;另外,为了避免因用户误操作,导致误删除数据的问题,同时考虑到当前不需要向目标存储段中存储新的数据,可以暂时不回收目标存储段,
当接收到需要向目标存储段中存储的待存储数据后,再运行垃圾回收程序,回收目标存储段,将待存储数据存储至目标存储段中,本申请实施例对此不进行限定。
在本申请的其他实施例中,为了保证数据的存储,当向目标存储段中重新写入数据时,都可以先将目标存储段标记为预删除,运行垃圾回收程序,回收目标存储段,再将待存储数据存储至目标存储段中。
应用上述实施例,硬盘包括多个存储段,每个存储段的长度相同;当接收到待存储数据,确定待存储数据对应的目标文件标识;根据预先存储的文件标识和基地址的对应关系,确定目标文件标识对应目标基地址;将待存储数据存储至目标基地址对应的目标存储段;其中,目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度,也就是,目标文件标识对应的完整文件都存储在了目标存储段中。可见,本申请实施例中,同一个文件在硬盘中占用的存储区域是连续的,为一个存储段,可以立即回收一个文件占用的存储区域,提高了硬盘的存储性能。
与硬盘数据存储方法实施例对应,本申请实施例还提供了一种硬盘数据存储装置。参考图3,图3为本申请实施例提供的一种硬盘数据存储装置的一种结构示意图,所述硬盘包括多个存储段,每个存储段的长度相同;所述装置包括:
数据接收单元301,用于接收待存储数据;
标识确定单元302,用于确定待存储数据对应的目标文件标识;
第一地址确定单元303,用于根据预先存储的文件标识和存储段的基地址的对应关系,确定目标文件标识对应目标基地址;
数据存储单元304,用于将待存储数据存储至目标基地址对应的目标存储段;目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度。
在本申请的其他实施例中,标识确定单元302,具体可以用于:
记录接收待存储数据的时间点;
确定时间点所属的目标时间段;
根据预先存储的待存储数据对应的时间段和文件标识的对应关系,确定目标时间段对应的目标文件标识。
在本申请的其他实施例中,数据存储单元304,具体可以用于:
若目标基地址对应的目标存储段中存储有目标文件标识对应的完整文件的数据,将目标存储段标记为预删除;
运行垃圾回收程序,将目标存储段中已存储的数据删除;
将待存储数据存储至目标存储段。
在本申请的其他实施例中,数据存储单元304,还可以用于:
根据目标基地址和目标存储段的长度,生成预删除命令;
根据预删除命令,将目标存储段标记为预删除。
在本申请的其他实施例中,硬盘数据存储装置还可以包括:
指令接收单元,用于接收携带目标文件标识的删除指令;
第二地址确定单元,用于根据预先存储的文件标识和存储段的基地址的对应关系,确定删除指令中携带的目标文件标识对应的目标基地址;
预删除标记单元,用于将目标基地址对应的目标存储段标记为预删除。
在本申请的其他实施例中,数据存储单元304,具体可以用于:
运行垃圾回收程序,将目标存储段中已存储的数据删除;
将待存储数据存储至目标存储段。
应用上述实施例,硬盘包括多个存储段,每个存储段的长度相同;当接收到待存储数据,确定待存储数据对应的目标文件标识;根据预先存储的文件标识和基地址的对应关系,确定目标文件标识对应目标基地址;将待存储数据存储至目标基地址对应的目标存储段;其中,目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度,也就是,目标文件标识对应的完整文件都存储在了目标存储段中。可见,本申请实施例中,同一个文件在硬盘中占用的存储区域是连续的,为一个存储段,可以立即回收一个文件占
用的存储区域,提高了硬盘的存储性能。
与硬盘数据存储方法实施例对应,参考图4,图4为本申请实施例提供的电子设备的一种结构示意图,包括处理器401、通信接口402、存储器403和通信总线404;其中,处理器401、通信接口402、存储器403通过通信总线404完成相互间的通信;
存储器403,用于存放计算机程序;
处理器401,用于执行存储器403上所存放的计算机程序时,实现硬盘数据存储方法。其中,硬盘包括多个存储段,每个存储段的长度相同;硬盘数据存储方法包括:
接收待存储数据;
确定待存储数据对应的目标文件标识;
根据预先存储的文件标识和存储段的基地址的对应关系,确定目标文件标识对应目标基地址;
将待存储数据存储至目标基地址对应的目标存储段;目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度。
应用上述实施例,硬盘包括多个存储段,每个存储段的长度相同;当接收到待存储数据,确定待存储数据对应的目标文件标识;根据预先存储的文件标识和基地址的对应关系,确定目标文件标识对应目标基地址;将待存储数据存储至目标基地址对应的目标存储段;其中,目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度,也就是,目标文件标识对应的完整文件都存储在了目标存储段中。可见,本申请实施例中,同一个文件在硬盘中占用的存储区域是连续的,为一个存储段,可以立即回收一个文件占用的存储区域,提高了硬盘的存储性能。
上述通信总线404可以是PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(Extended Industry Standard Architecture,扩展工业标准结构)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。图4中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
通信接口402用于上述电子设备与其他设备之间的通信。
存储器403可以包括RAM(Random Access Memory,随机存取存储器),也可以包括NVM(Non-Volatile Memory,非易失性存储器),例如至少一个磁盘存储器。可选的,存储器403还可以是至少一个位于远离前述处理器的存储装置。
处理器401可以是通用处理器,包括CPU(Central Processing Unit,中央处理器)、NP(Network Processor,网络处理器)等;还可以是DSP(Digital Signal Processing,数字信号处理器)、ASIC(Application Specific Integrated Circuit,专用集成电路)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)或其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
与硬盘数据存储方法实施例对应,本申请实施例公开了一种计算机程序,计算机程序用于在运行时实现硬盘数据存储方法。其中,硬盘包括多个存储段,每个存储段的长度相同;硬盘数据存储方法包括:
接收待存储数据;
确定待存储数据对应的目标文件标识;
根据预先存储的文件标识和存储段的基地址的对应关系,确定目标文件标识对应目标基地址;
将待存储数据存储至目标基地址对应的目标存储段;目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度。
应用上述实施例,硬盘包括多个存储段,每个存储段的长度相同;当接收到待存储数据,确定待存储数据对应的目标文件标识;根据预先存储的文件标识和基地址的对应关系,确定目标文件标识对应目标基地址;将待存储数据存储至目标基地址对应的目标存储段;其中,目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度,也就是,目标文件标识对应的完整文件都存储在了目标存储段中。可见,本申请实施例中,同一个文件在硬盘中占用的存储区域是连续的,为一个存储段,可以立即回收一个文件占用的存储区域,提高了硬盘的存储性能。
与硬盘数据存储方法实施例对应,本申请实施例提供了一种存储介质,
存储介质用于存储计算机程序,计算机程序被运行时实现硬盘数据存储方法。其中,硬盘包括多个存储段,每个存储段的长度相同;硬盘数据存储方法包括:
接收待存储数据;
确定待存储数据对应的目标文件标识;
根据预先存储的文件标识和存储段的基地址的对应关系,确定目标文件标识对应目标基地址;
将待存储数据存储至目标基地址对应的目标存储段;目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度。
应用上述实施例,硬盘包括多个存储段,每个存储段的长度相同;当接收到待存储数据,确定待存储数据对应的目标文件标识;根据预先存储的文件标识和基地址的对应关系,确定目标文件标识对应目标基地址;将待存储数据存储至目标基地址对应的目标存储段;其中,目标存储段的长度不大于目标文件标识对应的完整文件的数据的长度,也就是,目标文件标识对应的完整文件都存储在了目标存储段中。可见,本申请实施例中,同一个文件在硬盘中占用的存储区域是连续的,为一个存储段,可以立即回收一个文件占用的存储区域,提高了硬盘的存储性能。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于硬盘数据存储装置、电子设备、计算机程序、存储介质实
施例而言,由于其基本相似于硬盘数据存储方法实施例,所以描述的比较简单,相关之处参见图1、图2所示的硬盘数据存储方法实施例的部分说明即可。
以上所述仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。
Claims (15)
- 一种硬盘数据存储方法,其特征在于,所述硬盘包括多个存储段,每个存储段的长度相同;所述方法包括:接收待存储数据;确定所述待存储数据对应的目标文件标识;根据预先存储的文件标识和存储段的基地址的对应关系,确定所述目标文件标识对应目标基地址;将所述待存储数据存储至所述目标基地址对应的目标存储段;所述目标存储段的长度不大于所述目标文件标识对应的完整文件的数据的长度。
- 根据权利要求1所述的方法,其特征在于,所述确定所述待存储数据对应的目标文件标识的步骤,包括:记录接收所述待存储数据的时间点;确定所述时间点所属的目标时间段;根据预先存储的所述待存储数据对应的时间段和文件标识的对应关系,确定所述目标时间段对应的目标文件标识。
- 根据权利要求1所述的方法,其特征在于,所述将所述待存储数据存储至所述目标基地址对应的目标存储段的步骤,包括:若所述目标基地址对应的目标存储段中存储有所述目标文件标识对应的完整文件的数据,将所述目标存储段标记为预删除;运行垃圾回收程序,将所述目标存储段中已存储的数据删除;将所述待存储数据存储至所述目标存储段。
- 根据权利要求3所述的方法,其特征在于,所述将所述目标存储段标记为预删除的步骤,包括:根据所述目标基地址和所述目标存储段的长度,生成预删除命令;根据所述预删除命令,将所述目标存储段标记为预删除。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:接收携带所述目标文件标识的删除指令;根据预先存储的文件标识和基地址的对应关系,确定所述删除指令中携带的所述目标文件标识对应的目标基地址;将所述目标基地址对应的目标存储段标记为预删除。
- 根据权利要求5所述的方法,其特征在于,所述将所述待存储数据存储至所述目标基地址对应的目标存储段的步骤,包括:运行垃圾回收程序,将所述目标存储段中已存储的数据删除;将所述待存储数据存储至所述目标存储段。
- 一种硬盘数据存储装置,其特征在于,所述硬盘包括多个存储段,每个存储段的长度相同;所述装置包括:数据接收单元,用于接收待存储数据;标识确定单元,用于确定所述待存储数据对应的目标文件标识;第一地址确定单元,用于根据预先存储的文件标识和存储段的基地址的对应关系,确定所述目标文件标识对应目标基地址;数据存储单元,用于将所述待存储数据存储至所述目标基地址对应的目标存储段;所述目标存储段的长度不大于所述目标文件标识对应的完整文件的数据的长度。
- 根据权利要求7所述的装置,其特征在于,所述标识确定单元,具体用于:记录接收所述待存储数据的时间点;确定所述时间点所属的目标时间段;根据预先存储的所述待存储数据对应的时间段和文件标识的对应关系,确定所述目标时间段对应的目标文件标识。
- 根据权利要求7所述的装置,其特征在于,所述数据存储单元,具体 用于:若所述目标基地址对应的目标存储段中存储有所述目标文件标识对应的完整文件的数据,将所述目标存储段标记为预删除;运行垃圾回收程序,将所述目标存储段中已存储的数据删除;将所述待存储数据存储至所述目标存储段。
- 根据权利要求9所述的装置,其特征在于,所述数据存储单元,还用于:根据所述目标基地址和所述目标存储段的长度,生成预删除命令;根据所述预删除命令,将所述目标存储段标记为预删除。
- 根据权利要求7所述的装置,其特征在于,所述装置还包括:指令接收单元,用于接收携带所述目标文件标识的删除指令;第二地址确定单元,用于根据预先存储的文件标识和基地址的对应关系,确定所述删除指令中携带的目标文件标识对应的目标基地址;预删除标记单元,用于将所述目标基地址对应的目标存储段标记为预删除。
- 根据权利要求11所述的装置,其特征在于,所述数据存储单元,具体用于:运行垃圾回收程序,将所述目标存储段中已存储的数据删除;将所述待存储数据存储至所述目标存储段。
- 一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线;其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信;所述存储器,用于存放计算机程序;所述处理器,用于执行所述存储器上所存放的计算机程序时,实现权利要求1-6任一所述的方法步骤。
- 一种计算机程序,其特征在于,所述计算机程序用于在运行时实现权利要求1-6任一所述的方法步骤。
- 一种存储介质,其特征在于,所述存储介质用于存储计算机程序,所述计算机程序被运行时实现权利要求1-6任一所述的方法步骤。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710055969.2A CN108345427B (zh) | 2017-01-25 | 2017-01-25 | 一种硬盘数据存储方法及装置 |
| CN201710055969.2 | 2017-01-25 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2018137366A1 true WO2018137366A1 (zh) | 2018-08-02 |
Family
ID=62962239
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2017/106787 Ceased WO2018137366A1 (zh) | 2017-01-25 | 2017-10-19 | 一种硬盘数据存储方法及装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN108345427B (zh) |
| WO (1) | WO2018137366A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115390749A (zh) * | 2022-07-29 | 2022-11-25 | 张绛丽 | 基于大数据的存储控制方法及装置、计算机存储介质 |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112463746B (zh) * | 2020-12-11 | 2023-11-03 | 杭州海康汽车软件有限公司 | 一种文件存储、生成方法、装置及电子设备 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080031590A1 (en) * | 2006-08-04 | 2008-02-07 | Kulas Charles J | Digital video recording of multiple associated channels |
| CN102325244A (zh) * | 2011-08-26 | 2012-01-18 | 杭州海康威视数字技术股份有限公司 | 按时间快速定位录像的方法、录像存储控制装置及定位装置 |
| CN105243027A (zh) * | 2015-09-24 | 2016-01-13 | 华为技术有限公司 | 在存储设备中存储数据的方法和存储控制器 |
| CN106254805A (zh) * | 2016-07-28 | 2016-12-21 | 浙江大华技术股份有限公司 | 一种录像数据的存储方法、装置及录像机 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7437530B1 (en) * | 2003-04-24 | 2008-10-14 | Network Appliance, Inc. | System and method for mapping file block numbers to logical block addresses |
| JP2005267111A (ja) * | 2004-03-17 | 2005-09-29 | Hitachi Ltd | 記憶制御システム及び記憶制御システムの制御方法 |
| US8151082B2 (en) * | 2007-12-06 | 2012-04-03 | Fusion-Io, Inc. | Apparatus, system, and method for converting a storage request into an append data storage command |
| CN103905789B (zh) * | 2012-12-27 | 2017-06-16 | 杭州海康威视数字技术股份有限公司 | 动态分析数据的保存、搜索和事后分析的方法及其装置 |
| CN106033324B (zh) * | 2015-03-09 | 2020-03-06 | 杭州海康威视数字技术股份有限公司 | 一种数据存储的方法和装置 |
-
2017
- 2017-01-25 CN CN201710055969.2A patent/CN108345427B/zh active Active
- 2017-10-19 WO PCT/CN2017/106787 patent/WO2018137366A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080031590A1 (en) * | 2006-08-04 | 2008-02-07 | Kulas Charles J | Digital video recording of multiple associated channels |
| CN102325244A (zh) * | 2011-08-26 | 2012-01-18 | 杭州海康威视数字技术股份有限公司 | 按时间快速定位录像的方法、录像存储控制装置及定位装置 |
| CN105243027A (zh) * | 2015-09-24 | 2016-01-13 | 华为技术有限公司 | 在存储设备中存储数据的方法和存储控制器 |
| CN106254805A (zh) * | 2016-07-28 | 2016-12-21 | 浙江大华技术股份有限公司 | 一种录像数据的存储方法、装置及录像机 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115390749A (zh) * | 2022-07-29 | 2022-11-25 | 张绛丽 | 基于大数据的存储控制方法及装置、计算机存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN108345427B (zh) | 2020-09-04 |
| CN108345427A (zh) | 2018-07-31 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11799959B2 (en) | Data processing method, apparatus, and system | |
| US11853549B2 (en) | Index storage in shingled magnetic recording (SMR) storage system with non-shingled region | |
| CN108572792B (zh) | 数据存储方法、装置、电子设备及计算机可读存储介质 | |
| US20170160989A1 (en) | Solid state disk and method for implementing trim command of the same | |
| CN104156321B (zh) | 一种数据预取的方法以及装置 | |
| EP3196767B1 (en) | Method for writing data into flash memory device, flash memory device and storage system | |
| CN105868122A (zh) | 快闪存储设备的数据处理方法及装置 | |
| WO2020192710A1 (zh) | 基于lsm数据库的垃圾处理的方法、固态硬盘以及存储装置 | |
| CN106598508A (zh) | 一种固态硬盘及其写入仲裁方法、系统 | |
| CN104134027B (zh) | 一种顺序流识别的方法以及装置 | |
| CN105718319A (zh) | 一种内存池版图解析方法和内存池装置 | |
| CN107656701A (zh) | 小文件读加速方法、系统、装置及计算机可读存储介质 | |
| WO2018137366A1 (zh) | 一种硬盘数据存储方法及装置 | |
| CN114400037B (zh) | Nand擦除方法、装置及可读存储介质 | |
| TW202429283A (zh) | 借助非平衡表搜尋來進行預定通訊架構中記憶體裝置的資料存取管理的方法、記憶體裝置的記憶體控制器、記憶體裝置以及電子裝置 | |
| CN107430546A (zh) | 一种文件更新方法及存储设备 | |
| CN109521969B (zh) | 一种固态硬盘数据回收方法、装置和计算机可读存储介质 | |
| TWI756854B (zh) | 管理資料儲存的方法及裝置以及電腦程式產品 | |
| KR20190123819A (ko) | 데이터 저장장치의 주소 맵핑 테이블 운용 방법 | |
| CN109324929B (zh) | 一种快照创建方法、装置、设备及可读存储介质 | |
| US9703497B2 (en) | Storage system and storage control method | |
| CN112597070B (zh) | 一种对象回收方法及装置 | |
| CN109215190B (zh) | 智能门锁的记录信息上传的方法 | |
| CN107346288A (zh) | 一种数据写入方法及装置 | |
| CN109284237B (zh) | 一种全闪存储阵列中的垃圾回收方法及系统 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17894005 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 17894005 Country of ref document: EP Kind code of ref document: A1 |