Skip to content

Commit 468dfca

Browse files
Mikulas Patockasnitm
authored andcommitted
dm integrity: add a bitmap mode
Introduce an alternate mode of operation where dm-integrity uses a bitmap instead of a journal. If a bit in the bitmap is 1, the corresponding region's data and integrity tags are not synchronized - if the machine crashes, the unsynchronized regions will be recalculated. The bitmap mode is faster than the journal mode, because we don't have to write the data twice, but it is also less reliable, because if data corruption happens when the machine crashes, it may not be detected. Benchmark results for an SSD connected to a SATA300 port, when doing large linear writes with dd: buffered I/O: raw device throughput - 245MB/s dm-integrity with journaling - 120MB/s dm-integrity with bitmap - 238MB/s direct I/O with 1MB block size: raw device throughput - 248MB/s dm-integrity with journaling - 123MB/s dm-integrity with bitmap - 223MB/s For more info see dm-integrity in Documentation/device-mapper/ Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 8b3bbd4 commit 468dfca

File tree

2 files changed

+525
-33
lines changed

2 files changed

+525
-33
lines changed

Documentation/device-mapper/dm-integrity.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ mode it calculates and verifies the integrity tag internally. In this
2121
mode, the dm-integrity target can be used to detect silent data
2222
corruption on the disk or in the I/O path.
2323

24+
There's an alternate mode of operation where dm-integrity uses bitmap
25+
instead of a journal. If a bit in the bitmap is 1, the corresponding
26+
region's data and integrity tags are not synchronized - if the machine
27+
crashes, the unsynchronized regions will be recalculated. The bitmap mode
28+
is faster than the journal mode, because we don't have to write the data
29+
twice, but it is also less reliable, because if data corruption happens
30+
when the machine crashes, it may not be detected.
2431

2532
When loading the target for the first time, the kernel driver will format
2633
the device. But it will only format the device if the superblock contains
@@ -59,6 +66,10 @@ Target arguments:
5966
either both data and tag or none of them are written. The
6067
journaled mode degrades write throughput twice because the
6168
data have to be written twice.
69+
B - bitmap mode - data and metadata are written without any
70+
synchronization, the driver maintains a bitmap of dirty
71+
regions where data and metadata don't match. This mode can
72+
only be used with internal hash.
6273
R - recovery mode - in this mode, journal is not replayed,
6374
checksums are not checked and writes to the device are not
6475
allowed. This mode is useful for data recovery if the
@@ -150,6 +161,15 @@ block_size:number
150161
Supported values are 512, 1024, 2048 and 4096 bytes. If not
151162
specified the default block size is 512 bytes.
152163

164+
sectors_per_bit:number
165+
In the bitmap mode, this parameter specifies the number of
166+
512-byte sectors that corresponds to one bitmap bit.
167+
168+
bitmap_flush_interval:number
169+
The bitmap flush interval in milliseconds. The metadata buffers
170+
are synchronized when this interval expires.
171+
172+
153173
The journal mode (D/J), buffer_sectors, journal_watermark, commit_time can
154174
be changed when reloading the target (load an inactive table and swap the
155175
tables with suspend and resume). The other arguments should not be changed
@@ -174,6 +194,8 @@ The layout of the formatted block device:
174194
* flags
175195
SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used
176196
SB_FLAG_RECALCULATING - recalculating is in progress
197+
SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty
198+
blocks
177199
* log2(sectors per block)
178200
* a position where recalculating finished
179201
* journal

0 commit comments

Comments
 (0)