fellow_cache: Use new fdo pointer (but no change yet)

parent 720e576c
......@@ -345,7 +345,6 @@ static inline uint16_t \
SEGLIST_FIT_FUNC(disk)
//struct fellow_disk_obj;
struct fellow_cache_obj;
struct fellow_cache_seg {
uint16_t magic;
......@@ -1087,10 +1086,12 @@ fellow_busy_io_submit(struct fellow_busy_io *fbio)
static inline struct fellow_disk_obj *
fellow_disk_obj(const struct fellow_cache_seg *fcs)
{
AN(fcs);
AN(fcs->alloc.ptr);
CHECK_OBJ_NOTNULL(fcs, FELLOW_CACHE_SEG_MAGIC);
assert(FCOS_HIGH(fcs->state) == FCO_HIGH);
return (fcs->alloc.ptr);
if (fcs->alloc.ptr != NULL)
assert(fcs->alloc.ptr == fcs->u.fco_fdo);
return (fcs->u.fco_fdo);
}
static const char *
......@@ -1180,16 +1181,18 @@ fellow_disk_obj_trim(const struct fellow_cache *fc,
mem = buddy_alloc1_ptr_extent_wait(fc->membuddy,
FEP_SPCPRI, trim_sz, 0);
if (mem.ptr) {
memcpy(mem.ptr, fcs->alloc.ptr, trim_sz);
memcpy(mem.ptr, fdo, trim_sz);
buddy_return1_ptr_extent(fc->membuddy,
&fcs->alloc);
fcs->alloc = mem;
fcs->u.fco_fdo = mem.ptr;
break;
}
}
/* FALLTHROUGH */
case FCO_WRITING:
buddy_trim1_ptr_extent(fc->membuddy, &fcs->alloc, trim_sz);
assert(fdo == fcs->alloc.ptr);
break;
default:
WRONG("fcs->state to call fellow_disk_obj_trim()");
......@@ -1402,9 +1405,12 @@ assert_cache_seg_consistency(const struct fellow_cache_seg *fcs)
AN(fcs->alloc.ptr); \
AN(fcs->alloc.size); \
} while(0)
#define FCOA_MEM do { \
AN(fcs->alloc.ptr); \
AN(fcs->alloc.size); \
#define FCOA_MEM do { \
/* can be NULL for embedded fdo */ \
if (fcs->alloc.ptr != NULL) { \
AN(fcs->alloc.size); \
assert(fcs->alloc.ptr == fcs->u.fco_fdo); \
} \
} while(0)
#define FDSA_NULL AZ(fcs->disk_seg)
#define FDSA_MAY CHECK_OBJ_ORNULL(fcs->disk_seg, FELLOW_DISK_SEG_MAGIC)
......@@ -2156,6 +2162,7 @@ fellow_cache_obj_new(
fellow_cache_seg_init(fcs, fco, FCO_INIT);
fcs->alloc = fdo_mem;
fcs->u.fco_fdo = fdo;
return (FCR_OK(fco));
err:
......
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