Method and apparatus for writing data

The present invention relates to a method and apparatus for writing data, comprising: determining a number of data blocks in a first set of data sub-blocks, each sub-block data stored in the first sub-set of data blocks are dirty data; when the first sub- set number of data blocks exceeds a threshold value, determining a second sub-set of data blocks, a second sub-set of data blocks is a first continuous sub-data sub-block stored in the data sub-block and the last dirty data are stored a set of data blocks; when the number of the second sub-set of data blocks does not exceed the threshold value, the second sub-data for each block in the first set of data blocks respectively generate write data request, the first memory write request data; if If the number of the second sub-set of the data block exceeds a threshold value, generating a second request to write data into data blocks, the second memory write request data. Method and apparatus for writing data to an embodiment of the present invention without reading the write data from the disk cache to reduce the pressure on the RAID reader.