Bare device data writing method and device, computer readable medium and program product

Through the bare device data writing method, preset rules are used to divide data into blocks and tag bit rules are written to memory blocks, which solves the problem of insufficient file system performance and improves the overall performance and data writing efficiency of the storage system.

CN119200985AInactive Publication Date: 2024-12-27SHANGHAI BILIBILI TECH CO LTD

Patent Information

Application Number
CN202411296880.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The file system performance in existing storage systems is limited, and the storage device performance cannot be fully utilized, resulting in low data writing efficiency, especially when accessing multiple levels of directories and large number of files, and the file partitioning method increases the number of file handles, resulting in Performance degraded.

Method used

Using the bare device data writing method, the data to be stored is divided into data blocks through preset data segmentation rules, and the data block is written into the data storage block according to the mark bit rules, bypassing the file system, and directly interacting with the storage device. Optimize storage performance.

Benefits of technology

Improves data writing efficiency, reduces the number of file handles, improves overall storage performance, and realizes efficient data storage and management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119200985A_ABST
    Figure CN119200985A_ABST
Patent Text Reader

Abstract

The invention provides a bare device data writing method and device, a computer readable medium and a program product, and the method comprises the steps: responding to a data storage request, and obtaining to-be-stored data; dividing the to-be-stored data into a plurality of data blocks according to a preset data segmentation rule; according to a preset data storage rule, any data block is written into a preset data storage block, and the byte number of the data block is not larger than the storage capacity of the data storage block, so that the use utilization rate of the storage device is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of raw device data management, and in particular to a raw device data writing method, device, computer-readable medium and program product. Background Art

[0002] This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.

[0003] In storage systems, disks are generally formatted into file systems and then mounted into the system for use. The file system provides a universal and convenient way to store and manage files. Although the above method is applicable and convenient, it has the following technical problems:

[0004] 1. The file system performance is limited, which cannot fully utilize the performance of storage devices and provide users with a better experience;

[0005] 2. Multiple directories are required, and opening a large number of files in the same folder will result in slow access;

[0006] 3. File partitions are generally divided according to size. Opening multiple files for reading and writing will greatly increase the number of file handles, resulting in performance degradation.

[0007] Therefore, there is an urgent need to propose a method, device, computer-readable medium and program product for writing data to a bare device that can solve the above-mentioned technical problems. Summary of the invention

[0008] Multiple aspects of the present application provide a method, device, computer-readable storage medium and program product for writing data to a bare device, so as to improve data writing efficiency and optimize storage system performance.

[0009] In one aspect of the present application, a method for writing data to a raw device is provided, comprising:

[0010] Responding to a data storage request, obtaining data to be stored;

[0011] According to a preset data segmentation rule, the data to be stored is divided into a plurality of data blocks;

[0012] According to a preset data storage rule, any of the data blocks is written into a preset data storage block, and the number of bytes of the data block is greater than the storage capacity of the data storage block.

[0013] Furthermore, the method also includes: in response to a raw device partition request, obtaining the storage capacity of the raw device; based on a preset capacity unit, dividing the raw device into a plurality of data storage blocks; marking the data storage block to which the data block has not been written as 0, and marking the data storage block to which the data block has been written as 1.

[0014] Furthermore, according to a preset data segmentation rule, the data to be stored is divided into several data blocks, including: obtaining the storage capacity of the data storage block and determining the storage capacity of each of the data storage blocks; determining the byte unit based on the storage capacity of the data storage block; and dividing the data to be stored into several data blocks based on the byte unit.

[0015] Furthermore, according to the preset data storage rules, any of the data blocks are written into the preset data storage block, including: if the mark bit of the nth data storage block is 0, then according to the preset first data storage rule, any of the data blocks are written into the preset data storage block; if the mark bit of the nth data storage block is 1, then according to the preset second data storage rule, any of the data blocks are written into the preset data storage block.

[0016] Furthermore, according to a preset first data storage rule, any of the data blocks is written into a preset data storage block, including: determining the position of the data storage block with the first mark bit being 0 as the position to be written; and starting from the position to be written, writing the data blocks sequentially into the data storage block.

[0017] Furthermore, starting from the position to be written, the data blocks are sequentially written into the data storage blocks, including: starting from the position to be written, determining that the number of data storage blocks with a mark bit of 0 is a first number; when the number of data blocks is not greater than the first number, writing the data blocks sequentially into the data storage blocks until the data blocks are completely written.

