A method operable in a storage controller having a cache memory used by the controller to store write data associated with write requests received by the controller from an attached host, the controller further having multiple staging buffer memories each communicatively coupled with a corresponding flash memory device through a corresponding communication channel, the method comprising:
- detecting an impending power loss to the controller;
- responsive to detecting the impending power loss, performing the additional steps of:
- identifying all dirty data presently in the cache memory;
- dividing the identified dirty data into multiple segments each segment comprising a substantially similar number of blocks of dirty data, each segment associated with a corresponding staging buffer memory of the multiple staging buffer memories;
- for each segment, performing the additional steps of:
- storing a header block in the corresponding staging buffer memory, the header block comprising indicia of the number of blocks of dirty data in the segment that follow the header block;
- for each block of dirty data in the segment, performing the steps of:
- generating an error detection and correction code value corresponding with the block of dirty data;
- and
- appending the block of dirty data and the error detection and correction code value to the staging buffer memory;
- and
- copying the staging buffer memory to the corresponding flash memory device through the corresponding communication channel,
- wherein processing of the multiple segments substantially overlaps temporally.