We have implemented the Persistent Snapshot Driver Driver (PSDD) in Linux 2.2.5-15 as a separate module [7]. As discussed earlier, the pseudo layer will always exist, independent of whether the snapshot is on or off. The following pseudo code explains the request_fn of the pseudo device that implements snapshots.
psdd_request() { while (1) { get the request from the pseudo device queue; if request is snapshot block read { if mapping exists for this block read the block from the snapshot disk; else read the block from the original disk; continue; } if request is original block read { read the block from the original disk; continue; } if request is a write request { if mapping exists for this block write the block to the disk; else { read the block from disk; copy to the snapshot disk; update the map; write the block to the disk; } } } }