From 4facce895ae842f29733b04773cdd2189afa8d4b Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 17 Jan 2006 19:08:22 +0000 Subject: [PATCH] Branch b_release_1_4_6 Use the "fid" EA name when storing FID data on the OST. This avoids confusion on the OST when using the "lov" EA name and would certainly be a problem with lfsck. b=10072 r=yury --- lustre/include/linux/lustre_fsfilt.h | 14 ++++++++------ lustre/lvfs/fsfilt_ext3.c | 11 ++++++----- lustre/lvfs/fsfilt_reiserfs.c | 5 +++-- lustre/mds/handler.c | 5 +++-- lustre/mds/mds_join.c | 2 +- lustre/mds/mds_lov.c | 2 +- lustre/mds/mds_open.c | 4 ++-- lustre/mds/mds_reint.c | 6 +++--- lustre/obdfilter/filter.c | 4 ++-- 9 files changed, 29 insertions(+), 24 deletions(-) diff --git a/lustre/include/linux/lustre_fsfilt.h b/lustre/include/linux/lustre_fsfilt.h index 34840d3..41109f1 100644 --- a/lustre/include/linux/lustre_fsfilt.h +++ b/lustre/include/linux/lustre_fsfilt.h @@ -61,8 +61,9 @@ struct fsfilt_operations { int (* fs_iocontrol)(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); int (* fs_set_md)(struct inode *inode, void *handle, void *md, - int size); - int (* fs_get_md)(struct inode *inode, void *md, int size); + int size, const char *name); + int (* fs_get_md)(struct inode *inode, void *md, int size, + const char *name); /* * this method is needed to make IO operation fsfilt nature depend. * @@ -273,15 +274,16 @@ static inline int fsfilt_iocontrol(struct obd_device *obd, struct inode *inode, } static inline int fsfilt_set_md(struct obd_device *obd, struct inode *inode, - void *handle, void *md, int size) + void *handle, void *md, int size, + const char *name) { - return obd->obd_fsops->fs_set_md(inode, handle, md, size); + return obd->obd_fsops->fs_set_md(inode, handle, md, size, name); } static inline int fsfilt_get_md(struct obd_device *obd, struct inode *inode, - void *md, int size) + void *md, int size, const char *name) { - return obd->obd_fsops->fs_get_md(inode, md, size); + return obd->obd_fsops->fs_get_md(inode, md, size, name); } static inline int fsfilt_send_bio(int rw, struct obd_device *obd, diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 9284843..31478fa 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -485,7 +485,7 @@ static int fsfilt_ext3_iocontrol(struct inode * inode, struct file *file, } static int fsfilt_ext3_set_md(struct inode *inode, void *handle, - void *lmm, int lmm_size) + void *lmm, int lmm_size, const char *name) { int rc; @@ -497,7 +497,7 @@ static int fsfilt_ext3_set_md(struct inode *inode, void *handle, lock_24kernel(); rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED, - XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size, 0); + name, lmm, lmm_size, 0); unlock_24kernel(); @@ -508,7 +508,8 @@ static int fsfilt_ext3_set_md(struct inode *inode, void *handle, } /* Must be called with i_sem held */ -static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size) +static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size, + const char *name) { int rc; @@ -516,7 +517,7 @@ static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size) lock_24kernel(); rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, - XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size); + name, lmm, lmm_size); unlock_24kernel(); /* This gives us the MD size */ @@ -525,7 +526,7 @@ static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size) if (rc < 0) { CDEBUG(D_INFO, "error getting EA %d/%s from inode %lu: rc %d\n", - EXT3_XATTR_INDEX_TRUSTED, XATTR_LUSTRE_MDS_LOV_EA, + EXT3_XATTR_INDEX_TRUSTED, name, inode->i_ino, rc); memset(lmm, 0, lmm_size); return (rc == -ENODATA) ? 0 : rc; diff --git a/lustre/lvfs/fsfilt_reiserfs.c b/lustre/lvfs/fsfilt_reiserfs.c index b9f987ab..68a049e 100644 --- a/lustre/lvfs/fsfilt_reiserfs.c +++ b/lustre/lvfs/fsfilt_reiserfs.c @@ -125,7 +125,7 @@ static int fsfilt_reiserfs_setattr(struct dentry *dentry, void *handle, } static int fsfilt_reiserfs_set_md(struct inode *inode, void *handle, - void *lmm, int lmm_size) + void *lmm, int lmm_size, const char *name) { /* XXX write stripe data into MDS file itself */ CERROR("not implemented yet\n"); @@ -133,7 +133,8 @@ static int fsfilt_reiserfs_set_md(struct inode *inode, void *handle, return -ENOSYS; } -static int fsfilt_reiserfs_get_md(struct inode *inode, void *lmm, int lmm_size) +static int fsfilt_reiserfs_get_md(struct inode *inode, void *lmm, int lmm_size, + const char *name) { if (lmm == NULL) return inode->i_size; diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index e46793f..e931c16 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -492,7 +492,7 @@ int mds_get_md(struct obd_device *obd, struct inode *inode, void *md, if (lock) down(&inode->i_sem); - rc = fsfilt_get_md(obd, inode, md, *size); + rc = fsfilt_get_md(obd, inode, md, *size, "lov"); if (rc < 0) { CERROR("Error %d reading eadata for ino %lu\n", @@ -707,7 +707,8 @@ static int mds_getattr_pack_msg(struct ptlrpc_request *req, struct inode *inode, if ((S_ISREG(inode->i_mode) && (body->valid & OBD_MD_FLEASIZE)) || (S_ISDIR(inode->i_mode) && (body->valid & OBD_MD_FLDIREA))) { down(&inode->i_sem); - rc = fsfilt_get_md(req->rq_export->exp_obd, inode, NULL, 0); + rc = fsfilt_get_md(req->rq_export->exp_obd, inode, NULL, 0, + "lov"); up(&inode->i_sem); CDEBUG(D_INODE, "got %d bytes MD data for inode %lu\n", rc, inode->i_ino); diff --git a/lustre/mds/mds_join.c b/lustre/mds/mds_join.c index 599287f..ec446bc 100644 --- a/lustre/mds/mds_join.c +++ b/lustre/mds/mds_join.c @@ -473,7 +473,7 @@ int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req, CDEBUG(D_INODE, "join finish, set lmm V2 to inode %lu \n", head_inode->i_ino); fsfilt_set_md(obd, head_inode, handle, head_lmmj, - sizeof(struct lov_mds_md_join)); + sizeof(struct lov_mds_md_join), "lov"); mds_finish_join(mds, req, head_inode, head_lmmj); cleanup: rc = mds_finish_transno(mds, head_inode, handle, req, rc, 0); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 6597308..c4279ad 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -678,7 +678,7 @@ int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode, GOTO(conv_free, rc); } - rc = fsfilt_set_md(obd, inode, handle, lmm, lmm_size); + rc = fsfilt_set_md(obd, inode, handle, lmm, lmm_size, "lov"); err = fsfilt_commit(obd, inode, handle, 0); if (!rc) diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 67d0fbe..d696ac5 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -364,7 +364,7 @@ static int mds_create_objects(struct ptlrpc_request *req, int offset, LASSERT(lmm_buf); LASSERT(lmm_bufsize >= lmm_size); memcpy(lmm_buf, lmm, lmm_size); - rc = fsfilt_set_md(obd, inode, *handle, lmm, lmm_size); + rc = fsfilt_set_md(obd, inode, *handle, lmm, lmm_size, "lov"); if (rc) CERROR("open replay failed to set md:%d\n", rc); RETURN(0); @@ -477,7 +477,7 @@ static int mds_create_objects(struct ptlrpc_request *req, int offset, GOTO(out_oa, rc); } - rc = fsfilt_set_md(obd, inode, *handle, lmm, lmm_size); + rc = fsfilt_set_md(obd, inode, *handle, lmm, lmm_size, "lov"); lmm_buf = lustre_msg_buf(req->rq_repmsg, offset, 0); lmm_bufsize = req->rq_repmsg->buflens[offset]; LASSERT(lmm_buf); diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 1e6d76c..37b16c5 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -577,7 +577,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset, lum->lmm_stripe_count == 0) || /* lmm_stripe_size == -1 is deprecated in 1.4.6 */ lum->lmm_stripe_size == (typeof(lum->lmm_stripe_size))(-1))){ - rc = fsfilt_set_md(obd, inode, handle, NULL, 0); + rc = fsfilt_set_md(obd, inode, handle, NULL, 0, "lov"); if (rc) GOTO(cleanup, rc); } else { @@ -590,7 +590,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset, obd_free_memmd(mds->mds_osc_exp, &lsm); rc = fsfilt_set_md(obd, inode, handle, rec->ur_eadata, - rec->ur_eadatalen); + rec->ur_eadatalen, "lov"); if (rc) GOTO(cleanup, rc); } @@ -865,7 +865,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, if (rc > 0) { down(&inode->i_sem); rc = fsfilt_set_md(obd, inode, handle, - &lmm, lmm_size); + &lmm, lmm_size, "lov"); up(&inode->i_sem); } if (rc) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 41eae0a..1689e8e 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -2061,7 +2061,7 @@ int filter_update_fidea(struct obd_export *exp, struct inode *inode, LPU64"/"LPU64")\n", oa->o_fid, oa->o_stripe_idx, oa->o_generation, oa->o_id, group); - rc = fsfilt_set_md(obd, inode, handle, &ff, sizeof(ff)); + rc = fsfilt_set_md(obd, inode, handle, &ff, sizeof(ff), "fid"); if (rc) CERROR("store fid in object failed! rc: %d\n", rc); } else { @@ -2208,7 +2208,7 @@ int filter_setattr(struct obd_export *exp, struct obdo *oa, __FUNCTION__, 1); if (IS_ERR(dentry)) RETURN(PTR_ERR(dentry)); - + filter = &exp->exp_obd->u.filter; push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL); lock_kernel(); -- 1.8.3.1