A data writing method, wherein the method is applied to a computer system, the computer system comprises a file system and a flash memory-based storage system, and the method comprises: obtaining a target logical address, wherein the target logical address is an address allocated from a first logical block to target data to be written into the storage system, the first logical block is one of a plurality of logical blocks comprised in the file system, and the storage system comprises a plurality of physical blocks; determining that the target logical address belongs to the first logical block; and writing the target data into a first physical block based on a correspondence between the first logical block and the first physical block, wherein the first physical block is one of the plurality of physical blocks, wherein the method further comprises: obtaining mode information, wherein the mode information is determined based on an attribute of the target data, and if the attribute indicates that the target data is key data, the mode information indicates that the first logical block is in a first mode, or if the attribute indicates that the target data is non-key data, the mode information indicates that the first logical block is in a second mode; and setting a mode of the first physical block to be the same as a mode of the first logical block based on the mode information, wherein a speed of reading data from the first physical block in the first mode is greater than a speed of reading data from the first physical block in the second mode, wherein the first mode is a single-level cell, SLC, and the second mode is a triple-level cell, TLC, or a quadrilateral-level cell, QLC. obtaining a target logical address, wherein the target logical address is an address allocated from a first logical block to target data to be written into the storage system, the first logical block is one of a plurality of logical blocks comprised in the file system, and the storage system comprises a plurality of physical blocks; determining that the target logical address belongs to the first logical block; and writing the target data into a first physical block based on a correspondence between the first logical block and the first physical block, wherein the first physical block is one of the plurality of physical blocks, wherein the method further comprises: obtaining mode information, wherein the mode information is determined based on an attribute of the target data, and if the attribute indicates that the target data is key data, the mode information indicates that the first logical block is in a first mode, or if the attribute indicates that the target data is non-key data, the mode information indicates that the first logical block is in a second mode; and setting a mode of the first physical block to be the same as a mode of the first logical block based on the mode information, wherein a speed of reading data from the first physical block in the first mode is greater than a speed of reading data from the first physical block in the second mode, wherein the first mode is a single-level cell, SLC, and the second mode is a triple-level cell, TLC, or a quadrilateral-level cell, QLC. obtaining mode information, wherein the mode information is determined based on an attribute of the target data, and if the attribute indicates that the target data is key data, the mode information indicates that the first logical block is in a first mode, or if the attribute indicates that the target data is non-key data, the mode information indicates that the first logical block is in a second mode; and setting a mode of the first physical block to be the same as a mode of the first logical block based on the mode information, wherein a speed of reading data from the first physical block in the first mode is greater than a speed of reading data from the first physical block in the second mode, wherein the first mode is a single-level cell, SLC, and the second mode is a triple-level cell, TLC, or a quadrilateral-level cell, QLC.