From 42e198d861aae86fce9b105369d96b8eae3b3635 Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Tue, 22 Dec 2009 04:28:49 +0300 Subject: [PATCH] b=19964 SOM cleanups, part1 SOM cleanups, comments and some bugfixes i=tappro i=vs --- lustre/contrib/packet-lustre.c | 28 +++--------- lustre/include/lustre/lustre_idl.h | 7 ++- lustre/lclient/glimpse.c | 5 +-- lustre/lclient/lcommon_cl.c | 4 +- lustre/liblustre/file.c | 90 ++++++++++++++++++++++++-------------- lustre/liblustre/llite_lib.h | 3 ++ lustre/liblustre/super.c | 7 ++- lustre/llite/file.c | 11 ++--- lustre/llite/llite_close.c | 80 ++++++++++++++++++--------------- lustre/llite/llite_internal.h | 5 ++- lustre/llite/llite_lib.c | 8 ++-- lustre/mdc/mdc_lib.c | 11 ++--- lustre/mdc/mdc_reint.c | 2 +- lustre/mdc/mdc_request.c | 2 +- lustre/mdt/mdt_handler.c | 7 ++- lustre/mdt/mdt_internal.h | 6 +-- lustre/mdt/mdt_lib.c | 13 +++--- lustre/mdt/mdt_open.c | 52 +++++++++++----------- lustre/mdt/mdt_recovery.c | 2 +- lustre/mdt/mdt_reint.c | 33 +++++++------- lustre/ptlrpc/layout.c | 4 +- lustre/ptlrpc/pack_generic.c | 5 +-- lustre/ptlrpc/ptlrpc_module.c | 2 +- lustre/ptlrpc/wiretest.c | 12 ++--- lustre/utils/req-layout.c | 2 +- lustre/utils/wirecheck.c | 3 +- lustre/utils/wiretest.c | 12 ++--- 27 files changed, 218 insertions(+), 198 deletions(-) diff --git a/lustre/contrib/packet-lustre.c b/lustre/contrib/packet-lustre.c index 32ed8e6..5ce8d76 100644 --- a/lustre/contrib/packet-lustre.c +++ b/lustre/contrib/packet-lustre.c @@ -667,7 +667,6 @@ static int hf_lustre_mds_rec_unlink_ul_padding_2 = -1; static int hf_lustre_obdo_o_gid = -1; static int hf_lustre_llog_catid_lci_logid = -1; static int hf_lustre_llog_rec_tail_lrt_index = -1; -static int hf_lustre_obdo_o_mds = -1; static int hf_lustre_lov_desc_ld_default_stripe_count = -1; static int hf_lustre_ldlm_resource_desc_lr_padding = -1; static int hf_lustre_cfg_marker_cm_vers = -1; @@ -680,7 +679,7 @@ static int hf_lustre_mds_rec_unlink_ul_cap = -1; static int hf_lustre_llog_setattr_rec_lsr_ogen = -1; static int hf_lustre_mds_rec_create_cr_padding_3 = -1; static int hf_lustre_llog_logid_rec_lid_hdr = -1; -static int hf_lustre_obdo_o_easize = -1; +static int hf_lustre_obdo_o_ioepoch = -1; static int hf_lustre_ost_body_oa = -1; static int hf_lustre_llog_logid_rec_padding3 = -1; static int hf_lustre_llog_log_hdr_llh_flags = -1; @@ -6488,8 +6487,7 @@ lustre_dissect_struct_llogd_conn_body(tvbuff_t *tvb _U_, int offset _U_, packet_ /* IDL: uint32 o_nlink; */ /* IDL: uint32 o_generation; */ /* IDL: uint32 o_misc; */ -/* IDL: uint32 o_easize; */ -/* IDL: uint32 o_mds; */ +/* IDL: uint64 o_ioepoch; */ /* IDL: uint32 o_stripe_idx; */ /* IDL: uint32 o_padding_1; */ /* IDL: struct lustre_handle { */ @@ -6674,17 +6672,9 @@ lustre_dissect_element_obdo_o_misc(tvbuff_t *tvb _U_, int offset _U_, packet_inf } static int -lustre_dissect_element_obdo_o_easize(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) +lustre_dissect_element_obdo_o_ioepoch(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { - offset=dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_obdo_o_easize); - - return offset; -} - -static int -lustre_dissect_element_obdo_o_mds(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_obdo_o_mds); + offset=dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_obdo_o_ioepoch); return offset; } @@ -6811,9 +6801,7 @@ lustre_dissect_struct_obdo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo offset=lustre_dissect_element_obdo_o_misc(tvb, offset, pinfo, tree); - offset=lustre_dissect_element_obdo_o_easize(tvb, offset, pinfo, tree); - - offset=lustre_dissect_element_obdo_o_mds(tvb, offset, pinfo, tree); + offset=lustre_dissect_element_obdo_o_ioepoch(tvb, offset, pinfo, tree); offset=lustre_dissect_element_obdo_o_stripe_idx(tvb, offset, pinfo, tree); @@ -9042,8 +9030,6 @@ void proto_register_dcerpc_lustre(void) { "Lci Logid", "lustre.llog_catid.lci_logid", FT_NONE, BASE_HEX, NULL, 0, "", HFILL }}, { &hf_lustre_llog_rec_tail_lrt_index, { "Lrt Index", "lustre.llog_rec_tail.lrt_index", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, - { &hf_lustre_obdo_o_mds, - { "O Mds", "lustre.obdo.o_mds", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_lustre_lov_desc_ld_default_stripe_count, { "Ld Default Stripe Count", "lustre.lov_desc.ld_default_stripe_count", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_lustre_ldlm_resource_desc_lr_padding, @@ -9068,8 +9054,8 @@ void proto_register_dcerpc_lustre(void) { "Cr Padding 3", "lustre.mds_rec_create.cr_padding_3", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_lustre_llog_logid_rec_lid_hdr, { "Lid Hdr", "lustre.llog_logid_rec.lid_hdr", FT_NONE, BASE_HEX, NULL, 0, "", HFILL }}, - { &hf_lustre_obdo_o_easize, - { "O Easize", "lustre.obdo.o_easize", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, + { &hf_lustre_obdo_o_ioepoch, + { "O IOEpoch", "lustre.obdo.o_ioepoch", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_lustre_ost_body_oa, { "Oa", "lustre.ost_body.oa", FT_NONE, BASE_HEX, NULL, 0, "", HFILL }}, { &hf_lustre_llog_logid_rec_padding3, diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index d2a427d..dfc2c1f 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1364,14 +1364,14 @@ struct mdt_body { extern void lustre_swab_mdt_body (struct mdt_body *b); -struct mdt_epoch { +struct mdt_ioepoch { struct lustre_handle handle; __u64 ioepoch; __u32 flags; __u32 padding; }; -extern void lustre_swab_mdt_epoch (struct mdt_epoch *b); +extern void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b); #define Q_QUOTACHECK 0x800100 #define Q_INITQUOTA 0x800101 /* init slave limits */ @@ -2338,8 +2338,7 @@ struct obdo { obd_count o_nlink; /* brw: checksum */ obd_count o_generation; obd_count o_misc; /* brw: o_dropped */ - __u32 o_easize; /* epoch in ost writes */ - __u32 o_mds; + __u64 o_ioepoch; /* epoch in ost writes */ __u32 o_stripe_idx; /* holds stripe idx */ __u32 o_padding_1; struct lustre_handle o_handle; /* brw: lock handle to prolong locks */ diff --git a/lustre/lclient/glimpse.c b/lustre/lclient/glimpse.c index 1527635..76b934d 100644 --- a/lustre/lclient/glimpse.c +++ b/lustre/lclient/glimpse.c @@ -223,10 +223,7 @@ int cl_local_size(struct inode *inode) ENTRY; - /* - * XXX layering violation. - */ - if (cl_i2info(inode)->lli_smd->lsm_stripe_count == 0) + if (!cl_i2info(inode)->lli_smd) RETURN(0); result = cl_io_get(inode, &env, &io, &refcheck); diff --git a/lustre/lclient/lcommon_cl.c b/lustre/lclient/lcommon_cl.c index 3d8ea67..28e5ba9 100644 --- a/lustre/lclient/lcommon_cl.c +++ b/lustre/lclient/lcommon_cl.c @@ -971,7 +971,7 @@ void ccc_req_completion(const struct lu_env *env, * * - o_generation * - * - and IO epoch (stored in o_easize), + * - o_ioepoch, * * and capability. */ @@ -999,7 +999,7 @@ void ccc_req_attr_set(const struct lu_env *env, if (slice->crs_req->crq_type == CRT_WRITE) { if (flags & OBD_MD_FLEPOCH) { oa->o_valid |= OBD_MD_FLEPOCH; - oa->o_easize = cl_i2info(inode)->lli_ioepoch; + oa->o_ioepoch = cl_i2info(inode)->lli_ioepoch; valid_flags |= OBD_MD_FLMTIME|OBD_MD_FLCTIME| OBD_MD_FLUID|OBD_MD_FLGID| OBD_MD_FLFID|OBD_MD_FLGENER; diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index f30cdaf..bad86ece 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -348,20 +348,24 @@ int llu_sizeonmds_update(struct inode *inode, struct lustre_handle *fh, LASSERT(!(lli->lli_flags & LLIF_MDS_SIZE_LOCK)); LASSERT(sbi->ll_lco.lco_flags & OBD_CONNECT_SOM); - rc = llu_inode_getattr(inode, &oa); - if (rc == -ENOENT) { - oa.o_valid = 0; - CDEBUG(D_INODE, "objid "LPX64" is already destroyed\n", - lli->lli_smd->lsm_object_id); - } else if (rc) { - CERROR("inode_getattr failed (%d): unable to send a " - "Size-on-MDS attribute update for inode %llu/%lu\n", - rc, (long long)llu_i2stat(inode)->st_ino, - lli->lli_st_generation); - RETURN(rc); - } + /* If inode is already in another epoch, skip getattr from OSTs. */ + if (lli->lli_ioepoch == ioepoch) { + rc = llu_inode_getattr(inode, &oa); + if (rc == -ENOENT) { + oa.o_valid = 0; + CDEBUG(D_INODE, "objid "LPX64" is already destroyed\n", + lli->lli_smd->lsm_object_id); + } else if (rc) { + CERROR("inode_getattr failed (%d): unable to send a " + "Size-on-MDS attribute update for inode " + "%llu/%lu\n", rc, + (long long)llu_i2stat(inode)->st_ino, + lli->lli_st_generation); + RETURN(rc); + } - md_from_obdo(&op_data, &oa, oa.o_valid); + md_from_obdo(&op_data, &oa, oa.o_valid); + } memcpy(&op_data.op_handle, fh, sizeof(*fh)); op_data.op_ioepoch = ioepoch; op_data.op_flags |= MF_SOM_CHANGE; @@ -370,6 +374,43 @@ int llu_sizeonmds_update(struct inode *inode, struct lustre_handle *fh, RETURN(rc); } +void llu_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data, + struct lustre_handle *fh) +{ + struct llu_inode_info *lli = llu_i2info(inode); + struct intnl_stat *st = llu_i2stat(inode); + ENTRY; + + op_data->op_fid1 = lli->lli_fid; + op_data->op_attr.ia_atime = st->st_atime; + op_data->op_attr.ia_mtime = st->st_mtime; + op_data->op_attr.ia_ctime = st->st_ctime; + op_data->op_attr.ia_size = st->st_size; + op_data->op_attr_blocks = st->st_blocks; + op_data->op_attr.ia_attr_flags = lli->lli_st_flags; + op_data->op_ioepoch = lli->lli_ioepoch; + if (fh) + op_data->op_handle = *fh; + EXIT; +} + +void llu_done_writing_attr(struct inode *inode, struct md_op_data *op_data) +{ + struct llu_inode_info *lli = llu_i2info(inode); + ENTRY; + + op_data->op_flags |= MF_SOM_CHANGE; + + /* Pack Size-on-MDS attributes if we are in IO + * epoch and attributes are valid. */ + LASSERT(!(lli->lli_flags & LLIF_MDS_SIZE_LOCK)); + if (!cl_local_size(inode)) + op_data->op_attr.ia_valid |= ATTR_MTIME_SET | ATTR_CTIME_SET | + ATTR_ATIME_SET | ATTR_SIZE | ATTR_BLOCKS; + + EXIT; +} + int llu_md_close(struct obd_export *md_exp, struct inode *inode) { struct llu_inode_info *lli = llu_i2info(inode); @@ -396,27 +437,12 @@ int llu_md_close(struct obd_export *md_exp, struct inode *inode) } else { /* Inode cannot be dirty. Close the epoch. */ op_data.op_flags |= MF_EPOCH_CLOSE; - /* XXX: Send CHANGE flag only if Size-on-MDS inode attributes - * are really changed. */ - op_data.op_flags |= MF_SOM_CHANGE; - - /* Pack Size-on-MDS attributes if we are in IO epoch and - * attributes are valid. */ - LASSERT(!(lli->lli_flags & LLIF_MDS_SIZE_LOCK)); - if (!cl_local_size(inode)) - op_data.op_attr.ia_valid |= - OBD_MD_FLSIZE | OBD_MD_FLBLOCKS; + /* XXX: Send SOM attributes only if they are really + * changed. */ + llu_done_writing_attr(inode, &op_data); } } - op_data.op_fid1 = lli->lli_fid; - op_data.op_attr.ia_atime = st->st_atime; - op_data.op_attr.ia_mtime = st->st_mtime; - op_data.op_attr.ia_ctime = st->st_ctime; - op_data.op_attr.ia_size = st->st_size; - op_data.op_attr_blocks = st->st_blocks; - op_data.op_attr.ia_attr_flags = lli->lli_st_flags; - op_data.op_ioepoch = lli->lli_ioepoch; - memcpy(&op_data.op_handle, &och->och_fh, sizeof(op_data.op_handle)); + llu_pack_inode2opdata(inode, &op_data, &och->och_fh); rc = md_close(md_exp, &op_data, och->och_mod, &req); if (rc == -EAGAIN) { diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index afbde6c..afe017c 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -246,7 +246,10 @@ void llu_finish_md_op_data(struct md_op_data *op_data); int llu_create(struct inode *dir, struct pnode_base *pnode, int mode); int llu_local_open(struct llu_inode_info *lli, struct lookup_intent *it); int llu_iop_open(struct pnode *pnode, int flags, mode_t mode); +void llu_done_writing_attr(struct inode *inode, struct md_op_data *op_data); int llu_md_close(struct obd_export *md_exp, struct inode *inode); +void llu_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data, + struct lustre_handle *fh); int llu_file_release(struct inode *inode); int llu_sizeonmds_update(struct inode *inode, struct lustre_handle *fh, __u64 ioepoch); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index bbb2dfb..7824522 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -704,7 +704,10 @@ static int llu_setattr_done_writing(struct inode *inode, CDEBUG(D_INODE, "Epoch "LPU64" closed on "DFID" for truncate\n", op_data->op_ioepoch, PFID(&lli->lli_fid)); - op_data->op_flags = MF_EPOCH_CLOSE | MF_SOM_CHANGE; + op_data->op_flags = MF_EPOCH_CLOSE; + llu_done_writing_attr(inode, op_data); + llu_pack_inode2opdata(inode, op_data, NULL); + rc = md_done_writing(llu_i2sbi(inode)->ll_md_exp, op_data, mod); if (rc == -EAGAIN) { /* MDS has instructed us to obtain Size-on-MDS attribute @@ -796,7 +799,7 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr) memcpy(&op_data.op_attr, attr, sizeof(*attr)); /* Open epoch for truncate. */ - if ((llu_i2mdexp(inode)->exp_connect_flags & OBD_CONNECT_SOM) && + if (exp_connect_som(llu_i2mdexp(inode)) && (ia_valid & ATTR_SIZE)) op_data.op_flags = MF_EPOCH_OPEN; rc = llu_md_setattr(inode, &op_data, &mod); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 7eceefe..0c0ee79 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -77,7 +77,8 @@ void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data, op_data->op_attr_blocks = inode->i_blocks; ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags = inode->i_flags; op_data->op_ioepoch = ll_i2info(inode)->lli_ioepoch; - memcpy(&op_data->op_handle, fh, sizeof(op_data->op_handle)); + if (fh) + op_data->op_handle = *fh; op_data->op_capa1 = ll_mdscapa_get(inode); } @@ -92,10 +93,10 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data, if (!(och->och_flags & FMODE_WRITE)) goto out; - if (!(exp_connect_som(ll_i2mdexp(inode))) || !S_ISREG(inode->i_mode)) + if (!exp_connect_som(ll_i2mdexp(inode)) || !S_ISREG(inode->i_mode)) op_data->op_attr.ia_valid |= ATTR_SIZE | ATTR_BLOCKS; else - ll_epoch_close(inode, op_data, &och, 0); + ll_ioepoch_close(inode, op_data, &och, 0); out: ll_pack_inode2opdata(inode, op_data, &och->och_fh); @@ -136,7 +137,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, LASSERT(epoch_close); /* MDS has instructed us to obtain Size-on-MDS attribute from * OSTs and send setattr to back to MDS. */ - rc = ll_sizeonmds_update(inode, &och->och_fh, + rc = ll_sizeonmds_update(inode, &op_data->op_handle, op_data->op_ioepoch); if (rc) { CERROR("inode %lu mdc Size-on-MDS update failed: " @@ -159,7 +160,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, EXIT; out: - if ((exp->exp_connect_flags & OBD_CONNECT_SOM) && !epoch_close && + if (exp_connect_som(exp) && !epoch_close && S_ISREG(inode->i_mode) && (och->och_flags & FMODE_WRITE)) { ll_queue_done_writing(inode, LLIF_DONE_WRITING); } else { diff --git a/lustre/llite/llite_close.c b/lustre/llite/llite_close.c index 28f5b07..f2f36c2 100644 --- a/lustre/llite/llite_close.c +++ b/lustre/llite/llite_close.c @@ -122,9 +122,29 @@ void ll_queue_done_writing(struct inode *inode, unsigned long flags) EXIT; } +void ll_done_writing_attr(struct inode *inode, struct md_op_data *op_data) +{ + struct ll_inode_info *lli = ll_i2info(inode); + ENTRY; + + op_data->op_flags |= MF_SOM_CHANGE; + /* Check if Size-on-MDS attributes are valid. */ + if (lli->lli_flags & LLIF_MDS_SIZE_LOCK) + CERROR("ino %lu/%u(flags %lu) som valid it just after " + "recovery\n", inode->i_ino, inode->i_generation, + lli->lli_flags); + + if (!cl_local_size(inode)) { + /* Send Size-on-MDS Attributes if valid. */ + op_data->op_attr.ia_valid |= ATTR_MTIME_SET | ATTR_CTIME_SET | + ATTR_ATIME_SET | ATTR_SIZE | ATTR_BLOCKS; + } + EXIT; +} + /** Closes epoch and sends Size-on-MDS attribute update if possible. Call * this under ll_inode_info::lli_lock spinlock. */ -void ll_epoch_close(struct inode *inode, struct md_op_data *op_data, +void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data, struct obd_client_handle **och, unsigned long flags) { struct ll_inode_info *lli = ll_i2info(inode); @@ -187,20 +207,8 @@ void ll_epoch_close(struct inode *inode, struct md_op_data *op_data, LASSERT(list_empty(&club->cob_pending_list)); lli->lli_flags &= ~LLIF_SOM_DIRTY; spin_unlock(&lli->lli_lock); - op_data->op_flags |= MF_SOM_CHANGE; + ll_done_writing_attr(inode, op_data); - /* Check if Size-on-MDS attributes are valid. */ - if (lli->lli_flags & LLIF_MDS_SIZE_LOCK) - CWARN("ino %lu/%u(flags %lu) som valid it just after " - "recovery\n", - inode->i_ino, inode->i_generation, lli->lli_flags); - - if (!cl_local_size(inode)) { - /* Send Size-on-MDS Attributes if valid. Atime is sent along - * with all the attributes. */ - op_data->op_attr.ia_valid |= ATTR_MTIME_SET | ATTR_CTIME_SET | - ATTR_ATIME_SET | ATTR_SIZE | ATTR_BLOCKS; - } EXIT; out: return; @@ -215,12 +223,10 @@ int ll_sizeonmds_update(struct inode *inode, struct lustre_handle *fh, int rc; ENTRY; - /* LASSERT(!(lli->lli_flags & LLIF_MDS_SIZE_LOCK)); */ - /* After recovery that can be valid. */ if (lli->lli_flags & LLIF_MDS_SIZE_LOCK) - CWARN("ino %lu/%u(flags %lu) som valid it just after " - "recovery\n", inode->i_ino, inode->i_generation, - lli->lli_flags); + CERROR("ino %lu/%u(flags %lu) som valid it just after " + "recovery\n", inode->i_ino, inode->i_generation, + lli->lli_flags); OBDO_ALLOC(oa); OBD_ALLOC_PTR(op_data); @@ -228,20 +234,24 @@ int ll_sizeonmds_update(struct inode *inode, struct lustre_handle *fh, CERROR("can't allocate memory for Size-on-MDS update.\n"); RETURN(-ENOMEM); } - rc = ll_inode_getattr(inode, oa); - if (rc == -ENOENT) { - oa->o_valid = 0; - CDEBUG(D_INODE, "objid "LPX64" is already destroyed\n", - lli->lli_smd->lsm_object_id); - } else if (rc) { - CERROR("inode_getattr failed (%d): unable to send a " - "Size-on-MDS attribute update for inode %lu/%u\n", - rc, inode->i_ino, inode->i_generation); - GOTO(out, rc); + /* If inode is already in another epoch, skip getattr from OSTs. */ + if (lli->lli_ioepoch == ioepoch) { + rc = ll_inode_getattr(inode, oa); + if (rc == -ENOENT) { + oa->o_valid = 0; + CDEBUG(D_INODE, "objid "LPX64" is already destroyed\n", + lli->lli_smd->lsm_object_id); + } else if (rc) { + CERROR("inode_getattr failed (%d): unable to send a " + "Size-on-MDS attribute update for inode " + "%lu/%u\n", rc, inode->i_ino, + inode->i_generation); + GOTO(out, rc); + } + CDEBUG(D_INODE, "Size-on-MDS update on "DFID"\n", + PFID(&lli->lli_fid)); + md_from_obdo(op_data, oa, oa->o_valid); } - CDEBUG(D_INODE, "Size-on-MDS update on "DFID"\n", PFID(&lli->lli_fid)); - - md_from_obdo(op_data, oa, oa->o_valid); memcpy(&op_data->op_handle, fh, sizeof(*fh)); op_data->op_ioepoch = ioepoch; @@ -266,7 +276,7 @@ static void ll_done_writing(struct inode *inode) int rc; ENTRY; - LASSERT(ll_i2mdexp(inode)->exp_connect_flags & OBD_CONNECT_SOM); + LASSERT(exp_connect_som(ll_i2mdexp(inode))); OBD_ALLOC_PTR(op_data); if (op_data == NULL) { @@ -275,7 +285,7 @@ static void ll_done_writing(struct inode *inode) return; } - ll_epoch_close(inode, op_data, &och, LLIF_DONE_WRITING); + ll_ioepoch_close(inode, op_data, &och, LLIF_DONE_WRITING); /* If there is no @och, we do not do D_W yet. */ if (och == NULL) GOTO(out, 0); @@ -286,7 +296,7 @@ static void ll_done_writing(struct inode *inode) if (rc == -EAGAIN) { /* MDS has instructed us to obtain Size-on-MDS attribute from * OSTs and send setattr to back to MDS. */ - rc = ll_sizeonmds_update(inode, &och->och_fh, + rc = ll_sizeonmds_update(inode, &op_data->op_handle, op_data->op_ioepoch); } else if (rc) { CERROR("inode %lu mdc done_writing failed: rc = %d\n", diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 7c120dd..6e19b0e 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -620,8 +620,9 @@ int ll_release_openhandle(struct dentry *, struct lookup_intent *); int ll_md_close(struct obd_export *md_exp, struct inode *inode, struct file *file); int ll_md_real_close(struct inode *inode, int flags); -void ll_epoch_close(struct inode *inode, struct md_op_data *op_data, - struct obd_client_handle **och, unsigned long flags); +void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data, + struct obd_client_handle **och, unsigned long flags); +void ll_done_writing_attr(struct inode *inode, struct md_op_data *op_data); int ll_sizeonmds_update(struct inode *inode, struct lustre_handle *fh, __u64 ioepoch); int ll_inode_getattr(struct inode *inode, struct obdo *obdo); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 98aae9a..6338762 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1207,7 +1207,10 @@ static int ll_setattr_done_writing(struct inode *inode, CDEBUG(D_INODE, "Epoch "LPU64" closed on "DFID" for truncate\n", op_data->op_ioepoch, PFID(&lli->lli_fid)); - op_data->op_flags = MF_EPOCH_CLOSE | MF_SOM_CHANGE; + op_data->op_flags = MF_EPOCH_CLOSE; + ll_done_writing_attr(inode, op_data); + ll_pack_inode2opdata(inode, op_data, NULL); + rc = md_done_writing(ll_i2sbi(inode)->ll_md_exp, op_data, mod); if (rc == -EAGAIN) { /* MDS has instructed us to obtain Size-on-MDS attribute @@ -1338,8 +1341,7 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr) memcpy(&op_data->op_attr, attr, sizeof(*attr)); /* Open epoch for truncate. */ - if ((ll_i2mdexp(inode)->exp_connect_flags & OBD_CONNECT_SOM) && - (ia_valid & ATTR_SIZE)) + if (exp_connect_som(ll_i2mdexp(inode)) && (ia_valid & ATTR_SIZE)) op_data->op_flags = MF_EPOCH_OPEN; rc = ll_md_setattr(inode, op_data, &mod); diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 3ba6799..83aa420 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -307,7 +307,8 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec, rec->sa_suppgid = op_data->op_suppgids[0]; } -static void mdc_epoch_pack(struct mdt_epoch *epoch, struct md_op_data *op_data) +static void mdc_ioepoch_pack(struct mdt_ioepoch *epoch, + struct md_op_data *op_data) { memcpy(&epoch->handle, &op_data->op_handle, sizeof(epoch->handle)); epoch->ioepoch = op_data->op_ioepoch; @@ -318,7 +319,7 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data, void *ea, int ealen, void *ea2, int ea2len) { struct mdt_rec_setattr *rec; - struct mdt_epoch *epoch; + struct mdt_ioepoch *epoch; CLASSERT(sizeof(struct mdt_rec_reint) ==sizeof(struct mdt_rec_setattr)); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); @@ -328,7 +329,7 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data, if (op_data->op_flags & (MF_SOM_CHANGE | MF_EPOCH_OPEN)) { epoch = req_capsule_client_get(&req->rq_pill, &RMF_MDT_EPOCH); - mdc_epoch_pack(epoch, op_data); + mdc_ioepoch_pack(epoch, op_data); } if (ealen == 0) @@ -464,7 +465,7 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags, void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data) { - struct mdt_epoch *epoch; + struct mdt_ioepoch *epoch; struct mdt_rec_setattr *rec; epoch = req_capsule_client_get(&req->rq_pill, &RMF_MDT_EPOCH); @@ -472,7 +473,7 @@ void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data) mdc_setattr_pack_rec(rec, op_data); mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1); - mdc_epoch_pack(epoch, op_data); + mdc_ioepoch_pack(epoch, op_data); } static int mdc_req_avail(struct client_obd *cli, struct mdc_cache_waiter *mcw) diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index ecab6c5..445d71d 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -199,7 +199,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, /* Save the obtained info in the original RPC for the replay case. */ if (rc == 0 && (op_data->op_flags & MF_EPOCH_OPEN)) { - struct mdt_epoch *epoch; + struct mdt_ioepoch *epoch; struct mdt_body *body; epoch = req_capsule_client_get(&req->rq_pill, &RMF_MDT_EPOCH); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 56b2b95..215c0af 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -656,7 +656,7 @@ void mdc_replay_open(struct ptlrpc_request *req) close_req = mod->mod_close_req; if (close_req != NULL) { __u32 opc = lustre_msg_get_opc(close_req->rq_reqmsg); - struct mdt_epoch *epoch; + struct mdt_ioepoch *epoch; LASSERT(opc == MDS_CLOSE || opc == MDS_DONE_WRITING); epoch = req_capsule_client_get(&close_req->rq_pill, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 295aa75..e47e9c9 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -4840,7 +4840,7 @@ static int mdt_object_print(const struct lu_env *env, void *cookie, return (*p)(env, cookie, LUSTRE_MDT_NAME"-object@%p(ioepoch=%llu " "flags=%llx, epochcount=%d, writecount=%d)", mdto, mdto->mot_ioepoch, mdto->mot_flags, - mdto->mot_epochcount, mdto->mot_writecount); + mdto->mot_ioepoch_count, mdto->mot_writecount); } static const struct lu_device_operations mdt_lu_ops = { @@ -4920,9 +4920,8 @@ static int mdt_connect_internal(struct obd_export *exp, return -EBADE; } - if (mdt->mdt_som_conf && - !(exp->exp_connect_flags & OBD_CONNECT_MDS_MDS) && - !(exp->exp_connect_flags & OBD_CONNECT_SOM)) { + if (mdt->mdt_som_conf && !exp_connect_som(exp) && + !(exp->exp_connect_flags & OBD_CONNECT_MDS_MDS)) { CWARN("%s: MDS has SOM enabled, but client does not support " "it\n", mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name); return -EBADE; diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index c32f9ad..8a7fa19 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -187,7 +187,7 @@ struct mdt_object { struct md_object mot_obj; __u64 mot_ioepoch; __u64 mot_flags; - int mot_epochcount; + int mot_ioepoch_count; int mot_writecount; }; @@ -358,7 +358,7 @@ struct mdt_thread_info { } mti_u; /* IO epoch related stuff. */ - struct mdt_epoch *mti_epoch; + struct mdt_ioepoch *mti_ioepoch; __u64 mti_replayepoch; /* server and client data buffers */ @@ -574,7 +574,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_file_data *mdt_handle2mfd(struct mdt_thread_info *, const struct lustre_handle *); -int mdt_epoch_open(struct mdt_thread_info *info, struct mdt_object *o); +int mdt_ioepoch_open(struct mdt_thread_info *info, struct mdt_object *o); void mdt_sizeonmds_enable(struct mdt_thread_info *info, struct mdt_object *mo); int mdt_sizeonmds_enabled(struct mdt_object *mo); int mdt_write_get(struct mdt_device *mdt, struct mdt_object *o); diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index e95f2c7..3a16cde 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -801,16 +801,17 @@ static int mdt_setattr_unpack_rec(struct mdt_thread_info *info) RETURN(0); } -static int mdt_epoch_unpack(struct mdt_thread_info *info) +static int mdt_ioepoch_unpack(struct mdt_thread_info *info) { struct req_capsule *pill = info->mti_pill; ENTRY; if (req_capsule_get_size(pill, &RMF_MDT_EPOCH, RCL_CLIENT)) - info->mti_epoch = req_capsule_client_get(pill, &RMF_MDT_EPOCH); + info->mti_ioepoch = + req_capsule_client_get(pill, &RMF_MDT_EPOCH); else - info->mti_epoch = NULL; - RETURN(info->mti_epoch == NULL ? -EFAULT : 0); + info->mti_ioepoch = NULL; + RETURN(info->mti_ioepoch == NULL ? -EFAULT : 0); } static inline int mdt_dlmreq_unpack(struct mdt_thread_info *info) { @@ -837,7 +838,7 @@ static int mdt_setattr_unpack(struct mdt_thread_info *info) RETURN(rc); /* Epoch may be absent */ - mdt_epoch_unpack(info); + mdt_ioepoch_unpack(info); ma->ma_lmm_size = req_capsule_get_size(pill, &RMF_EADATA, RCL_CLIENT); if (ma->ma_lmm_size) { @@ -861,7 +862,7 @@ int mdt_close_unpack(struct mdt_thread_info *info) int rc; ENTRY; - rc = mdt_epoch_unpack(info); + rc = mdt_ioepoch_unpack(info); if (rc) RETURN(rc); diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index f98b7a7..6edad7a 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -123,9 +123,9 @@ static int mdt_create_data(struct mdt_thread_info *info, RETURN(rc); } -static int mdt_epoch_opened(struct mdt_object *mo) +static int mdt_ioepoch_opened(struct mdt_object *mo) { - return mo->mot_epochcount; + return mo->mot_ioepoch_count; } int mdt_sizeonmds_enabled(struct mdt_object *mo) @@ -138,8 +138,8 @@ void mdt_sizeonmds_enable(struct mdt_thread_info *info, struct mdt_object *mo) { spin_lock(&info->mti_mdt->mdt_ioepoch_lock); - if (info->mti_epoch->ioepoch == mo->mot_ioepoch) { - LASSERT(!mdt_epoch_opened(mo)); + if (info->mti_ioepoch->ioepoch == mo->mot_ioepoch) { + LASSERT(!mdt_ioepoch_opened(mo)); mo->mot_ioepoch = 0; mo->mot_flags = 0; } @@ -148,7 +148,7 @@ void mdt_sizeonmds_enable(struct mdt_thread_info *info, /* Open the epoch. Epoch open is allowed if @writecount is not negative. * The epoch and writecount handling is performed under the mdt_ioepoch_lock. */ -int mdt_epoch_open(struct mdt_thread_info *info, struct mdt_object *o) +int mdt_ioepoch_open(struct mdt_thread_info *info, struct mdt_object *o) { struct mdt_device *mdt = info->mti_mdt; int cancel = 0; @@ -160,7 +160,7 @@ int mdt_epoch_open(struct mdt_thread_info *info, struct mdt_object *o) RETURN(0); spin_lock(&mdt->mdt_ioepoch_lock); - if (mdt_epoch_opened(o)) { + if (mdt_ioepoch_opened(o)) { /* Epoch continues even if there is no writers yet. */ CDEBUG(D_INODE, "continue epoch "LPU64" for "DFID"\n", o->mot_ioepoch, PFID(mdt_object_fid(o))); @@ -175,7 +175,7 @@ int mdt_epoch_open(struct mdt_thread_info *info, struct mdt_object *o) mdt->mdt_ioepoch, PFID(mdt_object_fid(o))); cancel = 1; } - o->mot_epochcount++; + o->mot_ioepoch_count++; spin_unlock(&mdt->mdt_ioepoch_lock); /* Cancel Size-on-MDS attributes on clients if not truncate. @@ -198,7 +198,7 @@ static int mdt_sizeonmds_update(struct mdt_thread_info *info, ENTRY; CDEBUG(D_INODE, "Closing epoch "LPU64" on "DFID". Count %d\n", - o->mot_ioepoch, PFID(mdt_object_fid(o)), o->mot_epochcount); + o->mot_ioepoch, PFID(mdt_object_fid(o)), o->mot_ioepoch_count); if (info->mti_attr.ma_attr.la_valid & LA_SIZE) { /* Do Size-on-MDS attribute update. @@ -222,7 +222,7 @@ static int mdt_sizeonmds_update(struct mdt_thread_info *info, * Returns 0 if epoch closes. * Returns -EAGAIN if epoch closes but an Size-on-MDS Update is still needed * from the client. */ -static int mdt_epoch_close(struct mdt_thread_info *info, struct mdt_object *o) +static int mdt_ioepoch_close(struct mdt_thread_info *info, struct mdt_object *o) { int eviction = (mdt_info_req(info) == NULL ? 1 : 0); struct lu_attr *la = &info->mti_attr.ma_attr; @@ -238,19 +238,19 @@ static int mdt_epoch_close(struct mdt_thread_info *info, struct mdt_object *o) spin_lock(&info->mti_mdt->mdt_ioepoch_lock); /* Epoch closes only if client tells about it or eviction occures. */ - if (eviction || (info->mti_epoch->flags & MF_EPOCH_CLOSE)) { - LASSERT(o->mot_epochcount); - o->mot_epochcount--; + if (eviction || (info->mti_ioepoch->flags & MF_EPOCH_CLOSE)) { + LASSERT(o->mot_ioepoch_count); + o->mot_ioepoch_count--; CDEBUG(D_INODE, "Closing epoch "LPU64" on "DFID". Count %d\n", o->mot_ioepoch, PFID(mdt_object_fid(o)), - o->mot_epochcount); + o->mot_ioepoch_count); if (!eviction) - achange = (info->mti_epoch->flags & MF_SOM_CHANGE); + achange = (info->mti_ioepoch->flags & MF_SOM_CHANGE); rc = 0; - if (!eviction && !mdt_epoch_opened(o)) { + if (!eviction && !mdt_ioepoch_opened(o)) { /* Epoch ends. Is an Size-on-MDS update needed? */ if (o->mot_flags & MF_SOM_CHANGE) { /* Some previous writer changed the attribute. @@ -268,7 +268,7 @@ static int mdt_epoch_close(struct mdt_thread_info *info, struct mdt_object *o) o->mot_flags |= MF_SOM_CHANGE; } - opened = mdt_epoch_opened(o); + opened = mdt_ioepoch_opened(o); spin_unlock(&info->mti_mdt->mdt_ioepoch_lock); /* If eviction occurred, do nothing. */ @@ -424,7 +424,7 @@ static int mdt_mfd_open(struct mdt_thread_info *info, struct mdt_object *p, if (flags & FMODE_WRITE) { rc = mdt_write_get(info->mti_mdt, o); if (rc == 0) { - mdt_epoch_open(info, o); + mdt_ioepoch_open(info, o); repbody->ioepoch = o->mot_ioepoch; } } else if (flags & MDS_FMODE_EXEC) { @@ -1240,11 +1240,11 @@ int mdt_mfd_close(struct mdt_thread_info *info, struct mdt_file_data *mfd) if ((mode & FMODE_WRITE) || (mode & FMODE_EPOCHLCK)) { mdt_write_put(info->mti_mdt, o); - ret = mdt_epoch_close(info, o); + ret = mdt_ioepoch_close(info, o); } else if (mode & MDS_FMODE_EXEC) { mdt_write_allow(info->mti_mdt, o); } else if (mode & FMODE_EPOCH) { - ret = mdt_epoch_close(info, o); + ret = mdt_ioepoch_close(info, o); } /* Update atime on close only. */ @@ -1314,7 +1314,7 @@ int mdt_close(struct mdt_thread_info *info) if (rc) RETURN(err_serious(rc)); - LASSERT(info->mti_epoch); + LASSERT(info->mti_ioepoch); req_capsule_set_size(info->mti_pill, &RMF_MDT_MD, RCL_SERVER, info->mti_mdt->mdt_max_mdsize); @@ -1350,12 +1350,12 @@ int mdt_close(struct mdt_thread_info *info) med = &req->rq_export->exp_mdt_data; spin_lock(&med->med_open_lock); - mfd = mdt_handle2mfd(info, &info->mti_epoch->handle); + mfd = mdt_handle2mfd(info, &info->mti_ioepoch->handle); if (mdt_mfd_closed(mfd)) { spin_unlock(&med->med_open_lock); CDEBUG(D_INODE, "no handle for file close: fid = "DFID ": cookie = "LPX64"\n", PFID(info->mti_rr.rr_fid1), - info->mti_epoch->handle.cookie); + info->mti_ioepoch->handle.cookie); /** not serious error since bug 3633 */ rc = -ESTALE; } else { @@ -1411,14 +1411,14 @@ int mdt_done_writing(struct mdt_thread_info *info) med = &info->mti_exp->exp_mdt_data; spin_lock(&med->med_open_lock); - mfd = mdt_handle2mfd(info, &info->mti_epoch->handle); + mfd = mdt_handle2mfd(info, &info->mti_ioepoch->handle); if (mfd == NULL) { spin_unlock(&med->med_open_lock); CDEBUG(D_INODE, "no handle for done write: fid = "DFID ": cookie = "LPX64" ioepoch = "LPU64"\n", PFID(info->mti_rr.rr_fid1), - info->mti_epoch->handle.cookie, - info->mti_epoch->ioepoch); + info->mti_ioepoch->handle.cookie, + info->mti_ioepoch->ioepoch); RETURN(-ESTALE); } @@ -1429,7 +1429,7 @@ int mdt_done_writing(struct mdt_thread_info *info) spin_unlock(&med->med_open_lock); /* Set EPOCH CLOSE flag if not set by client. */ - info->mti_epoch->flags |= MF_EPOCH_CLOSE; + info->mti_ioepoch->flags |= MF_EPOCH_CLOSE; info->mti_attr.ma_valid = 0; rc = mdt_mfd_close(info, mfd); mdt_empty_transno(info); diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 1709333..c290643 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -1136,7 +1136,7 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti, mo_attr_get(mti->mti_env, mdt_object_child(obj), &mti->mti_attr); mdt_pack_attr2body(mti, body, &mti->mti_attr.ma_attr, mdt_object_fid(obj)); - if (mti->mti_epoch && (mti->mti_epoch->flags & MF_EPOCH_OPEN)) { + if (mti->mti_ioepoch && (mti->mti_ioepoch->flags & MF_EPOCH_OPEN)) { struct mdt_file_data *mfd; struct mdt_body *repbody; diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 0939947..30d08ec 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -286,12 +286,12 @@ int mdt_attr_set(struct mdt_thread_info *info, struct mdt_object *mo, int flags) /* attr shouldn't be set on remote object */ LASSERT(mdt_object_exists(mo) >= 0); - if (exp_connect_som(info->mti_exp) && info->mti_epoch) - som_update = (info->mti_epoch->flags & MF_SOM_CHANGE); + if (exp_connect_som(info->mti_exp) && info->mti_ioepoch) + som_update = (info->mti_ioepoch->flags & MF_SOM_CHANGE); /* Try to avoid object_lock if another epoch has been started * already. */ - if (som_update && (info->mti_epoch->ioepoch != mo->mot_ioepoch)) + if (som_update && (info->mti_ioepoch->ioepoch != mo->mot_ioepoch)) RETURN(0); lh = &info->mti_lh[MDT_LH_PARENT]; @@ -310,7 +310,7 @@ int mdt_attr_set(struct mdt_thread_info *info, struct mdt_object *mo, int flags) /* Setattrs are syncronized through dlm lock taken above. If another * epoch started, its attributes may be already flushed on disk, * skip setattr. */ - if (som_update && (info->mti_epoch->ioepoch != mo->mot_ioepoch)) + if (som_update && (info->mti_ioepoch->ioepoch != mo->mot_ioepoch)) GOTO(out_unlock, rc = 0); if (mdt_object_exists(mo) == 0) @@ -339,9 +339,10 @@ int mdt_attr_set(struct mdt_thread_info *info, struct mdt_object *mo, int flags) /* Re-enable SIZEONMDS. */ if (som_update) { - CDEBUG(D_INODE, "Closing epoch "LPU64" on "DFID". Count %d\n", - mo->mot_ioepoch, PFID(mdt_object_fid(mo)), - mo->mot_epochcount); + CDEBUG(D_INODE, "Closing epoch "LPU64" on "DFID" size "LPU64 + ". Count %d\n", mo->mot_ioepoch, + PFID(mdt_object_fid(mo)), ma->ma_attr.la_size, + mo->mot_ioepoch_count); mdt_sizeonmds_enable(info, mo); } @@ -384,8 +385,8 @@ static int mdt_reint_setattr(struct mdt_thread_info *info, if (mdt_write_read(info->mti_mdt, mo) < 0) GOTO(out_put, rc = -ETXTBSY); } - } else if (info->mti_epoch && - (info->mti_epoch->flags & MF_EPOCH_OPEN)) { + } else if (info->mti_ioepoch && + (info->mti_ioepoch->flags & MF_EPOCH_OPEN)) { /* Truncate case. */ rc = mdt_write_get(info->mti_mdt, mo); if (rc) @@ -395,7 +396,7 @@ static int mdt_reint_setattr(struct mdt_thread_info *info, if (mfd == NULL) GOTO(out_put, rc = -ENOMEM); - mdt_epoch_open(info, mo); + mdt_ioepoch_open(info, mo); repbody->ioepoch = mo->mot_ioepoch; mdt_object_get(info->mti_env, mo); @@ -409,30 +410,30 @@ static int mdt_reint_setattr(struct mdt_thread_info *info, repbody->handle.cookie = mfd->mfd_handle.h_cookie; } - if (info->mti_epoch && (info->mti_epoch->flags & MF_SOM_CHANGE)) + if (info->mti_ioepoch && (info->mti_ioepoch->flags & MF_SOM_CHANGE)) ma->ma_attr_flags |= MDS_PERM_BYPASS | MDS_SOM; rc = mdt_attr_set(info, mo, rr->rr_flags); if (rc) GOTO(out_put, rc); - if (info->mti_epoch && (info->mti_epoch->flags & MF_SOM_CHANGE)) { + if (info->mti_ioepoch && (info->mti_ioepoch->flags & MF_SOM_CHANGE)) { LASSERT(mdt_conn_flags(info) & OBD_CONNECT_SOM); - LASSERT(info->mti_epoch); + LASSERT(info->mti_ioepoch); spin_lock(&med->med_open_lock); /* Size-on-MDS Update. Find and free mfd. */ - mfd = mdt_handle2mfd(info, &info->mti_epoch->handle); + mfd = mdt_handle2mfd(info, &info->mti_ioepoch->handle); if (mfd == NULL) { spin_unlock(&med->med_open_lock); CDEBUG(D_INODE | D_ERROR, "no handle for file close: " "fid = "DFID": cookie = "LPX64"\n", PFID(info->mti_rr.rr_fid1), - info->mti_epoch->handle.cookie); + info->mti_ioepoch->handle.cookie); GOTO(out_put, rc = -ESTALE); } LASSERT(mfd->mfd_mode == FMODE_SOM); - LASSERT(!(info->mti_epoch->flags & MF_EPOCH_CLOSE)); + LASSERT(!(info->mti_ioepoch->flags & MF_EPOCH_CLOSE)); class_handle_unhash(&mfd->mfd_handle); list_del_init(&mfd->mfd_list); diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 4cddc07..0f7461f 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -743,8 +743,8 @@ const struct req_msg_field RMF_QUNIT_DATA = EXPORT_SYMBOL(RMF_QUNIT_DATA); const struct req_msg_field RMF_MDT_EPOCH = - DEFINE_MSGF("mdt_epoch", 0, - sizeof(struct mdt_epoch), lustre_swab_mdt_epoch, NULL); + DEFINE_MSGF("mdt_ioepoch", 0, + sizeof(struct mdt_ioepoch), lustre_swab_mdt_ioepoch, NULL); EXPORT_SYMBOL(RMF_MDT_EPOCH); const struct req_msg_field RMF_PTLRPC_BODY = diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index ae5658b..eaa65e3 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1519,8 +1519,7 @@ void lustre_swab_obdo (struct obdo *o) __swab32s (&o->o_nlink); __swab32s (&o->o_generation); __swab32s (&o->o_misc); - __swab32s (&o->o_easize); - __swab32s (&o->o_mds); + __swab64s (&o->o_ioepoch); __swab32s (&o->o_stripe_idx); __swab32s (&o->o_padding_1); /* o_inline is opaque */ @@ -1649,7 +1648,7 @@ void lustre_swab_mdt_body (struct mdt_body *b) __swab32s (&b->padding_4); } -void lustre_swab_mdt_epoch (struct mdt_epoch *b) +void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b) { /* handle is opaque */ __swab64s (&b->ioepoch); diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index 99dba0d..b5a9e8e 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -248,7 +248,7 @@ EXPORT_SYMBOL(lustre_swab_ost_lvb); EXPORT_SYMBOL(lustre_swab_mds_status_req); EXPORT_SYMBOL(lustre_swab_mds_body); EXPORT_SYMBOL(lustre_swab_mdt_body); -EXPORT_SYMBOL(lustre_swab_mdt_epoch); +EXPORT_SYMBOL(lustre_swab_mdt_ioepoch); EXPORT_SYMBOL(lustre_swab_obd_quotactl); EXPORT_SYMBOL(lustre_swab_mds_remote_perm); EXPORT_SYMBOL(lustre_swab_mdt_remote_perm); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 46db76f..57d658d 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -568,14 +568,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_misc)); LASSERTF((int)sizeof(((struct obdo *)0)->o_misc) == 4, " found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_misc)); - LASSERTF((int)offsetof(struct obdo, o_easize) == 112, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_easize)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_easize)); - LASSERTF((int)offsetof(struct obdo, o_mds) == 116, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_mds)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_mds)); + LASSERTF((int)offsetof(struct obdo, o_ioepoch) == 112, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_ioepoch)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_ioepoch) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_ioepoch)); LASSERTF((int)offsetof(struct obdo, o_stripe_idx) == 120, " found %lld\n", (long long)(int)offsetof(struct obdo, o_stripe_idx)); LASSERTF((int)sizeof(((struct obdo *)0)->o_stripe_idx) == 4, " found %lld\n", diff --git a/lustre/utils/req-layout.c b/lustre/utils/req-layout.c index 4b7c685..55c9020 100644 --- a/lustre/utils/req-layout.c +++ b/lustre/utils/req-layout.c @@ -53,7 +53,7 @@ #define lustre_swab_lu_seq_range NULL #define lustre_swab_md_fld NULL #define lustre_swab_mdt_body NULL -#define lustre_swab_mdt_epoch NULL +#define lustre_swab_mdt_ioepoch NULL #define lustre_swab_ptlrpc_body NULL #define lustre_swab_obd_statfs NULL #define lustre_swab_connect NULL diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 1d6aae3..606ccff 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -246,8 +246,7 @@ check_obdo(void) CHECK_MEMBER(obdo, o_nlink); CHECK_MEMBER(obdo, o_generation); CHECK_MEMBER(obdo, o_misc); - CHECK_MEMBER(obdo, o_easize); - CHECK_MEMBER(obdo, o_mds); + CHECK_MEMBER(obdo, o_ioepoch); CHECK_MEMBER(obdo, o_stripe_idx); CHECK_MEMBER(obdo, o_padding_1); CHECK_MEMBER(obdo, o_handle); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index debda52..818f19e8 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -565,14 +565,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_misc)); LASSERTF((int)sizeof(((struct obdo *)0)->o_misc) == 4, " found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_misc)); - LASSERTF((int)offsetof(struct obdo, o_easize) == 112, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_easize)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_easize)); - LASSERTF((int)offsetof(struct obdo, o_mds) == 116, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_mds)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_mds)); + LASSERTF((int)offsetof(struct obdo, o_ioepoch) == 112, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_ioepoch)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_ioepoch) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_ioepoch)); LASSERTF((int)offsetof(struct obdo, o_stripe_idx) == 120, " found %lld\n", (long long)(int)offsetof(struct obdo, o_stripe_idx)); LASSERTF((int)sizeof(((struct obdo *)0)->o_stripe_idx) == 4, " found %lld\n", -- 1.8.3.1