From 34117ca4459da48deca9d0398d24a00658e2656a Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 4 Mar 2004 23:49:27 +0000 Subject: [PATCH] Add fields (currently unused) to ost_lvb for glimpse time/blocks updates. b=1021 r=phil --- lustre/ChangeLog | 2 +- lustre/include/linux/lustre_idl.h | 2 +- lustre/obdfilter/filter_lvb.c | 20 ++++++++++---------- lustre/ptlrpc/pack_generic.c | 36 ++++++++++++++++++++++++++++++++---- lustre/utils/wirecheck.c | 13 +++++++++++++ lustre/utils/wiretest.c | 24 ++++++++++++++++++++++++ 6 files changed, 81 insertions(+), 16 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index b8ca8c9..75cad90 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1,4 +1,4 @@ -tbd Cluster File Systems, Inc. +2004-03-04 Cluster File Systems, Inc. * version 1.2.0 * bug fixes - account for cache space usage on clients to avoid data loss (974) diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 8df580b..c0452ea 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -458,7 +458,7 @@ extern void lustre_swab_ost_last_id(obd_id *id); struct ost_lvb { __u64 lvb_size; - __u64 lvb_time; + __u64 lvb_mtime; __u64 lvb_atime; __u64 lvb_ctime; __u64 lvb_blocks; diff --git a/lustre/obdfilter/filter_lvb.c b/lustre/obdfilter/filter_lvb.c index b9ef0ee..852aeaf 100644 --- a/lustre/obdfilter/filter_lvb.c +++ b/lustre/obdfilter/filter_lvb.c @@ -82,9 +82,9 @@ static int filter_lvbo_init(struct ldlm_resource *res) f_dput(dentry); lvb->lvb_size = dentry->d_inode->i_size; - lvb->lvb_time = LTIME_S(dentry->d_inode->i_mtime); - CDEBUG(D_DLMTRACE, "res: "LPU64" initial lvb size: "LPU64", time: " - LPU64"\n", res->lr_name.name[0], lvb->lvb_size, lvb->lvb_time); + lvb->lvb_mtime = LTIME_S(dentry->d_inode->i_mtime); + CDEBUG(D_DLMTRACE, "res: "LPU64" initial lvb size: "LPU64", mtime: " + LPU64"\n", res->lr_name.name[0], lvb->lvb_size, lvb->lvb_mtime); out: if (oa) @@ -143,11 +143,11 @@ static int filter_lvbo_update(struct ldlm_resource *res, struct lustre_msg *m, lvb->lvb_size, new->lvb_size); lvb->lvb_size = new->lvb_size; } - if (new->lvb_time > lvb->lvb_time) { - CDEBUG(D_DLMTRACE, "res: "LPU64" updating lvb time: " + if (new->lvb_mtime > lvb->lvb_mtime) { + CDEBUG(D_DLMTRACE, "res: "LPU64" updating lvb mtime: " LPU64" -> "LPU64"\n", res->lr_name.name[0], - lvb->lvb_time, new->lvb_time); - lvb->lvb_time = new->lvb_time; + lvb->lvb_mtime, new->lvb_mtime); + lvb->lvb_mtime = new->lvb_mtime; } GOTO(out, rc = 0); } @@ -171,9 +171,9 @@ static int filter_lvbo_update(struct ldlm_resource *res, struct lustre_msg *m, obdo_from_inode(oa, dentry->d_inode, FILTER_VALID_FLAGS); lvb->lvb_size = dentry->d_inode->i_size; - lvb->lvb_time = LTIME_S(dentry->d_inode->i_mtime); - CDEBUG(D_DLMTRACE, "res: "LPU64" disk lvb size: "LPU64", time: " - LPU64"\n", res->lr_name.name[0], lvb->lvb_size, lvb->lvb_time); + lvb->lvb_mtime = LTIME_S(dentry->d_inode->i_mtime); + CDEBUG(D_DLMTRACE, "res: "LPU64" disk lvb size: "LPU64", mtime: " + LPU64"\n", res->lr_name.name[0], lvb->lvb_size, lvb->lvb_mtime); f_dput(dentry); out: diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index d524021..f34f5f2 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -48,7 +48,7 @@ lustre_init_msg (struct lustre_msg *msg, int count, int *lens, char **bufs) { char *ptr; int i; - + msg->magic = PTLRPC_MSG_MAGIC; msg->version = PTLRPC_MSG_VERSION; msg->bufcount = count; @@ -65,11 +65,11 @@ lustre_init_msg (struct lustre_msg *msg, int count, int *lens, char **bufs) } } -int lustre_pack_request (struct ptlrpc_request *req, +int lustre_pack_request (struct ptlrpc_request *req, int count, int *lens, char **bufs) { ENTRY; - + req->rq_reqlen = lustre_msg_size (count, lens); OBD_ALLOC(req->rq_reqmsg, req->rq_reqlen); if (req->rq_reqmsg == NULL) @@ -416,7 +416,10 @@ void lustre_swab_ost_last_id(obd_id *id) void lustre_swab_ost_lvb(struct ost_lvb *lvb) { __swab64s(&lvb->lvb_size); - __swab64s(&lvb->lvb_time); + __swab64s(&lvb->lvb_mtime); + __swab64s(&lvb->lvb_atime); + __swab64s(&lvb->lvb_ctime); + __swab64s(&lvb->lvb_blocks); } void lustre_swab_ll_fid (struct ll_fid *fid) @@ -1735,6 +1738,30 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8, " found %lld\n", (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2)); + /* Checks for struct ost_lvb */ + LASSERTF((int)sizeof(struct ost_lvb) == 40, " found %lld\n", + (long long)(int)sizeof(struct ost_lvb)); + LASSERTF(offsetof(struct ost_lvb, lvb_size) == 0, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_size)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_size)); + LASSERTF(offsetof(struct ost_lvb, lvb_mtime) == 8, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_mtime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_mtime)); + LASSERTF(offsetof(struct ost_lvb, lvb_atime) == 16, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_atime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_atime)); + LASSERTF(offsetof(struct ost_lvb, lvb_ctime) == 24, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_ctime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_ctime)); + LASSERTF(offsetof(struct ost_lvb, lvb_blocks) == 32, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_blocks)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks)); + /* Checks for struct ptlbd_op */ LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n", (long long)(int)sizeof(struct ptlbd_op)); @@ -2110,3 +2137,4 @@ void lustre_assert_wire_constants(void) (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx)); } + diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index b94fddb..8fb5d2e 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -472,6 +472,18 @@ check_ldlm_reply(void) } void +check_ldlm_lvb(void) +{ + BLANK_LINE(); + CHECK_STRUCT(ost_lvb); + CHECK_MEMBER(ost_lvb, lvb_size); + CHECK_MEMBER(ost_lvb, lvb_mtime); + CHECK_MEMBER(ost_lvb, lvb_atime); + CHECK_MEMBER(ost_lvb, lvb_ctime); + CHECK_MEMBER(ost_lvb, lvb_blocks); +} + +void check_ptlbd_op(void) { BLANK_LINE(); @@ -882,6 +894,7 @@ main(int argc, char **argv) check_ldlm_lock_desc(); check_ldlm_request(); check_ldlm_reply(); + check_ldlm_lvb(); check_ptlbd_op(); check_ptlbd_niob(); check_ptlbd_rsp(); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 45a5a2b..849b0f0 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1095,6 +1095,30 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8, " found %lld\n", (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2)); + /* Checks for struct ost_lvb */ + LASSERTF((int)sizeof(struct ost_lvb) == 40, " found %lld\n", + (long long)(int)sizeof(struct ost_lvb)); + LASSERTF(offsetof(struct ost_lvb, lvb_size) == 0, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_size)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_size)); + LASSERTF(offsetof(struct ost_lvb, lvb_mtime) == 8, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_mtime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_mtime)); + LASSERTF(offsetof(struct ost_lvb, lvb_atime) == 16, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_atime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_atime)); + LASSERTF(offsetof(struct ost_lvb, lvb_ctime) == 24, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_ctime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_ctime)); + LASSERTF(offsetof(struct ost_lvb, lvb_blocks) == 32, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_blocks)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks)); + /* Checks for struct ptlbd_op */ LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n", (long long)(int)sizeof(struct ptlbd_op)); -- 1.8.3.1