diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2023-04-24 23:58:21 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2023-04-25 00:12:31 +0200 |
commit | 8947964f10499cf286985da37973cdbcaff9d7f1 (patch) | |
tree | 63bf3fe9b993c4c5870b69a25aee8c590f75ad84 | |
parent | 31cfcf7ce9aab5dd16ba15e48bfe33be849fad4c (diff) | |
download | lvm2-8947964f10499cf286985da37973cdbcaff9d7f1.tar.gz |
wipe_lv: use zeroing ioctl only for large sizes
There is no easy way to detect, whether device supports zeroing,
and kernel also zeroes device when it's not directly supported,
but with extra message:
operation not supported error, dev X, sector Y op 0x9:(WRITE_ZEROES)...
So to avoid generating such message with every 'lvcreate', use for
zeroing of upto 8K just standard write of zeroed page.
(maybe we can go with even larger sizes).
-rw-r--r-- | lib/metadata/lv_manip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 2a4e0e88a..762a65785 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -8718,7 +8718,7 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp) display_lvname(lv), wp.zero_value); #ifdef HAVE_BLKZEROOUT - if (!test_mode() && !wp.zero_value) { + if (!test_mode() && !wp.zero_value && (zero_sectors > 16)) { /* TODO: maybe integrate with bcache_zero_set() */ const uint64_t end = zero_sectors << SECTOR_SHIFT; uint64_t range[2] = { 0, 1024 * 1024 }; /* zeroing with 1M steps (for better ^C support) */ |