[0018] Furthermore, according to a preset second data storage rule, the data block is written into a preset data storage block, including: dividing the data storage block into data storage groups; sequentially traversing the data storage groups; when a parameter corresponding to the data storage group is less than a preset parameter, obtaining a data storage block with a mark bit of 0, and sequentially writing the data block into the data storage block until the data block is completely written.

[0019] Furthermore, the method also includes: generating metadata information corresponding to the data to be stored, and storing the metadata information; wherein the metadata information includes: the size and name of the data to be stored and the storage location of the data blocks contained in the data to be stored.

[0020] Another aspect of the present application provides a method for reading data from a raw device, for reading data written to a raw device based on a method for writing data to a raw device, the method comprising:

[0021] In response to a raw device data read request, obtaining metadata information of the data to be read;

[0022] Based on the metadata information of the data to be read, the data written to the raw device is read.

[0023] In another aspect of the present application, a raw device data writing device is provided, the system comprising:

[0024] A response unit, for acquiring data to be stored in response to a data storage request;

[0025] A data segmentation unit, used to divide the data to be stored into a plurality of data blocks according to a preset data segmentation rule;

[0026] The data storage unit is used to write any of the data blocks into a preset data storage block according to a preset data storage rule, and the number of bytes of the data block is not greater than the storage capacity of the data storage block.

[0027] Another aspect of the present application provides an electronic device, the device comprising:

[0028] at least one processor; and

[0029] a memory communicatively connected to the at least one processor; wherein,

[0030] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the raw device data writing method and / or the raw device data reading method as described above.

[0031] In another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the raw device data writing method and / or the raw device data reading method.

[0032] Another aspect of the present application provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the method for writing data to a raw device and / or the method for reading data from a raw device are implemented.

[0033] In the solution provided by the embodiment of the present application, by responding to a data storage request, the data to be stored is obtained; according to a preset data segmentation rule, the data to be stored is divided into a plurality of data blocks; according to the preset data storage rule, any of the data blocks is written into a preset data storage block, and the number of bytes of the data block is not greater than the storage capacity of the data storage block, so as to achieve efficient data writing. The method described in the present application improves the efficiency of writing data by using a raw device to bypass the file operating system;

[0034] At the same time, the entire device is regarded as a file, so there is no need to manage it in a hierarchical manner. The number of open file handles is equal to the number of devices, thereby improving the overall storage performance of the device. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0036] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0037] Figure 1 A schematic diagram of a process for writing data to a raw device provided in an embodiment of the present application;

[0038] Figure 2 A schematic diagram of a process for reading data from a raw device provided in an embodiment of the present application;

[0039] Figure 3 A schematic diagram of the structure of a device for writing data to a raw device provided in an embodiment of the present application;

[0040] Figure 4 A schematic diagram of the structure of an electronic device suitable for implementing the solution in the embodiments of the present application;

[0041] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0043] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPU), input / output interface, network interface and memory.

[0044] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0045] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer program instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0046] The present invention provides a method for writing data to a raw device, the method comprising:

[0047] Responding to a data storage request, obtaining data to be stored;

[0048] According to a preset data segmentation rule, the data to be stored is divided into a plurality of data blocks;

[0049] According to a preset data storage rule, any of the data blocks is written into a preset data storage block, and the number of bytes of the data block is not greater than the storage capacity of the data storage block.

[0050] In actual scenarios, the execution subject of the method can be a user device, or a device formed by integrating a user device and a network device through a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.

[0051] Embodiment 1

[0052] Figure 1 The processing flow of a method for writing data to a raw device provided by an embodiment of the present application is shown, and the method at least includes the following processing steps:

[0053] Step S101, in response to a data storage request, obtaining data to be stored;

[0054] Step S102, dividing the data to be stored into a plurality of data blocks according to a preset data segmentation rule;

[0055] Step S103: writing any of the data blocks into a preset data storage block according to a preset data storage rule, wherein the number of bytes of the data block is not greater than the storage capacity of the data storage block.

[0056] It should be understood that the raw device described in this application is a hardware device that has not been processed by a file system, has not been formatted or partitioned, and can be directly accessed by an application.

