US 12,293,078 B2
Storage space organization method and electronic device
Dachen Jin, Shenzhen (CN); and Jian Dang, Shenzhen (CN)
Assigned to Honor Device Co., Ltd., Shenzhen (CN)
Appl. No. 18/552,295
Filed by Honor Device Co., Ltd., Shenzhen (CN)
PCT Filed Apr. 19, 2023, PCT No. PCT/CN2023/089219
§ 371(c)(1), (2) Date Sep. 25, 2023,
PCT Pub. No. WO2024/007678, PCT Pub. Date Jan. 11, 2024.
Claims priority of application No. 202210776818.7 (CN), filed on Jul. 4, 2022.
Prior Publication US 2025/0085850 A1, Mar. 13, 2025
Int. Cl. G06F 3/06 (2006.01)
CPC G06F 3/0608 (2013.01) [G06F 3/0638 (2013.01); G06F 3/0679 (2013.01)] 13 Claims
OG exemplary drawing
 
1. A storage space organization method, wherein the method is applied to an electronic device, a kernel of the electronic device comprises a file system and a block layer, and the method comprises:
monitoring, by the electronic device, input/output ports (IOs) through the block layer, and determining, by the block layer when there is IO release, whether all the IOs have been released, wherein when all the IOs have been released, the electronic device updates a state of the file system to an idle state through the block layer, to trigger the electronic device to perform first garbage collection processing through the file system, and the state of the file system comprises the idle state or a busy state;
when a second duration has elapsed since a last garbage collection detection, triggering, by the electronic device through the file system, garbage collection detection and determining whether a garbage collection condition is met; and performing, by the electronic device when the garbage collection condition is met, the first garbage collection processing through the file system, wherein the garbage collection condition is that the state of the file system is the idle state and all the IOs of the block layer have been released; and
updating, by the electronic device, the state of the file system to the idle state through the block layer, and triggering, by the file system after a first duration, garbage collection detection and determining whether the garbage collection condition is met; and performing, by the electronic device when the garbage collection condition is met, the first garbage collection processing through the file system, wherein
a duration between the file system triggering the garbage collection detection after the first duration and the last garbage collection detection is less than the second duration.