mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
wipe: dev_set_bytes resolves zeroing
Since dev_write_zeros() is just subset of dev_set_bytes() use it directly and simplify code.
This commit is contained in:
parent
d588de77aa
commit
2b36542f41
@ -7641,6 +7641,7 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
||||
log_debug("Metadata logical volume %s will be fully zeroed.",
|
||||
display_lvname(lv));
|
||||
zero_sectors = lv->size;
|
||||
wp.zero_value = 0;
|
||||
} else {
|
||||
if (wp.is_metadata) /* Verbosely notify metadata will not be fully zeroed */
|
||||
log_verbose("Metadata logical volume %s not fully zeroed and may contain stale data.",
|
||||
@ -7657,11 +7658,7 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
||||
display_size(lv->vg->cmd, zero_sectors),
|
||||
display_lvname(lv), wp.zero_value);
|
||||
|
||||
if ((!wp.is_metadata &&
|
||||
wp.zero_value && !dev_set_bytes(dev, UINT64_C(0),
|
||||
(size_t) zero_sectors << SECTOR_SHIFT,
|
||||
(uint8_t)wp.zero_value)) ||
|
||||
!dev_write_zeros(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT)) {
|
||||
if (!dev_set_bytes(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT, wp.zero_value)) {
|
||||
label_scan_invalidate(dev);
|
||||
log_error("Failed to initialize %s of logical volume %s with value %d.",
|
||||
display_size(lv->vg->cmd, zero_sectors),
|
||||
|
Loading…
x
Reference in New Issue
Block a user