Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174494458
D60269.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D60269.diff
View Options
diff --git a/stand/efi/boot1/zfs_module.c b/stand/efi/boot1/zfs_module.c
--- a/stand/efi/boot1/zfs_module.c
+++ b/stand/efi/boot1/zfs_module.c
@@ -140,7 +140,7 @@
{
spa_t *spa;
struct zfsmount zmount;
- dnode_phys_t dn;
+ zfs_dnode_t dn;
struct stat st;
uint64_t rootobj;
int err;
@@ -217,7 +217,7 @@
}
/* Only st_size is inspected here, so identity is irrelevant. */
- if ((err = zfs_dnode_stat(&zmount, &dn, &st, 0, 0)) != 0) {
+ if ((err = zfs_dnode_stat(&zmount, &dn.dnode, &st, 0, 0)) != 0) {
printf("Failed to stat '%s' on pool '%s' (%d)\n", filepath,
spa->spa_name, err);
return (EFI_INVALID_PARAMETER);
@@ -230,7 +230,7 @@
return (EFI_INVALID_PARAMETER);
}
- if ((err = dnode_read(spa, &dn, 0, buf, st.st_size)) != 0) {
+ if ((err = dnode_read(spa, &dn.dnode, 0, buf, st.st_size)) != 0) {
printf("Failed to read node from %s (%d)\n", spa->spa_name,
err);
free(buf);
diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c
--- a/stand/libsa/zfs/zfs.c
+++ b/stand/libsa/zfs/zfs.c
@@ -84,7 +84,7 @@
*/
struct file {
off_t f_seekp; /* seek pointer */
- dnode_phys_t f_dnode;
+ zfs_dnode_t f_dnode;
uint64_t f_objnum; /* object number (st_ino) */
uint64_t f_zap_type; /* zap type for readdir */
uint64_t f_num_leafs; /* number of fzap leaf blocks */
@@ -163,7 +163,7 @@
if (fp->f_seekp + n > sb.st_size)
n = sb.st_size - fp->f_seekp;
- rc = dnode_read(spa, &fp->f_dnode, fp->f_seekp, start, n);
+ rc = dnode_read(spa, &fp->f_dnode.dnode, fp->f_seekp, start, n);
if (rc)
return (rc);
@@ -218,7 +218,7 @@
struct zfsmount *zm = dev->d_opendata;
struct file *fp = (struct file *)f->f_fsdata;
- return (zfs_dnode_stat(zm, &fp->f_dnode, sb, zm->fsid_guid,
+ return (zfs_dnode_stat(zm, &fp->f_dnode.dnode, sb, zm->fsid_guid,
fp->f_objnum));
}
@@ -230,7 +230,7 @@
struct file *fp = (struct file *)f->f_fsdata;
mzap_ent_phys_t mze;
struct stat sb;
- size_t bsize = fp->f_dnode.dn_datablkszsec << SPA_MINBLOCKSHIFT;
+ size_t bsize = fp->f_dnode.dnode.dn_datablkszsec << SPA_MINBLOCKSHIFT;
int rc;
rc = zfs_stat(f, &sb);
@@ -243,7 +243,7 @@
* If this is the first read, get the zap type.
*/
if (fp->f_seekp == 0) {
- rc = dnode_read(spa, &fp->f_dnode,
+ rc = dnode_read(spa, &fp->f_dnode.dnode,
0, &fp->f_zap_type, sizeof(fp->f_zap_type));
if (rc)
return (rc);
@@ -251,7 +251,7 @@
if (fp->f_zap_type == ZBT_MICRO) {
fp->f_seekp = offsetof(mzap_phys_t, mz_chunk);
} else {
- rc = dnode_read(spa, &fp->f_dnode,
+ rc = dnode_read(spa, &fp->f_dnode.dnode,
offsetof(zap_phys_t, zap_num_leafs),
&fp->f_num_leafs,
sizeof(fp->f_num_leafs));
@@ -262,7 +262,7 @@
fp->f_zap_leaf = malloc(bsize);
if (fp->f_zap_leaf == NULL)
return (ENOMEM);
- rc = dnode_read(spa, &fp->f_dnode,
+ rc = dnode_read(spa, &fp->f_dnode.dnode,
fp->f_seekp,
fp->f_zap_leaf,
bsize);
@@ -276,7 +276,7 @@
if (fp->f_seekp >= bsize)
return (ENOENT);
- rc = dnode_read(spa, &fp->f_dnode,
+ rc = dnode_read(spa, &fp->f_dnode.dnode,
fp->f_seekp, &mze, sizeof(mze));
if (rc)
return (rc);
@@ -322,7 +322,7 @@
if (fp->f_seekp >= bsize * fp->f_num_leafs)
return (ENOENT);
- rc = dnode_read(spa, &fp->f_dnode,
+ rc = dnode_read(spa, &fp->f_dnode.dnode,
fp->f_seekp,
fp->f_zap_leaf,
bsize);
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
@@ -70,6 +70,11 @@
ZFS_SA_COUNT
};
+typedef union zfs_dnode {
+ dnode_phys_t dnode;
+ uint8_t bytes[DNODE_MAX_SIZE];
+} zfs_dnode_t;
+
struct zfsmount {
char *path;
const spa_t *spa;
@@ -183,6 +188,8 @@
void *value);
static int objset_get_dnode(const spa_t *, const objset_phys_t *, uint64_t,
dnode_phys_t *);
+static int objset_get_dnode_full(const spa_t *, const objset_phys_t *,
+ uint64_t, zfs_dnode_t *);
static int dnode_read(const spa_t *, const dnode_phys_t *, off_t, void *,
size_t);
static int vdev_indirect_read(vdev_t *, const blkptr_t *, void *, off_t,
@@ -3078,6 +3085,25 @@
dnode, sizeof(dnode_phys_t));
}
+static int
+objset_get_dnode_full(const spa_t *spa, const objset_phys_t *os,
+ uint64_t objnum, zfs_dnode_t *dnode)
+{
+ size_t size;
+ int error;
+
+ error = objset_get_dnode(spa, os, objnum, &dnode->dnode);
+ if (error != 0)
+ return (error);
+ size = ((size_t)dnode->dnode.dn_extra_slots + 1) << DNODE_SHIFT;
+ if (size > sizeof(*dnode))
+ return (EIO);
+ if (size == DNODE_MIN_SIZE)
+ return (0);
+ return (dnode_read(spa, &os->os_meta_dnode,
+ objnum << DNODE_SHIFT, dnode, size));
+}
+
/*
* Lookup a name in a microzap directory.
*/
@@ -4010,12 +4036,12 @@
*/
static int
zfs_lookup(struct zfsmount *mount, const char *upath,
- dnode_phys_t *dnode, uint64_t *objnum_out)
+ zfs_dnode_t *dnode_buf, uint64_t *objnum_out)
{
int rc;
uint64_t objnum;
const spa_t *spa;
- dnode_phys_t dn;
+ dnode_phys_t *dn = &dnode_buf->dnode;
const char *p, *q;
char element[256];
char path[1024];
@@ -4037,13 +4063,14 @@
/*
* Get the root directory dnode.
*/
- rc = objset_get_dnode(spa, &mount->objset, MASTER_NODE_OBJ, &dn);
+ rc = objset_get_dnode_full(spa, &mount->objset, MASTER_NODE_OBJ,
+ dnode_buf);
if (rc) {
free(entry);
return (rc);
}
- rc = zap_lookup(spa, &dn, ZFS_ROOT_OBJ, sizeof(objnum), 1, &objnum);
+ rc = zap_lookup(spa, dn, ZFS_ROOT_OBJ, sizeof(objnum), 1, &objnum);
if (rc) {
free(entry);
return (rc);
@@ -4051,13 +4078,15 @@
entry->objnum = objnum;
STAILQ_INSERT_HEAD(&on_cache, entry, entry);
- rc = objset_get_dnode(spa, &mount->objset, objnum, &dn);
+ rc = objset_get_dnode_full(spa, &mount->objset, objnum,
+ dnode_buf);
if (rc != 0)
goto done;
p = upath;
while (p && *p) {
- rc = objset_get_dnode(spa, &mount->objset, objnum, &dn);
+ rc = objset_get_dnode_full(spa, &mount->objset, objnum,
+ dnode_buf);
if (rc != 0)
goto done;
@@ -4097,14 +4126,14 @@
p = q;
/* Only st_mode is inspected here, so identity is irrelevant. */
- if ((rc = zfs_dnode_stat(mount, &dn, &sb, 0, 0)) != 0)
+ if ((rc = zfs_dnode_stat(mount, dn, &sb, 0, 0)) != 0)
goto done;
if (!S_ISDIR(sb.st_mode)) {
rc = ENOTDIR;
goto done;
}
- rc = zap_lookup(spa, &dn, element, sizeof (objnum), 1, &objnum);
+ rc = zap_lookup(spa, dn, element, sizeof (objnum), 1, &objnum);
if (rc)
goto done;
objnum = ZFS_DIRENT_OBJ(objnum);
@@ -4115,7 +4144,8 @@
}
entry->objnum = objnum;
STAILQ_INSERT_HEAD(&on_cache, entry, entry);
- rc = objset_get_dnode(spa, &mount->objset, objnum, &dn);
+ rc = objset_get_dnode_full(spa, &mount->objset, objnum,
+ dnode_buf);
if (rc)
goto done;
@@ -4123,7 +4153,7 @@
* Check for symlink.
*/
/* Only st_mode is inspected here, so identity is irrelevant. */
- rc = zfs_dnode_stat(mount, &dn, &sb, 0, 0);
+ rc = zfs_dnode_stat(mount, dn, &sb, 0, 0);
if (rc)
goto done;
if (S_ISLNK(sb.st_mode)) {
@@ -4143,7 +4173,7 @@
}
strcpy(&path[sb.st_size], p);
- rc = zfs_dnode_readlink(mount, &dn, path, sb.st_size);
+ rc = zfs_dnode_readlink(mount, dn, path, sb.st_size);
if (rc != 0)
goto done;
@@ -4169,7 +4199,6 @@
}
}
- *dnode = dn;
/*
* objnum tracks the object number of the dnode we just resolved (the
* loader's equivalent of the kernel's z_id/db_object); hand it back so
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 4, 4:56 PM (4 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40156000
Default Alt Text
D60269.diff (7 KB)
Attached To
Mode
D60269: Implemented large-dnode support for ZPL file lookups.
Attached
Detach File
Event Timeline
Log In to Comment