Skip to content

Commit

Permalink
Minor code cleanups in arc_python.py
Browse files Browse the repository at this point in the history
Remove unused library re and associated variable kstat_pobj. Add note
to documentation at start of program about required support for old
versions of Python. Change variable "format" (which is a built-in
function) to "fmt".

Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Scot W. Stevenson <[email protected]>
Closes openzfs#6869
  • Loading branch information
scotws authored and Nasf-Fan committed Jan 29, 2018
1 parent 1881cc0 commit 7399bf2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/arc_summary/arc_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#
# If you are having troubles when using this script from cron(8) please try
# adjusting your PATH before reporting problems.
#
# Note some of this code uses older code (eg getopt instead of argparse,
# subprocess.Popen() instead of subprocess.run()) because we need to support
# some very old versions of Python.
"""Print statistics on the ZFS Adjustable Replacement Cache (ARC)
Provides basic information on the ARC, its efficiency, the L2ARC (if present),
Expand All @@ -41,7 +45,6 @@

import getopt
import os
import re
import sys
import time

Expand All @@ -50,7 +53,6 @@

show_tunable_descriptions = False
alternate_tunable_layout = False
kstat_pobj = re.compile("^([^:]+):\s+(.+)\s*$", flags=re.M)


def get_Kstat():
Expand Down Expand Up @@ -911,9 +913,9 @@ def _tunable_summary(Kstat):
names.sort()

if alternate_tunable_layout:
format = "\t%s=%s\n"
fmt = "\t%s=%s\n"
else:
format = "\t%-50s%s\n"
fmt = "\t%-50s%s\n"

for name in names:

Expand All @@ -923,7 +925,7 @@ def _tunable_summary(Kstat):
if show_tunable_descriptions and name in descriptions:
sys.stdout.write("\t# %s\n" % descriptions[name])

sys.stdout.write(format % (name, values[name]))
sys.stdout.write(fmt % (name, values[name]))


unSub = [
Expand Down

0 comments on commit 7399bf2

Please sign in to comment.