Whamcloud - gitweb
LU-14535 quota: improve quota output format
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 23 Mar 2024 01:28:42 +0000 (18:28 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 23 Mar 2024 20:29:48 +0000 (20:29 +0000)
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 <adilger@whamcloud.com>
Change-Id: I80fbd42dea865dff1d106724dbf69946d23ebbe5
Reviewed-by: Sergey Cheremencev <sergey.cheremencev@hpe.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/46332
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/quota/lproc_quota.c
lustre/tests/sanity-quota.sh

index 37c90f5..610ecae 100644 (file)
@@ -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,
index 45e5f47..f6bef6c 100755 (executable)
@@ -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"