Patent ID: 8417909

Claim:
A data writing method, for writing data from a host system into a plurality of physical blocks of a flash memory chip, the data writing method comprising: grouping the physical blocks into a plurality of physical units; grouping a portion of the physical units into a data area and a spare area; configuring a plurality of logical units, wherein each of the logical units maps one of the physical units of the data area; grouping the logical units into a plurality of logical unit groups; configuring another portion of the physical units as a plurality of global random physical units corresponding to the logical unit groups, wherein each of the global random physical units corresponds to one of the logical unit groups; receiving first data, wherein the first data corresponds to a first logical unit among the logical units, the first logical unit belongs to a first logical unit group among the logical unit groups and a first global random physical unit among the global random physical units corresponds to the first logical unit group; determining whether the first data is small data and whether the first logical unit is at an opened mother-child unit state; getting a physical unit from the physical units of the spare area as a child physical unit of the physical unit mapped to the first logical unit and writing the first data into the child physical unit when the first data is not the small data and the first logical unit is not at the opened mother-child unit state; writing the first data into the child physical unit of the physical unit mapped the first logical unit when the first logical unit is at the opened mother-child unit state; determining whether the first global random physical unit is full when the first data is the small data and the first logical unit is not at the opened mother-child unit state; getting a physical unit from the physical units of the spare area as a first global random substitute physical unit for substituting the first global random physical unit and temporarily storing the first data into the first global random substitute physical unit when the first global random physical unit is full; and temporarily storing the first data into the first global random physical unit when the first global random physical unit is not full, wherein the child physical unit for substituting the physical unit mapped to the first logical unit is written only with data belonging to the first logical unit, and the first global random physical unit and the first global random substitute physical unit are written with data belonging to a plurality of logical units of the first logical unit group.