vlserver: Add flags to extent address entries
authorSimon Wilkinson <sxw@your-file-system.com>
Mon, 23 May 2011 05:24:09 +0000 (06:24 +0100)
committerDerrick Brashear <shadow@dementia.org>
Sun, 5 Jun 2011 14:07:40 +0000 (07:07 -0700)
Add a "flags" field to the extent address entry so that we can store
per server bit flag information. Rename the header flags feel (and
corresponding macro) so that it's explicitly a header flag. Take
this opportunity to also fix this comment to clarify that the header
flags are not a copy of anything from the vlentry, but that they
must be at the same structure offset as the vlentry flags field (so
that something accessing an extent block as if it was a vlentry can
see what it is from the flags)

Change-Id: If8a4816418d9400fb971679c08b4777e7d83c983
Reviewed-on: http://gerrit.openafs.org/4776
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/vlserver/cnvldb.c
src/vlserver/vldb_check.c
src/vlserver/vlserver.p.h
src/vlserver/vlutils.c

index bbbb514..85cde3e 100644 (file)
@@ -399,7 +399,7 @@ read_mhentries(afs_uint32 mh_addr, int oldfd)
     }
 
     /* Verify that this block is the right one */
-    if (ntohl(base[0]->ex_flags) != VLCONTBLOCK) {     /* check if flag is correct */
+    if (ntohl(base[0]->ex_hdrflags) != VLCONTBLOCK) {  /* check if flag is correct */
        free(base[0]);
        base[0] = 0;
        return;
@@ -442,7 +442,7 @@ read_mhentries(afs_uint32 mh_addr, int oldfd)
        }
 
        /* Verify that this block knows its an extent block */
-       if (ntohl(base[j]->ex_flags) != VLCONTBLOCK) {
+       if (ntohl(base[j]->ex_hdrflags) != VLCONTBLOCK) {
            free(base[j]);
            base[j] = 0;
            continue;
index 496bbe6..f027e77 100644 (file)
@@ -351,7 +351,7 @@ readMH(afs_int32 addr, struct extentaddr *mhblockP)
     vldbread(addr, (char *)mhblockP, VL_ADDREXTBLK_SIZE);
 
     mhblockP->ex_count = ntohl(mhblockP->ex_count);
-    mhblockP->ex_flags = ntohl(mhblockP->ex_flags);
+    mhblockP->ex_hdrflags = ntohl(mhblockP->ex_hdrflags);
     for (i = 0; i < VL_MAX_ADDREXTBLKS; i++)
        mhblockP->ex_contaddrs[i] = ntohl(mhblockP->ex_contaddrs[i]);
 
@@ -497,7 +497,7 @@ readSIT(int base, int addr)
     quiet_println("multihome info block: base %d\n", base);
     if (base == 0) {
        quiet_println("   count = %u\n", ntohl(extent->ex_count));
-       quiet_println("   flags = %u\n", ntohl(extent->ex_flags));
+       quiet_println("   flags = %u\n", ntohl(extent->ex_hdrflags));
        for (i = 0; i < VL_MAX_ADDREXTBLKS; i++) {
            quiet_println("   contaddrs[%d] = %u\n", i,
                   ntohl(extent->ex_contaddrs[i]));
@@ -897,7 +897,7 @@ CheckIpAddrs(struct vlheader *header)
         * addresses of all the mh blocks.
         */
        readMH(header->SIT, MHblock);
-       if (MHblock->ex_flags != VLCONTBLOCK) {
+       if (MHblock->ex_hdrflags != VLCONTBLOCK) {
           log_error
                (VLDB_CHECK_ERROR,"Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n",
                 header->SIT);
@@ -919,7 +919,7 @@ CheckIpAddrs(struct vlheader *header)
                continue;
 
            readMH(caddrs[i], MHblock);
-           if (MHblock->ex_flags != VLCONTBLOCK) {
+           if (MHblock->ex_hdrflags != VLCONTBLOCK) {
                log_error
                    (VLDB_CHECK_ERROR,"Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n",
                     header->SIT);
index d324493..dc6ffa0 100644 (file)
@@ -106,7 +106,8 @@ struct extentaddr {
        struct {
            afs_int32 count;    /* # of valid addresses */
            afs_int32 spares1[2];
-           afs_int32 flags;    /* must match vlentry's flags field XXX */
+           afs_int32 flags;    /* must be in the same position as the vlentry's
+                                  flags field */
            afs_uint32 contaddrs[VL_MAX_ADDREXTBLKS];
            afs_int32 spares2[24];
        } _ex_header;
@@ -114,16 +115,18 @@ struct extentaddr {
            afsUUID hostuuid;
            afs_int32 uniquifier;
            afs_uint32 addrs[VL_MAXIPADDRS_PERMH];
-           afs_int32 spares[12];
+           afs_uint32 flags;
+           afs_int32 spares[11];
        } _ex_addrentry;
     } _ex_un;
 };
 #define        ex_count        _ex_un._ex_header.count
-#define        ex_flags        _ex_un._ex_header.flags
+#define        ex_hdrflags     _ex_un._ex_header.flags
 #define        ex_contaddrs    _ex_un._ex_header.contaddrs
 #define        ex_hostuuid     _ex_un._ex_addrentry.hostuuid
 #define        ex_addrs        _ex_un._ex_addrentry.addrs
 #define        ex_uniquifier   _ex_un._ex_addrentry.uniquifier
+#define ex_srvflags    _ex_un._ex_addrentry.flags
 
 #define VLog(level, str)   ViceLog(level, str)
 
index 231bc2d..06f7efd 100644 (file)
@@ -266,7 +266,7 @@ readExtents(struct ubik_trans *trans)
        }
 
        /* After reading it in, check to see if its a real continuation block */
-       if (ntohl(rd_ex_addr[i]->ex_flags) != VLCONTBLOCK) {
+       if (ntohl(rd_ex_addr[i]->ex_hdrflags) != VLCONTBLOCK) {
            extent_mod = 1;
            rd_ex_addr[0]->ex_contaddrs[i] = 0;
            free(rd_ex_addr[i]);        /* Not the place to create it */
@@ -409,7 +409,7 @@ GetExtentBlock(struct vl_ctx *ctx, register afs_int32 base)
        memset(ctx->ex_addr[base], 0, VL_ADDREXTBLK_SIZE);
 
        /* Write the full extension block at end of vldb */
-       ctx->ex_addr[base]->ex_flags = htonl(VLCONTBLOCK);
+       ctx->ex_addr[base]->ex_hdrflags = htonl(VLCONTBLOCK);
        blockindex = ntohl(ctx->cheader->vital_header.eofPtr);
        code =
            vlwrite(ctx->trans, blockindex, (char *)ctx->ex_addr[base],