Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/tarfs/tarfs_io.c
Show First 20 Lines • Show All 624 Lines • ▼ Show 20 Lines | tarfs_zio_init(struct tarfs_mount *tmp, off_t i, off_t o) | ||||
zio->idx = malloc(zio->szidx * sizeof(*zio->idx), M_TARFSZSTATE, | zio->idx = malloc(zio->szidx * sizeof(*zio->idx), M_TARFSZSTATE, | ||||
M_ZERO | M_WAITOK); | M_ZERO | M_WAITOK); | ||||
zio->curidx = 0; | zio->curidx = 0; | ||||
zio->nidx = 1; | zio->nidx = 1; | ||||
zio->idx[zio->curidx].i = zio->ipos = i; | zio->idx[zio->curidx].i = zio->ipos = i; | ||||
zio->idx[zio->curidx].o = zio->opos = o; | zio->idx[zio->curidx].o = zio->opos = o; | ||||
tmp->zio = zio; | tmp->zio = zio; | ||||
TARFS_DPF(ALLOC, "%s: allocated zio index\n", __func__); | TARFS_DPF(ALLOC, "%s: allocated zio index\n", __func__); | ||||
getnewvnode("tarfsz", tmp->vfs, &tarfs_znodeops, &zvp); | (void)getnewvnode("tarfsz", tmp->vfs, &tarfs_znodeops, &zvp); | ||||
imp: how do we know it's safe to ignore the return value here? | |||||
Done Inline ActionsThe last time getnewvnode() returned an error was in 1997. des: The last time `getnewvnode()` returned an error was in 1997. | |||||
Done Inline Actionsthat's a good reason... why is it still int? imp: that's a good reason... why is it still int? | |||||
Done Inline Actionsdes: Inertia, I guess? I'll leave it up to @kib or @mjg. | |||||
Not Done Inline ActionsI don't know what the original author was thinking. However, it should be clear that ultimately getnewvnode must be able to return an error and have it handled. The fact that not returning an error was introduced so long ago poses a massive problem fixing it. I think the pragmatic thing to do is to introduce a variant which *can* fail and incrementally patch filesystems to use it. Maybe i'll post smething next week. New filesystems should definitely NOT be ignoring the error. mjg: I don't know what the original author was thinking. However, it should be clear that ultimately… | |||||
zvp->v_data = zio; | zvp->v_data = zio; | ||||
zvp->v_type = VREG; | zvp->v_type = VREG; | ||||
zvp->v_mount = tmp->vfs; | zvp->v_mount = tmp->vfs; | ||||
vn_set_state(zvp, VSTATE_CONSTRUCTED); | vn_set_state(zvp, VSTATE_CONSTRUCTED); | ||||
tmp->znode = zvp; | tmp->znode = zvp; | ||||
TARFS_DPF(ZIO, "%s: created zio node\n", __func__); | TARFS_DPF(ZIO, "%s: created zio node\n", __func__); | ||||
return (zio); | return (zio); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |
how do we know it's safe to ignore the return value here?