Patent ID: 7937529

Claim:
A method for detecting frequent improper removals of a memory stick in a port and changing writing policies to prevent data loss in the memory stick, the method comprising: detecting a plurality of insertions of the memory stick; detecting a plurality of removals of the memory stick; tracking a number of times the memory stick has been docked when removed; tracking a number of times the memory stick has been undocked when removed; determining a removal ratio of times the memory has been removed when docked to the number of times the memory stick has been removed when undocked; comparing the removal ratio to a predetermined threshold; in response to the removal ratio being below the predetermined threshold, caching writes and directory updates, and committing the writes and directory updates to the memory stick when required by a respective application and when the memory stick is undocked; and in response to the removal ratio being equal to or above the predetermined threshold, flushing all writes and updates to the memory stick at a predetermined time.