[0057] In one embodiment, after the data to be stored is divided into a plurality of data blocks according to a preset data segmentation rule, the method further includes: obtaining a data block whose byte number is less than a first threshold according to a preset rule; determining that the data block is a first data block or a second data block; splicing the first data block and the second data block to generate a target data block; writing the target data block into a preset data storage block; wherein the byte number of the target data block is not greater than the storage capacity of the data storage block. It should be understood that a data block whose byte number is less than the first threshold is a data block that cannot occupy the storage capacity of the data storage block alone.

[0058] In one embodiment, after determining that the data block is the first data block, the method further includes: obtaining other first data blocks within a first preset time length, and determining that the other first data blocks are second data blocks; if the acquisition fails, or the first data block and the second data block and the target data block formed exceed the storage capacity of the preset data storage block, then writing the first data block into the preset data storage block; if the acquisition is successful, and the target data block composed of the first data block and the second data block does not exceed the storage capacity of the preset data storage block, then writing the target data block into the data storage block.

[0059] It should be understood that the method described in the present application has performed relevant processing on the data block before writing the data block into the data storage block (for example, splicing the first data block and the second data block that can be spliced ​​together to form a target data block); and will not perform relevant processing such as data block splicing on the data block after the data block is written. The reason is that: based on the method described in the present application, when the data storage block is written into the data block, the mark bit of the data storage block is marked as 1. After the data block is written, performing relevant processing such as data block splicing on the data block not only requires identifying the data storage block with a mark bit of 0, but also requires identifying the data storage block with a mark bit of 1, which will increase the data block writing time and resource usage.

[0060] The present application does not limit the number of the second data blocks, and the number of the second data blocks can be multiple. It should be understood that a data block (the first data block or the second data block) can only be written to the same data storage block to ensure the accuracy of data reading and writing.

[0061] In one embodiment, the method further includes: in response to a raw device partition request, obtaining the storage capacity of the raw device; based on a preset capacity unit, dividing the raw device into a plurality of data storage blocks, and marking each of the data storage blocks to generate a marking bit. The raw device is divided into a plurality of data storage blocks of the same size, and the overall management of the raw device is achieved by managing each data storage block, thereby reducing the complexity of system management.

[0062] Specifically, the preset capacity unit is 16M. It should be understood that the present application does not limit the size of the preset capacity unit, and in actual application scenarios, those skilled in the art can determine the preset capacity unit based on actual business requirements, bare equipment performance and loss, and other aspects.

[0063] In one embodiment, the data to be stored is divided into several data blocks according to a preset data segmentation rule, including: obtaining the storage capacity of the data storage block and determining the storage capacity of each of the data storage blocks; determining the byte unit based on the storage capacity of the data storage block; based on the byte unit, dividing the data to be stored into several data blocks; wherein the number of bytes of the data block is not greater than the storage capacity of the data storage block.

[0064] Specifically, when the preset capacity unit is 16M, the size of any data block is also 16M, that is, if the data to be stored is 10T, the data to be stored is divided into 16M sizes and stored in 655360 data blocks. If the data to be stored is 15M (or less than 16M), the data to be stored can also be directly written into the data storage block as a data block.

[0065] In one embodiment, the method described in the present application further includes: marking a mark bit of a data storage block to which a data block has not been written as 0, and marking a mark bit of a data storage block to which a data block has been written as 1.

[0066] Specifically, the use status of each data storage block is marked by a bitmap. It should be understood that in the present application, the data block with a mark bit of 0 can be a data storage block with a mark bit always being 0, or a data storage block with a mark bit changing from 1 to 0.

[0067] In one embodiment, after marking the mark bit of the data storage block, the method further includes: storing the mark bit of the data storage block in a storage unit (such as a kv database) so that when the bare device is restarted, the writing status of the data storage block can be directly and quickly obtained from the storage unit.

[0068] In one embodiment, any of the data blocks are written into a preset data storage block according to a preset data storage rule, including: if the mark bit of the nth data storage block is 0, then according to a preset first data storage rule, any of the data blocks are written into the preset data storage block; if the mark bit of the nth data storage block is 1, then according to a preset second data storage rule, any of the data blocks are written into the preset data storage block.

[0069] It should be understood that the nth data storage block described in the present application is the last data storage block. If the bare device is divided into 100 data storage blocks, the nth data storage block is the 100th data storage block.

