From feadf17233a776f9dae495bf82261424499c8c89 Mon Sep 17 00:00:00 2001 From: pschwan Date: Thu, 13 Jun 2002 21:05:11 +0000 Subject: [PATCH] - Added the obdo inline code to the OSC, for the non-lov-using case - use extN MDS - fixups to the EA code that I broke earlier --- lustre/include/linux/lustre_mds.h | 8 +++++++- lustre/mds/mds_extN.c | 35 +++++++++-------------------------- lustre/osc/osc_request.c | 15 +++++++++++++-- lustre/tests/mds.cfg | 2 +- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index 69f71fb..222c09a 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -31,6 +31,7 @@ #include #include #include +#include /* for lov_md */ #define LUSTRE_MDS_NAME "mds" @@ -48,7 +49,12 @@ struct mds_update_record { __u32 ur_uid; __u32 ur_gid; __u64 ur_time; -}; +}; + +struct mds_objid { + __u64 mo_magic; + struct lov_md mo_lov_md; +}; #define MDS_LR_CLIENT 8192 #define MDS_LR_SIZE 128 diff --git a/lustre/mds/mds_extN.c b/lustre/mds/mds_extN.c index be7587e..3068fe0 100644 --- a/lustre/mds/mds_extN.c +++ b/lustre/mds/mds_extN.c @@ -34,11 +34,6 @@ struct mds_cb_data { __u64 cb_last_rcvd; }; -struct mds_objid { - __u64 mo_magic; - struct lov_md mo_lov_md; -}; - #define EXTN_XATTR_INDEX_LUSTRE 5 #define XATTR_LUSTRE_MDS_OBJID "system.lustre_mds_objid" @@ -130,47 +125,35 @@ static int mds_extN_set_obdo(struct inode *inode, void *handle, static int mds_extN_get_obdo(struct inode *inode, struct obdo *obdo) { - char *buf; - struct mds_objid data; - struct lov_object_id *lov_ids; - int rc, size; + struct mds_objid *data; + int rc; lock_kernel(); down(&inode->i_sem); rc = extN_xattr_get(inode, EXTN_XATTR_INDEX_LUSTRE, - XATTR_LUSTRE_MDS_OBJID, &data, - sizeof(struct mds_objid)); - size = sizeof(struct mds_objid) + data.mo_lov_md.lmd_stripe_count * - sizeof(*lov_ids); - OBD_ALLOC(buf, size); - if (buf == NULL) - LBUG(); - rc = extN_xattr_get(inode, EXTN_XATTR_INDEX_LUSTRE, - XATTR_LUSTRE_MDS_OBJID, buf, size); + XATTR_LUSTRE_MDS_OBJID, obdo->o_inline, + OBD_INLINESZ); + data = (struct mds_objid *)obdo->o_inline; + up(&inode->i_sem); unlock_kernel(); - if (size > OBD_INLINESZ) - LBUG(); - if (rc < 0) { CERROR("error getting EA %s from MDS inode %ld: rc = %d\n", XATTR_LUSTRE_MDS_OBJID, inode->i_ino, rc); obdo->o_id = 0; - } else if (data.mo_magic != cpu_to_le64(XATTR_MDS_MO_MAGIC)) { + } else if (data->mo_magic != cpu_to_le64(XATTR_MDS_MO_MAGIC)) { CERROR("MDS object id %Ld has bad magic %Lx\n", (unsigned long long)obdo->o_id, - (unsigned long long)le64_to_cpu(data.mo_magic)); + (unsigned long long)le64_to_cpu(data->mo_magic)); rc = -EINVAL; } else { /* This field is byteswapped because it appears in the * catalogue. All others are opaque to the MDS */ - obdo->o_id = le64_to_cpu(data.mo_lov_md.lmd_object_id); - memcpy(obdo->o_inline, buf + sizeof(data), size); + obdo->o_id = le64_to_cpu(data->mo_lov_md.lmd_object_id); } #warning FIXME: pass this buffer to caller for transmission when size exceeds OBD_INLINESZ - OBD_FREE(buf, size); return rc; } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 901cdbe..a2e1fc3 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -21,7 +21,9 @@ #include #include +#include /* for mds_objid */ #include +#include static void osc_con2cl(struct obd_conn *conn, struct ptlrpc_client **cl, struct ptlrpc_connection **connection) @@ -155,8 +157,7 @@ static int osc_open(struct obd_conn *conn, struct obdo *oa) body = lustre_msg_buf(request->rq_reqmsg, 0); memcpy(&body->oa, oa, sizeof(*oa)); body->connid = conn->oc_id; - if (body->oa.o_valid != (OBD_MD_FLMODE | OBD_MD_FLID)) - LBUG(); + body->oa.o_valid = (OBD_MD_FLMODE | OBD_MD_FLID); request->rq_replen = lustre_msg_size(1, &size); @@ -247,6 +248,8 @@ static int osc_create(struct obd_conn *conn, struct obdo *oa) struct ptlrpc_client *cl; struct ptlrpc_connection *connection; struct ost_body *body; + struct mds_objid *objid; + struct lov_object_id *lov_id; int rc, size = sizeof(*body); ENTRY; @@ -274,6 +277,14 @@ static int osc_create(struct obd_conn *conn, struct obdo *oa) body = lustre_msg_buf(request->rq_repmsg, 0); memcpy(oa, &body->oa, sizeof(*oa)); + memset(oa->o_inline, 0, sizeof(oa->o_inline)); + objid = (struct mds_objid *)oa->o_inline; + objid->mo_lov_md.lmd_object_id = oa->o_id; + objid->mo_lov_md.lmd_stripe_count = 1; + lov_id = (struct lov_object_id *)(oa->o_inline + sizeof(*objid)); + lov_id->l_device_id = 0; + lov_id->l_object_id = oa->o_id; + EXIT; out: ptlrpc_free_req(request); diff --git a/lustre/tests/mds.cfg b/lustre/tests/mds.cfg index 34a2db0..bfea75b 100644 --- a/lustre/tests/mds.cfg +++ b/lustre/tests/mds.cfg @@ -1,6 +1,6 @@ #!/bin/sh # Config file for setting up a metadata server -MDSFS=ext3 +MDSFS=extN MDSDEV=/tmp/mds MDSSIZE=25000 SETUP_MDS=y -- 1.8.3.1