CN111897484B - Data storage method and device, electronic equipment and storage medium - Google Patents

Data storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111897484B
CN111897484B CN201910368563.9A CN201910368563A CN111897484B CN 111897484 B CN111897484 B CN 111897484B CN 201910368563 A CN201910368563 A CN 201910368563A CN 111897484 B CN111897484 B CN 111897484B
Authority
CN
China
Prior art keywords
data
stored
target cluster
storage
set value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910368563.9A
Other languages
Chinese (zh)
Other versions
CN111897484A (en
Inventor
冯颖俏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Geyi Electronic Co ltd
Zhaoyi Innovation Technology Group Co ltd
Original Assignee
Shanghai Geyi Electronic Co ltd
Zhaoyi Innovation Technology Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Geyi Electronic Co ltd, Zhaoyi Innovation Technology Group Co ltd filed Critical Shanghai Geyi Electronic Co ltd
Priority to CN201910368563.9A priority Critical patent/CN111897484B/en
Publication of CN111897484A publication Critical patent/CN111897484A/en
Application granted granted Critical
Publication of CN111897484B publication Critical patent/CN111897484B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a data storage method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: when a data storage instruction is received, judging whether data are stored in the target cluster or not; if the data is stored in the target cluster, judging whether the data amount stored in the target cluster reaches a set value; if the data quantity stored in the target cluster does not reach the set value, reading out the first data stored in the target cluster; combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently; storing the combined data; wherein each cluster corresponds to a set number of logical blocks. By adopting the technical scheme, the utilization rate of the storage space is improved, and the space waste is reduced.

Description

Data storage method and device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of data storage, in particular to a data storage method, a data storage device, electronic equipment and a storage medium.
Background
EMMC (Embedded Multi Media Card ) is an MMC association, and is mainly aimed at standard specifications of embedded memories of products such as mobile phones or tablet computers, and consists of an embedded memory solution with an MMC multimedia interface, a flash memory (e.g. nand flash) and an EMMC controller. More and more mobile devices employ EMMC chips as storage units.
When storing user data (such as photos, videos, etc. taken by a user through a mobile phone), the user data can be sent from a user end (such as the front end of the mobile phone) to a nand flash storage medium of an EMMC chip. According to the EMMC protocol, the writing unit of user data is 512 bytes, i.e., the size of LBA (Logical Block Address ) is 512 bytes. However, when the user data is stored based on the EMMC chip, the mapping relationship between the logical address where the user data is stored and the physical address where the data is actually stored is in units of 4KB, and the physical address corresponding to each logical address may store 4KB of user data, that is, each physical address corresponds to 8 LBAs. However, when storing user data, the user data may occupy less than 8 LBAs each time because the user data size is less than 4KB, for example, in an operation of storing user data, the user data occupies only 2 LBAs, and the remaining 6 LBAs of the physical address corresponding to the current logical address are in a blank state and cannot be used continuously, i.e. other user data cannot be stored.
Obviously, the data storage method has the problem of space waste and low space utilization rate.
Disclosure of Invention
The embodiment of the invention provides a data storage method, a data storage device, electronic equipment and a storage medium.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a data storage method, where the method includes:
when a data storage instruction is received, judging whether data are stored in the target cluster or not;
if the data is stored in the target cluster, judging whether the data amount stored in the target cluster reaches a set value;
if the data quantity stored in the target cluster does not reach the set value, reading out the first data stored in the target cluster;
combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently;
storing the combined data;
wherein each cluster corresponds to a set number of logical blocks.
In a second aspect, an embodiment of the present invention provides a data storage device, the device including:
the first judging module is used for judging whether the data are stored in the target cluster or not when the data storage instruction is received;
the second judging module is used for judging whether the data amount stored in the target cluster reaches a set value or not if the data is stored in the target cluster;
the reading module is used for reading the first data stored in the target cluster if the data quantity stored in the target cluster does not reach the set value;
the combination module is used for combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently;
the storage module is used for storing the combined data;
wherein each cluster corresponds to a set number of logical blocks.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the data storage method according to any one of claims 1-7 when executing the computer program.
In a fourth aspect, embodiments of the present invention provide a storage medium containing computer executable instructions which, when executed by a computer processor, implement the data storage method of any of claims 1-7.
According to the data storage method provided by the embodiment of the invention, when a data storage instruction is received, whether data are stored in a target cluster is judged, if the data are stored in the target cluster, whether the data amount stored in the target cluster reaches a set value is judged, if the data amount stored in the target cluster does not reach the set value, a blank logic block in the target cluster is determined, at the moment, first data stored in the target cluster are read out, the first data and the second data are combined according to the sum of the data amounts of the read first data and the second data to be stored currently, and finally the combined data are stored, so that the full utilization of each logic block in each cluster is realized, the space utilization rate is improved, and the space waste is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following description will briefly explain the drawings needed in the description of the embodiments of the present invention, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to the contents of the embodiments of the present invention and these drawings without inventive effort for those skilled in the art.
FIG. 1 is a schematic flow chart of a data storage method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of a mapping relationship between each cluster and LBA and a mapping relationship between a logical address and a physical address according to a first embodiment of the present invention;
FIG. 3 is a schematic flow chart of a data storage method according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram of a data storage device according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical problems solved by the present invention, the technical solutions adopted and the technical effects achieved more clear, the technical solutions of the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings, and it is obvious that the described embodiments are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
Example 1
Fig. 1 is a schematic flow chart of a data storage method according to a first embodiment of the present invention. The data storage method disclosed in this embodiment may be performed by a data storage device, wherein the device may be implemented in software and/or hardware and is typically integrated in a chip, such as an EMMC chip or the like. Referring specifically to fig. 1, the method comprises the steps of:
step 110, when a data storage instruction is received, determining whether data is already stored in a target cluster, and if the data is already stored in the target cluster, continuing to execute step 120.
The target cluster specifically refers to a storage space of a nand flash for storing current data to be stored. The data storage instruction comprises address information of the target cluster and the length of data to be stored, wherein the address information can be logic address information or physical address information, and if the address information is the logic address information, the physical address corresponding to the logic address can be further determined according to the mapping relation between the logic address and the physical address. The data storage instruction is generated by the operating system according to a triggering instruction of a user, for example, the user wants to store a photo, the photo is user data to be stored, the user realizes the storage of the photo by triggering a storage button, and when the user triggers the storage button, a related program at the operating system side is triggered to generate the data storage instruction, and the data storage instruction is further issued to an EMMC controller of an EMMC chip.
Step 120, determining whether the data amount stored in the target cluster reaches a set value, and if the data amount stored in the target cluster does not reach the set value, continuing to execute step 130.
The EMMC protocol specifies that the size of each logical block LBA is 512byte, and according to different dividing units, the number of corresponding LBAs of each cluster is different, and the corresponding set value is also different, taking the dividing unit as 4KB as an example, each cluster corresponds to 8 LBAs, and the storable data amount of each cluster is 4KB, that is, the set value is 4KB. Specifically, referring to the correspondence between each cluster and LBA and the mapping between logical addresses and physical addresses shown in fig. 2, logical address LCA0 210 and logical address LCA1 220 respectively represent a cluster, each cluster corresponds to 8 LBAs, 8 LBAs corresponding to cluster 210 are LBA0, LBA1, LBA2, LBA3, LBA4, LBA5, LBA6 and LBA7, and 8 LBAs corresponding to cluster 220 are LBA8, LBA9, LBA10, LBA11, LBA12, LBA13, LBA14 and LBA15 respectively; the physical address corresponding to logical address LCA0 210 is PCA8 230 and the physical address corresponding to logical address LCA1 220 is 240.
And 130, reading out the first data stored in the target cluster.
And 140, combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently.
Specifically, if the sum of the data amounts of the read first data and the second data to be stored currently is not greater than the set value, the first data and the second data are combined into a first file, and because the sum of the data amounts of the read first data and the second data to be stored currently is not greater than the set value, the first file can be stored in the target cluster, so that the full utilization of the storage space of the target cluster is realized, and the number of blank LBAs is reduced. For example, if the target cluster is the logical address LCA0 210 shown in fig. 2, and the data amount of the read first data is 2×512b yte, and the data amount of the second data to be stored is 3×512b yte, the first data may be stored to LBA0 and LBA1 of the target cluster 210, the second data may be stored to LBA2, LBA3 and LBA4 of the target cluster 210, and LBA5, LBA6 and LBA7 of the target cluster 210 are filled with invalid data FF, and when the data is stored next time, the first data, the second data and the new data to be stored are combined by the above data storage method, so that the valid data are stored in all LBA0, LBA1, LBA2, LBA3, LBA4, LBA5, LBA6 and LBA7 corresponding to the target cluster 210, and full utilization of each LBA is achieved.
And step 150, storing the combined data.
Specifically, the combined data can be stored according to the size of the combined data, if the combined data is larger than the storable set value of the target cluster, the target cluster is fully written by using the combined data, and the rest of the data is stored in other clusters, so that the full utilization of each LBA in each cluster is realized.
Further, after storing the combined data, the method further includes:
and updating the storage address information of the first data and the second data, wherein the storage address information specifically comprises the address of a target cluster for storing the first data and the second data and also comprises the address of a specific LBA.
Further, after storing the combined data, the method further includes:
when a reading instruction for reading the first data or the second data is received, acquiring storage address information of the first data or the second data from the reading instruction;
determining the position of the first data or the second data in the target cluster based on logic block information contained in the storage address information;
and reading the first data or the second data according to the position of the first data or the second data in the target cluster.
According to the data storage method provided by the embodiment, when a data storage instruction is received, if data is already stored in a target cluster, whether the data amount stored in the target cluster reaches a set value is judged, if the data amount already stored in the target cluster does not reach the set value, a blank logic block is determined to exist in the target cluster, at the moment, the first data stored in the target cluster is read out, the first data and the second data are combined according to the sum of the data amounts of the read first data and the second data to be stored currently, if the combined data amount is not greater than the set value, the combined data is stored in the target cluster, if the combined data amount is greater than the set value, each LBA in the target cluster is fully written by utilizing the combined data, and the rest data is stored in other clusters, so that full utilization of each LBA in each cluster is realized, the space utilization rate is improved, and the space waste is reduced.
Example two
Fig. 3 is a flow chart of a data storage method according to a second embodiment of the present invention. On the basis of the above embodiment, the present embodiment shows how to store combined data when the sum of the second data to be stored and the first data already stored in the target cluster is greater than the set value of the storable data amount of the target cluster, and specifically, referring to fig. 3, the method includes the following steps:
step 310, when a data storage instruction is received, it is determined whether data is already stored in the target cluster, if yes, step 320 is continuously performed.
Step 320, determining whether the data amount stored in the target cluster reaches a set value, and if the data amount stored in the target cluster does not reach the set value, continuing to execute step 330.
And step 330, reading out the first data stored in the target cluster.
Step 340, if the sum of the data amounts of the read first data and the second data to be stored is greater than the set value, combining the first data and a part of the second data into a first file, and combining the data except the part of the second data into a second file.
Wherein the data amount of the first file is equal to the set value. Because the storable data volume of each cluster is fixed, for example, the storable maximum data volume of each cluster is 4KB, when the sum of the data volumes of the stored first data and the second data to be stored is greater than 4KB, the target cluster can not store the first data and the second data completely, so that the first data and part of the second data can be stored into the target cluster, and the rest of the second data is stored into a new cluster.
And step 350, storing the first file to the target cluster, and storing the second file to other target clusters.
According to the data storage method provided by the embodiment, when the sum of the data amounts of the read first data and the second data to be stored currently is larger than the set value, the first data and a part of data in the second data are combined into the first file, the data except the part of data in the second data are combined into the second file, the first file is stored in the target cluster, the second file is stored in other target clusters, full utilization of each LBA in each cluster is achieved, space utilization is improved, and space waste is reduced.
Example III
Fig. 4 is a schematic structural diagram of a data storage device according to a third embodiment of the present invention. Referring to fig. 4, the apparatus includes: a first judging module 410, a second judging module 420, a reading module 430, a combining module 440 and a storing module 450;
the first determining module 410 is configured to determine, when receiving the data storage instruction, whether data is already stored in the target cluster; a second judging module 420, configured to judge whether the amount of data already stored in the target cluster reaches a set value if the data already stored in the target cluster; a reading module 430, configured to read the first data already stored in the target cluster if the amount of data already stored in the target cluster does not reach the set value; a combination module 440, configured to combine the first data and the second data according to a sum of the amounts of the read first data and the second data to be stored currently; a storage module 450, configured to store the combined data; wherein each cluster corresponds to a set number of logical blocks.
Further, the combining module 430 is specifically configured to: and if the sum of the data amounts of the read first data and the second data to be stored is not greater than the set value, combining the first data and the second data into a first file. Correspondingly, the storage module 440 is specifically configured to: and storing the first file to the target cluster.
Further, the combining module 430 is specifically configured to: if the sum of the data amounts of the read first data and the second data to be stored currently is larger than the set value, combining the first data and a part of data in the second data into a first file; forming a second file from data except the part of data in the second data; wherein the data amount of the first file is equal to the set value. Correspondingly, the storage module 440 is specifically configured to: storing the first file to the target cluster; and storing the second file to other target clusters.
Further, the device further comprises: and the updating module is used for updating the storage address information of the first data and the second data after the combined data are stored.
Further, the device further comprises: the reading module comprises an acquisition unit, a determination unit and a reading unit, wherein the acquisition unit is used for acquiring storage information of the first data or the second data from a reading instruction when the reading instruction for reading the first data or the second data is received;
a determining unit configured to determine a position of the first data or the second data in the target cluster based on logic block information included in the storage information;
and the reading unit is used for reading the first data or the second data according to the position of the first data or the second data in the target cluster.
According to the data storage device provided by the embodiment, when a data storage instruction is received, if data is already stored in a target cluster, whether the data amount stored in the target cluster reaches a set value is judged, if the data amount stored in the target cluster does not reach the set value, a blank logic block is determined to exist in the target cluster, at the moment, first data stored in the target cluster are read out, the first data and second data are combined according to the sum of the data amounts of the read first data and the second data to be stored currently, if the combined data amount is not greater than the set value, the combined data is stored in the target cluster, if the combined data amount is greater than the set value, each LBA in the target cluster is fully written by utilizing the combined data, and the rest data is stored in other clusters, so that full utilization of each LBA in each cluster is realized, the space utilization rate is improved, and the space waste is reduced.
The data storage device provided by the embodiment of the invention can execute the data storage method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in the above embodiments may be found in the data storage method provided in any of the embodiments of the present invention.
Example IV
Fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. Fig. 5 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention. The electronic device 12 shown in fig. 5 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 5, the electronic device 12 is in the form of a general purpose computing device. Components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard disk drive"). Although not shown in fig. 5, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set of program modules (e.g., first determination module 410, second determination module 420, read module 430, combination module 440, and storage module 450 of a data storage device) configured to perform the functions of embodiments of the present invention.
Program/utility 40 having a set of program modules 42 (e.g., first determination module 410, second determination module 420, readout module 430, combination module 440, and storage module 450 of a data storage device) may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and/or any devices (e.g., network card, modem, etc.) that enable the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 over the bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing a data storage method provided by an embodiment of the present invention, the method including:
when a data storage instruction is received, judging whether data are stored in the target cluster or not;
if the data is stored in the target cluster, judging whether the data amount stored in the target cluster reaches a set value;
if the data quantity stored in the target cluster does not reach the set value, reading out the first data stored in the target cluster;
combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently;
storing the combined data;
wherein each cluster corresponds to a set number of logical blocks.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing a data storage method provided by an embodiment of the present invention.
Of course, those skilled in the art will appreciate that the processor may also implement the technical solution of the data storage method provided in any embodiment of the present invention.
Example five
The fifth embodiment of the present invention also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a data storage method as provided by the embodiments of the present invention, the method comprising:
when a data storage instruction is received, judging whether data are stored in the target cluster or not;
if the data is stored in the target cluster, judging whether the data amount stored in the target cluster reaches a set value;
if the data quantity stored in the target cluster does not reach the set value, reading out the first data stored in the target cluster;
combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently;
storing the combined data;
wherein each cluster corresponds to a set number of logical blocks.
Of course, the computer-readable storage medium provided by the embodiments of the present invention, on which the computer program stored, is not limited to the method operations described above, but may also perform the related operations in the data storage method provided by any of the embodiments of the present invention.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (9)

1. A method of data storage, comprising:
when a data storage instruction is received, judging whether data are stored in the target cluster or not;
if the data is stored in the target cluster, judging whether the data amount stored in the target cluster reaches a set value;
if the data quantity stored in the target cluster does not reach the set value, reading out the first data stored in the target cluster;
combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently;
storing the combined data according to the size of the combined data volume;
wherein each cluster corresponds to a set number of logical blocks;
the combining the first data and the second data according to the sum of the data amounts of the read first data and the second data to be stored currently comprises:
if the sum of the data amounts of the read first data and the second data to be stored is not larger than the set value, combining the first data and the second data into a first file;
the data storage instruction comprises address information of the target cluster and the length of data to be stored.
2. The method of claim 1, wherein storing the combined data comprises:
and storing the first file to the target cluster.
3. The method of claim 1, wherein combining the first data with the second data based on a sum of data amounts of the read first data and the second data to be currently stored comprises:
if the sum of the data amounts of the read first data and the second data to be stored currently is larger than the set value, combining the first data and a part of data in the second data into a first file;
forming a second file from data except the part of data in the second data;
wherein the data amount of the first file is equal to the set value.
4. A method according to claim 3, wherein storing the combined data comprises:
storing the first file to the target cluster;
and storing the second file to other target clusters.
5. The method of any of claims 1-4, further comprising, after storing the combined data:
and updating the storage address information of the first data and the second data.
6. The method of any of claims 1-5, further comprising, after storing the combined data:
when a reading instruction for reading the first data or the second data is received, acquiring storage address information of the first data or the second data from the reading instruction;
determining the position of the first data or the second data in the target cluster based on logic block information contained in the storage address information;
and reading the first data or the second data according to the position of the first data or the second data in the target cluster.
7. A data storage device, the device comprising:
the first judging module is used for judging whether the data are stored in the target cluster or not when the data storage instruction is received;
the second judging module is used for judging whether the data amount stored in the target cluster reaches a set value or not if the data is stored in the target cluster;
the reading module is used for reading the first data stored in the target cluster if the data quantity stored in the target cluster does not reach the set value;
the combination module is used for combining the first data with the second data according to the sum of the data amounts of the read first data and the second data to be stored currently;
the storage module is used for storing the combined data according to the size of the combined data volume;
wherein each cluster corresponds to a set number of logical blocks;
the combination module is specifically used for: if the sum of the data amounts of the read first data and the second data to be stored is not larger than the set value, combining the first data and the second data into a first file;
the data storage instruction comprises address information of the target cluster and the length of data to be stored.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the data storage method of any of claims 1-6 when the computer program is executed by the processor.
9. A storage medium containing computer executable instructions which when executed by a computer processor implement the data storage method of any one of claims 1-6.
CN201910368563.9A 2019-05-05 2019-05-05 Data storage method and device, electronic equipment and storage medium Active CN111897484B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910368563.9A CN111897484B (en) 2019-05-05 2019-05-05 Data storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910368563.9A CN111897484B (en) 2019-05-05 2019-05-05 Data storage method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111897484A CN111897484A (en) 2020-11-06
CN111897484B true CN111897484B (en) 2024-03-29

Family

ID=73169225

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910368563.9A Active CN111897484B (en) 2019-05-05 2019-05-05 Data storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111897484B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113010116B (en) * 2021-03-23 2024-07-12 深圳市元征科技股份有限公司 Data processing method, device, terminal equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107870739A (en) * 2017-03-15 2018-04-03 珠海市杰理科技股份有限公司 Disk file storage method and system
CN109542864A (en) * 2018-11-29 2019-03-29 广州创维平面显示科技有限公司 A kind of resource storage method, resource downloading method, system, equipment and medium
CN109697019A (en) * 2017-10-20 2019-04-30 北京京东尚科信息技术有限公司 The method and system of data write-in based on FAT file system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015047284A1 (en) * 2013-09-27 2015-04-02 Empire Technology Development Llc Flexible storage block for a solid state drive (ssd)-based file system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107870739A (en) * 2017-03-15 2018-04-03 珠海市杰理科技股份有限公司 Disk file storage method and system
CN109697019A (en) * 2017-10-20 2019-04-30 北京京东尚科信息技术有限公司 The method and system of data write-in based on FAT file system
CN109542864A (en) * 2018-11-29 2019-03-29 广州创维平面显示科技有限公司 A kind of resource storage method, resource downloading method, system, equipment and medium

Also Published As

Publication number Publication date
CN111897484A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
US10496548B2 (en) Method and system for user-space storage I/O stack with user-space flash translation layer
KR102691851B1 (en) Nonvolatile memory device, data storage apparatus including the same and operating method thereof
WO2021036370A1 (en) Method and device for pre-reading file page, and terminal device
CN111459844B (en) Data storage device and method for accessing logical-to-physical address mapping table
CN111897485A (en) Data storage method and device, electronic equipment and storage medium
US11010056B2 (en) Data operating method, device, and system
US9164804B2 (en) Virtual memory module
KR20200139433A (en) Operating method of controller and memory system
CN110543435B (en) Mixed mapping operation method, device and equipment of storage unit and storage medium
CN113625973B (en) Data writing method, device, electronic equipment and computer readable storage medium
CN110543284A (en) Garbage collection method and device for storage block, electronic equipment and storage medium
CN108089822A (en) Management method, system, equipment and the storage medium of storage chip
CN111104347B (en) Heap memory block searching method, device, equipment and storage medium
US10684953B2 (en) Data storage apparatus capable of varying map cache buffer size
CN111897484B (en) Data storage method and device, electronic equipment and storage medium
KR20200114086A (en) Controller, memory system and operating method thereof
CN115080457A (en) Controller and operation method thereof
US9817837B2 (en) Method and system for file storage and access
CN111897744B (en) Data writing method and device, electronic equipment and storage medium
US20230048813A1 (en) Method of storing data and method of reading data
CN111897745B (en) Data storage method and device, electronic equipment and storage medium
WO2023056687A1 (en) Solid state disk and data manipulation method and apparatus therefor, and electronic device
CN109189332A (en) A kind of disk hanging method, device, server and storage medium
CN111897748B (en) Mapping relation storage method, reading method, device, equipment and medium
CN114664361A (en) DRAM-less multi-level cell programming with NAND buffers

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
CB02 Change of applicant information

Address after: Room 101, Floor 1-5, Building 8, Yard 9, Fenghao East Road, Haidian District, Beijing 100094

Applicant after: Zhaoyi Innovation Technology Group Co.,Ltd.

Applicant after: SHANGHAI GEYI ELECTRONIC Co.,Ltd.

Address before: 100083 12 Floors, Block A, Tiangong Building, Science and Technology University, 30 College Road, Haidian District, Beijing

Applicant before: GIGADEVICE SEMICONDUCTOR(BEIJING) Inc.

Applicant before: SHANGHAI GEYI ELECTRONIC Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant