libzfs: import: zpool_clear_label: bool for boolean status
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13304
This commit is contained in:
parent
74e4bfbcff
commit
0dd34a1955
|
@ -138,8 +138,8 @@ zpool_clear_label(int fd)
|
|||
int l;
|
||||
vdev_label_t *label;
|
||||
uint64_t size;
|
||||
int labels_cleared = 0;
|
||||
boolean_t clear_l2arc_header = B_FALSE, header_cleared = B_FALSE;
|
||||
boolean_t labels_cleared = B_FALSE, clear_l2arc_header = B_FALSE,
|
||||
header_cleared = B_FALSE;
|
||||
|
||||
if (fstat64_blk(fd, &statbuf) == -1)
|
||||
return (0);
|
||||
|
@ -198,9 +198,8 @@ zpool_clear_label(int fd)
|
|||
size_t label_size = sizeof (vdev_label_t) - (2 * VDEV_PAD_SIZE);
|
||||
|
||||
if (pwrite64(fd, label, label_size, label_offset(size, l) +
|
||||
(2 * VDEV_PAD_SIZE)) == label_size) {
|
||||
labels_cleared++;
|
||||
}
|
||||
(2 * VDEV_PAD_SIZE)) == label_size)
|
||||
labels_cleared = B_TRUE;
|
||||
}
|
||||
|
||||
if (clear_l2arc_header) {
|
||||
|
@ -214,10 +213,7 @@ zpool_clear_label(int fd)
|
|||
|
||||
free(label);
|
||||
|
||||
if (labels_cleared == 0)
|
||||
return (-1);
|
||||
|
||||
if (clear_l2arc_header && !header_cleared)
|
||||
if (!labels_cleared || (clear_l2arc_header && !header_cleared))
|
||||
return (-1);
|
||||
|
||||
return (0);
|
||||
|
|
Loading…
Reference in New Issue