[COMMIT osv master] zfs: modify fsid_guid to store extra bits to allow detecting ZFS in pagecache

5 views
Skip to first unread message

Commit Bot

unread,
Apr 27, 2020, 9:36:16 PM4/27/20
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

zfs: modify fsid_guid to store extra bits to allow detecting ZFS in pagecache

This patch slightly modifies logic in zfs_domount() to put
ZFS identifier into the 8 highest bits of vfs_fsid field.
This will allow us to detect file system type in pagecache logic.

Please note that vfs_fsid field is used to source st_dev value
in ZFS getattr() function. The combination of st_dev and ino is used
to uniquely identify files in pagecache implementation logic.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c b/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
--- a/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
+++ b/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
@@ -61,6 +61,7 @@
#include <sys/dmu_objset.h>
#include <sys/spa_boot.h>
#include "zfs_comutil.h"
+#include <fs/vfs/vfs_id.h>

#if notyet
struct mtx zfs_debug_mtx;
@@ -1009,7 +1010,7 @@ zfs_domount(vfs_t *vfsp, const char *osname)
ASSERT((fsid_guid & ~((1ULL<<56)-1)) == 0);
vfsp->vfs_fsid.__val[0] = fsid_guid;
/* fsid type not included */
- vfsp->vfs_fsid.__val[1] = fsid_guid >> 32;
+ vfsp->vfs_fsid.__val[1] = (ZFS_ID | fsid_guid) >> 32;

/*
* Set features for file system.
diff --git a/fs/vfs/vfs_id.h b/fs/vfs/vfs_id.h
--- a/fs/vfs/vfs_id.h
+++ b/fs/vfs/vfs_id.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2020 Waldemar Kozaczuk
+ *
+ * This work is open source software, licensed under the terms of the
+ * BSD license as described in the LICENSE file in the top-level directory.
+ */
+
+#ifndef _VFS_ID_H
+#define _VFS_ID_H
+
+#define RAMFS_ID (1ULL<<56)
+#define DEVFS_ID (2ULL<<56)
+#define NFS_ID (3ULL<<56)
+#define PROCFS_ID (4ULL<<56)
+#define SYSFS_ID (5ULL<<56)
+#define ZFS_ID (6ULL<<56)
+#define ROFS_ID (7ULL<<56)
+#define VIRTIOFS_ID (8ULL<<56)
+
+#endif /* !_VFS_ID_H */
Reply all
Reply to author
Forward
0 new messages