Whamcloud - gitweb
LU-18803 lmv: add statfs stats to LMV device 32/58432/5
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 17 Mar 2025 08:11:33 +0000 (02:11 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 10 Apr 2025 06:58:11 +0000 (06:58 +0000)
Enable the statfs stats for LMV to show aggregate stats, including
the marged (minimum) os_namelen from all MDTs.

Merge os_state together from targets.  Merge "downgrade" flags if
any target has a problem, mask "upgrade" flags if any target does
not have this improvement.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I07451e65b04e5570a025bd9ff2e72f34a00273c7
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58432
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/llite/llite_lib.c
lustre/llite/lproc_llite.c
lustre/lmv/lmv_obd.c
lustre/lmv/lproc_lmv.c
lustre/lov/lov_request.c

index 09de932..1481235 100644 (file)
@@ -273,6 +273,10 @@ enum obd_statfs_state {
        OS_STATFS_ENOINO        = 0x00000040, /**< not enough inodes */
        OS_STATFS_SUM           = 0x00000100, /**< aggregated for all tagrets */
        OS_STATFS_NONROT        = 0x00000200, /**< non-rotational device */
+       OS_STATFS_DOWNGRADE     = OS_STATFS_DEGRADED | OS_STATFS_READONLY |
+                                 OS_STATFS_NOCREATE | OS_STATFS_ENOSPC |
+                                 OS_STATFS_ENOINO,
+       OS_STATFS_UPGRADE       = OS_STATFS_NONROT,
 };
 
 struct obd_statfs_state_name {
index 388f934..32d13f4 100644 (file)
@@ -2600,6 +2600,9 @@ int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs,
        /* do not update MDT os_namelen, OSTs do not store filenames */
        /* only update from OST os_maxbytes, DoM files are small */
        osfs->os_maxbytes = ost_osfs.os_maxbytes;
+       /* OR failure states, AND performance states */
+       osfs->os_state |= ost_osfs.os_state & ~OS_STATFS_DOWNGRADE;
+       osfs->os_state &= ost_osfs.os_state & OS_STATFS_UPGRADE;
 
        /* If we have _some_ OSTs, but don't have as many free objects on the
         * OSTs as inodes on the MDTs, reduce the reported number of inodes
index cdc2105..4b3d8de 100644 (file)
@@ -288,6 +288,7 @@ static ssize_t namelen_max_show(struct kobject *kobj, struct attribute *attr,
 {
        struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
                                              ll_kset.kobj);
+
        struct obd_statfs osfs;
        int rc;
 
index 618926d..17856fd 100644 (file)
@@ -1473,6 +1473,9 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
                                               temp->os_namelen);
                        osfs->os_maxbytes = min(osfs->os_maxbytes,
                                                temp->os_maxbytes);
+                       /* OR failure states, AND performance states */
+                       osfs->os_state |= temp->os_state & ~OS_STATFS_DOWNGRADE;
+                       osfs->os_state &= temp->os_state & OS_STATFS_UPGRADE;
                }
        }
        /* There is no stats from some MDTs, data incomplete */
index b44149c..85acd1f 100644 (file)
@@ -435,7 +435,7 @@ int lmv_tunables_init(struct obd_device *obd)
 #ifdef CONFIG_PROC_FS
        obd->obd_vars = lprocfs_lmv_obd_vars;
 #endif
-       rc = lprocfs_obd_setup(obd, true);
+       rc = lprocfs_obd_setup(obd, false);
        if (rc)
                goto out_failed;
 #ifdef CONFIG_PROC_FS
index 64c3d19..7f27bfc 100644 (file)
@@ -233,13 +233,18 @@ lov_statfs_update(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
                 *
                 * Currently using the sum capped at U64_MAX.
                 */
-               osfs->os_files = osfs->os_files + lov_sfs->os_files < osfs->os_files ?
+               osfs->os_files =
+                       osfs->os_files + lov_sfs->os_files < osfs->os_files ?
                        U64_MAX : osfs->os_files + lov_sfs->os_files;
-               osfs->os_ffree = osfs->os_ffree + lov_sfs->os_ffree < osfs->os_ffree ?
+               osfs->os_ffree =
+                       osfs->os_ffree + lov_sfs->os_ffree < osfs->os_ffree ?
                        U64_MAX : osfs->os_ffree + lov_sfs->os_ffree;
                osfs->os_namelen = min(osfs->os_namelen, lov_sfs->os_namelen);
                osfs->os_maxbytes = min(osfs->os_maxbytes,
                                        lov_sfs->os_maxbytes);
+               /* OR failure states, AND performance states */
+               osfs->os_state |= lov_sfs->os_state & ~OS_STATFS_DOWNGRADE;
+               osfs->os_state &= lov_sfs->os_state & OS_STATFS_UPGRADE;
        }
 }