Whamcloud - gitweb
Interoperability for different PAGE_SIZE/wordsize machines. Tested on ia64
authoradilger <adilger>
Fri, 14 Nov 2003 20:12:30 +0000 (20:12 +0000)
committeradilger <adilger>
Fri, 14 Nov 2003 20:12:30 +0000 (20:12 +0000)
and i386 separately, and with ia64 client + i386 MDS/OST.

Mostly aligning structs to have 64-bit fields aligned on 64-bit boundaries.
Remove some VFS constants and replace them with Lustre constants on the wire.
Since the MDS doesn't really open files itself, we don't need to convert from
the wire constants back to local flags at all.

Frobbing of niobufs on the targets to split them into PAGE_SIZE chunks (this
may be a problem on large PAGE_SIZE servers with small PAGE_SIZE clients,
not sure yet).

I have tested and this appears to be compatible with old filesystems.
At worst we should only need another --write_conf on the MDS.

b=686, b=1821, b=1343, b=2042

lustre/mdc/mdc_lib.c
lustre/obdfilter/filter_internal.h
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 3713e2c..e3a1c4d 100644 (file)
@@ -87,6 +87,20 @@ void mdc_create_pack(struct ptlrpc_request *req, int offset,
         }
 }
 
+static __u32 mds_pack_open_flags(__u32 flags)
+{
+        return
+                (flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC |
+                          MDS_OPEN_DELAY_CREATE | MDS_OPEN_HAS_EA)) |
+                ((flags & O_CREAT) ? MDS_OPEN_CREAT : 0) |
+                ((flags & O_EXCL) ? MDS_OPEN_EXCL : 0) |
+                ((flags & O_TRUNC) ? MDS_OPEN_TRUNC : 0) |
+                ((flags & O_APPEND) ? MDS_OPEN_APPEND : 0) |
+                ((flags & O_SYNC) ? MDS_OPEN_SYNC : 0) |
+                ((flags & O_DIRECTORY) ? MDS_OPEN_DIRECTORY : 0) |
+                0;
+}
+
 /* packing of MDS records */
 void mdc_open_pack(struct ptlrpc_request *req, int offset,
                    struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
@@ -105,7 +119,7 @@ void mdc_open_pack(struct ptlrpc_request *req, int offset,
                 rec->cr_fid = op_data->fid1;
         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
         rec->cr_mode = mode;
-        rec->cr_flags = flags;
+        rec->cr_flags = mds_pack_open_flags(flags);
         rec->cr_rdev = rdev;
         rec->cr_time = op_data->mod_time;
         rec->cr_suppgid = op_data->ctxt.gid1;
index d5bb1ea..da8faa3 100644 (file)
@@ -52,8 +52,7 @@
 /* Data stored per server at the head of the last_rcvd file.  In le32 order.
  * Try to keep this the same as mds_server_data so we might one day merge. */
 struct filter_server_data {
-        __u8  fsd_uuid[37];        /* server UUID */
-        __u8  fsd_uuid_padding[3]; /* unused */
+        __u8  fsd_uuid[40];        /* server UUID */
         __u64 fsd_unused;          /* was fsd_last_objid - don't use for now */
         __u64 fsd_last_transno;    /* last completed transaction ID */
         __u64 fsd_mount_count;     /* FILTER incarnation number */
@@ -66,15 +65,13 @@ struct filter_server_data {
         __u16 fsd_subdir_count;    /* number of subdirectories for objects */
         __u64 fsd_catalog_oid;     /* recovery catalog object id */
         __u32 fsd_catalog_ogen;    /* recovery catalog inode generation */
-        __u8  fsd_peeruuid[37];    /* UUID of MDS associated with this OST */
-        __u8  peer_padding[3];     /* unused */
+        __u8  fsd_peeruuid[40];    /* UUID of MDS associated with this OST */
         __u8  fsd_padding[FILTER_LR_SERVER_SIZE - 140];
 };
 
 /* Data stored per client in the last_rcvd file.  In le32 order. */
 struct filter_client_data {
-        __u8  fcd_uuid[37];        /* client UUID */
-        __u8  fcd_uuid_padding[3]; /* unused */
+        __u8  fcd_uuid[40];        /* client UUID */
         __u64 fcd_last_rcvd;       /* last completed transaction ID */
         __u64 fcd_mount_count;     /* FILTER incarnation number */
         __u64 fcd_last_xid;        /* client RPC xid for the last transaction */
index 2e5d51e..8fa2e34 100644 (file)
@@ -245,6 +245,7 @@ check_mds_body(void)
         CHECK_MEMBER(mds_body, handle);
         CHECK_MEMBER(mds_body, size);
         CHECK_MEMBER(mds_body, blocks);
+        CHECK_MEMBER(mds_body, io_epoch);
         CHECK_MEMBER(mds_body, ino);
         CHECK_MEMBER(mds_body, valid);
         CHECK_MEMBER(mds_body, fsuid);
@@ -262,6 +263,17 @@ check_mds_body(void)
         CHECK_MEMBER(mds_body, generation);
         CHECK_MEMBER(mds_body, suppgid);
         CHECK_MEMBER(mds_body, eadatasize);
+
+        CHECK_VALUE(FMODE_READ);
+        CHECK_VALUE(FMODE_WRITE);
+        CHECK_VALUE(FMODE_EXEC);
+        CHECK_VALUE(MDS_OPEN_CREAT);
+        CHECK_VALUE(MDS_OPEN_EXCL);
+        CHECK_VALUE(MDS_OPEN_APPEND);
+        CHECK_VALUE(MDS_OPEN_SYNC);
+        CHECK_VALUE(MDS_OPEN_DIRECTORY);
+        CHECK_VALUE(MDS_OPEN_DELAY_CREATE);
+        CHECK_VALUE(MDS_OPEN_HAS_EA);
 }
 
 void
@@ -545,7 +557,8 @@ check_llogd_body(void)
         BLANK_LINE();
         CHECK_STRUCT(llogd_body);
         CHECK_MEMBER(llogd_body, lgd_logid);
-        CHECK_MEMBER(llogd_body, lgd_len);
+        CHECK_MEMBER(llogd_body, lgd_ctxt_idx);
+        CHECK_MEMBER(llogd_body, lgd_llh_flags);
         CHECK_MEMBER(llogd_body, lgd_index);
         CHECK_MEMBER(llogd_body, lgd_saved_index);
         CHECK_MEMBER(llogd_body, lgd_cur_offset);
index b42f4d4..b44ad08 100644 (file)
@@ -63,7 +63,7 @@ void lustre_assert_wire_constants(void)
         LASSERT(MDS_DISCONNECT == 39);
         LASSERT(MDS_GETSTATUS == 40);
         LASSERT(MDS_STATFS == 41);
-        LASSERT(MDS_LAST_OPC == 46);
+        LASSERT(MDS_LAST_OPC == 45);
         LASSERT(MDS_FIRST_OPC == 33);
         LASSERT(REINT_SETATTR == 1);
         LASSERT(REINT_CREATE == 2);
@@ -297,7 +297,7 @@ void lustre_assert_wire_constants(void)
         LASSERT((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4);
 
         /* Checks for struct mds_body */
-        LASSERT((int)sizeof(struct mds_body) == 128);
+        LASSERT((int)sizeof(struct mds_body) == 136);
         LASSERT(offsetof(struct mds_body, fid1) == 0);
         LASSERT((int)sizeof(((struct mds_body *)0)->fid1) == 16);
         LASSERT(offsetof(struct mds_body, fid2) == 16);
@@ -308,40 +308,52 @@ void lustre_assert_wire_constants(void)
         LASSERT((int)sizeof(((struct mds_body *)0)->size) == 8);
         LASSERT(offsetof(struct mds_body, blocks) == 48);
         LASSERT((int)sizeof(((struct mds_body *)0)->blocks) == 8);
-        LASSERT(offsetof(struct mds_body, ino) == 56);
+        LASSERT(offsetof(struct mds_body, io_epoch) == 56);
+        LASSERT((int)sizeof(((struct mds_body *)0)->io_epoch) == 8);
+        LASSERT(offsetof(struct mds_body, ino) == 64);
         LASSERT((int)sizeof(((struct mds_body *)0)->ino) == 4);
-        LASSERT(offsetof(struct mds_body, valid) == 60);
+        LASSERT(offsetof(struct mds_body, valid) == 68);
         LASSERT((int)sizeof(((struct mds_body *)0)->valid) == 4);
-        LASSERT(offsetof(struct mds_body, fsuid) == 64);
+        LASSERT(offsetof(struct mds_body, fsuid) == 72);
         LASSERT((int)sizeof(((struct mds_body *)0)->fsuid) == 4);
-        LASSERT(offsetof(struct mds_body, fsgid) == 68);
+        LASSERT(offsetof(struct mds_body, fsgid) == 76);
         LASSERT((int)sizeof(((struct mds_body *)0)->fsgid) == 4);
-        LASSERT(offsetof(struct mds_body, capability) == 72);
+        LASSERT(offsetof(struct mds_body, capability) == 80);
         LASSERT((int)sizeof(((struct mds_body *)0)->capability) == 4);
-        LASSERT(offsetof(struct mds_body, mode) == 76);
+        LASSERT(offsetof(struct mds_body, mode) == 84);
         LASSERT((int)sizeof(((struct mds_body *)0)->mode) == 4);
-        LASSERT(offsetof(struct mds_body, uid) == 80);
+        LASSERT(offsetof(struct mds_body, uid) == 88);
         LASSERT((int)sizeof(((struct mds_body *)0)->uid) == 4);
-        LASSERT(offsetof(struct mds_body, gid) == 84);
+        LASSERT(offsetof(struct mds_body, gid) == 92);
         LASSERT((int)sizeof(((struct mds_body *)0)->gid) == 4);
-        LASSERT(offsetof(struct mds_body, mtime) == 88);
+        LASSERT(offsetof(struct mds_body, mtime) == 96);
         LASSERT((int)sizeof(((struct mds_body *)0)->mtime) == 4);
-        LASSERT(offsetof(struct mds_body, ctime) == 92);
+        LASSERT(offsetof(struct mds_body, ctime) == 100);
         LASSERT((int)sizeof(((struct mds_body *)0)->ctime) == 4);
-        LASSERT(offsetof(struct mds_body, atime) == 96);
+        LASSERT(offsetof(struct mds_body, atime) == 104);
         LASSERT((int)sizeof(((struct mds_body *)0)->atime) == 4);
-        LASSERT(offsetof(struct mds_body, flags) == 100);
+        LASSERT(offsetof(struct mds_body, flags) == 108);
         LASSERT((int)sizeof(((struct mds_body *)0)->flags) == 4);
-        LASSERT(offsetof(struct mds_body, rdev) == 104);
+        LASSERT(offsetof(struct mds_body, rdev) == 112);
         LASSERT((int)sizeof(((struct mds_body *)0)->rdev) == 4);
-        LASSERT(offsetof(struct mds_body, nlink) == 108);
+        LASSERT(offsetof(struct mds_body, nlink) == 116);
         LASSERT((int)sizeof(((struct mds_body *)0)->nlink) == 4);
-        LASSERT(offsetof(struct mds_body, generation) == 112);
+        LASSERT(offsetof(struct mds_body, generation) == 120);
         LASSERT((int)sizeof(((struct mds_body *)0)->generation) == 4);
-        LASSERT(offsetof(struct mds_body, suppgid) == 116);
+        LASSERT(offsetof(struct mds_body, suppgid) == 124);
         LASSERT((int)sizeof(((struct mds_body *)0)->suppgid) == 4);
-        LASSERT(offsetof(struct mds_body, eadatasize) == 120);
+        LASSERT(offsetof(struct mds_body, eadatasize) == 128);
         LASSERT((int)sizeof(((struct mds_body *)0)->eadatasize) == 4);
+        LASSERT(FMODE_READ == 1);
+        LASSERT(FMODE_WRITE == 2);
+        LASSERT(FMODE_EXEC == 4);
+        LASSERT(MDS_OPEN_CREAT == 64);
+        LASSERT(MDS_OPEN_EXCL == 128);
+        LASSERT(MDS_OPEN_APPEND == 1024);
+        LASSERT(MDS_OPEN_SYNC == 4096);
+        LASSERT(MDS_OPEN_DIRECTORY == 65536);
+        LASSERT(MDS_OPEN_DELAY_CREATE == 16777216);
+        LASSERT(MDS_OPEN_HAS_EA == 1073741824);
 
         /* Checks for struct mds_rec_setattr */
         LASSERT((int)sizeof(struct mds_rec_setattr) == 88);
@@ -652,16 +664,18 @@ void lustre_assert_wire_constants(void)
         LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4);
 
         /* Checks for struct llogd_body */
-        LASSERT((int)sizeof(struct llogd_body) == 40);
+        LASSERT((int)sizeof(struct llogd_body) == 48);
         LASSERT(offsetof(struct llogd_body, lgd_logid) == 0);
         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20);
-        LASSERT(offsetof(struct llogd_body, lgd_len) == 20);
-        LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4);
-        LASSERT(offsetof(struct llogd_body, lgd_index) == 24);
+        LASSERT(offsetof(struct llogd_body, lgd_ctxt_idx) == 20);
+        LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4);
+        LASSERT(offsetof(struct llogd_body, lgd_llh_flags) == 24);
+        LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4);
+        LASSERT(offsetof(struct llogd_body, lgd_index) == 28);
         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4);
-        LASSERT(offsetof(struct llogd_body, lgd_saved_index) == 28);
+        LASSERT(offsetof(struct llogd_body, lgd_saved_index) == 32);
         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4);
-        LASSERT(offsetof(struct llogd_body, lgd_cur_offset) == 32);
+        LASSERT(offsetof(struct llogd_body, lgd_cur_offset) == 40);
         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8);
         LASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501);
         LASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502);