Adjust to vxid changes in varnish-cache master

parent b1aa1fc5
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include "fellow_cache_storage.h" #include "fellow_cache_storage.h"
#include "fellow_tune.h" #include "fellow_tune.h"
#include "foreign/vend.h"
#ifdef TEST_DRIVER #ifdef TEST_DRIVER
#define FCERR_INJECT #define FCERR_INJECT
#endif #endif
...@@ -303,6 +305,7 @@ fcsc_next(struct fcscursor *c) ...@@ -303,6 +305,7 @@ fcsc_next(struct fcscursor *c)
// fdo_flags // fdo_flags
#define FDO_F_INLOG 1 #define FDO_F_INLOG 1
#define FDO_F_VXID64 2 // vxid uses 8 bytes
/* /*
* disk layout * disk layout
...@@ -743,6 +746,24 @@ fellow_disk_obj_check(const struct fellow_disk_obj *fdo, ...@@ -743,6 +746,24 @@ fellow_disk_obj_check(const struct fellow_disk_obj *fdo,
return (NULL); return (NULL);
} }
/*
* convert old formats to current
*/
static void
fellow_disk_obj_compat(struct fellow_disk_obj *fdo)
{
uint32_t vxid;
CHECK_OBJ_NOTNULL(fdo, FELLOW_DISK_OBJ_MAGIC);
if (fdo->fdo_flags & FDO_F_VXID64)
return;
vxid = vbe32dec(fdo->fa_vxid);
vbe64enc(fdo->fa_vxid, (uint64_t)vxid);
fdo->fdo_flags |= FDO_F_VXID64;
}
/* ============================================================ /* ============================================================
* cache obj * cache obj
*/ */
...@@ -1656,6 +1677,7 @@ fellow_busy_obj_alloc(struct fellow_cache *fc, ...@@ -1656,6 +1677,7 @@ fellow_busy_obj_alloc(struct fellow_cache *fc,
fdo->magic = FELLOW_DISK_OBJ_MAGIC; fdo->magic = FELLOW_DISK_OBJ_MAGIC;
fdo->version = 1; fdo->version = 1;
fdo->va_data_len = wsl; fdo->va_data_len = wsl;
fdo->fdo_flags = FDO_F_VXID64;
// disk obj init (allocation happened before) // disk obj init (allocation happened before)
fds = &fdo->fdo_fds; fds = &fdo->fdo_fds;
...@@ -3739,7 +3761,7 @@ fellow_busy_done(struct fellow_busy *fbo, struct objcore *oc, unsigned inlog) ...@@ -3739,7 +3761,7 @@ fellow_busy_done(struct fellow_busy *fbo, struct objcore *oc, unsigned inlog)
fellow_disk_seglist_fini(fco->seglist.fdsl); fellow_disk_seglist_fini(fco->seglist.fdsl);
AZ(fdo->fdo_flags); AZ(fdo->fdo_flags & FDO_F_INLOG);
AZ(fco->oc); AZ(fco->oc);
// XXX still needed with logstate? // XXX still needed with logstate?
if (inlog) { if (inlog) {
...@@ -4055,6 +4077,8 @@ fellow_cache_obj_get(struct fellow_cache *fc, ...@@ -4055,6 +4077,8 @@ fellow_cache_obj_get(struct fellow_cache *fc,
if (err != NULL) if (err != NULL)
goto err; goto err;
fellow_disk_obj_compat(fdo);
fdsl = (void *)((uint8_t *)fdo + sizeof *fdo + fdo->va_data_len); fdsl = (void *)((uint8_t *)fdo + sizeof *fdo + fdo->va_data_len);
assert(PAOK(fdsl)); assert(PAOK(fdsl));
// XXX load of folow-up seglists could be async // XXX load of folow-up seglists could be async
...@@ -4520,7 +4544,7 @@ iter_sha256(void *priv, unsigned flush, const void *ptr, ssize_t l) ...@@ -4520,7 +4544,7 @@ iter_sha256(void *priv, unsigned flush, const void *ptr, ssize_t l)
static const char * const oatest[OA__MAX] = { static const char * const oatest[OA__MAX] = {
[OA_LEN] = "lenlenle", [OA_LEN] = "lenlenle",
[OA_VXID] = "vxid", [OA_VXID] = "vxidvxid",
[OA_FLAGS] = "f", [OA_FLAGS] = "f",
[OA_GZIPBITS] = "gzipbitsgzipbitsgzipbitsgzipbits", [OA_GZIPBITS] = "gzipbitsgzipbitsgzipbitsgzipbits",
[OA_LASTMODIFIED] = "lastmodi", [OA_LASTMODIFIED] = "lastmodi",
......
...@@ -65,7 +65,7 @@ size_t fellow_rndup(const struct fellow_fd *ffd, size_t sz); ...@@ -65,7 +65,7 @@ size_t fellow_rndup(const struct fellow_fd *ffd, size_t sz);
buddy_t *fellow_dskbuddy(struct fellow_fd *ffd); buddy_t *fellow_dskbuddy(struct fellow_fd *ffd);
static void static void
mutate_to_sfeexp(struct objcore *oc, uint32_t xid); mutate_to_sfeexp(struct objcore *oc, vxid_t xid);
static vtim_real static vtim_real
sfe_ban_earliest_time(const uint8_t *banspec, unsigned len); sfe_ban_earliest_time(const uint8_t *banspec, unsigned len);
static vtim_real static vtim_real
...@@ -371,11 +371,11 @@ sfemem_objslim(struct worker *wrk, struct objcore *memoc) ...@@ -371,11 +371,11 @@ sfemem_objslim(struct worker *wrk, struct objcore *memoc)
{ {
const struct stevedore *stv = oc_stv(wrk, memoc); const struct stevedore *stv = oc_stv(wrk, memoc);
const struct stvfe *stvfe = stv_stvfe(stv); const struct stvfe *stvfe = stv_stvfe(stv);
uint32_t xid; vxid_t xid;
/* for drain, mutate to exp object */ /* for drain, mutate to exp object */
if (stvfe->shutdown && wrk->strangelove == (int)STVELOVE_IS_DRAIN) { if (stvfe->shutdown && wrk->strangelove == (int)STVELOVE_IS_DRAIN) {
xid = (uint32_t)ObjGetXID(wrk, memoc); xid = ObjGetXID(wrk, memoc);
sfemem_free(wrk, memoc); sfemem_free(wrk, memoc);
mutate_to_sfeexp(memoc, xid); mutate_to_sfeexp(memoc, xid);
...@@ -455,7 +455,7 @@ sfedsk_objslim(struct worker *wrk, struct objcore *dskoc) ...@@ -455,7 +455,7 @@ sfedsk_objslim(struct worker *wrk, struct objcore *dskoc)
/* for drain, mutate to exp object */ /* for drain, mutate to exp object */
if (stvfe->shutdown && wrk->strangelove == (int)STVELOVE_IS_DRAIN) { if (stvfe->shutdown && wrk->strangelove == (int)STVELOVE_IS_DRAIN) {
LRU_Remove(dskoc); LRU_Remove(dskoc);
mutate_to_sfeexp(dskoc, 42); mutate_to_sfeexp(dskoc, (struct vxids){42});
return; return;
} }
...@@ -861,7 +861,7 @@ static const void * v_matchproto_(objgetattr_f) ...@@ -861,7 +861,7 @@ static const void * v_matchproto_(objgetattr_f)
sfedsk_getattr(struct worker *wrk, struct objcore *dskoc, enum obj_attr attr, sfedsk_getattr(struct worker *wrk, struct objcore *dskoc, enum obj_attr attr,
ssize_t *slen) ssize_t *slen)
{ {
static const uint32_t zero = 0; static const struct vxids zero = {0};
if (attr != OA_VXID) if (attr != OA_VXID)
return (sfedsk_getattr_tomem(wrk, dskoc, attr, slen)); return (sfedsk_getattr_tomem(wrk, dskoc, attr, slen));
...@@ -997,7 +997,7 @@ sfeexp_objfree(struct worker *wrk, struct objcore *oc) ...@@ -997,7 +997,7 @@ sfeexp_objfree(struct worker *wrk, struct objcore *oc)
wrk->stats->n_object--; wrk->stats->n_object--;
} }
#define OA_VXID_LEN 4 #define OA_VXID_LEN 8
static const void * v_matchproto_(objgetattr_f) static const void * v_matchproto_(objgetattr_f)
sfeexp_getattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr, sfeexp_getattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
...@@ -1014,7 +1014,7 @@ sfeexp_getattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr, ...@@ -1014,7 +1014,7 @@ sfeexp_getattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
} }
static void static void
mutate_to_sfeexp(struct objcore *oc, uint32_t xid) mutate_to_sfeexp(struct objcore *oc, vxid_t xid)
{ {
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#ifdef FDO_FIXATTR #ifdef FDO_FIXATTR
FDO_FIXATTR(FLAGS, flags, 2, 1) FDO_FIXATTR(FLAGS, flags, 2, 1)
FDO_FIXATTR(LEN, len, 8, 8) FDO_FIXATTR(LEN, len, 8, 8)
FDO_FIXATTR(VXID, vxid, 8, 4) FDO_FIXATTR(VXID, vxid, 8, 8)
FDO_FIXATTR(LASTMODIFIED, lastmodified, 8, 8) FDO_FIXATTR(LASTMODIFIED, lastmodified, 8, 8)
FDO_FIXATTR(GZIPBITS, gzipbits, 32, 32) FDO_FIXATTR(GZIPBITS, gzipbits, 32, 32)
#undef FDO_FIXATTR #undef FDO_FIXATTR
......
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