Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174491575
D60264.id188501.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D60264.id188501.diff
View Options
diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c
--- a/stand/libsa/zfs/zfsimpl.c
+++ b/stand/libsa/zfs/zfsimpl.c
@@ -43,12 +43,43 @@
extern int zstd_init(void);
#endif
+enum zfs_sa_attr_id {
+ ZFS_SA_ATIME,
+ ZFS_SA_MTIME,
+ ZFS_SA_CTIME,
+ ZFS_SA_CRTIME,
+ ZFS_SA_GEN,
+ ZFS_SA_MODE,
+ ZFS_SA_SIZE,
+ ZFS_SA_PARENT,
+ ZFS_SA_LINKS,
+ ZFS_SA_XATTR,
+ ZFS_SA_RDEV,
+ ZFS_SA_FLAGS,
+ ZFS_SA_UID,
+ ZFS_SA_GID,
+ ZFS_SA_PAD,
+ ZFS_SA_ZNODE_ACL,
+ ZFS_SA_DACL_COUNT,
+ ZFS_SA_SYMLINK,
+ ZFS_SA_SCANSTAMP,
+ ZFS_SA_DACL_ACES,
+ ZFS_SA_DXATTR,
+ ZFS_SA_PROJID,
+ ZFS_SA_SEQ,
+ ZFS_SA_COUNT
+};
+
struct zfsmount {
char *path;
const spa_t *spa;
objset_phys_t objset;
uint64_t rootobj;
uint64_t fsid_guid; /* mount's ds_fsid_guid */
+ dnode_phys_t sa_registry;
+ dnode_phys_t sa_layouts;
+ uint64_t sa_attrs[ZFS_SA_COUNT];
+ bool sa_loaded;
STAILQ_ENTRY(zfsmount) next;
};
@@ -3519,6 +3550,7 @@
{
mount->spa = spa;
+ mount->sa_loaded = false;
/*
* Find the root object set if not explicitly provided
@@ -3713,6 +3745,90 @@
return (rc);
}
+struct zfs_sa_attr {
+ const char *name;
+ uint16_t length;
+};
+
+static const struct zfs_sa_attr zfs_sa_attrs[ZFS_SA_COUNT] = {
+ [ZFS_SA_ATIME] = { "ZPL_ATIME", 16 },
+ [ZFS_SA_MTIME] = { "ZPL_MTIME", 16 },
+ [ZFS_SA_CTIME] = { "ZPL_CTIME", 16 },
+ [ZFS_SA_CRTIME] = { "ZPL_CRTIME", 16 },
+ [ZFS_SA_GEN] = { "ZPL_GEN", 8 },
+ [ZFS_SA_MODE] = { "ZPL_MODE", 8 },
+ [ZFS_SA_SIZE] = { "ZPL_SIZE", 8 },
+ [ZFS_SA_PARENT] = { "ZPL_PARENT", 8 },
+ [ZFS_SA_LINKS] = { "ZPL_LINKS", 8 },
+ [ZFS_SA_XATTR] = { "ZPL_XATTR", 8 },
+ [ZFS_SA_RDEV] = { "ZPL_RDEV", 8 },
+ [ZFS_SA_FLAGS] = { "ZPL_FLAGS", 8 },
+ [ZFS_SA_UID] = { "ZPL_UID", 8 },
+ [ZFS_SA_GID] = { "ZPL_GID", 8 },
+ [ZFS_SA_PAD] = { "ZPL_PAD", 32 },
+ [ZFS_SA_ZNODE_ACL] = { "ZPL_ZNODE_ACL", 88 },
+ [ZFS_SA_DACL_COUNT] = { "ZPL_DACL_COUNT", 8 },
+ [ZFS_SA_SYMLINK] = { "ZPL_SYMLINK", 0 },
+ [ZFS_SA_SCANSTAMP] = { "ZPL_SCANSTAMP", 32 },
+ [ZFS_SA_DACL_ACES] = { "ZPL_DACL_ACES", 0 },
+ [ZFS_SA_DXATTR] = { "ZPL_DXATTR", 0 },
+ [ZFS_SA_PROJID] = { "ZPL_PROJID", 8 },
+ [ZFS_SA_SEQ] = { "ZPL_SEQ", 8 },
+};
+
+#define ZFS_SA_MAX_ATTRS 256
+
+static int
+zfs_sa_load(struct zfsmount *mount)
+{
+ dnode_phys_t master, sa_master;
+ uint64_t sa_object, registry, layouts;
+ int error;
+
+ if (mount->sa_loaded)
+ return (0);
+
+ error = objset_get_dnode(mount->spa, &mount->objset, MASTER_NODE_OBJ,
+ &master);
+ if (error != 0)
+ return (error);
+ error = zap_lookup(mount->spa, &master, ZFS_SA_ATTRS,
+ sizeof(sa_object), 1, &sa_object);
+ if (error != 0)
+ return (error);
+ error = objset_get_dnode(mount->spa, &mount->objset, sa_object,
+ &sa_master);
+ if (error != 0)
+ return (error);
+ error = zap_lookup(mount->spa, &sa_master, SA_REGISTRY,
+ sizeof(registry), 1, ®istry);
+ if (error != 0)
+ return (error);
+ error = zap_lookup(mount->spa, &sa_master, SA_LAYOUTS,
+ sizeof(layouts), 1, &layouts);
+ if (error != 0)
+ return (error);
+ error = objset_get_dnode(mount->spa, &mount->objset, registry,
+ &mount->sa_registry);
+ if (error != 0)
+ return (error);
+ error = objset_get_dnode(mount->spa, &mount->objset, layouts,
+ &mount->sa_layouts);
+ if (error != 0)
+ return (error);
+
+ for (unsigned int i = 0; i < nitems(zfs_sa_attrs); i++) {
+ error = zap_lookup(mount->spa, &mount->sa_registry,
+ zfs_sa_attrs[i].name, sizeof(mount->sa_attrs[i]), 1,
+ &mount->sa_attrs[i]);
+ if (error != 0)
+ mount->sa_attrs[i] = UINT64_MAX;
+ }
+
+ mount->sa_loaded = true;
+ return (0);
+}
+
static int
zfs_dnode_stat(struct zfsmount *mount, dnode_phys_t *dn, struct stat *sb,
uint64_t fsid_guid, uint64_t objnum)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 4, 4:25 PM (18 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40152187
Default Alt Text
D60264.id188501.diff (3 KB)
Attached To
Mode
D60264: stand: Load dynamic system attribute offsets
Attached
Detach File
Event Timeline
Log In to Comment