Search

CN-121996580-A - Method, apparatus, device, medium and program product for updating address mapping table

CN121996580ACN 121996580 ACN121996580 ACN 121996580ACN-121996580-A

Abstract

The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, a medium, and a program product for updating an address mapping table. The method comprises the steps of responding to a received first writing request, determining a first logic address to be written in of first data in the first writing request, determining a first physical address corresponding to the first logic address according to a multi-level address mapping table, writing the first data according to the first physical address, responding to successful writing of the first data, and updating a root-level address mapping table in the multi-level address mapping table according to the first logic address, the first physical address and adjacent idle physical address segments thereof so as to add mapping information for mapping to the adjacent idle physical address segments in the root-level address mapping table. Thus, the address mapping table is optimized, and the data writing efficiency can be improved.

Inventors

  • HE XIAOYANG
  • LIN ZHIMING
  • HU TINGXIAN

Assignees

  • 北京小米移动软件有限公司南京分公司
  • 北京小米移动软件有限公司

Dates

Publication Date
20260508
Application Date
20241108

Claims (10)

  1. 1. A method for updating an address mapping table, the method comprising: In response to receiving a first write request, determining a first logical address in the first write request where first data is to be written; determining a first physical address corresponding to the first logical address according to a multi-level address mapping table; writing the first data according to the first physical address; And in response to the success of the first data writing, updating a root-level address mapping table in the multi-level address mapping table according to the first logical address, the first physical address and the adjacent idle physical address segments thereof, so as to add mapping information for mapping to the adjacent idle physical address segments in the root-level address mapping table.
  2. 2. The method of claim 1, wherein the determining a first logical address of the first data in the first write request to be written comprises: if the idle address segment state information corresponding to the multi-level address mapping table is determined to exist, determining a logic address in the idle address segment state information as the first logic address; and if the idle address segment state information does not exist, distributing the first logical address to the first write request according to the idle logical address in the multi-level address mapping table.
  3. 3. The method according to claim 2, wherein the method further comprises: When the multi-stage address mapping table meets detection trigger conditions, detecting whether an idle physical address segment exists in the multi-stage address mapping table; acquiring a first logical address of the detected idle physical address segment in response to the existence of the idle physical address segment; and generating the idle address segment state information containing the first logical address.
  4. 4. A method according to any one of claims 1-3, wherein determining a first physical address corresponding to the first logical address according to a multi-level address mapping table comprises: Determining the root-level address mapping table as an initial address mapping table to be queried; the following steps are circularly executed until the first physical address is obtained: Determining a mapping result of the first logical address in an address mapping table to be queried; if the mapping result is the first physical address, ending the table lookup flow; and if the mapping result is another address mapping table, determining the another address mapping table as a new address mapping table to be queried.
  5. 5. A method according to any one of claims 1-3, wherein said updating a root level address mapping table of said multi-level address mapping table based on said first logical address, and said first physical address and its adjacent free physical address segments, comprises: Determining a target address mapping table containing the first physical address; Responding to the target address mapping table not being the root level address mapping table, wherein the target address mapping table has idle physical address segments adjacent to the first physical address, and determining the target data length according to the first physical address and the idle physical address segments adjacent to the first physical address; and adding the mapping relation among the first logical address, the first physical address and the target data length in the root-level address mapping table.
  6. 6. The method of claim 5, wherein after updating the root level address mapping table of the multi-level address mapping table, the method further comprises: In response to receiving a second write request, determining a second logical address in the second write request, at which second data is to be written, according to the first logical address; Determining an address offset between the second logical address and the first logical address; Determining a second physical address according to the first physical address and the address offset; and writing the second data according to the second physical address.
  7. 7. An apparatus for updating an address mapping table, the apparatus comprising: a first determining unit, configured to determine, in response to receiving a first write request, a first logical address where first data in the first write request is to be written; the second determining unit is used for determining a first physical address corresponding to the first logical address according to the multi-level address mapping table; a writing unit for writing the first data according to the first physical address; And the updating unit is used for responding to the successful writing of the first data, updating a root-level address mapping table in the multi-level address mapping table according to the first logical address, the first physical address and the adjacent idle physical address segments thereof, and adding mapping information for mapping to the adjacent idle physical address segments in the root-level address mapping table.
  8. 8. An electronic device, comprising: processor, and A memory storing computer instructions for causing the processor to perform the method of any one of claims 1 to 6.
  9. 9. A computer readable storage medium, characterized in that computer instructions for causing a computer to perform the method according to any one of claims 1 to 6 are stored.
  10. 10. A computer program product comprising computer readable code, or a non-transitory computer readable storage medium carrying computer readable code, which when run in a processor of an electronic device, the processor of the electronic device being in accordance with the method of any one of claims 1 to 6.

