If we discard already discarded blocks, we do not need to write discard
filler to the metadata, because it is already there.

Signed-off-by: Mikulas Patocka <[email protected]>

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c
+++ linux-2.6/drivers/md/dm-integrity.c
@@ -1429,8 +1429,10 @@ static int dm_integrity_rw_tag(struct dm
                if (op == TAG_READ) {
                        memcpy(tag, dp, to_copy);
                } else if (op == TAG_WRITE) {
-                       memcpy(dp, tag, to_copy);
-                       dm_bufio_mark_partial_buffer_dirty(b, *metadata_offset, 
*metadata_offset + to_copy);
+                       if (memcmp(dp, tag, to_copy)) {
+                               memcpy(dp, tag, to_copy);
+                               dm_bufio_mark_partial_buffer_dirty(b, 
*metadata_offset, *metadata_offset + to_copy);
+                       }
                } else {
                        /* e.g.: op == TAG_CMP */
 

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to