From: Darrick J. Wong <[email protected]>

Create an alias for the debugfs dir so that we can find a filesystem by
uuid.  Unless it's mounted nouuid.

Signed-off-by: Darrick J. Wong <[email protected]>
---
 fs/xfs/xfs_mount.h |    1 +
 fs/xfs/xfs_super.c |   11 +++++++++++
 2 files changed, 12 insertions(+)


diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 7cfd209404365..63649c259b9c5 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -235,6 +235,7 @@ typedef struct xfs_mount {
        uint64_t                m_resblks_save; /* reserved blks @ remount,ro */
        struct delayed_work     m_reclaim_work; /* background inode reclaim */
        struct dentry           *m_debugfs;     /* debugfs parent */
+       struct dentry           *m_debugfs_uuid; /* debugfs symlink */
        struct xfs_kobj         m_kobj;
        struct xfs_kobj         m_error_kobj;
        struct xfs_kobj         m_error_meta_kobj;
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 69f1c1d85edf6..29a53874490cc 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -768,6 +768,7 @@ xfs_mount_free(
        if (mp->m_ddev_targp)
                xfs_free_buftarg(mp->m_ddev_targp);
 
+       debugfs_remove(mp->m_debugfs_uuid);
        debugfs_remove(mp->m_debugfs);
        xfs_timestats_destroy(mp);
        kfree(mp->m_rtname);
@@ -1799,6 +1800,16 @@ xfs_fs_fill_super(
                goto out_unmount;
        }
 
+       if (xfs_debugfs && mp->m_debugfs && !xfs_has_nouuid(mp)) {
+               char    name[UUID_STRING_LEN + 1];
+
+               snprintf(name, UUID_STRING_LEN + 1, "%pU", &mp->m_sb.sb_uuid);
+               mp->m_debugfs_uuid = debugfs_create_symlink(name, xfs_debugfs,
+                               mp->m_super->s_id);
+       } else {
+               mp->m_debugfs_uuid = NULL;
+       }
+
        return 0;
 
  out_filestream_unmount:


Reply via email to