From a81b8dba2190f4c6d9536378c43e21ac52ce8023 Mon Sep 17 00:00:00 2001 From: braam Date: Mon, 9 Sep 2002 16:01:17 +0000 Subject: [PATCH] - change field names for clarity. --- lustre/include/linux/obd.h | 4 ++-- lustre/lib/l_net.c | 2 +- lustre/lib/lov_pack.c | 4 ++-- lustre/llite/file.c | 2 +- lustre/llite/namei.c | 2 +- lustre/llite/super.c | 26 +++++++++++++++----------- lustre/lov/lov_obd.c | 11 ++++++----- lustre/mdc/mdc_reint.c | 2 +- lustre/mdc/mdc_request.c | 6 +++--- lustre/osc/osc_request.c | 6 +++--- lustre/ptlrpc/niobuf.c | 5 +++++ 11 files changed, 40 insertions(+), 30 deletions(-) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 93cc6a3..2d50867 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -40,7 +40,7 @@ struct lov_oinfo { /* per-child structure */ struct lov_stripe_md { __u32 lmd_magic; - __u32 lmd_easize; /* packed size for MDS of ea */ + __u32 lmd_mds_easize; /* packed size for MDS of ea */ __u64 lmd_object_id; /* lov object id */ __u64 lmd_stripe_offset; /* offset of the stripe */ __u64 lmd_stripe_size; /* size of the stripe */ @@ -105,7 +105,7 @@ struct client_obd { struct semaphore cl_sem; int cl_conn_count; __u8 cl_target_uuid[37]; /* XXX -> lustre_name */ - int cl_max_mdsize; + int cl_max_mds_easize; }; struct mds_obd { diff --git a/lustre/lib/l_net.c b/lustre/lib/l_net.c index 844aa8d..07369bc 100644 --- a/lustre/lib/l_net.c +++ b/lustre/lib/l_net.c @@ -100,7 +100,7 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) cli->cl_import.imp_client = &obddev->obd_ldlm_client; cli->cl_import.imp_obd = obddev; - cli->cl_max_mdsize = sizeof(struct lov_mds_md); + cli->cl_max_mds_easize = sizeof(struct lov_mds_md); MOD_INC_USE_COUNT; RETURN(0); diff --git a/lustre/lib/lov_pack.c b/lustre/lib/lov_pack.c index 626ac76..1a2dd94 100644 --- a/lustre/lib/lov_pack.c +++ b/lustre/lib/lov_pack.c @@ -48,7 +48,7 @@ void lov_packmd(struct lov_mds_md *mdsmd, struct lov_stripe_md *md) { int i; mdsmd->lmd_magic = md->lmd_magic; - mdsmd->lmd_easize = md->lmd_easize; + mdsmd->lmd_easize = md->lmd_mds_easize; mdsmd->lmd_object_id = md->lmd_object_id; mdsmd->lmd_stripe_offset = md->lmd_stripe_offset; mdsmd->lmd_stripe_count = md->lmd_stripe_count; @@ -63,7 +63,7 @@ void lov_unpackmd(struct lov_stripe_md *md, struct lov_mds_md *mdsmd) { int i; md->lmd_magic = mdsmd->lmd_magic; - md->lmd_easize = mdsmd->lmd_easize; + md->lmd_mds_easize = mdsmd->lmd_easize; md->lmd_object_id = mdsmd->lmd_object_id; md->lmd_stripe_offset = mdsmd->lmd_stripe_offset; md->lmd_stripe_count = mdsmd->lmd_stripe_count; diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 83945ff..a1aeaf7 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -61,7 +61,7 @@ static int ll_file_open(struct inode *inode, struct file *file) RETURN(-ENOMEM); } oa->o_mode = S_IFREG | 0600; - oa->o_easize = mdc->cl_max_mdsize; + oa->o_easize = mdc->cl_max_mds_easize; oa->o_id = inode->i_ino; oa->o_valid = OBD_MD_FLMODE | OBD_MD_FLEASIZE | OBD_MD_FLID; diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 9d6f227..0b344f2 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -467,7 +467,7 @@ static int ll_create(struct inode * dir, struct dentry * dentry, int mode) out_destroy: if (smd) { - oa.o_easize = smd->lmd_easize; + oa.o_easize = smd->lmd_mds_easize; oa.o_valid |= OBD_MD_FLEASIZE; err = obd_destroy(ll_i2obdconn(dir), &oa, smd); if (err) diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 3a80f78..755cc8f 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -89,6 +89,17 @@ static void ll_options(char *options, char **ost, char **mds, int *flags) #ifndef log2 #define log2(n) ffz(~(n)) #endif +inline int ll_mds_easize(struct super_block *sb) +{ + struct client_obd *mdc = sbi2mdc(ll_s2sbi(sb)); + return mdc->cl_max_mds_easize; +} + +inline int ll_lov_easize(struct lov_stripe_md *md) +{ + return sizeof(*md) + md->lmd_stripe_count * + sizeof(struct lov_oinfo); +} static struct super_block * ll_read_super(struct super_block *sb, void *data, int silent) @@ -257,8 +268,7 @@ static void ll_clear_inode(struct inode *inode) char *symlink_name = lli->lli_symlink_name; if (md) { - int size = sizeof(*md) + - md->lmd_stripe_count * sizeof(struct lov_oinfo); + int size = ll_lov_easize(md); OBD_FREE(md, size); lli->lli_smd = NULL; } @@ -290,7 +300,7 @@ static void ll_delete_inode(struct inode *inode) GOTO(out, -ENOMEM); oa->o_id = md->lmd_object_id; - oa->o_easize = md->lmd_easize; + oa->o_easize = md->lmd_mds_easize; oa->o_mode = inode->i_mode; oa->o_valid = OBD_MD_FLID | OBD_MD_FLEASIZE | OBD_MD_FLMODE; @@ -411,11 +421,6 @@ out: RETURN(rc); } -inline int ll_stripe_mds_md_size(struct super_block *sb) -{ - struct client_obd *mdc = sbi2mdc(ll_s2sbi(sb)); - return mdc->cl_max_mdsize; -} static void ll_read_inode2(struct inode *inode, void *opaque) { @@ -457,13 +462,12 @@ static void ll_read_inode2(struct inode *inode, void *opaque) if (md && md->md && md->md->lmd_stripe_count) { struct lov_mds_md *smd = md->md; int size; - if (md->md->lmd_easize != ll_stripe_mds_md_size(inode->i_sb)) { + if (md->md->lmd_easize != ll_mds_easize(inode->i_sb)) { CERROR("Striping metadata size error %ld\n", inode->i_ino); LBUG(); } - size = sizeof(*lli->lli_smd) + - md->md->lmd_stripe_count * sizeof(struct lov_oinfo); + size = ll_lov_easize(lli->lli_smd); OBD_ALLOC(lli->lli_smd, size); if (!lli->lli_smd) { CERROR("No memory for %d\n", size); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 6112b0e..8745fcc 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -74,7 +74,7 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, GOTO(out, rc = -EINVAL); } - mdc->cl_max_mdsize = sizeof(struct lov_mds_md) + + mdc->cl_max_mds_easize = sizeof(struct lov_mds_md) + desc->ld_tgt_count * sizeof(struct lov_object_id); if (memcmp(obd->obd_uuid, desc->ld_uuid, sizeof(desc->ld_uuid))) { @@ -238,7 +238,7 @@ static int lov_create(struct lustre_handle *conn, struct obdo *oa, } md = *ea; - md->lmd_easize = lov_mds_md_size(export->exp_obd); + md->lmd_mds_easize = lov_mds_md_size(export->exp_obd); md->lmd_object_id = oa->o_id; if (!md->lmd_stripe_count) md->lmd_stripe_count = lov->desc.ld_default_stripe_count; @@ -674,8 +674,8 @@ static int lov_enqueue(struct lustre_handle *conn, struct lov_stripe_md *md, continue; submd.lmd_object_id = md->lmd_oinfo[i].loi_id; - submd.lmd_easize = sizeof(struct lov_mds_md); - submd.lmd_stripe_count = md->lmd_stripe_count; + submd.lmd_mds_easize = sizeof(struct lov_mds_md); + submd.lmd_stripe_count = 0; /* XXX submd is not fully initialized here */ rc = obd_enqueue(&(lov->tgts[i].conn), &submd, parent_lock, type, &sub_ext, sizeof(sub_ext), mode, @@ -713,7 +713,8 @@ static int lov_cancel(struct lustre_handle *conn, struct lov_stripe_md *md, continue; submd.lmd_object_id = md->lmd_oinfo[i].loi_id; - submd.lmd_easize = sizeof(struct lov_mds_md); + submd.lmd_mds_easize = sizeof(struct lov_mds_md); + submd.lmd_stripe_count = 0; rc = obd_cancel(&lov->tgts[i].conn, &submd, mode, &lockhs[i]); if (rc) CERROR("Error cancel object "LPD64" subobj "LPD64"\n", diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index 90ef7e5..ee891f3 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -92,7 +92,7 @@ int mdc_create(struct lustre_handle *conn, dir->i_ino, namelen, name); LBUG(); } - size[2] = smd->lmd_easize; + size[2] = smd->lmd_mds_easize; bufcount = 3; } else if (S_ISLNK(mode)) { size[2] = tgtlen + 1; diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 2c23133..8878e28 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -129,7 +129,7 @@ int mdc_getattr(struct lustre_handle *conn, if (S_ISREG(type)) { struct client_obd *mdc = &class_conn2obd(conn)->u.cli; bufcount = 2; - size[1] = mdc->cl_max_mdsize; + size[1] = mdc->cl_max_mds_easize; } else if (valid & OBD_MD_LINKNAME) { bufcount = 2; size[1] = ea_size; @@ -195,7 +195,7 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type, int rc, flags; int repsize[3] = {sizeof(struct ldlm_reply), sizeof(struct mds_body), - obddev->u.cli.cl_max_mdsize}; + obddev->u.cli.cl_max_mds_easize}; struct ldlm_reply *dlm_rep; struct ldlm_intent *lit; ENTRY; @@ -358,7 +358,7 @@ int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags, if (smd != NULL) { bufcount = 2; - size[1] = smd->lmd_easize; + size[1] = smd->lmd_mds_easize; } req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_OPEN, bufcount, size, diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index b05df59..7c28b98 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -183,7 +183,7 @@ static int osc_create(struct lustre_handle *conn, struct obdo *oa, OBD_ALLOC(*ea, oa->o_easize); if (!*ea) RETURN(-ENOMEM); - (*ea)->lmd_easize = oa->o_easize; + (*ea)->lmd_mds_easize = oa->o_easize; } request = ptlrpc_prep_req(class_conn2cliimp(conn), OST_CREATE, 1, &size, @@ -520,9 +520,9 @@ static int osc_brw_write(struct lustre_handle *conn, struct lov_stripe_md *md, local[mapped].addr = kmap(pga[mapped].pg); CDEBUG(D_INFO, "kmap(pg) = %p ; pg->flags = %lx ; pg->count = " - "%d ; pg->virtual = %p ; page %d of %d\n", + "%d ; page %d of %d\n", local[mapped].addr, pga[mapped].pg->flags, - page_count(pga[mapped].pg), pga[mapped].pg->virtual, + page_count(pga[mapped].pg), mapped, page_count - 1); local[mapped].offset = pga[mapped].off; diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index c66bf96..2351bdd 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -195,6 +195,11 @@ int ptlrpc_register_bulk(struct ptlrpc_bulk_desc *desc) ptl_process_id_t source_id; ENTRY; + if (desc->bd_page_count > PTL_MD_MAX_IOV) { + CERROR("iov longer than %d not supported\n", PTL_MD_MAX_IOV); + RETURN(-EINVAL); + } + iov = ptlrpc_get_bulk_iov (desc); if (iov == NULL) return (-ENOMEM); -- 1.8.3.1