CN109508143B - Data storage method and device - Google Patents
Data storage method and device Download PDFInfo
- Publication number
- CN109508143B CN109508143B CN201810942119.9A CN201810942119A CN109508143B CN 109508143 B CN109508143 B CN 109508143B CN 201810942119 A CN201810942119 A CN 201810942119A CN 109508143 B CN109508143 B CN 109508143B
- Authority
- CN
- China
- Prior art keywords
- data
- stored
- storage area
- storage
- memory
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 37
- 238000013500 data storage Methods 0.000 title claims abstract description 28
- 238000012544 monitoring process Methods 0.000 claims description 17
- 238000013467 fragmentation Methods 0.000 abstract description 14
- 238000006062 fragmentation reaction Methods 0.000 abstract description 14
- 238000010586 diagram Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/0629—Configuration or reconfiguration of storage systems
- G06F3/0631—Configuration or reconfiguration of storage systems by allocating resources to storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
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)
- Signal Processing For Digital Recording And Reproducing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a data storage method and a data storage device, which comprise the following steps: acquiring metadata of data to be stored, wherein the metadata comprises: determining the storage area of the data to be stored in the memory according to the metadata, and storing the data to be stored into the storage area corresponding to the data to be stored. Therefore, by adopting the scheme provided by the embodiment of the application, the storage area for storing the data to be stored can be determined according to the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored, rather than randomly allocating the storage area for the data to be stored. The starting position of the data to be stored in the memory can be determined by the storage area occupied by the data already stored in the memory. Therefore, the data stored in the memory is continuously stored, and the disk fragmentation problem is effectively reduced.
Description
Technical Field
The present application relates to the field of data storage, and in particular, to a data storage method and apparatus.
Background
With the development of science and technology, a huge amount of data is generated, and the data can be stored in a memory such as a magnetic disk. At present, when storing data, data storage can be performed directly by using a common File system such as a File Allocation Table (FAT) 32 and a File system such as a File Allocation Table (FAT) system.
However, because of the severe disk fragmentation problems of FAT32 and NTFS, this may result in memory that is unusable after some period of memory use and must be formatted for further use. Here, disk fragmentation means that the locations where files are stored in the memory are not consecutive but are scattered in the memory. On the one hand, disk fragmentation is severe, which results in a low memory space utilization of the memory. On the other hand, after the memory has been used for a period of time, the user may need to format the memory in a timely manner, which may provide a poor experience to the user.
Therefore, a solution is needed to reduce the problem of disk fragmentation.
Disclosure of Invention
The technical problem to be solved by the application is how to reduce disk fragmentation, and a data storage method and device are provided.
In a first aspect, an embodiment of the present application provides a data storage method, including:
obtaining metadata of data to be stored, the metadata including: the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored;
determining a storage area of the data to be stored in the memory according to the metadata;
and storing the data to be stored into a storage area corresponding to the data to be stored.
Optionally, the memory includes a first storage area and a second storage area, and the storage area of the data to be stored in the memory is a storage area in the second storage area; the method further comprises the following steps:
and storing the metadata of the data to be stored into the first storage area.
Optionally, if the second storage area includes a plurality of sub-storage areas whose storage spaces are the first numerical values, the obtaining of the start address of the data to be stored in the memory includes:
acquiring the initial address of a sub-storage area which stores data in the second storage area most recently;
and adding the first numerical value to the initial address of the sub-storage area of the most recently stored data to obtain the initial storage address of the data to be stored in the memory.
Optionally, if the size of the storage area occupied by the data to be stored is smaller than or equal to the first value, the storing the data to be stored into the storage area corresponding to the data to be stored includes:
and storing the data to be stored into a sub-storage area comprising the initial storage address.
Optionally, if the size of the storage space occupied by the data to be stored is greater than the first value, the method further includes:
dividing the data to be stored into a first number of first data to be stored, the size of the first data to be stored occupying a first numerical value, and a second number of second data to be stored, the size of the second data occupying a second numerical value being smaller than the first numerical value; wherein the first number is a positive integer and the second number is equal to 1 or 0;
and respectively storing the first data to be stored and the second data to be stored into corresponding storage areas.
Optionally, the data to be stored includes:
the video monitoring system monitors the obtained video data.
Optionally, the metadata of the monitored video data in the video monitoring system further includes:
the time corresponding to the video data.
In a second aspect, an embodiment of the present application provides a data storage device, including:
an obtaining unit configured to obtain metadata of data to be stored, the metadata including: the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored;
the determining unit is used for determining a storage area of the data to be stored in the memory according to the metadata;
and the first storage unit is used for storing the data to be stored into the storage area corresponding to the data to be stored.
Optionally, the memory includes a first storage area and a second storage area, and the storage area of the data to be stored in the memory is a storage area in the second storage area; the device further comprises:
and the second storage unit is used for storing the metadata of the data to be stored into the first storage area.
Optionally, if the second storage area includes a plurality of sub-storage areas whose storage spaces are the first numerical values, the obtaining of the start address of the data to be stored in the memory includes:
acquiring the initial address of a sub-storage area which stores data in the second storage area most recently;
and adding the first numerical value to the initial address of the sub-storage area of the most recently stored data to obtain the initial storage address of the data to be stored in the memory.
Optionally, if the size of the storage area occupied by the data to be stored is smaller than or equal to the first value, the first storage unit is specifically configured to:
and storing the data to be stored into a sub-storage area comprising the initial storage address.
Optionally, if the size of the storage space occupied by the data to be stored is greater than the first value, the apparatus further includes:
the dividing unit is used for dividing the data to be stored into a first number of first data to be stored, the size of the first data to be stored occupying a first numerical value, and a second number of second data to be stored, the size of the second data occupying a storage space smaller than the first numerical value; wherein the first number is a positive integer and the second number is equal to 1 or 0;
and the third storage unit is used for respectively storing the first data to be stored and the second data to be stored into corresponding storage areas.
Optionally, the data to be stored includes:
the video monitoring system monitors the obtained video data.
Optionally, the metadata of the monitored video data in the video monitoring system further includes:
the time corresponding to the video data.
Compared with the prior art, the embodiment of the application has the following advantages:
the data storage method and device provided by the embodiment of the application comprise the following steps: acquiring metadata of data to be stored, wherein the metadata comprises: determining the storage area of the data to be stored in the memory according to the metadata, and storing the data to be stored into the storage area corresponding to the data to be stored. Therefore, by adopting the scheme provided by the embodiment of the application, before the data to be stored is stored, the storage area for storing the data to be stored can be determined according to the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored, rather than randomly allocating the storage area for the data to be stored as in the prior art. The starting position of the data to be stored in the memory can be determined by the storage area occupied by the data already stored in the memory. Therefore, the data stored in the memory is continuously stored, and the disk fragmentation problem is effectively reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be 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 described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of a data storage method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a data storage method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a data storage device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
The inventors of the present application have found through research that the problem of disk fragmentation of file systems such as the file allocation tables FAT32 and NTFS is severe, which may cause the memory to be unusable after a period of memory usage, and the memory must be formatted for further use. Here, disk fragmentation means that the locations where files are stored in the memory are not consecutive but are scattered in the memory. One of the reasons why the fragmentation of the file system is serious at present is that when the file system stores data to be stored, the file system randomly allocates a storage area for the data instead of determining the storage area of the data to be stored in combination with the data area already stored in the current memory.
On the one hand, disk fragmentation is severe, which results in a low memory space utilization of the memory. On the other hand, after the memory has been used for a period of time, the user may need to format the memory in a timely manner, which may provide a poor experience to the user.
In order to solve the above problem, an embodiment of the present application provides a data storage method and apparatus, including: acquiring metadata of data to be stored, wherein the metadata comprises: determining the storage area of the data to be stored in the memory according to the metadata, and storing the data to be stored into the storage area corresponding to the data to be stored.
Therefore, by adopting the scheme provided by the embodiment of the application, before the data to be stored is stored, the storage area for storing the data to be stored can be determined according to the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored, rather than randomly allocating the storage area for the data to be stored as in the prior art. The starting position of the data to be stored in the memory can be determined by the storage area occupied by the data already stored in the memory. Therefore, the data stored in the memory is continuously stored, and the disk fragmentation problem is effectively reduced.
Various non-limiting embodiments of the present application are described in detail below with reference to the accompanying drawings.
Exemplary method
Referring to fig. 1, the figure is a schematic flowchart of a data storage method according to an embodiment of the present application.
The data storage method provided by the embodiment of the application can be realized through the following steps S101 to S103, for example.
S101: the method comprises the steps of obtaining metadata of data to be stored, wherein the metadata comprises an initial storage address of the data to be stored in a storage and the size of a storage space occupied by the data to be stored.
It should be noted that, the to-be-stored data is not specifically limited in the embodiments of the present application, and as an example, the to-be-stored data may be video data monitored by a video monitoring system.
It should be noted that metadata is a special data, and is a data for describing data. In the embodiment of the present application, the metadata of the data to be stored may be understood as data describing the data to be stored.
It should be noted that, in the embodiment of the present application, the size of the storage space occupied by the metadata is not particularly limited, and as an example, the size of the storage space occupied by the metadata may be 64 bytes, for example.
In this embodiment of the present application, the metadata of the data to be stored may include a starting storage address of the data to be stored in the memory, and a size of a storage space occupied by the data to be stored.
It should be noted that, in the embodiment of the present application, a starting storage address of data to be stored in the memory may be determined by a storage area occupied by data already stored in the memory, for example, may be determined by an ending address of the storage area occupied by data already stored in the memory.
It should be noted that the embodiment of the present application is not particularly limited to the memory, and as an example, the memory may be a hard disk, for example.
It should be noted that, in practical applications, after the data to be stored is stored in the memory, the data to be stored may need to be read from the memory, and the metadata of the data to be stored may be used as an index for searching the data to be stored from the memory. Therefore, in a possible implementation manner of the embodiment of the present application, after the metadata is obtained, the metadata may also be stored in the memory.
Specifically, in a possible implementation manner of the embodiment of the present application, the memory may be divided into a first storage area and a second storage area, where the first storage area is used for storing metadata of data stored in the memory, and the second storage area is used for storing data itself.
That is to say, in the embodiment of the present application, after the metadata of the data to be stored is acquired, the metadata may be stored in the first storage area. And the storage area of the data to be stored in the memory is the storage area in the second storage area.
It should be noted that, in the embodiment of the present application, the size of the storage space occupied by the first storage area and the second storage area is not specifically limited, and the size of the storage space occupied by the first storage area may be determined by combining the size of the storage space occupied by the metadata and the size of the total storage space of the memory, for example. As an example, if the storage space of the memory is 20G, the first 5M in the memory may be used as the first storage area, and the storage areas except the first storage area may be used as the second storage area.
It can be understood that, since the metadata includes the starting storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored. Therefore, obtaining metadata of the data to be stored includes: and acquiring the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored.
The embodiment of the present application does not specifically limit a specific implementation manner of obtaining the initial storage address of the data to be stored in the memory, and as described above, the initial storage address of the data to be stored in the memory may be determined by a storage area occupied by the data already stored in the memory.
In view of this, in a possible implementation manner of the embodiment of the present application, when the obtaining of the start address of the data to be stored in the memory is implemented specifically, the following steps a-B may be implemented.
Step A: and acquiring the starting address of the sub-area of the second storage area, which stores the data most recently.
And B: and adding a first numerical value to the initial address of the sub-area of the latest stored data to obtain the initial storage address of the data to be stored in the memory. Regarding step a and step B, it should be noted that, in the embodiment of the present application, the second storage area may be divided into a plurality of sub-storage areas with a storage space size of a first value, for example, the second storage area may be divided into a plurality of sub-storage areas with a storage space size of 128K.
It will be appreciated that, in general, data is stored sequentially in the second storage area, and therefore, the start address of the sub-storage area where data is most recently stored is larger than the start address of the sub-storage area where data is previously stored. Therefore, in a possible implementation manner of the embodiment of the present application, in the step a, during a specific implementation, for example, the second storage area in the memory may be retrieved, a sub-storage area in the second storage area where data is already stored is determined, and a start address with a maximum start address in the sub-storage area is used as a start address of the sub-storage area where data is most recently stored.
It should be noted that, the embodiment of the present application also does not specifically limit the specific implementation manner of obtaining the size of the storage space occupied by the data to be stored. As mentioned above, the data to be stored may be video data monitored by a video monitoring system. The video data monitored by the video monitoring system may need to be stored in real time, so the size of the storage space occupied by the data to be stored can be obtained by utilizing the storage frequency of the video data monitored by the video monitoring system, the parameters of the video data and the like.
S102: and determining a storage area of the data to be stored in the memory according to the metadata.
It should be noted that the storage area of the data to be stored in the memory mentioned in the embodiment of the present application refers to a storage area in which a start address of the data to be stored in the memory is used as a start address, and a size of a storage space occupied by the data to be stored is a size of a storage space occupied by the data to be stored. For example, if the initial storage address of the data to be stored in the memory is 55, and the size of the storage space occupied by the data to be stored is 10K, the storage area of the data to be stored in the memory is a storage area which takes 55 as the initial address and occupies 10K of the storage space.
S103: and storing the data to be stored into a storage area corresponding to the data to be stored.
As described above, in the embodiment of the present application, the second storage area may be divided into a plurality of sub-storage areas having a storage space with a first value. In the embodiment of the present application, when the step S103 is implemented specifically, the following two cases may be included:
in the first case: and if the size of the storage area occupied by the data to be stored is smaller than or equal to the first numerical value, directly storing the data to be stored into a sub-storage area comprising the initial storage address.
In the second case: if the size of the storage space occupied by the data to be stored is larger than the first numerical value, dividing the data to be stored into a first number of first data to be stored, the size of which is the first numerical value, and a second number of second data to be stored, the size of which is smaller than the first numerical value; wherein the first number is a positive integer and the second number is equal to 1 or 0; and respectively storing the first data to be stored and the second data to be stored into corresponding storage areas. It should be noted that, in the embodiment of the present application, the first data to be stored is stored in a corresponding storage area, and in a specific implementation, the method described in the above steps a-B may be used to obtain a starting storage address of the first data to be stored in the memory, and then store the first data to be stored in a sub-storage area including the starting storage address of the first data to be stored in the memory.
Similarly, the second data to be stored is stored in the corresponding storage area, and in a specific implementation, the method described in the above steps a-B may be utilized to obtain a starting storage address of the second data to be stored in the memory, and then store the second data to be stored in a sub-storage area including the starting storage address of the second data to be stored in the memory.
As mentioned above, the data to be stored may be video data monitored by a video monitoring system. When the video data monitored by the video monitoring system is read from the memory (for example, when the monitoring video is played back), the corresponding video data needs to be read by time. And the metadata of the data to be stored may serve as an index for looking up the data to be stored from the memory. Therefore, in a possible implementation manner of the embodiment of the present application, if the data to be stored is video data monitored by a video monitoring system, the metadata of the video data monitored in the video monitoring system may further include, in addition to a starting storage address of the video data in the memory and a size of a storage space occupied by the video data: the time corresponding to the video data.
Therefore, with the data storage method provided by the embodiment of the present application, before storing the data to be stored, the storage area for storing the data to be stored may be determined according to the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored, instead of randomly allocating the storage area for the data to be stored as in the prior art. The starting position of the data to be stored in the memory can be determined by the storage area occupied by the data already stored in the memory. Therefore, the data stored in the memory is continuously stored, and the disk fragmentation problem is effectively reduced.
The data storage method provided by the embodiment of the present application is introduced above, and the method is introduced below with reference to specific scenarios.
In this scenario, the size of the memory is 10G, and the memory is divided into two memory areas, where the size of the memory space occupied by the first memory area is 5M, and the size of the memory space occupied by the second memory area is (10G-5M). The storage address corresponding to the first storage area is 0-A, and the storage address corresponding to the second storage area is (A +1) -B. Wherein the second storage area is divided into a plurality of sub-storage areas with the storage space size of 128K.
It is understood that the addresses of the respective sub-storage areas may be, for example, [ a +1) - (a +128 ], [ a +129) - (a +256 ], [ a +257) - (a +384 ] … …, and the like.
Referring to fig. 2, the figure is a schematic flowchart of a data storage method according to an embodiment of the present application.
The data storage method provided in this embodiment can be implemented, for example, by the following steps S201 to S204.
S201: the initial storage address of the data to be stored is obtained as 128, and the size of the storage space occupied by the data to be stored is obtained as 200 k.
S202: the data to be stored is divided into a first data to be stored occupying a storage space of 128K and a second data to be stored occupying a storage space of 72K.
S203: the first data to be stored is stored into the sub-storage area including the storage address 128.
S204: determining the starting address of the second data to be stored in the memory to be 256, and storing the second data to be stored into the sub-storage area comprising the storage address 256.
It should be noted that fig. 2 is only an exemplary illustration of the embodiments of the present application, and does not limit the embodiments of the present application.
Exemplary device
Based on the data storage method provided by the above method embodiment, the embodiment of the present application further provides a data storage device, which is described below with reference to the accompanying drawings.
Referring to fig. 3, the figure is a schematic structural diagram of a data storage device according to an embodiment of the present application.
The data storage device 300 provided in the embodiment of the present application may specifically include: an acquisition unit 310, a determination unit 320, and a first storage unit 330.
An obtaining unit 310, configured to obtain metadata of data to be stored, where the metadata includes: the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored;
a determining unit 320, configured to determine, according to the metadata, a storage area of the data to be stored in the memory;
the first storage unit 330 is configured to store the data to be stored in a storage area corresponding to the data to be stored.
Optionally, the memory includes a first storage area and a second storage area, and the storage area of the data to be stored in the memory is a storage area in the second storage area; the apparatus 300 further comprises:
and the second storage unit is used for storing the metadata of the data to be stored into the first storage area.
Optionally, if the second storage area includes a plurality of sub-storage areas whose storage spaces are the first numerical values, the obtaining of the start address of the data to be stored in the memory includes:
acquiring the initial address of a sub-storage area which stores data in the second storage area most recently;
and adding a first numerical value to the initial address of the sub-storage area of the most recently stored data to obtain the initial storage address of the data to be stored in the memory.
Optionally, if the size of the storage area occupied by the data to be stored is smaller than or equal to the first value, the first storage unit 330 is specifically configured to:
and storing the data to be stored into a sub-storage area comprising the initial storage address.
Optionally, if the size of the storage space occupied by the data to be stored is greater than the first value, the apparatus 300 further includes:
the dividing unit is used for dividing the data to be stored into a first number of first data to be stored, the size of the first data to be stored occupying a first numerical value, and a second number of second data to be stored, the size of the second data occupying a storage space smaller than the first numerical value; wherein the first number is a positive integer and the second number is equal to 1 or 0;
and the third storage unit is used for respectively storing the first data to be stored and the second data to be stored into corresponding storage areas.
Optionally, the data to be stored includes:
the video monitoring system monitors the obtained video data.
Optionally, the metadata of the monitored video data in the video monitoring system further includes:
the time corresponding to the video data.
Since the apparatus 300 is a device corresponding to the data storage method provided in the above method embodiment, for specific implementation of each unit of the apparatus, reference may be made to the description part of the above method embodiment, and details are not described here.
Therefore, with the data storage device provided by the embodiment of the present application, before storing data to be stored, a storage area for storing the data to be stored may be determined according to a starting storage address of the data to be stored in a memory and a size of a storage space occupied by the data to be stored, instead of randomly allocating a storage area for the data to be stored as in the prior art. The starting position of the data to be stored in the memory can be determined by the storage area occupied by the data already stored in the memory. Therefore, the data stored in the memory is continuously stored, and the disk fragmentation problem is effectively reduced.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice in the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the attached claims
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims (14)
1. A method of storing data, comprising:
obtaining metadata of data to be stored, the metadata including: storing the metadata in a memory according to the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored;
determining a storage area of the data to be stored in the memory according to the metadata;
and storing the data to be stored into a storage area corresponding to the data to be stored.
2. The method according to claim 1, wherein the memory comprises a first storage area and a second storage area, and the storage area of the data to be stored in the memory is a storage area in the second storage area; the method further comprises the following steps:
and storing the metadata of the data to be stored into the first storage area.
3. The method according to claim 1, wherein the second storage area includes a plurality of sub-storage areas having a storage space with a first value, and the obtaining the start address of the data to be stored in the memory includes:
acquiring the initial address of a sub-storage area which stores data in the second storage area most recently;
and adding the first numerical value to the initial address of the sub-storage area of the most recently stored data to obtain the initial storage address of the data to be stored in the memory.
4. The method according to claim 3, wherein if the size of the storage area occupied by the data to be stored is smaller than or equal to the first value, the storing the data to be stored into the storage area corresponding to the data to be stored comprises:
and storing the data to be stored into a sub-storage area comprising the initial storage address.
5. The method of claim 4, wherein if the size of the storage space occupied by the data to be stored is larger than the first value, the method further comprises:
dividing the data to be stored into a first number of first data to be stored, the size of the first data to be stored occupying a first numerical value, and a second number of second data to be stored, the size of the second data occupying a second numerical value being smaller than the first numerical value; wherein the first number is a positive integer and the second number is equal to 1 or 0;
and respectively storing the first data to be stored and the second data to be stored into corresponding storage areas.
6. The method of claim 1, wherein the data to be stored comprises:
the video monitoring system monitors the obtained video data.
7. The method of claim 6, wherein the metadata of the monitored video data in the video surveillance system further comprises:
the time corresponding to the video data.
8. A data storage device, comprising:
an obtaining unit configured to obtain metadata of data to be stored, the metadata including: storing the metadata in a memory according to the initial storage address of the data to be stored in the memory and the size of the storage space occupied by the data to be stored;
the determining unit is used for determining a storage area of the data to be stored in the memory according to the metadata;
and the first storage unit is used for storing the data to be stored into the storage area corresponding to the data to be stored.
9. The device according to claim 8, wherein the memory comprises a first storage area and a second storage area, and the storage area of the data to be stored in the memory is a storage area in the second storage area; the device further comprises:
and the second storage unit is used for storing the metadata of the data to be stored into the first storage area.
10. The apparatus according to claim 8, wherein the second storage area includes a plurality of sub-storage areas having a storage space with a first value, and the obtaining the start address of the data to be stored in the memory includes:
acquiring the initial address of a sub-storage area which stores data in the second storage area most recently;
and adding the first numerical value to the initial address of the sub-storage area of the most recently stored data to obtain the initial storage address of the data to be stored in the memory.
11. The apparatus of claim 10, wherein if the size of the storage area occupied by the data to be stored is smaller than or equal to the first value, the first storage unit is specifically configured to:
and storing the data to be stored into a sub-storage area comprising the initial storage address.
12. The apparatus of claim 11, wherein if the size of the storage space occupied by the data to be stored is larger than the first value, the apparatus further comprises:
the dividing unit is used for dividing the data to be stored into a first number of first data to be stored, the size of the first data to be stored occupying a first numerical value, and a second number of second data to be stored, the size of the second data occupying a storage space smaller than the first numerical value; wherein the first number is a positive integer and the second number is equal to 1 or 0;
and the third storage unit is used for respectively storing the first data to be stored and the second data to be stored into corresponding storage areas.
13. The apparatus of claim 8, wherein the data to be stored comprises:
the video monitoring system monitors the obtained video data.
14. The apparatus of claim 13, wherein the metadata of the video data monitored in the video surveillance system further comprises:
the time corresponding to the video data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810942119.9A CN109508143B (en) | 2018-08-17 | 2018-08-17 | Data storage method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810942119.9A CN109508143B (en) | 2018-08-17 | 2018-08-17 | Data storage method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109508143A CN109508143A (en) | 2019-03-22 |
CN109508143B true CN109508143B (en) | 2022-04-22 |
Family
ID=65745673
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810942119.9A Active CN109508143B (en) | 2018-08-17 | 2018-08-17 | Data storage method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109508143B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113625938B (en) * | 2020-05-06 | 2024-07-30 | 华为技术有限公司 | Metadata storage method and device |
CN113934373A (en) * | 2021-10-13 | 2022-01-14 | 山东鲁软数字科技有限公司 | Energy monitoring data storage method and system |
CN116501654B (en) * | 2022-01-18 | 2024-06-04 | 北京科益虹源光电技术有限公司 | Data storage method and laser |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101814044A (en) * | 2010-04-19 | 2010-08-25 | 中兴通讯股份有限公司 | Method and device for processing metadata |
CN103984640A (en) * | 2014-05-14 | 2014-08-13 | 华为技术有限公司 | Method and device for realizing data prefetching |
CN105468642A (en) * | 2014-09-09 | 2016-04-06 | 杭州海康威视数字技术股份有限公司 | Data storage method and apparatus |
CN106354840A (en) * | 2016-08-31 | 2017-01-25 | 北京小米移动软件有限公司 | File processing method and device and distributed file system |
CN106873908A (en) * | 2017-01-17 | 2017-06-20 | 北京联想核芯科技有限公司 | Date storage method and device |
CN107436725A (en) * | 2016-05-25 | 2017-12-05 | 杭州海康威视数字技术股份有限公司 | A kind of data are write, read method, apparatus and distributed objects storage cluster |
CN107784121A (en) * | 2017-11-18 | 2018-03-09 | 中国人民解放军国防科技大学 | Lowercase optimization method of log file system based on nonvolatile memory |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100899147B1 (en) * | 2007-05-04 | 2009-05-27 | 한양대학교 산학협력단 | Method of storing meta-data and system for storing meta-data |
US8094952B2 (en) * | 2007-09-19 | 2012-01-10 | Ricoh Company, Ltd. | Image processing apparatus and image processing method |
US8326897B2 (en) * | 2007-12-19 | 2012-12-04 | International Business Machines Corporation | Apparatus and method for managing data storage |
CN105786410A (en) * | 2016-03-01 | 2016-07-20 | 深圳市瑞驰信息技术有限公司 | Method for increasing processing speed of data storage system and data storage system |
CN107315533A (en) * | 2016-04-26 | 2017-11-03 | 杭州海康威视数字技术股份有限公司 | A kind of date storage method and device |
-
2018
- 2018-08-17 CN CN201810942119.9A patent/CN109508143B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101814044A (en) * | 2010-04-19 | 2010-08-25 | 中兴通讯股份有限公司 | Method and device for processing metadata |
CN103984640A (en) * | 2014-05-14 | 2014-08-13 | 华为技术有限公司 | Method and device for realizing data prefetching |
CN105468642A (en) * | 2014-09-09 | 2016-04-06 | 杭州海康威视数字技术股份有限公司 | Data storage method and apparatus |
CN107436725A (en) * | 2016-05-25 | 2017-12-05 | 杭州海康威视数字技术股份有限公司 | A kind of data are write, read method, apparatus and distributed objects storage cluster |
CN106354840A (en) * | 2016-08-31 | 2017-01-25 | 北京小米移动软件有限公司 | File processing method and device and distributed file system |
CN106873908A (en) * | 2017-01-17 | 2017-06-20 | 北京联想核芯科技有限公司 | Date storage method and device |
CN107784121A (en) * | 2017-11-18 | 2018-03-09 | 中国人民解放军国防科技大学 | Lowercase optimization method of log file system based on nonvolatile memory |
Also Published As
Publication number | Publication date |
---|---|
CN109508143A (en) | 2019-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110149803B (en) | Data storage method, system and terminal equipment | |
CN103218224B (en) | A kind of method improving memory space utilization rate and terminal | |
EP2921963A1 (en) | Memory recycling method and device | |
CN106294352B (en) | A kind of document handling method, device and file system | |
CN109508143B (en) | Data storage method and device | |
CN108512876B (en) | Data pushing method and device | |
CN107436725A (en) | A kind of data are write, read method, apparatus and distributed objects storage cluster | |
US9383936B1 (en) | Percent quotas for deduplication storage appliance | |
CN110597762A (en) | File processing method, device, equipment and storage medium | |
CN111061752B (en) | Data processing method and device and electronic equipment | |
CN111880734A (en) | Data processing method, system, electronic equipment and storage medium | |
CN113568582B (en) | Data management method, device and storage equipment | |
CN108399050B (en) | Data processing method and device | |
CN103678143A (en) | File storage method and device and electronic equipment | |
US10803109B2 (en) | Method and device for reading and writing video data in NAS device | |
CN106709014B (en) | File system conversion method and device | |
CN102541969B (en) | File protection method and system based on file allocation table (FAT) file system, and memory | |
CN107229421B (en) | Method and device for creating video data storage system, method and device for writing file into video data storage system and method and device for reading video data storage system | |
CN109669621A (en) | A kind of file management method, file management system, electronic equipment and storage medium | |
CN109753224B (en) | Storage structure and storage structure configuration method | |
CN104252415B (en) | Method and system for redistributing data | |
CN110018986B (en) | Abnormal snapshot identification method and device | |
US7565483B2 (en) | Method and apparatus for exchanging data with a hard disk | |
CN113905252B (en) | Data storage method and device for live broadcasting room, electronic equipment and storage medium | |
CN109669623A (en) | A kind of file management method, document management apparatus, electronic equipment and storage medium |
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 |