[0070] Specifically, the data block storage rules of the present application can be understood as a whole: starting from the first data storage block, in order from front to back (regardless of whether there is a data storage block in the middle whose mark bit is set from 1 to 0), the data blocks are written to the data storage blocks in sequence until the last data storage block is written. When the last data block is written, it means that the first write is completed.

[0071] Then, when the mark bit of the nth data storage block is 0, it means that the first write of the entire raw device (which can also be understood as a disk) has not been completed, then according to the preset first data storage rule, any of the data blocks are sequentially written into the preset data storage block; when the mark bit of the nth data storage block is 1, it means that the first write of the entire raw device (which can also be understood as a disk) has been completed, then according to the preset second data storage rule, any of the data blocks are sequentially written into the preset data storage block.

[0072] In one embodiment, according to a preset first data storage rule, any of the data blocks is written into a preset data storage block, including: determining the position of the data storage block with the first mark bit being 0 as the position to be written; starting from the position to be written, the data blocks are written sequentially into the data storage block.

[0073] Specifically, starting from the position to be written, sequentially writing the data blocks into the data storage block includes: starting from the position to be written, each time a data storage block with a mark bit of 0 is obtained, a data block is written into the data storage block, so as to realize instant writing of data blocks and achieve the technical effect of immediate storage. Among them, the first data storage block with a mark bit of 0 can be the first data storage block, or any data storage block among the multiple data blocks.

[0074] In one embodiment, starting from the position to be written, the data blocks are sequentially written into the data storage blocks, including: starting from the position to be written, determining that the number of data storage blocks with a mark bit of 0 is a first number; when the number of data blocks is not greater than the first number, writing the data blocks sequentially into the data storage blocks. That is to say, at least when the number of data storage blocks is ensured to be the same as the number of data blocks, batch writing of data blocks is performed to prevent some data blocks in the data to be stored from being unable to be written into the storage due to insufficient data storage blocks, that is, batch writability of data blocks is achieved.

[0075] Specifically, starting from the position to be written, determining the number of data storage blocks with a mark bit of 0 as a first number includes: starting from the position to be written and ending at the position of the nth data storage block, determining the number of data storage blocks with a mark bit of 0 as a first number; when the number of data blocks is not greater than the first number, writing the data blocks sequentially into the data storage blocks; when the number of data blocks is greater than the first number, dividing the data storage blocks into data storage groups, sequentially traversing the data storage groups, determining whether M data storage blocks with a mark bit of 0 can be obtained, and if so, sequentially writing the data blocks into the data storage blocks. Wherein, M = the number of data blocks - the first number.

[0076] For example: in an actual application scenario (specifically referring to the case of batch writing of data blocks), when the data to be stored is divided into 13 data blocks, there may be a situation where only 10 data blocks are written into the data storage block after the first write is completed, and there are still 3 data blocks that have not been written; at this time, the data storage group can be polled (starting from the first data storage group, the parameters corresponding to each data storage group are obtained in turn) to confirm whether there are recycled data storage blocks (that is, whether there are data storage blocks whose mark bits are set from 0 to 1); if it is determined that there are recycled data storage blocks, then further obtain whether the number of recycled data storage blocks in the data storage group is 3, and if it is not less than 3, stop obtaining the parameters corresponding to the next data storage group, and there is no need to confirm how many recycled data storage blocks there are in all data storage groups, so as to achieve the effect of reducing resource consumption and saving time.

[0077] In one of the embodiments, determining the position of the first data storage block whose mark bit is 0 as the position to be written includes: when the data block is written to the data storage block (that is, after all the data blocks to be written to the data storage block are written to the data storage block), automatically marking the position of the first data storage block after the last data storage block whose mark bit is 1 as the position to be written; when executing the next data block writing task, the position of the first data storage block to which the data block will be written can be directly determined according to the position to be written, so as to reduce resource usage and improve data writing efficiency.

[0078] In one embodiment, the data block is written into a preset data storage block according to a preset second data storage rule, including: dividing the data storage block into data storage groups; sequentially traversing the data storage groups; when the parameter corresponding to the data storage group is less than the preset parameter, obtaining a data storage block with a mark bit of 0, and sequentially writing the data block into the data storage block until the data block is completely written.

[0079] Specifically, dividing the data storage blocks into data storage groups includes: dividing at most 64 data storage blocks into a group to generate a data storage group; wherein the mark bit of each data storage block is a bit.

