diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2021-04-27 17:57:06 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2021-04-30 20:01:39 +0200 |
commit | a9c0fda4c08292399e08db0a4b70bc161cd247b9 (patch) | |
tree | d7053cd514c1dcb5010ee3ba5c521fa64df6950b /drivers/md/dm-integrity.c | |
parent | dm raid: fix inconclusive reshape layout on fast raid4/5/6 table reload seque... (diff) | |
download | linux-a9c0fda4c08292399e08db0a4b70bc161cd247b9.tar.xz linux-a9c0fda4c08292399e08db0a4b70bc161cd247b9.zip |
dm integrity: don't re-write metadata if discarding same blocks
If we discard already discarded blocks we do not need to write discard
pattern to the metadata, because it is already there.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-integrity.c')
-rw-r--r-- | drivers/md/dm-integrity.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 6977422454a4..3b54b7f8c9b9 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -1429,8 +1429,10 @@ static int dm_integrity_rw_tag(struct dm_integrity_c *ic, unsigned char *tag, se 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 */ |