A method for controlling a nonvolatile semiconductor memory including a plurality of regions, the regions including one or more first regions, a plurality of second regions different from the first regions, and a third region different from the second regions, the method comprising:
- receiving a write request from a host device, the write request designating a size of first data;
- performing a first operation of writing the first data to the first regions;
- performing a second operation of transferring second data stored in the second regions to the third region that stores no valid data and treating the second regions as free regions;
- and
- performing at least a part of the second operation during a period of time starting from the receiving of the write request and ending at a completion of the first operation of writing the first data.