[0080] Take a data storage group containing 64 data storage blocks as an example to illustrate, traverse the data storage group in sequence, and when the parameter corresponding to the data storage group is less than the preset parameter, obtain the data storage block with the mark bit 0, that is: when a data storage group contains 64 data storage blocks, the preset parameter is 2 64 -1 (i.e., the flag bit of each data storage block in the data storage group is 1); when the parameter corresponding to the data storage group (i.e., the decimal number obtained by converting the binary number composed of the flag bits of the 64 data storage blocks) is less than 2 64 When the value is -1, it means that the mark bits of the data storage blocks in the data storage group are not all 1 (that is, there are data storage blocks with a mark bit of 0). By first determining that there are data storage blocks with a mark bit of 0 in the data storage group, and then determining the number and position of the data storage blocks with a mark bit of 0, the polling efficiency of the data storage blocks is improved.

[0081] It should be understood that the present application does not limit the number of data storage blocks contained in the data storage group, and those skilled in the art can select it according to the actual application scenario. For example, the number of data storage blocks in each data storage group can be 8, 16, 32 or 64. When the data storage group is limited to include 8 data storage blocks, the preset parameter is 2. 8 -1; when the data storage group is limited to 16 data storage blocks, the preset parameter is 2 16 -1... and so on. Preferably, each data storage group includes 64 data storage blocks to improve the polling efficiency of the data storage blocks.

[0082] In one embodiment, the method further includes: generating metadata information corresponding to the data to be stored, and storing the metadata information; wherein the metadata information includes: the size and name of the data to be stored and the storage location of the data blocks contained in the data to be stored.

[0083] Specifically, the metadata information includes information such as size, name, offset (data block location mark), etc., where offset is the relative position of the data block in the raw device, such as the first offset is 0, the second offset is 1, and so on; the data is written to the actual position of the raw device equivalent to the offset, such as offset is 2, and the actual position in the storage device is 2*16M=33554432.

[0084] In one embodiment, when the bare device is divided into a plurality of data storage blocks based on a preset capacity unit, the method further includes: dividing the bare device according to the data designed by the EC storage system to obtain a plurality of data storage blocks, so as to ensure that when part of the data to be stored is lost, it can be rebuilt and restored through other data blocks. EC is called Erasure Coding, which is a data protection method commonly used in object storage systems. It divides data into multiple data blocks, and generates redundant data blocks according to a certain coding method and stores them on different devices, so as to ensure that when part of the data is lost, the data can be rebuilt through data blocks on other devices.

[0085] Embodiment 2

[0086] like Figure 2 A method for reading data from a raw device is provided, for reading data written to the raw device based on the method of Embodiment 1, the method comprising:

[0087] Step S201: In response to a raw device data read request, obtaining metadata information of the data to be read;

[0088] Step S202: Based on the metadata information of the data to be read, the data written to the raw device is read.

[0089] Embodiment 3

[0090] like Figure 3 A bare device data writing device is provided, and the system includes: a response unit, which obtains the data to be stored in response to a data storage request; a data segmentation unit, which is used to divide the data to be stored into a plurality of data blocks according to a preset data segmentation rule; a data storage unit, which is used to write any of the data blocks into a preset data storage block according to the preset data storage rule, and the number of bytes of the data block is not greater than the storage capacity of the data storage block.

[0091] Embodiment 4

[0092] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the method corresponding to the electronic device may be the method for writing data to a raw device and the method for reading data from a raw device in the aforementioned embodiment, and the principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.

[0093] The electronic device may be a user device, or a device formed by integrating a user device and a network device through a network, or may be an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.

[0094] Figure 4 The structure of a device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown, and the device 400 includes a central processing unit (CPU, Central Processing Unit) 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM, Read Only Memory) 402 or the program loaded from the storage part 408 to the random access memory (RAM, Random Access Memory) 403. In RAM403, various programs and data required for system operation are also stored. CPU401, ROM402 and RAM403 are connected to each other through bus 404. Input / output (I / O, Input / Output) interface 405 is also connected to bus 404.

[0095] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker, etc.; a storage section 408 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet.

[0096] In particular, the methods and / or embodiments in the embodiments of the present application may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 401, the above functions defined in the method of the present application are executed.

[0097] Embodiment 5

[0098] Another embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application described above.

[0099] Specifically, the present embodiment may adopt 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 may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device, or device.

