fellow_disk_obj: Tighten assertions on alloc.ptr cast

parent 0242113e
......@@ -594,7 +594,7 @@ struct fellow_disk_obj {
// shaved off one pointer...
#define FCO_FCS(fco) (&(fco)->fdo_fcs)
#define FCO_FDO(fco) (void*)(fco)->fdo_fcs.alloc.ptr
#define FCO_FDO(fco) fellow_disk_obj(FCO_FCS(fco))
#define FCO_REFCNT(fco) (fco)->fdo_fcs.refcnt
#define FCO_STATE(fco) (fco)->fdo_fcs.state
......@@ -1018,11 +1018,12 @@ fellow_busy_io_submit(struct fellow_busy_io *fbio)
return (FC_ERRSTR("disk object wrong " x)); \
} while(0)
static struct fellow_disk_obj *
static inline struct fellow_disk_obj *
fellow_disk_obj(const struct fellow_cache_seg *fcs)
{
AN(fcs);
AN(fcs->alloc.ptr);
assert(FCOS_HIGH(fcs->state) == FCO_HIGH);
return (fcs->alloc.ptr);
}
......@@ -2167,7 +2168,7 @@ fellow_busy_obj_alloc(struct fellow_cache *fc,
fbo->segdskdowry = dskdowry;
// disk object in memory
fdo = fcs->alloc.ptr;
fdo = fellow_disk_obj(fcs);
memset(fdo, 0, fcs->alloc.size);
fdo->magic = FELLOW_DISK_OBJ_MAGIC;
fdo->version = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment