Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugins/wdc: fix json output for vs-nand-stats
Running nvme wdc vs-nand-stats will change the values of the user data fields depending on output format used. In regular stdout, the ordering is TLC min, TLC Max, SLC Min, SLC Max. However in json, the values get reassigned, what was SLC Min in stdout will become TLC > Regular format (TLC Min, TLC Max, SLC Min, SLC Max) [root@ /tmp/]# nvme wdc vs-nand-stats /dev/nvme0n1 | grep User\ Data User Data Erase Counts - TLC Min 169 User Data Erase Counts - TLC Max 310 User Data Erase Counts - SLC Min 10719 User Data Erase Counts - SLC Max 11676 Json format (SLC Min, SLC Max, TLC Min, TLC Max) [root@ /tmp/]# nvme wdc vs-nand-stats /dev/nvme0n1 -o json | grep User\ Data "User Data Erase Counts - SLC Min" : 169, "User Data Erase Counts - SLC Max" : 310, "User Data Erase Counts - TLC Min" : 10719, "User Data Erase Counts - TLC Max" : 11676, The difference can be traced to how the array subscripts are being used in the two output formats stdout : https://t.ly/sRIDz tlc_min == 0 tlc_max == 1 slc_min == 2 slc_max == 3 json : https://t.ly/pmU-m slc_min = 0 slc_max = 1 tlc_min = 2 tlc_max = 3 With the patch, we rename the fields to be the same for both stdout & json. Output comparison below Regular format (TLC Min, TLC Max, SLC Min, SLC Max) [root@ /tmp/]# ./nvme wdc vs-nand-stats /dev/nvme0n1 | grep User\ Data User Data Erase Counts - TLC Min 169 User Data Erase Counts - TLC Max 310 User Data Erase Counts - SLC Min 10719 User Data Erase Counts - SLC Max 11676 Json format (TLC Min, TLC Max, SLC Min, SLC Max) [root@ /tmp/]# ./nvme wdc vs-nand-stats /dev/nvme0n1 -o json | grep User\ Data "User Data Erase Counts - TLC Min":169, "User Data Erase Counts - TLC Max":310, "User Data Erase Counts - SLC Min":10719, "User Data Erase Counts - SLC Max":11676, Signed-off-by: Carl Moran<[email protected]>
- Loading branch information