From a3c073f7ea8470c3fe9980112e85e91b15af6109 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 22 Mar 2024 18:28:42 -0700 Subject: [PATCH] LU-14535 quota: improve quota output format Make the output of the quota proc files more readable by removing needless whitespace that causes it to wrap over a single line. Lustre-change: https://review.whamcloud.com/43099 Lustre-commit: cd1847e73e5990ef797280846dc27fc0b0a876e9 [NOTE: missing changes to procfs output that change field names] Test-Parameters: trivial testlist=sanity-quota Test-Parameters: testlist=sanity-quota serverversion=EXA5 Signed-off-by: Andreas Dilger Change-Id: I80fbd42dea865dff1d106724dbf69946d23ebbe5 Reviewed-by: Sergey Cheremencev Reviewed-by: Hongchao Zhang Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/46332 Tested-by: jenkins Tested-by: Maloo --- lustre/quota/lproc_quota.c | 4 ++-- lustre/tests/sanity-quota.sh | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lustre/quota/lproc_quota.c b/lustre/quota/lproc_quota.c index 37c90f5..610ecae 100644 --- a/lustre/quota/lproc_quota.c +++ b/lustre/quota/lproc_quota.c @@ -249,12 +249,12 @@ static int lprocfs_quota_seq_show(struct seq_file *p, void *v) seq_printf(p, "- %-8s %llu\n", "id:", *((__u64 *)key)); if (fid_is_acct(fid)) - seq_printf(p, " %-8s { inodes: %20llu, kbytes: %20llu }\n", "usage:", + seq_printf(p, " %-8s { inodes: %12llu, kbytes: %12llu }\n", "usage:", ((struct lquota_acct_rec *)rec)->ispace, toqb(((struct lquota_acct_rec *)rec)->bspace)); else if (fid_seq(fid) == FID_SEQ_QUOTA_GLB || fid_seq(fid) == FID_SEQ_LOCAL_NAME) - seq_printf(p, " %-8s { hard: %20llu, soft: %20llu, granted: %20llu, time: %20llu }\n", + seq_printf(p, " %-8s { hard: %12llu, soft: %12llu, granted: %12llu, time: %15llu }\n", "limits:", ((struct lquota_glb_rec *)rec)->qbr_hardlimit, ((struct lquota_glb_rec *)rec)->qbr_softlimit, diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 45e5f47..f6bef6c 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -127,17 +127,20 @@ resetquota() { quota_scan() { local local_ugp=$1 local local_id=$2 + local count if [ "$local_ugp" == "a" -o "$local_ugp" == "u" ]; then $LFS quota -v -u $local_id $DIR - log "Files for user ($local_id):" + count=$($LFS find --user $local_id $DIR | wc -l) + log "Files for user ($local_id), count=$count:" ($LFS find --user $local_id $DIR | head -n 4 | xargs stat 2>/dev/null) fi if [ "$local_ugp" == "a" -o "$local_ugp" == "g" ]; then $LFS quota -v -g $local_id $DIR - log "Files for group ($local_id):" + count=$($LFS find --group $local_id $DIR | wc -l) + log "Files for group ($local_id), count=$count:" ($LFS find --group $local_id $DIR | head -n 4 | xargs stat 2>/dev/null) fi @@ -145,7 +148,8 @@ quota_scan() { is_project_quota_supported || return 0 if [ "$local_ugp" == "a" -o "$local_ugp" == "p" ]; then $LFS quota -v -p $TSTPRJID $DIR - log "Files for project ($TSTPRJID):" + count=$($LFS find --projid $local_id $DIR | wc -l) + log "Files for project ($local_id), count=$count:" ($LFS find --projid $TSTPRJID $DIR | head -n 4 | xargs stat 2>/dev/null) fi @@ -1241,11 +1245,13 @@ test_2() { local testfile="$DIR/$tdir/$tfile-0" local least_qunit=$(do_facet mds1 $LCTL get_param -n \ qmt.$FSNAME-QMT0000.md-0x0.info | - awk '/least qunit/{ print $3 }') + sed -e 's/least qunit/least_qunit/' | + awk '/least_qunit/{ print $2 }') local limit [ "$SLOW" = "no" ] && limit=$((least_qunit * 2)) || limit=$((least_qunit * 1024)) + echo "least_qunit: '$least_qunit', limit: '$limit'" local free_inodes=$(mdt_free_inodes 0) echo "$free_inodes free inodes on master MDT" -- 1.8.3.1