From 055d7452ef06675da795db23380dab977f6627f1 Mon Sep 17 00:00:00 2001 From: wangdi Date: Thu, 14 Jul 2005 12:46:48 +0000 Subject: [PATCH] Branch HEAD add fid and group in kml log --- .../patches/vfs-wantedi-misc-2.6-suse.patch | 10 ++++++---- lustre/mds/handler.c | 17 ++++++++++------- lustre/mds/mds_fs.c | 6 ++++-- lustre/mds/mds_internal.h | 4 ++-- lustre/mds/mds_open.c | 10 +++++++--- lustre/mds/mds_reint.c | 16 ++++++++++------ lustre/smfs/mds_kml.c | 5 +++++ 7 files changed, 44 insertions(+), 24 deletions(-) diff --git a/lustre/kernel_patches/patches/vfs-wantedi-misc-2.6-suse.patch b/lustre/kernel_patches/patches/vfs-wantedi-misc-2.6-suse.patch index 0f52cf6..f44b1586 100644 --- a/lustre/kernel_patches/patches/vfs-wantedi-misc-2.6-suse.patch +++ b/lustre/kernel_patches/patches/vfs-wantedi-misc-2.6-suse.patch @@ -1,14 +1,16 @@ -Index: uml-2.6.3/include/linux/dcache.h +Index: linux-2.6.10/include/linux/dcache.h =================================================================== ---- uml-2.6.3.orig/include/linux/dcache.h 2004-02-21 00:19:14.365988600 +0800 -+++ uml-2.6.3/include/linux/dcache.h 2004-02-21 00:21:04.612228624 +0800 -@@ -25,6 +25,11 @@ +--- linux-2.6.10.orig/include/linux/dcache.h 2005-07-11 17:33:07.000000000 +0800 ++++ linux-2.6.10/include/linux/dcache.h 2005-07-14 20:27:46.000000000 +0800 +@@ -24,6 +24,13 @@ #define IS_ROOT(x) ((x) == (x)->d_parent) +struct dentry_params { + unsigned long p_inum; + void *p_ptr; ++ __u64 p_fid; ++ __u64 p_group; +}; + /* diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 16d09e8..2c205ab 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -2281,6 +2281,7 @@ static int mdt_obj_create(struct ptlrpc_request *req) struct mea *mea; void *handle = NULL; unsigned long cr_inum = 0; + __u64 fid = 0; ENTRY; DEBUG_REQ(D_HA, req, "create remote object"); @@ -2392,10 +2393,13 @@ repeat: CERROR("%s: name exists. repeat\n", obd->obd_name); goto repeat; } - + + fid = mds_alloc_fid(obd); new->d_fsdata = (void *)&dp; dp.p_inum = 0; dp.p_ptr = req; + dp.p_fid = fid; + dp.p_group = mds->mds_num; if ((lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) || (body->oa.o_flags & OBD_FL_RECREATE_OBJS)) { @@ -2471,7 +2475,7 @@ repeat: * and this is not replay. */ down(&new->d_inode->i_sem); - rc = mds_alloc_inode_sid(obd, new->d_inode, handle, &id); + rc = mds_set_inode_sid(obd, new->d_inode, handle, &id, fid); up(&new->d_inode->i_sem); } if (rc) { @@ -3258,12 +3262,11 @@ __u64 mds_alloc_fid(struct obd_device *obd) return fid; } - /* - * allocates new lustre_id on passed @inode and saves it to inode EA. + * update new lustre_id on passed @inode and saves it to inode EA. */ -int mds_alloc_inode_sid(struct obd_device *obd, struct inode *inode, - void *handle, struct lustre_id *id) +int mds_set_inode_sid(struct obd_device *obd, struct inode *inode, + void *handle, struct lustre_id *id, __u64 fid) { struct mds_obd *mds = &obd->u.mds; int alloc = 0, rc = 0; @@ -3280,7 +3283,7 @@ int mds_alloc_inode_sid(struct obd_device *obd, struct inode *inode, } id_group(id) = mds->mds_num; - id_fid(id) = mds_alloc_fid(obd); + id_fid(id) = fid; id_ino(id) = inode->i_ino; id_gen(id) = inode->i_generation; id_type(id) = (S_IFMT & inode->i_mode); diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 0785828..811e838 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -460,6 +460,7 @@ int mds_fs_setup_rootid(struct obd_device *obd) struct inode *inode; struct dentry *dentry; struct mds_obd *mds = &obd->u.mds; + __u64 fid; ENTRY; /* getting root directory and setup its fid. */ @@ -498,12 +499,13 @@ int mds_fs_setup_rootid(struct obd_device *obd) GOTO(out_dentry, rc); } + fid = mds_alloc_fid(obd); down(&inode->i_sem); - rc = mds_alloc_inode_sid(obd, inode, handle, &mds->mds_rootid); + rc = mds_set_inode_sid(obd, inode, handle, &mds->mds_rootid, fid); up(&inode->i_sem); if (rc) { - CERROR("mds_alloc_inode_sid() failed, rc = %d\n", + CERROR("mds_set_inode_sid() failed, rc = %d\n", rc); GOTO(out_dentry, rc); } diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index aa0d14e..5948655 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -205,8 +205,8 @@ int mds_fs_setup_virtid(struct obd_device *obd); __u64 mds_alloc_fid(struct obd_device *obd); -int mds_alloc_inode_sid(struct obd_device *, struct inode *, - void *, struct lustre_id *); +int mds_set_inode_sid(struct obd_device *, struct inode *, + void *, struct lustre_id *, __u64 fid); int mds_update_inode_sid(struct obd_device *, struct inode *, void *, struct lustre_id *); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index deff801..82e21b7 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -914,6 +914,7 @@ int mds_open(struct mds_update_record *rec, int offset, struct mea *mea = NULL; int mea_size, update_mode; int child_mode = LCK_PR; + __u64 fid = 0; ENTRY; DEBUG_REQ(D_INODE, req, "parent "DLID4" name %*s mode %o", @@ -1147,9 +1148,12 @@ got_child: handle = NULL; GOTO(cleanup, rc); } + fid = mds_alloc_fid(obd); dchild->d_fsdata = (void *) &dp; dp.p_ptr = req; dp.p_inum = ino; + dp.p_fid = fid; + dp.p_group = mds->mds_num; rc = ll_vfs_create(dparent->d_inode, dchild, rec->ur_mode, NULL); if (dchild->d_fsdata == (void *)(unsigned long)ino) @@ -1210,10 +1214,10 @@ got_child: */ mds_set_last_fid(obd, id_fid(rec->ur_id2)); } else { - rc = mds_alloc_inode_sid(obd, dchild->d_inode, - handle, &body->id1); + rc = mds_set_inode_sid(obd, dchild->d_inode, + handle, &body->id1, fid); if (rc) { - CERROR("mds_alloc_inode_sid() failed, " + CERROR("mds_set_inode_sid() failed, " "rc = %d\n", rc); } } diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index c69d9e5..64459bf 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -693,6 +693,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, struct dentry_params dp; struct mea *mea = NULL; int mea_size; + __u64 fid; ENTRY; LASSERT(offset == 1); @@ -781,9 +782,12 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, * needed to check if object already created in the case of creating * remote inode. */ + fid = mds_alloc_fid(obd); dchild->d_fsdata = (void *)&dp; dp.p_inum = (unsigned long)id_ino(rec->ur_id2); dp.p_ptr = req; + dp.p_fid = fid; + dp.p_group = mds->mds_num; switch (type) { case S_IFREG: { @@ -842,10 +846,10 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, */ mds_set_last_fid(obd, id_fid(rec->ur_id2)); } else { - rc = mds_alloc_inode_sid(obd, dchild->d_inode, - handle, NULL); + rc = mds_set_inode_sid(obd, dchild->d_inode, + handle, NULL, fid); if (rc) { - CERROR("mds_alloc_inode_sid() failed, inode %lu, " + CERROR("mds_set_inode_sid() failed, inode %lu, " "rc %d\n", dchild->d_inode->i_ino, rc); } } @@ -1079,11 +1083,11 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, * because for dir it was already done. */ down(&inode->i_sem); - rc = mds_alloc_inode_sid(obd, inode, - handle, NULL); + rc = mds_set_inode_sid(obd, inode, + handle, NULL, fid); up(&inode->i_sem); if (rc) { - CERROR("mds_alloc_inode_sid() failed, " + CERROR("mds_set_inode_sid() failed, " "inode %lu, rc %d\n", inode->i_ino, rc); } diff --git a/lustre/smfs/mds_kml.c b/lustre/smfs/mds_kml.c index d62350d..54ad1ad 100644 --- a/lustre/smfs/mds_kml.c +++ b/lustre/smfs/mds_kml.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -134,6 +135,8 @@ static int mds_rec_create_pack(char *buffer, struct dentry *dentry, struct lustre_msg *msg = NULL; struct mdc_op_data *op_data; struct mds_rec_create *rec; + struct dentry_params *param = + (struct dentry_params *) dentry->d_fsdata; int rc = 0, tgt_len = 0; void *tmp = NULL; @@ -147,6 +150,8 @@ static int mds_rec_create_pack(char *buffer, struct dentry *dentry, (char *)dentry->d_name.name, dentry->d_name.len, 0); + id_fid(&op_data->id1) = param->p_fid; + id_group(&op_data->id1) = param->p_group; PACK_KML_REC_INIT(buffer, MDS_REINT); mkpi = (struct mds_kml_pack_info *)buffer; -- 1.8.3.1