摘要 |
A method and apparatus for writing data, the method comprising: determining in a cache a first valid data block comprising a plurality of contiguous valid sectors where data is saved; determining in the first valid data block a second valid data block referring to a valid data block containing dirty sectors; determining in the second valid data block a target valid data block containing a plurality of pages, wherein any page contains dirty data; and writing the data in the target valid data block into a solid state disk (SSD). The number of clean sectors written into the SSD is reduced as much as possible, and therefore the volume of data written into the SSD is reduced to prolong the service life of the SSD. |