Description

Method, apparatus, device, medium and program product for updating address mapping table Technical Field The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, a medium, and a program product for updating an address mapping table. Background In some data storage scenarios, the mapping between logical addresses and physical addresses of storage devices is typically maintained through a logical address to physical address (Logical address To PHYSICAL ADDRESS, L2P) table, so that the physical address corresponding to the logical address of a data read-write request may be determined from the L2P table, to effect address translation, In the related art, the L2P table generally adopts a mapping table or a multi-level mapping table. The multi-level mapping table comprises a plurality of levels of address mapping tables. However, if the address mapping relationship is maintained only by one level mapping table, a large amount of mapping management resources are consumed, and when the address mapping relationship is maintained by multiple levels of mapping tables, the table lookup efficiency is low and the data writing efficiency is low. Disclosure of Invention To solve the above problems, embodiments of the present disclosure provide a method, apparatus, device, medium, and program product for updating an address mapping table. In one aspect, an embodiment of the present disclosure provides a method for updating an address mapping table, where the method includes: In response to receiving a first write request, determining a first logical address in the first write request where first data is to be written; Determining a first physical address corresponding to the first logical address according to the multi-level address mapping table; Writing first data according to the first physical address; And in response to the success of the first data writing, updating a root-level address mapping table in the multi-level address mapping table according to the first logical address, the first physical address and the adjacent idle physical address segments thereof, so as to add mapping information for mapping to the adjacent idle physical address segments in the root-level address mapping table. In one embodiment, determining a first logical address to be written for first data in a first write request includes: if the idle address segment state information corresponding to the multi-level address mapping table exists, determining a logic address in the idle address segment state information as a first logic address; If it is determined that the free address segment status information does not exist, a first logical address is allocated to the first write request according to the free logical address in the multi-level address mapping table. In one embodiment, the method further comprises: When the multi-level address mapping table meets the detection trigger condition, detecting whether an idle physical address segment exists in the multi-level address mapping table; In response to the existence of the idle physical address segment, acquiring a first logical address of the detected idle physical address segment; idle address segment status information is generated that contains the first logical address. In one embodiment, determining a first physical address corresponding to a first logical address according to a multi-level address mapping table includes: determining a root-level address mapping table as an initial address mapping table to be queried; The following steps are circularly performed until a first physical address is obtained: Determining a mapping result of the first logical address in an address mapping table to be queried; If the mapping result is the first physical address, ending the table look-up flow; if the mapping result is another address mapping table, the other address mapping table is determined to be a new address mapping table to be queried. In one embodiment, updating a root level address mapping table in the multi-level address mapping table according to the first logical address, the first physical address and the adjacent free physical address segments thereof comprises: Determining a target address mapping table containing a first physical address; determining a target data length according to the first physical address and the adjacent idle physical address segments thereof in response to the target address mapping table not being the root level address mapping table and the idle physical address segments adjacent to the first physical address existing in the target address mapping table; and adding a mapping relation among the first logical address, the first physical address and the target data length in the root-level address mapping table. In one embodiment, after updating the root level address mapping table in the multi-level address mapping table, the method further comprises: In response to receiving the seco