Lines Matching +full:write +full:- +full:to +full:- +full:write
2 dm-log-writes
5 This target takes 2 devices, one to pass all IO to normally, and one to log all
6 of the write operations to. This is intended for file system developers wishing
7 to verify the integrity of metadata or data as the file system is written to.
8 There is a log_write_entry written for every WRITE request and the target is
9 able to take arbitrary data from userspace to insert into the log. The data
10 that is in the WRITE requests is copied into the log to make the replay happen
16 We log things in order of completion once we are sure the write is no longer in
17 cache. This means that normal WRITE requests are not actually logged until the
18 next REQ_PREFLUSH request. This is to make it easier for userspace to replay
19 the log in a way that correlates to what is on disk and not what is in cache,
20 to make it easier to detect improper waiting/flushing.
22 This works by attaching all WRITE requests to a list once the write completes.
25 completed WRITEs, at the time the REQ_PREFLUSH is issued, are added in order to
26 simulate the worst case scenario with regard to power failures. Consider the
27 following example (W means write, C means complete):
35 Again this is to simulate what is actually on disk, this allows us to detect
42 Any REQ_OP_DISCARD requests are treated like WRITE requests. Otherwise we would
43 have all the DISCARD requests, and then the WRITE requests and then the FLUSH
46 WRITE block 1, DISCARD block 1, FLUSH
50 DISCARD 1, WRITE 1, FLUSH
59 log-writes <dev_path> <log_dev_path>
62 dev_path Device that all of the IO will go to normally.
63 log_dev_path Device where the log entries are written to.
79 You can use a dmsetup message to set an arbitrary mark in a log.
80 For example say you want to fsck a file system after every
81 write, but first you need to replay up to the mkfs to make sure
85 mkfs.btrfs -f /dev/mapper/log
89 This would allow you to replay the log up to the mkfs mark and
93 Every log has a mark at the end labeled "dm-log-writes-end".
99 It can be found here: https://github.com/josefbacik/log-writes
104 Say you want to test fsync on your file system. You would do something like
107 TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc"
108 dmsetup create log --table "$TABLE"
109 mkfs.btrfs -f /dev/mapper/log
112 mount /dev/mapper/log /mnt/btrfs-test
115 md5sum /mnt/btrfs-test/foo
116 umount /mnt/btrfs-test
119 replay-log --log /dev/sdc --replay /dev/sdb --end-mark fsync
120 mount /dev/sdb /mnt/btrfs-test
121 md5sum /mnt/btrfs-test/foo
124 Another option is to do a complicated file system operation and verify the file
127 TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc"
128 dmsetup create log --table "$TABLE"
129 mkfs.btrfs -f /dev/mapper/log
132 mount /dev/mapper/log /mnt/btrfs-test
133 <fsstress to dirty the fs>
134 btrfs filesystem balance /mnt/btrfs-test
135 umount /mnt/btrfs-test
138 replay-log --log /dev/sdc --replay /dev/sdb --end-mark mkfs
140 replay-log --log /dev/sdc --replay /dev/sdb --start-mark mkfs \
141 --fsck "btrfsck /dev/sdb" --check fua
144 and if the fsck passes it will replay to the next FUA, until it is completed or