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 and a busy state; when a second duration has elapsed since the 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, 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 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. 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 and a busy state; when a second duration has elapsed since the 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, 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 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.