Skip to content

Commit

Permalink
Merge pull request #251 from truenas/NAS-125883
Browse files Browse the repository at this point in the history
NAS-125883 / 24.04 / Account for `pss_skipped` in scan progress
  • Loading branch information
themylogin authored Jan 17, 2024
2 parents 6eab53c + 362d1a5 commit 143b624
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libzfs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2626,6 +2626,11 @@ cdef class ZPoolScrub(object):
if self.stats != NULL:
return self.stats.pss_pass_issued

property bytes_skipped:
def __get__(self):
if self.stats != NULL:
return self.stats.pss_skipped

property pause:
def __get__(self):
if self.state == ScanState.SCANNING and self.stats.pss_pass_scrub_pause != 0:
Expand All @@ -2644,7 +2649,11 @@ cdef class ZPoolScrub(object):
if not self.bytes_to_scan:
return 0

return (<float>self.bytes_issued / <float>self.bytes_to_scan) * 100
bytes_total = self.bytes_to_scan - self.bytes_skipped
if bytes_total == 0:
return 0

return (<float>self.bytes_issued / <float>bytes_total) * 100

def asdict(self):
return {
Expand Down
1 change: 1 addition & 0 deletions pxd/zfs.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ cdef extern from "sys/fs/zfs.h" nogil:
uint64_t pss_end_time # scan end time
uint64_t pss_to_examine # total bytes to scan
uint64_t pss_examined # total bytes located by scanner
uint64_t pss_skipped # total bytes skipped by scanner
uint64_t pss_to_process # total bytes to process
uint64_t pss_processed # total processed bytes
uint64_t pss_errors # scan errors
Expand Down

0 comments on commit 143b624

Please sign in to comment.