From 90a8375bf34ccdd5adcc514cfefed3871d0fbb73 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 10 Oct 2008 19:19:42 +0000 Subject: [PATCH] b=17299 i=adilger i=nathan rename MAXPOOLNAME to LOV_MAXPOOLNAME --- lustre/include/lustre/liblustreapi.h | 2 +- lustre/include/lustre/lustre_idl.h | 5 +---- lustre/include/lustre/lustre_user.h | 5 +++-- lustre/include/obd.h | 18 +++++++++--------- lustre/lov/lov_ea.c | 2 +- lustre/lov/lov_pack.c | 7 ++++--- lustre/lov/lov_pool.c | 29 +++++++++++++++-------------- lustre/mgs/mgs_handler.c | 4 ++-- lustre/obdclass/debug.c | 2 +- lustre/utils/lfs.c | 8 ++++---- lustre/utils/liblustreapi.c | 10 +++++----- lustre/utils/obd.c | 10 +++++----- 12 files changed, 51 insertions(+), 51 deletions(-) diff --git a/lustre/include/lustre/liblustreapi.h b/lustre/include/lustre/liblustreapi.h index e6c1e43..f8c29ed 100644 --- a/lustre/include/lustre/liblustreapi.h +++ b/lustre/include/lustre/liblustreapi.h @@ -135,7 +135,7 @@ struct find_param { unsigned int depth; dev_t st_dev; - char poolname[MAXPOOLNAME+1]; + char poolname[LOV_MAXPOOLNAME + 1]; }; extern int llapi_getstripe(char *path, struct find_param *param); diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 1007e03..38517bd 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -760,9 +760,6 @@ typedef __u32 obd_count; #define LOV_OBJECT_GROUP_DEFAULT ~0ULL #define LOV_OBJECT_GROUP_CLEAR 0ULL -#define MAXPOOLNAME 16 -#define POOLNAMEF "%.16s" - #define lov_ost_data lov_ost_data_v1 struct lov_ost_data_v1 { /* per-stripe data structure (little-endian)*/ __u64 l_object_id; /* OST object ID */ @@ -798,7 +795,7 @@ struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */ __u64 lmm_object_gr; /* LOV object group */ __u32 lmm_stripe_size; /* size of stripe in bytes */ __u32 lmm_stripe_count; /* num stripes in use for this object */ - char lmm_pool_name[MAXPOOLNAME]; /* must be 32bit aligned */ + char lmm_pool_name[LOV_MAXPOOLNAME]; /* must be 32bit aligned */ struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */ }; diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index ed40b0e..d95e221 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -136,7 +136,8 @@ struct obd_statfs; #define LOV_PATTERN_RAID1 0x002 #define LOV_PATTERN_FIRST 0x100 -#define MAXPOOLNAME 16 +#define LOV_MAXPOOLNAME 16 +#define LOV_POOLNAMEF "%.16s" #define lov_user_ost_data lov_user_ost_data_v1 struct lov_user_ost_data_v1 { /* per-stripe data structure */ @@ -166,7 +167,7 @@ struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ __u32 lmm_stripe_size; /* size of stripe in bytes */ __u16 lmm_stripe_count; /* num stripes in use for this object */ __u16 lmm_stripe_offset; /* starting stripe offset in lmm_objects */ - char lmm_pool_name[MAXPOOLNAME]; /* pool name */ + char lmm_pool_name[LOV_MAXPOOLNAME]; /* pool name */ struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */ } __attribute__((packed)); diff --git a/lustre/include/obd.h b/lustre/include/obd.h index b02fd6b..72b61d7 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -150,7 +150,7 @@ struct lov_stripe_md { __u32 lw_stripe_size; /* size of the stripe */ __u32 lw_pattern; /* striping pattern (RAID0, RAID1) */ unsigned lw_stripe_count; /* number of objects being striped over */ - char lw_pool_name[MAXPOOLNAME]; /* pool name */ + char lw_pool_name[LOV_MAXPOOLNAME]; /* pool name */ } lsm_wire; struct lov_array_info *lsm_array; /*Only for joined file array info*/ @@ -701,14 +701,14 @@ struct lov_tgt_desc { #define pool_tgt(_p, _i) _p->pool_lov->lov_tgts[_p->pool_obds.op_array[_i]] struct pool_desc { - char pool_name[MAXPOOLNAME + 1]; /* name of pool */ - struct ost_pool pool_obds; /* pool members */ - struct lov_qos_rr pool_rr; /* round robin qos */ - struct hlist_node pool_hash; /* access by poolname */ - struct list_head pool_list; /* serial access */ - cfs_proc_dir_entry_t *pool_proc_entry; /* file in /proc */ - struct lov_obd *pool_lov; /* lov obd to which this - pool belong */ + char pool_name[LOV_MAXPOOLNAME + 1]; /* name of pool */ + struct ost_pool pool_obds; /* pool members */ + struct lov_qos_rr pool_rr; /* round robin qos */ + struct hlist_node pool_hash; /* access by poolname */ + struct list_head pool_list; /* serial access */ + cfs_proc_dir_entry_t *pool_proc_entry; /* file in /proc */ + struct lov_obd *pool_lov; /* lov obd to which this + pool belong */ }; struct lov_obd { diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 1ea9d70..f403660 100755 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -669,7 +669,7 @@ int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, lmm = (struct lov_mds_md_v3 *)lmmv1; lsm_unpackmd_common(lsm, (struct lov_mds_md_v1 *)lmm); - strncpy(lsm->lsm_pool_name, lmm->lmm_pool_name, MAXPOOLNAME); + strncpy(lsm->lsm_pool_name, lmm->lmm_pool_name, LOV_MAXPOOLNAME); for (i = 0; i < lsm->lsm_stripe_count; i++) { /* XXX LOV STACKING call down to osc_unpackmd() */ diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 7d1d552..a39e92b 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -105,7 +105,7 @@ void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm) CDEBUG(level,"stripe_size %u, stripe_count %u\n", le32_to_cpu(lmm->lmm_stripe_size), le32_to_cpu(lmm->lmm_stripe_count)); - CDEBUG(level,"pool_name "POOLNAMEF"\n", lmm->lmm_pool_name); + CDEBUG(level,"pool_name "LOV_POOLNAMEF"\n", lmm->lmm_pool_name); if (le32_to_cpu(lmm->lmm_stripe_count) <= LOV_V1_INSANE_STRIPE_COUNT) { for (i = 0, lod = lmm->lmm_objects; @@ -244,7 +244,8 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, lmmv1->lmm_stripe_count = cpu_to_le32(stripe_count); lmmv1->lmm_pattern = cpu_to_le32(lsm->lsm_pattern); if (lsm->lsm_magic == LOV_MAGIC_V3) { - strncpy(lmmv3->lmm_pool_name, lsm->lsm_pool_name, MAXPOOLNAME); + strncpy(lmmv3->lmm_pool_name, lsm->lsm_pool_name, + LOV_MAXPOOLNAME); lmm_objects = lmmv3->lmm_objects; } else { lmm_objects = lmmv1->lmm_objects; @@ -507,7 +508,7 @@ static int __lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, (*lsmp)->lsm_stripe_size = lumv1->lmm_stripe_size; if (lmm_magic == LOV_USER_MAGIC_V3) strncpy((*lsmp)->lsm_pool_name, lumv3.lmm_pool_name, - MAXPOOLNAME); + LOV_MAXPOOLNAME); rc = 0; } diff --git a/lustre/lov/lov_pool.c b/lustre/lov/lov_pool.c index 95846ce..fe55794 100644 --- a/lustre/lov/lov_pool.c +++ b/lustre/lov/lov_pool.c @@ -66,7 +66,7 @@ static __u32 pool_hashfn(lustre_hash_t *hash_body, void *key, unsigned mask) result = 0; poolname = (char *)key; - for (i = 0; i < MAXPOOLNAME; i++) { + for (i = 0; i < LOV_MAXPOOLNAME; i++) { if (poolname[i] == '\0') break; result = (result << 4)^(result >> 28) ^ poolname[i]; @@ -90,7 +90,7 @@ static int pool_hashkey_compare(void *key, struct hlist_node *compared_hnode) pool_name = (char *)key; pool = hlist_entry(compared_hnode, struct pool_desc, pool_hash); - rc = strncmp(pool_name, pool->pool_name, MAXPOOLNAME); + rc = strncmp(pool_name, pool->pool_name, LOV_MAXPOOLNAME); return (!rc); } @@ -260,14 +260,15 @@ void lov_dump_pool(int level, struct pool_desc *pool) { int i; - CDEBUG(level, "pool "POOLNAMEF" has %d members\n", + CDEBUG(level, "pool "LOV_POOLNAMEF" has %d members\n", pool->pool_name, pool->pool_obds.op_count); read_lock(&pool_tgt_rwlock(pool)); for (i = 0; i < pool_tgt_count(pool) ; i++) { if (!pool_tgt(pool, i) || !(pool_tgt(pool, i))->ltd_exp) continue; - CDEBUG(level, "pool "POOLNAMEF"[%d] = %s\n", pool->pool_name, - i, obd_uuid2str(&((pool_tgt(pool, i))->ltd_uuid))); + CDEBUG(level, "pool "LOV_POOLNAMEF"[%d] = %s\n", + pool->pool_name, i, + obd_uuid2str(&((pool_tgt(pool, i))->ltd_uuid))); } read_unlock(&pool_tgt_rwlock(pool)); } @@ -378,15 +379,15 @@ int lov_pool_new(struct obd_device *obd, char *poolname) lov = &(obd->u.lov); - if (strlen(poolname) > MAXPOOLNAME) + if (strlen(poolname) > LOV_MAXPOOLNAME) return -ENAMETOOLONG; OBD_ALLOC_PTR(new_pool); if (new_pool == NULL) return -ENOMEM; - strncpy(new_pool->pool_name, poolname, MAXPOOLNAME); - new_pool->pool_name[MAXPOOLNAME] = '\0'; + strncpy(new_pool->pool_name, poolname, LOV_MAXPOOLNAME); + new_pool->pool_name[LOV_MAXPOOLNAME] = '\0'; new_pool->pool_lov = lov; rc = lov_ost_pool_init(&new_pool->pool_obds, 0); if (rc) @@ -415,7 +416,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname) lov->lov_pool_count++; spin_unlock(&obd->obd_dev_lock); - CDEBUG(D_CONFIG, POOLNAMEF" is pool #%d\n", + CDEBUG(D_CONFIG, LOV_POOLNAMEF" is pool #%d\n", poolname, lov->lov_pool_count); #ifdef LPROCFS @@ -427,7 +428,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname) #endif if (IS_ERR(new_pool->pool_proc_entry)) { - CWARN("Cannot add proc pool entry "POOLNAMEF"\n", poolname); + CWARN("Cannot add proc pool entry "LOV_POOLNAMEF"\n", poolname); new_pool->pool_proc_entry = NULL; } @@ -513,7 +514,7 @@ int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname) pool->pool_rr.lqr_dirty = 1; - CDEBUG(D_CONFIG, "Added %s to "POOLNAMEF" as member %d\n", + CDEBUG(D_CONFIG, "Added %s to "LOV_POOLNAMEF" as member %d\n", ostname, poolname, pool_tgt_count(pool)); return 0; } @@ -559,7 +560,7 @@ int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname) pool->pool_rr.lqr_dirty = 1; - CDEBUG(D_CONFIG, "%s removed from "POOLNAMEF"\n", ostname, poolname); + CDEBUG(D_CONFIG, "%s removed from "LOV_POOLNAMEF"\n", ostname, poolname); return 0; } @@ -587,10 +588,10 @@ struct pool_desc *lov_find_pool(struct lov_obd *lov, char *poolname) if (poolname[0] != '\0') { pool = lustre_hash_lookup(lov->lov_pools_hash_body, poolname); if (pool == NULL) - CWARN("Request for an unknown pool ("POOLNAMEF")\n", + CWARN("Request for an unknown pool ("LOV_POOLNAMEF")\n", poolname); if ((pool != NULL) && (pool_tgt_count(pool) == 0)) { - CWARN("Request for an empty pool ("POOLNAMEF")\n", + CWARN("Request for an empty pool ("LOV_POOLNAMEF")\n", poolname); pool = NULL; } diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 40e1275..99cb466 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -752,7 +752,7 @@ static int mgs_iocontrol_pool(struct obd_device *obd, if (fsname == NULL) RETURN(-ENOMEM); - OBD_ALLOC(poolname, MAXPOOLNAME + 1); + OBD_ALLOC(poolname, LOV_MAXPOOLNAME + 1); if (poolname == NULL) { rc = -ENOMEM; GOTO(out_pool, rc); @@ -842,7 +842,7 @@ out_pool: OBD_FREE(fsname, MTI_NAME_MAXLEN); if (poolname != NULL) - OBD_FREE(poolname, MAXPOOLNAME + 1); + OBD_FREE(poolname, LOV_MAXPOOLNAME + 1); RETURN(rc); } diff --git a/lustre/obdclass/debug.c b/lustre/obdclass/debug.c index ed5faa3..a80cd2c 100644 --- a/lustre/obdclass/debug.c +++ b/lustre/obdclass/debug.c @@ -117,7 +117,7 @@ int dump_obdo(struct obdo *oa) void dump_lsm(int level, struct lov_stripe_md *lsm) { CDEBUG(level, "lsm %p, objid "LPX64", maxbytes "LPX64", magic 0x%08X, " - "stripe_size %u, stripe_count %u pool "POOLNAMEF"\n", lsm, + "stripe_size %u, stripe_count %u pool "LOV_POOLNAMEF"\n", lsm, lsm->lsm_object_id, lsm->lsm_maxbytes, lsm->lsm_magic, lsm->lsm_stripe_size, lsm->lsm_stripe_count, lsm->lsm_pool_name); diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 922e812..f29ae94 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -615,17 +615,17 @@ static int lfs_find(int argc, char **argv) break; case FIND_POOL_OPT: new_fashion = 1; - if (strlen(optarg) > MAXPOOLNAME) { + if (strlen(optarg) > LOV_MAXPOOLNAME) { fprintf(stderr, "Pool name %s is too long" " (max is %d)\n", optarg, - MAXPOOLNAME); + LOV_MAXPOOLNAME); return -1; } /* we do check for empty pool because empty pool * is used to find V1 lov attributes */ - strncpy(param.poolname, optarg, MAXPOOLNAME); - param.poolname[MAXPOOLNAME] = '\0'; + strncpy(param.poolname, optarg, LOV_MAXPOOLNAME); + param.poolname[LOV_MAXPOOLNAME] = '\0'; param.exclude_pool = !!neg_opt; param.check_pool = 1; break; diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index f0d5be2..9978cdf 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -301,7 +301,7 @@ int llapi_file_open_pool(const char *name, int flags, int mode, if (poolpath(fsname, NULL, NULL) == 0) pool_name = ptr + 1; } - strncpy(lum.lmm_pool_name, pool_name, MAXPOOLNAME); + strncpy(lum.lmm_pool_name, pool_name, LOV_MAXPOOLNAME); } else { /* If no pool is specified at all, use V1 request */ lum.lmm_magic = LOV_USER_MAGIC_V1; @@ -947,12 +947,12 @@ void llapi_lov_dump_user_lmm(struct find_param *param, (param->verbose || !param->obduuid)); break; case LOV_USER_MAGIC_V3: { - char pool_name[MAXPOOLNAME + 1]; + char pool_name[LOV_MAXPOOLNAME + 1]; struct lov_user_ost_data_v1 *objects; struct lov_user_md_v3 *lmmv3 = (void *)¶m->lmd->lmd_lmm; - strncpy(pool_name, lmmv3->lmm_pool_name, MAXPOOLNAME); - pool_name[MAXPOOLNAME] = '\0'; + strncpy(pool_name, lmmv3->lmm_pool_name, LOV_MAXPOOLNAME); + pool_name[LOV_MAXPOOLNAME] = '\0'; objects = lmmv3->lmm_objects; lov_dump_user_lmm_v1v3(¶m->lmd->lmd_lmm, pool_name, objects, path, is_dir, @@ -1477,7 +1477,7 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, (param->poolname[0] == '\0')) || ((param->lmd->lmd_lmm.lmm_magic == LOV_USER_MAGIC_V3) && (strncmp(lmmv3->lmm_pool_name, - param->poolname, MAXPOOLNAME) == 0)) || + param->poolname, LOV_MAXPOOLNAME) == 0)) || ((param->lmd->lmd_lmm.lmm_magic == LOV_USER_MAGIC_V3) && (strcmp(param->poolname, "*") == 0))) { if (param->exclude_pool) diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 5a5bde3..c8e9059 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -2781,15 +2781,15 @@ static int extract_fsname_poolname(char *arg, char *fsname, char *poolname) rc = -EINVAL; goto err; } - if (len > MAXPOOLNAME) { + if (len > LOV_MAXPOOLNAME) { fprintf(stderr, "poolname %s is too long (length is %d max is %d)\n", - ptr + 1, len, MAXPOOLNAME); + ptr + 1, len, LOV_MAXPOOLNAME); rc = -ENAMETOOLONG; goto err; } - strncpy(poolname, ptr + 1, MAXPOOLNAME); - poolname[MAXPOOLNAME] = '\0'; + strncpy(poolname, ptr + 1, LOV_MAXPOOLNAME); + poolname[LOV_MAXPOOLNAME] = '\0'; *ptr = '\0'; return 0; @@ -2802,7 +2802,7 @@ int jt_pool_cmd(int argc, char **argv) { enum lcfg_command_type cmd; char fsname[PATH_MAX + 1]; - char poolname[MAXPOOLNAME + 1]; + char poolname[LOV_MAXPOOLNAME + 1]; char *ostnames_buf = NULL; int i, rc; int *array = NULL, array_sz; -- 1.8.3.1