[0100] Computer readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than a computer readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0101] 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.

[0102] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0103] Embodiment 6

[0104] This embodiment also provides a computer program product, including a computer program, which implements the methods and / or technical solutions of any one or more embodiments of the present application when processed by an executor.

[0105] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0106] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0107] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0108] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0109] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0110] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

[0112] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in a device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

Claims

1. A method for writing data to a raw device, wherein: The method comprises: Responding to a data storage request, obtaining data to be stored; According to a preset data segmentation rule, the data to be stored is divided into a plurality of data blocks; According to a preset data storage rule, any of the data blocks is written into a preset data storage block, and the number of bytes of the data block is not greater than the storage capacity of the data storage block.

2. The method for writing data to a raw device according to claim 1, wherein: The method further comprises: In response to a raw device partition request, obtaining a storage capacity of the raw device; Based on a preset capacity unit, the raw device is divided into a plurality of data storage blocks. The mark bit of the data storage block that marks the data block that has not been written is 0, and the mark bit of the data storage block that marks the data block that has been written is 1.

3. The method for writing data to a raw device according to claim 2, wherein: According to the preset data segmentation rules, the data to be stored is divided into several data blocks, including: Acquire the storage capacity of the data storage block, and determine the storage capacity of each of the data storage blocks; Determining byte units based on a storage capacity of the data storage block; Based on the byte unit, the data to be stored is divided into a plurality of data blocks.

4. The method for writing data to a raw device according to claim 3, wherein: According to a preset data storage rule, writing any of the data blocks into a preset data storage block includes: If the mark bit of the nth data storage block is 0, any of the data blocks is written into the preset data storage block according to the preset first data storage rule; If the mark bit of the nth data storage block is 1, any of the data blocks is written into the preset data storage block according to the preset second data storage rule.

5. The method for writing data to a raw device according to claim 4, wherein: Writing any of the data blocks into a preset data storage block according to a preset first data storage rule includes: Determine the position of the data storage block with the first mark bit being 0 as the position to be written; Starting from the position to be written, the data blocks are sequentially written into the data storage block.

6. The method for writing data to a raw device according to claim 4, wherein: Starting from the position to be written, the data blocks are sequentially written into the data storage block, including: Starting from the position to be written, determining the number of data storage blocks whose mark bit is 0 as a first number; When the number of the data blocks is not greater than the first number, the data blocks are sequentially written into the data storage blocks until the writing of the data blocks is completed.

7. The method for writing data to a raw device according to any one of claims 4 to 6, wherein: Writing the data block into a preset data storage block according to a preset second data storage rule includes: dividing the data storage blocks into data storage groups; sequentially traverse the data storage group; When the parameter corresponding to the data storage group is less than the preset parameter, a data storage block with a mark bit of 0 is obtained, and the data blocks are sequentially written into the data storage blocks until the data blocks are completely written.

8. The method for writing data to a raw device according to claim 7, wherein: The method further comprises: Generating metadata information corresponding to the data to be stored, and storing the metadata information; The metadata information includes: the size and name of the data to be stored and the storage location of the data blocks included in the data to be stored.

9. A method for reading data from a raw device, wherein: The method is used to read data written into a bare device according to the method described in any one of claims 1 to 8, and the method comprises: In response to a raw device data read request, obtaining metadata information of the data to be read; Based on the metadata information of the data to be read, the data written to the raw device is read.

10. A device for writing data to a raw device, wherein: The system comprises: A response unit, for acquiring data to be stored in response to a data storage request; A data segmentation unit, used to divide the data to be stored into a plurality of data blocks according to a preset data segmentation rule; The data storage unit is used to write any of the data blocks into a preset data storage block according to a preset data storage rule, and the number of bytes of the data block is not greater than the storage capacity of the data storage block.

11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.

12. A computer readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 9.

13. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Data read-write method and device, electronic equipment and storage medium

    CN111625191A

  • One-way data caching method, system and device and storage medium

    CN115309324A

  • Method and device for writing data into storage cluster, storage medium and electronic equipment

    CN116755617A

  • Data storage method and device, computer equipment and storage medium

    CN117742615A

  • Data storage method and device, electronic equipment and computer program product

    CN118444849A

Cited By

  • Data storage method and system, electronic equipment and vehicle

    CN121166042A

  • Data storage method, system, electronic device and vehicle

    CN121166042B