Storage space management method, device, electronic equipment and medium
By introducing a bitmap algorithm in the kernel layer, it manages disk space read and write in cloud computing applications based on CEPH, solves the problem of the impact of write zero operation on performance, and achieves both data security and performance.
Patent Information
- Application Number
- CN202211415572.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-11
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2042-11-11
AI Technical Summary
In CEPH-based cloud computing applications, it is necessary to ensure data security while avoiding the impact of write zero operations on the performance of CEPH clusters.
By introducing bitmap algorithms at the kernel layer, read and write operations of disk space are managed. Each bit in the bit diagram corresponds to a sector in the disk space. The value of the bits determines whether to read data from the corresponding sector to avoid real write-zero operations.
It ensures the security of user data without affecting the performance of the CEPH cluster and prevents deleted data from being read.
Smart Images

Figure CN115657962B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data storage technology, and more particularly to a storage space management method, device, electronic device and medium. Background Art
[0002] In the actual use of cloud computing services, it is common for different users to alternately create, delete, and recreate storage volumes. Each time a storage volume is deleted, the released storage space may be used again by subsequent volumes created by other users.
[0003] In some cloud computing scenarios where the distributed object storage system CEPH is used at the bottom layer, in order to prevent deleted data from still being read from the disk through disk testing tools, which may lead to data leakage, some known technologies propose to write zero operations on deleted storage volumes and clear each object space to successfully release all objects, so as to reduce the risk of data leakage and improve data storage security.
[0004] In the above process, since the throughput supported by each disk per second is fixed, when it is necessary to write zero operations to multiple disk partitions, the read and write performance of other volumes will be seriously affected, resulting in a decrease in the overall performance of the CEPH cluster.
[0005] In summary, there is an urgent need for a storage space management mechanism that can ensure that no user data is read in read IO operations at all levels of disk zeroing space in CEPH-based cloud computing applications, while not affecting the overall performance of the CEPH cluster. Summary of the invention
[0006] The present application provides a storage space management method, device, electronic device and medium, which are used to ensure the continuous, stable and reliable performance of the entire CEPH cluster while ensuring data security.
[0007] In one aspect, the present application provides a storage space management method, the method comprising:
[0008] Receive a first write request, the first write request is used to indicate a write-zero operation to release disk space, the first write request includes a first position in a bitmap, the first position includes at least one bit, each bit in the bitmap corresponds to a sector in the disk space;
[0009] According to the first write request, each bit in the first position of the bitmap is set to a first value, wherein the first value is used to indicate that the space of the sector corresponding to the bit is released, and the first value is also used to indicate returning all-zero data when a read request is received;
[0010] A first write response is returned, where the first write response is used to indicate that the write-zero operation is successful.
[0011] In another possible implementation, the method further includes:
[0012] receiving a second write request, the second write request being used to indicate writing data, the second write request comprising a second position in the bitmap, the second position comprising at least one bit;
[0013] Determine, according to the second write request, whether each bit of the second position is the first value;
[0014] If yes, write the data into the sector corresponding to the bit at the second position, and set the bit at the second position to a second value, wherein the second value is used to indicate that the data is written into the sector;
[0015] A second write response is returned, where the second write response is used to indicate that the data is written successfully.
[0016] In another possible implementation, the method further includes:
[0017] receiving a read request, the read request comprising a third position in the bitmap, the third position comprising at least one target bit;
[0018] According to the read request, obtaining a value of each target bit of the third position;
[0019] Based on the value of the target bit, a read response is returned.
[0020] In another possible implementation, returning a read response based on the value of the target bit includes:
[0021] If the value of the target bit is the first value, a first read response is returned, wherein the first read response includes all zero data;
[0022] If the value of the target bit is the second value, data is read from the disk sector corresponding to the target bit, and a second read response is returned, wherein the second read response includes the data read from the disk sector.
[0023] In another possible implementation, the method further includes:
[0024] When creating a file system, the initialization interface of the bitmap is called to initialize the bitmap, wherein the bit at each position in the initialized bitmap is set to the first value.
[0025] In another possible implementation, the calling of the bitmap is executed in kernel mode.
[0026] In another possible implementation, the disk space is a storage space in a distributed object storage system.
[0027] On the other hand, the present application provides a storage space management device, including a first receiving module, a first setting module and a first returning module, wherein:
[0028] A first receiving module is used to receive a first write request, the first write request is used to instruct to perform a write-zero operation to release disk space, the first write request includes a first position in a bitmap, the first position includes at least one bit, and each bit in the bitmap corresponds to a sector in the disk space;
[0029] A first setting module, configured to set each bit at a first position in the bitmap to a first value according to the first write request, wherein the first value is used to indicate that the space of the sector corresponding to the bit is released, and the first value is also used to indicate returning all-zero data when a read request is received;
[0030] The first returning module is used to return a first write response, where the first write response is used to indicate that the write-zero operation is successful.
[0031] In another possible implementation, the device further includes a second receiving module, a determining module, a second setting module, and a second returning module, wherein:
[0032] A second receiving module receives a second write request, where the second write request is used to indicate writing data, the second write request includes a second position in the bitmap, and the second position includes at least one bit;
[0033] a determination module, configured to determine, according to the second write request, whether each bit of the second position is the first value;
[0034] A second setting module, used for writing data into the sector corresponding to the bit position of the second position and setting the bit position of the second position to a second value when the bit positions of the second position are all the first value, wherein the second value is used to indicate that the data is written into the sector;
[0035] The second returning module is used to return a second write response, where the second write response is used to indicate that the data is written successfully.
[0036] In another possible implementation, the device further includes a third receiving module, an acquiring module and a third returning module, wherein:
[0037] A third receiving module, configured to receive a read request, wherein the read request includes a third position in the bitmap, and the third position includes at least one target bit;
[0038] An acquisition module, configured to acquire a value of each target bit of the third position according to the read request;
[0039] The third returning module is used to return a read response based on the value of the target bit.
[0040] In another possible implementation, the third returning module is specifically used for:
[0041] If the value of the target bit is the first value, a first read response is returned, wherein the first read response includes all zero data;
[0042] If the value of the target bit is the second value, data is read from the disk sector corresponding to the target bit, and a second read response is returned, wherein the second read response includes the data read from the disk sector.
[0043] In another possible implementation, the device further includes an initialization module, wherein:
[0044] The initialization module is used to call the initialization interface of the bitmap when creating a file system to initialize the bitmap, wherein the bit at each position in the initialized bitmap is set to the first value.
[0045] In another possible implementation, the calling of the bitmap is executed in kernel mode.
[0046] In another possible implementation, the disk space is a storage space in a distributed object storage system.
[0047] In a third aspect, the present invention provides an electronic device, comprising:
[0048] at least one processor and memory;
[0049] The memory stores computer-executable instructions;
[0050] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the storage space management method as described in any one of the first aspects above.
[0051] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the storage space management method as described in any one of the first aspects above is implemented.
[0052] The present application provides a storage space management method and system. When the storage space in the distributed object storage system needs to be released, the first write request for indicating a write-zero operation is first received, and then the value of each bit in the first position included in the first write request is set to a first value to indicate that the disk sector corresponding to the bit has been cleared. Finally, a first write response is returned to the upper layer to inform the upper layer that the disk sector corresponding to each bit in the first position has been cleared.
[0053] At this time, when a read request for reading the disk sector corresponding to the above bit is received, since the value of the above bit is the first value, it will only respond to the read request and directly return all-zero data without reading data from the disk sector, thereby ensuring the security of user data. At the same time, since the disk sector is not actually written to zero in the above process, it will not affect the reading and writing of other volumes, thereby ensuring the continuous, stable and reliable performance of the entire CEPH cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0055] Figure 1 A flowchart of a storage space management method provided in an embodiment of the present application;
[0056] Figure 2 A flowchart of a write request processing method provided in an embodiment of the present application;
[0057] Figure 3 A flowchart of a read request processing method provided in an embodiment of the present application;
[0058] Figure 4 A schematic diagram of the structure of a storage space management device provided in an embodiment of the present application;
[0059] Figure 5 An electronic device is provided in an embodiment of the present application.
[0060] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0061] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0062] In the actual use of cloud computing services, it is common for different users to alternately create, delete, and recreate storage volumes. The storage space released after each deletion of a storage volume may be reused by new volumes created by other users. For example, a cloud disk was originally authorized to customer A. After the agreement expires, customer A deletes the data stored in the cloud disk to free up the storage space of the cloud disk. At this time, if the cloud disk is authorized to customer B, customer B can reoccupy the storage space of the cloud disk.
[0063] If the underlying cloud computing uses a distributed object storage system, taking the block scenario as an example, after a new volume is created, when reading the space that has not been written, all zeros will be directly returned. If some areas of an object have been written and some areas have not been written, all zeros will also be returned when reading the areas that have not been written. That is, for the space that has not been written, CEPH can determine it and will not read from the disk, but will directly fill it with all-zero data and return it to the user. In this way, no matter what data user A wrote in this space before, when this space is allocated to user B by the CEPH cluster again, user B will not be able to read the previous data, and data leakage will not occur.
[0064] However, in some high-demand business acceptance standards such as finance, there are higher requirements for cloud storage. This includes ensuring that after user A deletes a storage volume, when user B or others use disk testing tools such as dd to read the corresponding area from the disk, all zero data can be returned, that is, to ensure the security of previous data generated by user A and stored on the underlying physical disk.
[0065] Since CEPH's own mechanism cannot meet the above requirements, some known technologies propose to write zero operations on deleted storage volumes and clear each object space to successfully release all objects, so as to reduce the risk of data leakage and improve data storage security.
[0066] However, since the throughput supported by each disk per second is fixed, when writing zero operations to multiple disk partitions, if there are other write IO operations or read IO operations in the same time period, it will seriously affect their performance, resulting in a decline in the overall performance of the CEPH cluster, which is not conducive to improving user experience.
[0067] In some CEPH-based cloud computing applications, in order to ensure that no user data is read in read IO operations at all levels of disk zeroing space while not affecting the overall performance of the CEPH cluster, the present application proposes a storage space management method, device, electronic device and medium, which adds a bitmap algorithm for managing disk space in the kernel layer, so that each bit in the bitmap corresponds to a sector of the disk, and determines whether data needs to be read from the sector through the value of the bit corresponding to each sector, so as to ensure that data in the disk sector that needs to be written to zero will not be read, and at the same time, the disk sector is not actually written to zero, thereby ensuring the performance of the CEPH cluster.
[0068] Figure 1 A flowchart of a storage space management method provided by an embodiment of the present application. Figure 1 As shown, the method in this embodiment may include step S101, step S102 and step S103, wherein:
[0069] Step S101, receiving a first request, where the first request is used to instruct to perform a write-zero operation to release disk space.
[0070] The first request includes a first position in the bitmap, the first position includes at least one bit, and each bit in the bitmap corresponds to a sector in the disk space.
[0071] In this embodiment, the disk space is a storage space in a distributed object storage system.
[0072] Optionally, in this embodiment, when creating a file system, an initialization interface of a bitmap is called to initialize the bitmap, wherein each bit in the initialized bitmap is set to a first value, and the calling of the bitmap is executed in kernel mode.
[0073] Specifically, this embodiment manages the read and write operations of the storage space by introducing a bitmap algorithm in the kernel layer. Each bit in the bitmap corresponds to a sector in the disk space. By assigning different values to the bits, it indicates whether to read data from the corresponding sector.
[0074] In this embodiment, the first value may be 1 in a binary language that can be recognized by a computer, or may be 0, which is not limited in this embodiment.
[0075] Step S102: according to the first write request, each bit at the first position in the bitmap is set to a first value.
[0076] The first value is used to indicate that the space of the sector corresponding to the bit is ready to be released, and is also used to return all-zero data when a read request is received.
[0077] Specifically, if the value of a certain bit is the first value, when the data in the sector corresponding to the bit is obtained, all-zero data is directly returned, and the data in the corresponding sector is not read, thereby ensuring the security of previous data.
[0078] Step S103: Return the first write response.
[0079] The first write response is used to indicate that the write-zero operation is successful. Specifically, after the value of each bit of the first position is set to the first value, the first write response is returned, rather than returning the first write response after actually writing zero to the corresponding disk sector, that is, in this embodiment, zero is not actually written to the disk sector, which is conducive to ensuring the stability of the CEPH cluster performance.
[0080] The method provided in this embodiment, when receiving a first write request for writing zeros to the disk space, assigns each bit of the first position included in the first write request to a first value, and then returns a first write response, indicating that the write zero operation is successful. When receiving disk sector data corresponding to the bit for reading the first position, since the value of the bit is the first value, it is not necessary to read data from the corresponding sector, but all-zero data is directly returned.
[0081] In the above process, when indicating to write zero operation, only the value of each bit in the first position is set, and the disk sector is not written to zero, so the performance of the entire CEPH cluster will not be affected by the need to write zero operation on the disk sector. After that, when reading data, since the value of the above bit is the first value, all zero data will be directly returned in response to the read request, and there is no need to read data in the disk sector. Therefore, the previous data in the disk sector will not be read, thereby ensuring the security of the previous data.
[0082] Figure 2 Schematic diagram of a write request processing method provided by an embodiment of the present application. Figure 2 , the specific implementation process of the embodiment of the present application is described in detail. Specifically, based on the above embodiment, this embodiment describes in detail different processing methods for different write requests.
[0083] like Figure 2 As shown, the method includes step S201, step S202, step S203, step S204, step S305, step S306 and step S307, wherein:
[0084] Step S201: receiving a write request, where the write request is used to instruct a write operation.
[0085] Specifically, the write request is divided into two categories according to different write operation purposes: a first write request and a second write request. The first write request is used to instruct a write zero operation, that is, to release disk space. The second write request is used to instruct writing data to the disk space.
[0086] Step S202, determining whether the write request is a first write request, the first write request is used to instruct a write-zero operation. If yes, executing step S203, if no, executing step S205.
[0087] The first write request includes a first position, and the first position includes at least one bit.
[0088] In this embodiment, whether the current write request is the first write request can be determined based on the data content carried by the write request. Specifically, if the data content carried by the current write request is all zero data, it means that the current write request is used to instruct a write-zero operation, that is, the current write request is the first write request. If the data content carried by the current write request is non-all zero data, it means that the current write request is used to instruct writing data to the disk space, that is, the current write request is the second write request.
[0089] Step S203: according to the first write request, each bit at the first position in the bitmap is set to a first value.
[0090] The first value is used to indicate that the space of the sector corresponding to the bit is released, and is also used to return all-zero data when a read request is received.
[0091] Step S204, returning a first write response, where the first write response is used to indicate that the write-zero operation is successful.
[0092] Specifically, the first write request includes a first position, and the first position includes at least one bit. When the first write request is received, the bits included in the first position are determined based on the first position included in the first write request, and the values of the above bits are set to the first value. After the setting is completed, the first write response is returned to indicate that the write zero operation is successful.
[0093] It can be seen that in the above process, the all-zero data carried by the first write request is not written to the disk space. Only when the first write request is received, the value of the bit included therein is set to the first value. The first value is used to indicate that the disk sector corresponding to the above bit has been cleared, that is, it is used to indicate that data can be written to the disk sector corresponding to the above bit.
[0094] Step S205: Determine whether each bit of the second position is the first value according to the second write request. If yes, execute step S206; otherwise, execute step S208.
[0095] The second write request includes a second position, and the second position includes at least one bit.
[0096] Specifically, before writing non-all-zero data to the disk space in response to the second write request, it is first determined whether the values of each bit contained in the second position are all the first value, that is, whether the disk sectors corresponding to each bit contained in the second position can write data.
[0097] Step S206, writing the data into the disk sector corresponding to the bit at the second position, and setting the bit at the second position to a second value.
[0098] The second value is used to indicate that data is written into the disk sector.
[0099] Specifically, only when the disk sector corresponding to each bit included in the second position can write data, the non-all-zero data of the second write request is written into the corresponding disk sector. After the writing is successful, the value of each bit of the second position is set to the second value to indicate that data has been written into the current disk sector, that is, to indicate that other non-all-zero data cannot be written into the current sector before the clearing process is performed.
[0100] In this embodiment, the first value and the second value are different binary values that can be recognized by the computer. The user can set the first value and the second value in advance through the electronic device. Specifically, the user can set the first value to 1 and the second value to 0, or the user can set the first value to 0 and the second value to 1, as long as the first value and the second value are different and recognizable values.
[0101] Step S207, returning a second write response, where the second write response is used to indicate that the data is written successfully.
[0102] Specifically, after the non-all-zero data of the second write request is written into the response disk sector, a second write response is returned to the upper layer to inform the upper layer that the data is written successfully.
[0103] Step S208: Return a third write response, where the third write response is used to indicate that there are disk sectors where data cannot be written.
[0104] Specifically, if the value of each bit at the second position is not all the first value, it means that not all target write sectors can write data. At this time, a third write response is returned to the upper layer to inform the upper layer that there are disk sectors that cannot write data.
[0105] Optionally, the third write response may include a bit corresponding to a disk sector where data cannot be written, so as to inform an upper layer which disk sector is specifically where data cannot be written.
[0106] The method provided in this embodiment, when receiving a write request, first determines whether the write request is a first write request for indicating a write-zero operation, or a second write request for indicating writing non-all-zero data into a disk sector. If it is a first write request, the value of the bit contained in the first position is directly set to the first value, and the all-zero data is not written into the corresponding disk sector. If it is a second write request, it is first necessary to determine whether the disk sector corresponding to each bit included in the second position can be written with data. Only when all the disk sectors corresponding to the second position can be written with data, the non-all-zero data is written into the corresponding disk sector according to the second write request. After the writing is successful, a prompt indicating that the data is written successfully is returned to the upper layer. Otherwise, a disk sector containing data that cannot be written is returned to the upper layer.
[0107] In the above process, when a write request is used to indicate a write-zero operation on the disk space, only the value of the bit contained in the first position is set to the first value, and the all-zero data contained in the write request is not written to the disk sector, thereby reducing the impact on the performance of the CEPH cluster.
[0108] Figure 3 A flowchart of a read request processing method provided in an embodiment of the present application is shown below. Figure 3 , the specific implementation process of the embodiment of the present application is further described in detail. Specifically, this embodiment defines in detail the way of processing the read request.
[0109] like Figure 3 As shown, the method may include step S301, step S302, step S303 and step S304, wherein:
[0110] Step S301, receiving a read request.
[0111] The read request includes a third position in the bitmap, and the third position includes at least one target bit.
[0112] Step S302: Obtain the value of each target bit at the third position according to the read request.
[0113] Step S303: If the value of the target bit is the first value, a first read response is returned.
[0114] The first read response includes all-zero data.
[0115] Specifically, when a read request is received, the third position included in the read request is obtained, and the value of each target bit included in the third position is determined. For a target bit whose value is the first value, all zero data included in the first read response is directly returned without reading data from the disk sector corresponding to the target bit.
[0116] Step S304: if the value of the target bit is the second value, data is read from the disk sector corresponding to the target bit, and a second read response is returned.
[0117] The second read response includes data read from the disk sector.
[0118] Specifically, for a target bit whose value is the second value, data is read from the disk sector corresponding to the target bit, and the read data is returned to the upper layer.
[0119] The method provided in this embodiment first obtains the value of each target bit at the third position upon receiving a read request. For a target bit with a first value, all zero data is directly returned to the upper layer. For a target bit with a second value, data is read from the corresponding disk sector and the read data is returned to the upper layer.
[0120] In the above process, for the disk sectors that need to be written to zero, when a read request to read the data content in these disk sectors is received, the read request is directly responded to by returning all-zero data, and data is not read from the corresponding disk sectors, thereby reducing the risk of previous data leakage in the disk sectors and improving data security.
[0121] The above embodiment introduces a storage space management method from the perspective of method flow, and the following embodiment introduces a storage space management device from the perspective of a virtual module or a virtual unit. Please refer to the following embodiment for details.
[0122] The present application embodiment provides a storage space management device, such as Figure 4 As shown, the device includes a first receiving module 41, a first setting module 42 and a first returning module 43, wherein:
[0123] A first receiving module 41 is used to receive a first write request, the first write request is used to instruct to perform a write-zero operation to release disk space, the first write request includes a first position in a bitmap, the first position includes at least one bit, and each bit in the bitmap corresponds to a sector in the disk space;
[0124] A first setting module 42, configured to set each bit in the first position of the bitmap to a first value according to a first write request, wherein the first value is used to indicate that the space of the sector corresponding to the bit is released, and the first value is also used to indicate that all zero data is returned when a read request is received;
[0125] The first returning module 43 is used to return a first write response, where the first write response is used to indicate that the write-zero operation is successful.
[0126] In another possible implementation manner of the embodiment of the present application, the device further includes a second receiving module, a determining module, a second setting module and a second returning module, wherein:
[0127] A second receiving module receives a second write request, the second write request is used to indicate writing data, the second write request includes a second position in the bitmap, and the second position includes at least one bit;
[0128] A determination module, configured to determine, according to the second write request, whether each bit of the second position is a first value;
[0129] A second setting module, used for writing data into the sector corresponding to the bit at the second position and setting the bit at the second position to a second value when all the bits at the second position are the first value, wherein the second value is used to indicate that the data is written into the sector;
[0130] The second returning module is used to return a second write response, where the second write response is used to indicate that the data is written successfully.
[0131] In another possible implementation manner of the embodiment of the present application, the device further includes a third receiving module, an acquisition module and a third returning module, wherein:
[0132] A third receiving module, configured to receive a read request, the read request comprising a third position in the bitmap, the third position comprising at least one target bit;
[0133] An acquisition module, used for acquiring a value of each target bit at the third position according to the read request;
[0134] The third returning module is used to return a read response based on the value of the target bit.
[0135] In another possible implementation of the embodiment of the present application, the third returning module is specifically used to:
[0136] If the value of the target bit is the first value, a first read response is returned, and the first read response includes all zero data;
[0137] If the value of the target bit is the second value, data is read from the disk sector corresponding to the target bit, and a second read response is returned, wherein the second read response includes the data read from the disk sector.
[0138] In another possible implementation manner of the embodiment of the present application, the device further includes an initialization module, wherein:
[0139] The initialization module is used to call the initialization interface of the bitmap when creating a file system to initialize the bitmap, wherein the bit at each position in the initialized bitmap is set to a first value.
[0140] In another possible implementation of the embodiment of the present application, the calling of the bitmap is executed in kernel mode.
[0141] In another possible implementation manner of the embodiment of the present application, the disk space is a storage space in a distributed object storage system.
[0142] In the embodiment of the present application, the first receiving module 41, the second receiving module and the third receiving module can be the same receiving module, or different receiving modules, or partially identical receiving modules; the first setting module 42 and the second setting module can be the same setting module, or completely different setting modules; the first return module 43, the second return module and the third return module can be the same return module, or partially identical return modules, or completely different return modules, which are not limited in the embodiment of the present application.
[0143] A storage space management device provided in an embodiment of the present application is applicable to the above method embodiment and will not be described in detail here.
[0144] An electronic device is provided in an embodiment of the present application, such as Figure 5 As shown, Figure 5 The electronic device shown includes: a processor 51 and a memory 52. The processor 51 and the memory 52 are connected, such as through a bus 53. Optionally, the electronic device may further include a transceiver 54. It should be noted that in actual applications, the transceiver 54 is not limited to one, and the structure of the electronic device does not constitute a limitation on the embodiments of the present application.
[0145] The processor 51 may be a CPU (Central Processing Unit, central processing unit 51), a general processor 51, a DSP (Digital Signal Processor, data signal processor 51), an ASIC (Application Specific Integrated Circuit, application-specific integrated circuit), an FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 51 may also be a combination that implements a computing function, such as a combination of one or more microprocessors 51, a combination of a DSP and a microprocessor 51, etc.
[0146] The bus 53 may include a path to transmit information between the above components. The bus 531002 may be a PCI (Peripheral Component Interconnect) bus 53 or an EISA (Extended Industry Standard Architecture) bus 53, etc. The bus 53 may be divided into an address bus 53, a data bus 53, a control bus 53, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus 53 or only one type of bus 53.
[0147] The memory 52 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0148] The memory 52 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 51. The processor 51 is used to execute the application code stored in the memory 52 to implement the contents shown in the above method embodiment.
[0149] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0150] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.
[0151] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0152] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A storage space management method, characterized in that: include: Receive a first write request, the first write request is used to indicate a write-zero operation to release disk space, the first write request includes a first position in a bitmap, the first position includes at least one bit, each bit in the bitmap corresponds to a sector in the disk space; According to the first write request, each bit in the first position of the bitmap is set to a first value, wherein the first value is used to indicate that the space of the sector corresponding to the bit is released, and the first value is also used to indicate returning all-zero data when a read request is received; Returning a first write response, wherein the first write response is used to indicate that the write-zero operation is successful; receiving a second write request, the second write request being used to indicate writing data, the second write request comprising a second position in the bitmap, the second position comprising at least one bit; Determine, according to the second write request, whether each bit of the second position is the first value; If yes, write the data into the sector corresponding to the bit at the second position, and set the bit at the second position to a second value, wherein the second value is used to indicate that the data is written into the sector; A second write response is returned, where the second write response is used to indicate that the data is written successfully.
2. The method according to claim 1, characterized in that The method further comprises: receiving a read request, the read request comprising a third position in the bitmap, the third position comprising at least one target bit; According to the read request, obtaining a value of each target bit of the third position; Based on the value of the target bit, a read response is returned.
3. The method according to claim 2, characterized in that The returning a read response based on the value of the target bit comprises: If the value of the target bit is the first value, a first read response is returned, wherein the first read response includes all zero data; If the value of the target bit is the second value, data is read from the disk sector corresponding to the target bit, and a second read response is returned, wherein the second read response includes the data read from the disk sector.
4. The method according to claim 1, characterized in that: The method further comprises: When creating a file system, the initialization interface of the bitmap is called to initialize the bitmap, wherein each bit in the initialized bitmap is set to the first value.
5. The method according to claim 4, characterized in that The calling of the bitmap is executed in kernel mode.
6. The method according to any one of claims 1 to 5, characterized in that: The disk space is a storage space in a distributed object storage system.
7. A storage space management device, characterized in that: include: A first receiving module is used to receive a first write request, the first write request is used to instruct to perform a write-zero operation to release disk space, the first write request includes a first position in a bitmap, the first position includes at least one bit, and each bit in the bitmap corresponds to a sector in the disk space; A first setting module, configured to set each bit at a first position in the bitmap to a first value according to the first write request, wherein the first value is used to indicate that the space of the sector corresponding to the bit is released, and the first value is also used to indicate returning all-zero data when a read request is received; A first returning module, used to return a first write response, where the first write response is used to indicate that a write-zero operation is successful; A second receiving module, configured to receive a second write request, the second write request being used to indicate writing data, the second write request comprising a second position in the bitmap, the second position comprising at least one bit; a determination module, configured to determine, according to the second write request, whether each bit of the second position is the first value; A second setting module, used for writing data into a sector corresponding to the bit at the second position and setting the bit at the second position to a second value when each bit at the second position is the first value, wherein the second value is used to indicate that the data is written into the sector; The second returning module is used to return a second write response, where the second write response is used to indicate that the data is written successfully.
8. An electronic device, characterized in that: It includes: One or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are used to: execute the storage space management method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the storage space management method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Method and device for recording / reproducing data in a data storage equipment based on probe
CN101188130A
Data reading method and device, data storage system, and equipment
CN108509156A