adilger@clusterfs.com
2007-Jan-24 15:33 UTC
[Lustre-devel] [Bug 11471] Many 160-stripe files cause memory fragmentation and failures
Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: https://bugzilla.lustre.org/show_bug.cgi?id=11471 Created an attachment (id=9414) Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: --> (https://bugzilla.lustre.org/attachment.cgi?id=9414&action=view) allocate per-stripe LOV EA data from its own slab This patch is an old patch (not to be used until updated & tested) that places the per-stripe data into its own slab. This avoids large single allocations when a file has many stripes, and will also facilitate other cleanups inside the code.
tianzy@clusterfs.com
2007-Jan-31 19:01 UTC
[Lustre-devel] [Bug 11471] Many 160-stripe files cause memory fragmentation and failures
Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: https://bugzilla.lustre.org/show_bug.cgi?id=11471 Created an attachment (id=9465) Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: --> (https://bugzilla.lustre.org/attachment.cgi?id=9465&action=view) ported patch
tianzy@clusterfs.com
2007-Feb-07 23:26 UTC
[Lustre-devel] [Bug 11471] Many 160-stripe files cause memory fragmentation and failures
Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: https://bugzilla.lustre.org/show_bug.cgi?id=11471 (From update of attachment 9465)>Index: lustre/include/linux/obd.h >==================================================================>RCS file: /cvsroot/cfs/lustre-core/include/linux/obd.h,v >retrieving revision 1.109.2.18.10.60 >retrieving revision 1.109.2.18.10.60.4.1 >diff -p -u -r1.109.2.18.10.60 -r1.109.2.18.10.60.4.1 >--- lustre/include/linux/obd.h 26 Dec 2006 19:00:09 -0000 1.109.2.18.10.60 >+++ lustre/include/linux/obd.h 30 Jan 2007 09:57:10 -0000 1.109.2.18.10.60.4.1 >@@ -112,7 +112,7 @@ struct lov_stripe_md { > } lsm_wire; > > struct lov_array_info *lsm_array; /*Only for joined file array info*/ >- struct lov_oinfo lsm_oinfo[0]; >+ struct lov_oinfo *lsm_oinfo[0]; > }; > > #define lsm_object_id lsm_wire.lw_object_id >Index: lustre/include/linux/obd_lov.h >==================================================================>RCS file: /cvsroot/cfs/lustre-core/include/linux/obd_lov.h,v >retrieving revision 1.12.42.3 >retrieving revision 1.12.42.3.24.1 >diff -p -u -r1.12.42.3 -r1.12.42.3.24.1 >--- lustre/include/linux/obd_lov.h 13 Jun 2006 16:53:20 -0000 1.12.42.3 >+++ lustre/include/linux/obd_lov.h 30 Jan 2007 09:57:11 -0000 1.12.42.3.24.1 >@@ -9,7 +9,7 @@ > > static inline int lov_stripe_md_size(int stripes) > { >- return sizeof(struct lov_stripe_md) + stripes*sizeof(struct lov_oinfo); >+ return sizeof(struct lov_stripe_md) + stripes*sizeof(struct lov_oinfo*); > } > > #define lov_mds_md_size(stripes) lov_mds_md_v1_size(stripes) >Index: lustre/liblustre/rw.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/liblustre/rw.c,v >retrieving revision 1.6.2.9.2.30 >retrieving revision 1.6.2.9.2.30.8.1 >diff -p -u -r1.6.2.9.2.30 -r1.6.2.9.2.30.8.1 >--- lustre/liblustre/rw.c 19 Oct 2006 20:05:48 -0000 1.6.2.9.2.30 >+++ lustre/liblustre/rw.c 30 Jan 2007 09:57:11 -0000 1.6.2.9.2.30.8.1 >@@ -156,12 +156,12 @@ static int llu_extent_lock_callback(stru > stripe = llu_lock_to_stripe_offset(inode, lock); > l_lock(&lock->l_resource->lr_namespace->ns_lock); > kms = ldlm_extent_shift_kms(lock, >- lsm->lsm_oinfo[stripe].loi_kms); >+ lsm->lsm_oinfo[stripe]->loi_kms); > l_unlock(&lock->l_resource->lr_namespace->ns_lock); >- if (lsm->lsm_oinfo[stripe].loi_kms != kms) >+ if (lsm->lsm_oinfo[stripe]->loi_kms != kms) > LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, >- lsm->lsm_oinfo[stripe].loi_kms, kms); >- lsm->lsm_oinfo[stripe].loi_kms = kms; >+ lsm->lsm_oinfo[stripe]->loi_kms, kms); >+ lsm->lsm_oinfo[stripe]->loi_kms = kms; > iput: > I_RELE(inode); > break; >@@ -201,7 +201,7 @@ static int llu_glimpse_callback(struct l > } > > lvb = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*lvb)); >- lvb->lvb_size = lli->lli_smd->lsm_oinfo[stripe].loi_kms; >+ lvb->lvb_size = lli->lli_smd->lsm_oinfo[stripe]->loi_kms; > > LDLM_DEBUG(lock, "i_size: %llu -> stripe number %u -> kms "LPU64, > (long long)llu_i2stat(inode)->st_size, stripe,lvb->lvb_size); >Index: lustre/llite/dir.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/llite/dir.c,v >retrieving revision 1.54.2.7.10.24 >retrieving revision 1.54.2.7.10.24.24.1 >diff -p -u -r1.54.2.7.10.24 -r1.54.2.7.10.24.24.1 >--- lustre/llite/dir.c 25 Jul 2006 20:55:27 -0000 1.54.2.7.10.24 >+++ lustre/llite/dir.c 30 Jan 2007 09:57:11 -0000 1.54.2.7.10.24.24.1 >@@ -595,13 +595,13 @@ static int ll_dir_ioctl(struct inode *in > lmj->lmm_objects[i].l_extent_end > lex->le_start + lex->le_len; > lmj->lmm_objects[i].l_object_id >- lsm->lsm_oinfo[i].loi_id; >+ lsm->lsm_oinfo[i]->loi_id; > lmj->lmm_objects[i].l_object_gr >- lsm->lsm_oinfo[i].loi_gr; >+ lsm->lsm_oinfo[i]->loi_gr; > lmj->lmm_objects[i].l_ost_gen >- lsm->lsm_oinfo[i].loi_ost_gen; >+ lsm->lsm_oinfo[i]->loi_ost_gen; > lmj->lmm_objects[i].l_ost_idx >- lsm->lsm_oinfo[i].loi_ost_idx; >+ lsm->lsm_oinfo[i]->loi_ost_idx; > } > lmm = (struct lov_mds_md *)lmj; > lmmsize = lmj_size; >Index: lustre/llite/file.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/llite/file.c,v >retrieving revision 1.127.2.32.2.70 >retrieving revision 1.127.2.32.2.70.2.1 >diff -p -u -r1.127.2.32.2.70 -r1.127.2.32.2.70.2.1 >--- lustre/llite/file.c 25 Jan 2007 14:11:50 -0000 1.127.2.32.2.70 >+++ lustre/llite/file.c 30 Jan 2007 09:57:11 -0000 1.127.2.32.2.70.2.1 >@@ -588,11 +588,11 @@ static int ll_lock_to_stripe_offset(stru > LASSERT(stripe < lsm->lsm_stripe_count); > > check: >- if (lsm->lsm_oinfo[stripe].loi_id != lock->l_resource->lr_name.name[0]|| >- lsm->lsm_oinfo[stripe].loi_gr != lock->l_resource->lr_name.name[1]){ >+ if (lsm->lsm_oinfo[stripe]->loi_id != lock->l_resource->lr_name.name[0]|| >+ lsm->lsm_oinfo[stripe]->loi_gr != lock->l_resource->lr_name.name[1]){ > LDLM_ERROR(lock, "resource doesn''t match object "LPU64"/"LPU64, >- lsm->lsm_oinfo[stripe].loi_id, >- lsm->lsm_oinfo[stripe].loi_gr); >+ lsm->lsm_oinfo[stripe]->loi_id, >+ lsm->lsm_oinfo[stripe]->loi_gr); > RETURN(-ELDLM_NO_LOCK_DATA); > } > >@@ -789,12 +789,12 @@ static int ll_extent_lock_callback(struc > l_lock(&lock->l_resource->lr_namespace->ns_lock); > lov_stripe_lock(lsm); > kms = ldlm_extent_shift_kms(lock, >- lsm->lsm_oinfo[stripe].loi_kms); >+ lsm->lsm_oinfo[stripe]->loi_kms); > >- if (lsm->lsm_oinfo[stripe].loi_kms != kms) >+ if (lsm->lsm_oinfo[stripe]->loi_kms != kms) > LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, >- lsm->lsm_oinfo[stripe].loi_kms, kms); >- lsm->lsm_oinfo[stripe].loi_kms = kms; >+ lsm->lsm_oinfo[stripe]->loi_kms, kms); >+ lsm->lsm_oinfo[stripe]->loi_kms = kms; > lov_stripe_unlock(lsm); > l_unlock(&lock->l_resource->lr_namespace->ns_lock); > //ll_try_done_writing(inode); >@@ -895,7 +895,7 @@ static int ll_glimpse_callback(struct ld > } > > lvb = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*lvb)); >- lvb->lvb_size = lli->lli_smd->lsm_oinfo[stripe].loi_kms; >+ lvb->lvb_size = lli->lli_smd->lsm_oinfo[stripe]->loi_kms; > lvb->lvb_mtime = LTIME_S(inode->i_mtime); > lvb->lvb_atime = LTIME_S(inode->i_atime); > lvb->lvb_ctime = LTIME_S(inode->i_ctime); >Index: lustre/lov/lov_ea.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/Attic/lov_ea.c,v >retrieving revision 1.1.60.4 >retrieving revision 1.1.60.4.12.1 >diff -p -u -r1.1.60.4 -r1.1.60.4.12.1 >--- lustre/lov/lov_ea.c 31 Aug 2006 06:46:05 -0000 1.1.60.4 >+++ lustre/lov/lov_ea.c 30 Jan 2007 09:57:12 -0000 1.1.60.4.12.1 >@@ -78,6 +78,49 @@ static int lsm_lmm_verify_common(struct > return 0; > } > >+struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size) >+{ >+ struct lov_stripe_md *lsm; >+ int i, oinfo_ptrs_size; >+ struct lov_oinfo *loi; >+ >+ LASSERT(stripe_count > 0); >+ >+ oinfo_ptrs_size = sizeof(struct lov_oinfo *) * stripe_count; >+ *size = sizeof(struct lov_stripe_md) + oinfo_ptrs_size; >+ >+ OBD_ALLOC(lsm, *size); >+ if (!lsm) >+ return NULL;; >+ >+ for (i = 0; i < stripe_count; i++) { >+ OBD_SLAB_ALLOC(loi, lov_oinfo_slab, SLAB_NOFS, sizeof(*loi)); >+ if (loi == NULL) >+ goto err; >+ lsm->lsm_oinfo[i] = loi; >+ } >+ lsm->lsm_stripe_count = stripe_count; >+ return lsm; >+ >+err: >+ while (--i >= 0) >+ OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, sizeof(*loi)); >+ OBD_FREE(lsm, *size); >+ return NULL; >+} >+ >+void lsm_free_plain(struct lov_stripe_md *lsm) >+{ >+ int stripe_count = lsm->lsm_stripe_count; >+ int i; >+ >+ for (i = 0; i < stripe_count; i++) >+ OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, >+ sizeof(struct lov_oinfo)); >+ OBD_FREE(lsm, sizeof(struct lov_stripe_md) + >+ stripe_count * sizeof(struct lov_oinfo *)); >+} >+ > static void lsm_unpackmd_common(struct lov_stripe_md *lsm, > struct lov_mds_md *lmm) > { >@@ -118,11 +161,6 @@ lsm_stripe_index_by_offset_plain(struct > return 0; > } > >-static void lsm_free_plain(struct lov_stripe_md *lsm) >-{ >- OBD_FREE(lsm, lov_stripe_md_size(lsm->lsm_stripe_count)); >-} >- > static int lsm_revalidate_plain(struct lov_stripe_md *lsm, > struct obd_device *obd) > { >@@ -164,8 +202,9 @@ int lsm_unpackmd_plain(struct lov_obd *l > > lsm_unpackmd_common(lsm, lmm); > >- for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { > /* XXX LOV STACKING call down to osc_unpackmd() */ >+ loi = lsm->lsm_oinfo[i]; > loi->loi_id = le64_to_cpu(lmm->lmm_objects[i].l_object_id); > loi->loi_gr = le64_to_cpu(lmm->lmm_objects[i].l_object_gr); > loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); >@@ -176,7 +215,6 @@ int lsm_unpackmd_plain(struct lov_obd *l > lov_dump_lmm_v1(D_WARNING, lmm); > return -EINVAL; > } >- loi++; > } > > return 0; >@@ -258,7 +296,7 @@ static void lovea_free_array_info(struct > static void lsm_free_join(struct lov_stripe_md *lsm) > { > lovea_free_array_info(lsm); >- OBD_FREE(lsm, lov_stripe_md_size(lsm->lsm_stripe_count)); >+ lsm_free_plain(lsm); > } > > static void >@@ -369,18 +407,17 @@ static int lovea_unpack_array(struct llo > > /* unpack extent''s lmm to lov_oinfo array */ > loi_index = lai->lai_ext_array[cursor].le_loi_idx; >- loi = &lsm->lsm_oinfo[loi_index]; > CDEBUG(D_INFO, "lovea upackmd cursor %d, loi_index %d extent " > LPU64":"LPU64"\n", cursor, loi_index, med->med_start, > med->med_len); > > for (i = 0; i < lmm->lmm_stripe_count; i ++) { > /* XXX LOV STACKING call down to osc_unpackmd() */ >+ loi = lsm->lsm_oinfo[loi_index]; > loi->loi_id = le64_to_cpu(lmm->lmm_objects[i].l_object_id); > loi->loi_gr = le64_to_cpu(lmm->lmm_objects[i].l_object_gr); > loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); > loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); >- loi++; > } > > RETURN(0); >Index: lustre/lov/lov_internal.h >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/lov_internal.h,v >retrieving revision 1.4.6.2.42.12 >retrieving revision 1.4.6.2.42.12.12.1 >diff -p -u -r1.4.6.2.42.12 -r1.4.6.2.42.12.12.1 >--- lustre/lov/lov_internal.h 26 Sep 2006 20:53:45 -0000 1.4.6.2.42.12 >+++ lustre/lov/lov_internal.h 30 Jan 2007 09:57:12 -0000 1.4.6.2.42.12.12.1 >@@ -71,6 +71,8 @@ struct lov_async_page { > (LASSERT(((struct lov_async_page *)(c))->lap_magic == LOV_AP_MAGIC), \ > (struct lov_async_page *)(c)) > >+extern kmem_cache_t *lov_oinfo_slab; >+ > static inline void lov_llh_addref(void *llhp) > { > struct lov_lock_handles *llh = llhp; >@@ -237,6 +239,8 @@ void lov_dump_lmm_join(int level, struct > /* lov_ea.c */ > int lov_unpackmd_join(struct lov_obd *lov, struct lov_stripe_md *lsm, > struct lov_mds_md *lmm); >+struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size); >+void lsm_free_plain(struct lov_stripe_md *lsm); > > struct lov_extent *lovea_idx2le(struct lov_stripe_md *lsm, int stripe_no); > struct lov_extent *lovea_off2le(struct lov_stripe_md *lsm, obd_off lov_off); >Index: lustre/lov/lov_log.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/lov_log.c,v >retrieving revision 1.3.10.2.42.7 >retrieving revision 1.3.10.2.42.7.50.1 >diff -p -u -r1.3.10.2.42.7 -r1.3.10.2.42.7.50.1 >--- lustre/lov/lov_log.c 24 Feb 2006 00:38:02 -0000 1.3.10.2.42.7 >+++ lustre/lov/lov_log.c 30 Jan 2007 09:57:12 -0000 1.3.10.2.42.7.50.1 >@@ -65,7 +65,6 @@ static int lov_llog_origin_add(struct ll > { > struct obd_device *obd = ctxt->loc_obd; > struct lov_obd *lov = &obd->u.lov; >- struct lov_oinfo *loi; > int i, rc = 0; > ENTRY; > >@@ -73,7 +72,8 @@ static int lov_llog_origin_add(struct ll > "logcookies %p, numcookies %d lsm->lsm_stripe_count %d \n", > logcookies, numcookies, lsm->lsm_stripe_count); > >- for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { >+ struct lov_oinfo *loi = lsm->lsm_oinfo[i]; > struct obd_device *child = lov->tgts[loi->loi_ost_idx].ltd_exp->exp_obd; > struct llog_ctxt *cctxt = llog_get_context(child, ctxt->loc_idx); > >@@ -141,16 +141,15 @@ static int lov_llog_repl_cancel(struct l > { > struct lov_obd *lov; > struct obd_device *obd = ctxt->loc_obd; >- struct lov_oinfo *loi; > int rc = 0, i; > ENTRY; > > LASSERT(lsm != NULL); > LASSERT(count == lsm->lsm_stripe_count); > >- loi = lsm->lsm_oinfo; > lov = &obd->u.lov; >- for (i = 0; i < count; i++, cookies++, loi++) { >+ for (i = 0; i < count; i++, cookies++) { >+ struct lov_oinfo *loi = lsm->lsm_oinfo[i]; > struct obd_device *child = lov->tgts[loi->loi_ost_idx].ltd_exp->exp_obd; > struct llog_ctxt *cctxt = llog_get_context(child, ctxt->loc_idx); > int err; >Index: lustre/lov/lov_merge.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/lov_merge.c,v >retrieving revision 1.1.34.14 >retrieving revision 1.1.34.14.12.1 >diff -p -u -r1.1.34.14 -r1.1.34.14.12.1 >--- lustre/lov/lov_merge.c 26 Sep 2006 23:59:54 -0000 1.1.34.14 >+++ lustre/lov/lov_merge.c 30 Jan 2007 09:57:12 -0000 1.1.34.14.12.1 >@@ -63,10 +63,10 @@ int lov_merge_lvb(struct obd_export *exp > LASSERT(lsm->lsm_lock_owner == current); > #endif > >- for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; >- i++, loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { > obd_size lov_size, tmpsize; > >+ loi = lsm->lsm_oinfo[i]; > tmpsize = loi->loi_kms; > if (kms_only == 0 && loi->loi_lvb.lvb_size > tmpsize) > tmpsize = loi->loi_lvb.lvb_size; >@@ -113,8 +113,8 @@ int lov_adjust_kms(struct obd_export *ex > > if (shrink) { > struct lov_oinfo *loi; >- for (loi = lsm->lsm_oinfo; stripe < lsm->lsm_stripe_count; >- stripe++, loi++) { >+ for (; stripe < lsm->lsm_stripe_count; stripe++) { >+ loi = lsm->lsm_oinfo[stripe]; > kms = lov_size_to_stripe(lsm, size, stripe); > CDEBUG(D_INODE, > "stripe %d KMS %sing "LPU64"->"LPU64"\n", >@@ -129,7 +129,7 @@ int lov_adjust_kms(struct obd_export *ex > if (size > 0) > stripe = lov_stripe_number(lsm, size - 1); > kms = lov_size_to_stripe(lsm, size, stripe); >- loi = &(lsm->lsm_oinfo[stripe]); >+ loi = lsm->lsm_oinfo[stripe]; > > CDEBUG(D_INODE, "stripe %d KMS %sincreasing "LPU64"->"LPU64"\n", > stripe, kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms); >Index: lustre/lov/lov_obd.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/lov_obd.c,v >retrieving revision 1.99.2.14.2.65 >retrieving revision 1.99.2.14.2.65.4.1 >diff -p -u -r1.99.2.14.2.65 -r1.99.2.14.2.65.4.1 >--- lustre/lov/lov_obd.c 21 Dec 2006 00:35:46 -0000 1.99.2.14.2.65 >+++ lustre/lov/lov_obd.c 30 Jan 2007 09:57:12 -0000 1.99.2.14.2.65.4.1 >@@ -872,8 +872,8 @@ static int lov_recreate(struct obd_expor > GOTO(out, rc = -EINVAL); > > for (i = 0; i < lsm->lsm_stripe_count; i++) { >- if (lsm->lsm_oinfo[i].loi_ost_idx == ost_idx) { >- if (lsm->lsm_oinfo[i].loi_id != src_oa->o_id) >+ if (lsm->lsm_oinfo[i]->loi_ost_idx == ost_idx) { >+ if (lsm->lsm_oinfo[i]->loi_id != src_oa->o_id) > GOTO(out, rc = -EINVAL); > break; > } >@@ -1368,7 +1368,7 @@ static int lov_brw_check(struct lov_obd > * I/O can succeed */ > for (i = 0; i < oa_bufs; i++) { > int stripe = lov_stripe_number(lov_oinfo->oi_md, pga[i].off); >- int ost = lov_oinfo->oi_md->lsm_oinfo[stripe].loi_ost_idx; >+ int ost = lov_oinfo->oi_md->lsm_oinfo[stripe]->loi_ost_idx; > obd_off start, end; > > if (!lov_stripe_intersects(lov_oinfo->oi_md, i, pga[i].off, >@@ -1573,7 +1573,7 @@ int lov_prep_async_page(struct obd_expor > /* for now only raid 0 which passes through */ > lap->lap_stripe = lov_stripe_number(lsm, offset); > lov_stripe_offset(lsm, offset, lap->lap_stripe, &lap->lap_sub_offset); >- loi = &lsm->lsm_oinfo[lap->lap_stripe]; >+ loi = lsm->lsm_oinfo[lap->lap_stripe]; > > /* so the callback doesn''t need the lsm */ > lap->lap_loi_id = loi->loi_id; >@@ -1607,7 +1607,7 @@ static int lov_queue_async_io(struct obd > > lap = LAP_FROM_COOKIE(cookie); > >- loi = &lsm->lsm_oinfo[lap->lap_stripe]; >+ loi = lsm->lsm_oinfo[lap->lap_stripe]; > > rc = obd_queue_async_io(lov->tgts[loi->loi_ost_idx].ltd_exp, lsm, > loi, lap->lap_sub_cookie, cmd, off, count, >@@ -1630,7 +1630,7 @@ static int lov_set_async_flags(struct ob > > lap = LAP_FROM_COOKIE(cookie); > >- loi = &lsm->lsm_oinfo[lap->lap_stripe]; >+ loi = lsm->lsm_oinfo[lap->lap_stripe]; > > rc = obd_set_async_flags(lov->tgts[loi->loi_ost_idx].ltd_exp, > lsm, loi, lap->lap_sub_cookie, async_flags); >@@ -1654,7 +1654,7 @@ static int lov_queue_group_io(struct obd > > lap = LAP_FROM_COOKIE(cookie); > >- loi = &lsm->lsm_oinfo[lap->lap_stripe]; >+ loi = lsm->lsm_oinfo[lap->lap_stripe]; > > rc = obd_queue_group_io(lov->tgts[loi->loi_ost_idx].ltd_exp, lsm, loi, > oig, lap->lap_sub_cookie, cmd, off, count, >@@ -1677,8 +1677,8 @@ static int lov_trigger_group_io(struct o > > ASSERT_LSM_MAGIC(lsm); > >- loi = lsm->lsm_oinfo; >- for (i = 0; i < lsm->lsm_stripe_count; i++, loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { >+ loi = lsm->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) { > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > continue; >@@ -1706,7 +1706,7 @@ static int lov_teardown_async_page(struc > > lap = LAP_FROM_COOKIE(cookie); > >- loi = &lsm->lsm_oinfo[lap->lap_stripe]; >+ loi = lsm->lsm_oinfo[lap->lap_stripe]; > > rc = obd_teardown_async_page(lov->tgts[loi->loi_ost_idx].ltd_exp, > lsm, loi, lap->lap_sub_cookie); >@@ -1830,9 +1830,10 @@ static int lov_change_cbdata(struct obd_ > RETURN(-ENODEV); > > lov = &exp->exp_obd->u.lov; >- for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { > struct lov_stripe_md submd; > >+ loi = lsm->lsm_oinfo[i]; > submd.lsm_object_id = loi->loi_id; > submd.lsm_stripe_count = 0; > rc = obd_change_cbdata(lov->tgts[loi->loi_ost_idx].ltd_exp, >@@ -1913,10 +1914,11 @@ static int lov_cancel_unused(struct obd_ > > ASSERT_LSM_MAGIC(lsm); > >- for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { > struct lov_stripe_md submd; > int err; > >+ loi = lsm->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > >@@ -1948,10 +1950,11 @@ static int lov_join_lru(struct obd_expor > RETURN(-ENODEV); > > lov = &exp->exp_obd->u.lov; >- for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { > struct lov_stripe_md submd; > int rc = 0; > >+ loi = lsm->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > >@@ -2200,9 +2203,8 @@ static int lov_get_info(struct obd_expor > /* XXX - it''s assumed all the locks for deleted OSTs have > * been cancelled. Also, the export for deleted OSTs will > * be NULL and won''t match the lock''s export. */ >- for (i = 0, loi = data->lsm->lsm_oinfo; >- i < data->lsm->lsm_stripe_count; >- i++, loi++) { >+ for (i = 0; i < data->lsm->lsm_stripe_count; i++) { >+ loi = data->lsm->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].ltd_exp => data->lock->l_conn_export && > loi->loi_id == res_id->name[0] && >@@ -2318,8 +2320,8 @@ int lov_test_and_clear_async_rc(struct l > int i, rc = 0; > ENTRY; > >- for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; >- i++, loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { >+ loi = lsm->lsm_oinfo[i]; > if (loi->loi_ar.ar_rc && !rc) > rc = loi->loi_ar.ar_rc; > loi->loi_ar.ar_rc = 0; >@@ -2481,12 +2483,19 @@ struct obd_ops lov_obd_ops = { > static quota_interface_t *quota_interface; > extern quota_interface_t lov_quota_interface; > >+kmem_cache_t *lov_oinfo_slab; >+ > int __init lov_init(void) > { > struct lprocfs_static_vars lvars; > int rc; > ENTRY; > >+ lov_oinfo_slab = kmem_cache_create("lov_oinfo", >+ sizeof(struct lov_oinfo), 0, >+ SLAB_HWCACHE_ALIGN, NULL, NULL); >+ if (lov_oinfo_slab == NULL) >+ return -ENOMEM; > lprocfs_init_vars(lov, &lvars); > > request_module("lquota"); >@@ -2495,8 +2504,12 @@ int __init lov_init(void) > > rc = class_register_type(&lov_obd_ops, lvars.module_vars, > OBD_LOV_DEVICENAME); >- if (rc && quota_interface) >- PORTAL_SYMBOL_PUT(lov_quota_interface); >+ if (rc) { >+ if (quota_interface) >+ PORTAL_SYMBOL_PUT(lov_quota_interface); >+ kmem_cache_destroy(lov_oinfo_slab); >+ } >+ > > RETURN(rc); > } >@@ -2508,6 +2521,7 @@ static void /*__exit*/ lov_exit(void) > PORTAL_SYMBOL_PUT(lov_quota_interface); > > class_unregister_type(OBD_LOV_DEVICENAME); >+ kmem_cache_destroy(lov_oinfo_slab); > } > > MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>"); >Index: lustre/lov/lov_pack.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/lov_pack.c,v >retrieving revision 1.14.2.4.40.15 >retrieving revision 1.14.2.4.40.15.12.1 >diff -p -u -r1.14.2.4.40.15 -r1.14.2.4.40.15.12.1 >--- lustre/lov/lov_pack.c 27 Sep 2006 16:24:36 -0000 1.14.2.4.40.15 >+++ lustre/lov/lov_pack.c 30 Jan 2007 09:57:12 -0000 1.14.2.4.40.15.12.1 >@@ -135,7 +135,8 @@ int lov_packmd(struct obd_export *exp, s > lmm->lmm_stripe_count = cpu_to_le32(stripe_count); > lmm->lmm_pattern = cpu_to_le32(lsm->lsm_pattern); > >- for (i = 0, loi = lsm->lsm_oinfo; i < stripe_count; i++, loi++) { >+ for (i = 0; i < stripe_count; i++) { >+ loi = lsm->lsm_oinfo[i]; > /* XXX LOV STACKING call down to osc_packmd() to do packing */ > LASSERTF(loi->loi_id, "lmm_oid "LPU64" stripe %u/%u idx %u\n", > lmm->lmm_object_id, i, stripe_count, loi->loi_ost_idx); >@@ -184,18 +185,14 @@ static int lov_verify_lmm(void *lmm, int > int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, > int pattern, int magic) > { >- int lsm_size = lov_stripe_md_size(stripe_count); >- struct lov_oinfo *loi; >- int i; >+ int i, lsm_size; > ENTRY; > >- CDEBUG(D_INFO, "alloc lsm, stripe_count %d, lsm_size %d\n", >- stripe_count, lsm_size); >+ CDEBUG(D_INFO, "alloc lsm, stripe_count %d\n", stripe_count); > >- OBD_ALLOC(*lsmp, lsm_size); >+ *lsmp = lsm_alloc_plain(stripe_count, &lsm_size); > if (!*lsmp) { >- CERROR("can not allocate lsmp lsm_size %d stripe_count %d\n", >- lsm_size, stripe_count); >+ CERROR("can''t allocate lsmp, stripe_count %d\n", stripe_count); > RETURN(-ENOMEM); > } > >@@ -205,10 +202,10 @@ int lov_alloc_memmd(struct lov_stripe_md > (*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES * stripe_count; > (*lsmp)->lsm_xfersize = (ulong)PTLRPC_MAX_BRW_SIZE * stripe_count; > (*lsmp)->lsm_pattern = pattern; >- (*lsmp)->lsm_oinfo[0].loi_ost_idx = ~0; >- >- for (i = 0, loi = (*lsmp)->lsm_oinfo; i < stripe_count; i++, loi++) >- loi_init(loi); >+ (*lsmp)->lsm_oinfo[0]->loi_ost_idx = ~0; >+ >+ for (i = 0; i < stripe_count; i++) >+ loi_init((*lsmp)->lsm_oinfo[i]); > > RETURN(lsm_size); > } >@@ -248,9 +245,11 @@ int lov_unpackmd(struct obd_export *exp, > } > > /* If we aren''t passed an lsmp struct, we just want the size */ >- if (!lsmp) >+ if (!lsmp) { > /* XXX LOV STACKING call into osc for sizes */ >+ LBUG(); > RETURN(lov_stripe_md_size(stripe_count)); >+ } > > /* If we are passed an allocated struct but nothing to unpack, free */ > if (*lsmp && !lmm) { >@@ -347,7 +346,7 @@ int lov_setstripe(struct obd_export *exp > if (rc < 0) > RETURN(rc); > >- (*lsmp)->lsm_oinfo[0].loi_ost_idx = lum.lmm_stripe_offset; >+ (*lsmp)->lsm_oinfo[0]->loi_ost_idx = lum.lmm_stripe_offset; > (*lsmp)->lsm_stripe_size = lum.lmm_stripe_size; > (*lsmp)->lsm_xfersize = (ulong)lum.lmm_stripe_size * stripe_count; > >@@ -384,10 +383,10 @@ int lov_setea(struct obd_export *exp, st > RETURN(rc); > > for (i = 0; i < lump->lmm_stripe_count; i++) { >- (*lsmp)->lsm_oinfo[i].loi_ost_idx >+ (*lsmp)->lsm_oinfo[i]->loi_ost_idx > lump->lmm_objects[i].l_ost_idx; >- (*lsmp)->lsm_oinfo[i].loi_id = lump->lmm_objects[i].l_object_id; >- (*lsmp)->lsm_oinfo[i].loi_gr = lump->lmm_objects[i].l_object_gr; >+ (*lsmp)->lsm_oinfo[i]->loi_id = lump->lmm_objects[i].l_object_id; >+ (*lsmp)->lsm_oinfo[i]->loi_gr = lump->lmm_objects[i].l_object_gr; > } > RETURN(0); > } >Index: lustre/lov/lov_qos.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/lov_qos.c,v >retrieving revision 1.1.34.11 >retrieving revision 1.1.34.11.4.1 >diff -p -u -r1.1.34.11 -r1.1.34.11.4.1 >--- lustre/lov/lov_qos.c 18 Jan 2007 21:29:49 -0000 1.1.34.11 >+++ lustre/lov/lov_qos.c 30 Jan 2007 09:57:12 -0000 1.1.34.11.4.1 >@@ -61,17 +61,26 @@ void qos_shrink_lsm(struct lov_request_s > > CWARN("using fewer stripes for object "LPX64": old %u new %u\n", > lsm->lsm_object_id, lsm->lsm_stripe_count, set->set_count); >+ LASSERT(lsm->lsm_stripe_count >= set->set_count); > >- oldsize = lov_stripe_md_size(lsm->lsm_stripe_count); >- newsize = lov_stripe_md_size(set->set_count); >- OBD_ALLOC(lsm_new, newsize); >+ lsm_new = lsm_alloc_plain(set->set_count, &newsize); > if (lsm_new != NULL) { >- memcpy(lsm_new, lsm, newsize); >+ int i; >+ memcpy(lsm_new, lsm, sizeof(*lsm)); >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { >+ if (i < set->set_count) { >+ lsm_new->lsm_oinfo[i] = lsm->lsm_oinfo[i]; >+ continue; >+ } >+ OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, >+ sizeof(struct lov_oinfo)); >+ } > lsm_new->lsm_stripe_count = set->set_count; >- OBD_FREE(lsm, oldsize); >+ OBD_FREE(lsm, sizeof(struct lov_stripe_md) + >+ lsm->lsm_stripe_count * sizeof(struct lov_oinfo *)); > set->set_oi->oi_md = lsm_new; > } else { >- CWARN("''leaking'' %d bytes\n", oldsize - newsize); >+ CWARN("''leaking'' few bytes\n"); > } > } > >@@ -93,7 +102,7 @@ int qos_remedy_create(struct lov_request > for (stripe = 0; stripe < lsm->lsm_stripe_count; stripe++) { > if (stripe == req->rq_stripe) > continue; >- if (ost_idx == lsm->lsm_oinfo[stripe].loi_ost_idx) >+ if (ost_idx == lsm->lsm_oinfo[stripe]->loi_ost_idx) > break; > } > >@@ -132,7 +141,7 @@ int qos_prep_create(struct lov_obd *lov, > lov->desc.ld_pattern : LOV_PATTERN_RAID0; > } > >- if (newea || lsm->lsm_oinfo[0].loi_ost_idx >= ost_count) { >+ if (newea || lsm->lsm_oinfo[0]->loi_ost_idx >= ost_count) { > if (--lov->lo_start_count <= 0) { > lov->lo_start_idx = ll_rand() % ost_count; > lov->lo_start_count >@@ -147,7 +156,7 @@ int qos_prep_create(struct lov_obd *lov, > } > ost_idx = (lov->lo_start_idx + lov->lo_offset_idx) % ost_count; > } else { >- ost_idx = lsm->lsm_oinfo[0].loi_ost_idx; >+ ost_idx = lsm->lsm_oinfo[0]->loi_ost_idx; > manual_start = 1; > } > >Index: lustre/lov/lov_request.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/lov/lov_request.c,v >retrieving revision 1.1.34.26 >retrieving revision 1.1.34.26.4.1 >diff -p -u -r1.1.34.26 -r1.1.34.26.4.1 >--- lustre/lov/lov_request.c 4 Jan 2007 14:53:40 -0000 1.1.34.26 >+++ lustre/lov/lov_request.c 30 Jan 2007 09:57:12 -0000 1.1.34.26.4.1 >@@ -125,7 +125,7 @@ int lov_update_enqueue_set(struct lov_re > LASSERT(set->set_oi != NULL); > > lov_lockhp = set->set_lockh->llh_handles + req->rq_stripe; >- loi = &set->set_oi->oi_md->lsm_oinfo[req->rq_stripe]; >+ loi = set->set_oi->oi_md->lsm_oinfo[req->rq_stripe]; > > /* XXX LOV STACKING: OSC gets a copy, created in lov_prep_enqueue_set > * and that copy can be arbitrarily out of date. >@@ -139,7 +139,7 @@ int lov_update_enqueue_set(struct lov_re > > LASSERT(lock != NULL); > lov_stripe_lock(set->set_oi->oi_md); >- loi->loi_lvb = req->rq_oi.oi_md->lsm_oinfo->loi_lvb; >+ loi->loi_lvb = req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb; > tmp = loi->loi_lvb.lvb_size; > /* Extend KMS up to the end of this lock and no further > * A lock on [x,y] means a KMS of up to y + 1 bytes! */ >@@ -163,7 +163,7 @@ int lov_update_enqueue_set(struct lov_re > (set->set_ei->ei_flags & LDLM_FL_HAS_INTENT)) { > memset(lov_lockhp, 0, sizeof(*lov_lockhp)); > lov_stripe_lock(set->set_oi->oi_md); >- loi->loi_lvb = req->rq_oi.oi_md->lsm_oinfo->loi_lvb; >+ loi->loi_lvb = req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb; > lov_stripe_unlock(set->set_oi->oi_md); > CDEBUG(D_INODE, "glimpsed, setting rss="LPU64"; leaving" > " kms="LPU64"\n", loi->loi_lvb.lvb_size, loi->loi_kms); >@@ -280,11 +280,11 @@ int lov_prep_enqueue_set(struct obd_expo > GOTO(out_set, rc = -ENOMEM); > oinfo->oi_lockh->cookie = set->set_lockh->llh_handle.h_cookie; > >- loi = oinfo->oi_md->lsm_oinfo; >- for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++, loi++) { >+ for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) { > struct lov_request *req; > obd_off start, end; > >+ loi = oinfo->oi_md->lsm_oinfo[i]; > if (!lov_stripe_intersects(oinfo->oi_md, i, > oinfo->oi_policy.l_extent.start, > oinfo->oi_policy.l_extent.end, >@@ -301,12 +301,17 @@ int lov_prep_enqueue_set(struct obd_expo > GOTO(out_set, rc = -ENOMEM); > > req->rq_buflen = sizeof(*req->rq_oi.oi_md) + >+ sizeof(struct lov_oinfo *) + > sizeof(struct lov_oinfo); > OBD_ALLOC(req->rq_oi.oi_md, req->rq_buflen); > if (req->rq_oi.oi_md == NULL) { > OBD_FREE(req, sizeof(*req)); > GOTO(out_set, rc = -ENOMEM); > } >+ req->rq_oi.oi_md->lsm_oinfo[0] >+ ((void *)req->rq_oi.oi_md) + sizeof(*req->rq_oi.oi_md) + >+ sizeof(struct lov_oinfo *); >+ > > req->rq_rqset = set; > /* Set lov request specific parameters. */ >@@ -326,10 +331,10 @@ int lov_prep_enqueue_set(struct obd_expo > /* XXX LOV STACKING: submd should be from the subobj */ > req->rq_oi.oi_md->lsm_object_id = loi->loi_id; > req->rq_oi.oi_md->lsm_stripe_count = 0; >- req->rq_oi.oi_md->lsm_oinfo->loi_kms_valid >+ req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms_valid > loi->loi_kms_valid; >- req->rq_oi.oi_md->lsm_oinfo->loi_kms = loi->loi_kms; >- req->rq_oi.oi_md->lsm_oinfo->loi_lvb = loi->loi_lvb; >+ req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms = loi->loi_kms; >+ req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb = loi->loi_lvb; > > lov_set_add_req(req, set); > } >@@ -399,10 +404,11 @@ int lov_prep_match_set(struct obd_export > GOTO(out_set, rc = -ENOMEM); > lockh->cookie = set->set_lockh->llh_handle.h_cookie; > >- for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, loi++){ >+ for (i = 0; i < lsm->lsm_stripe_count; i++){ > struct lov_request *req; > obd_off start, end; > >+ loi = lsm->lsm_oinfo[i]; > if (!lov_stripe_intersects(lsm, i, policy->l_extent.start, > policy->l_extent.end, &start, &end)) > continue; >@@ -489,10 +495,11 @@ int lov_prep_cancel_set(struct obd_expor > } > lockh->cookie = set->set_lockh->llh_handle.h_cookie; > >- for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, loi++){ >+ for (i = 0; i < lsm->lsm_stripe_count; i++){ > struct lov_request *req; > struct lustre_handle *lov_lockhp; > >+ loi = lsm->lsm_oinfo[i]; > lov_lockhp = set->set_lockh->llh_handles + i; > if (!lustre_handle_is_used(lov_lockhp)) { > CDEBUG(D_HA, "lov idx %d subobj "LPX64" no lock?\n", >@@ -657,7 +664,7 @@ int lov_update_create_set(struct lov_req > ENTRY; > > req->rq_stripe = set->set_success; >- loi = &lsm->lsm_oinfo[req->rq_stripe]; >+ loi = lsm->lsm_oinfo[req->rq_stripe]; > > if (rc && lov->tgts[req->rq_idx].active) { > CERROR("error creating fid "LPX64" sub-object" >@@ -815,7 +822,7 @@ static int brw_done(struct lov_request_s > if (!req->rq_complete || req->rq_rc) > continue; > >- loi = &lsm->lsm_oinfo[req->rq_stripe]; >+ loi = lsm->lsm_oinfo[req->rq_stripe]; > > if (req->rq_oi.oi_oa->o_valid & OBD_MD_FLBLOCKS) > loi->loi_lvb.lvb_blocks = req->rq_oi.oi_oa->o_blocks; >@@ -883,13 +890,13 @@ int lov_prep_brw_set(struct obd_export * > > /* alloc and initialize lov request */ > shift = 0; >- for (i = 0, loi = oinfo->oi_md->lsm_oinfo; >- i < oinfo->oi_md->lsm_stripe_count; i++, loi++){ >+ for (i = 0 ; i < oinfo->oi_md->lsm_stripe_count; i++){ > struct lov_request *req; > > if (info[i].count == 0) > continue; > >+ loi = oinfo->oi_md->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) { > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > GOTO(out, rc = -EIO); >@@ -1003,11 +1010,11 @@ int lov_prep_getattr_set(struct obd_expo > > set->set_exp = exp; > set->set_oi = oinfo; >- >- loi = oinfo->oi_md->lsm_oinfo; >- for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++, loi++) { >+ >+ for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) { > struct lov_request *req; > >+ loi = oinfo->oi_md->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) { > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > continue; >@@ -1082,10 +1089,10 @@ int lov_prep_destroy_set(struct obd_expo > if (oti != NULL && src_oa->o_valid & OBD_MD_FLCOOKIE) > set->set_cookies = oti->oti_logcookies; > >- loi = lsm->lsm_oinfo; >- for (i = 0; i < lsm->lsm_stripe_count; i++, loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { > struct lov_request *req; > >+ loi = lsm->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) { > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > continue; >@@ -1149,13 +1156,13 @@ int lov_update_setattr_set(struct lov_re > > if (rc == 0) { > if (req->rq_oi.oi_oa->o_valid & OBD_MD_FLCTIME) >- lsm->lsm_oinfo[req->rq_stripe].loi_lvb.lvb_ctime >+ lsm->lsm_oinfo[req->rq_stripe]->loi_lvb.lvb_ctime > req->rq_oi.oi_oa->o_ctime; > if (req->rq_oi.oi_oa->o_valid & OBD_MD_FLMTIME) >- lsm->lsm_oinfo[req->rq_stripe].loi_lvb.lvb_mtime >+ lsm->lsm_oinfo[req->rq_stripe]->loi_lvb.lvb_mtime > req->rq_oi.oi_oa->o_mtime; > if (req->rq_oi.oi_oa->o_valid & OBD_MD_FLATIME) >- lsm->lsm_oinfo[req->rq_stripe].loi_lvb.lvb_atime >+ lsm->lsm_oinfo[req->rq_stripe]->loi_lvb.lvb_atime > req->rq_oi.oi_oa->o_atime; > } > >@@ -1192,10 +1199,11 @@ int lov_prep_setattr_set(struct obd_expo > if (oti != NULL && oinfo->oi_oa->o_valid & OBD_MD_FLCOOKIE) > set->set_cookies = oti->oti_logcookies; > >- loi = oinfo->oi_md->lsm_oinfo; >- for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++, loi++) { >+ >+ for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) { > struct lov_request *req; > >+ loi = oinfo->oi_md->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) { > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > continue; >@@ -1279,7 +1287,7 @@ int lov_update_punch_set(struct lov_requ > if (rc == 0) { > lov_stripe_lock(lsm); > if (req->rq_oi.oi_oa->o_valid & OBD_MD_FLBLOCKS) { >- lsm->lsm_oinfo[req->rq_stripe].loi_lvb.lvb_blocks >+ lsm->lsm_oinfo[req->rq_stripe]->loi_lvb.lvb_blocks > req->rq_oi.oi_oa->o_blocks; > } > >@@ -1318,11 +1326,12 @@ int lov_prep_punch_set(struct obd_export > set->set_oi = oinfo; > set->set_exp = exp; > >- loi = oinfo->oi_md->lsm_oinfo; >- for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++, loi++) { >+ >+ for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) { > struct lov_request *req; > obd_off rs, re; > >+ loi = oinfo->oi_md->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) { > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > continue; >@@ -1408,11 +1417,11 @@ int lov_prep_sync_set(struct obd_export > set->set_oi->oi_md = lsm; > set->set_oi->oi_oa = src_oa; > >- loi = lsm->lsm_oinfo; >- for (i = 0; i < lsm->lsm_stripe_count; i++, loi++) { >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { > struct lov_request *req; > obd_off rs, re; >- >+ >+ loi = lsm->lsm_oinfo[i]; > if (lov->tgts[loi->loi_ost_idx].active == 0) { > CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); > continue; >Index: lustre/obdecho/echo_client.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/obdecho/echo_client.c,v >retrieving revision 1.18.2.5.40.21 >retrieving revision 1.18.2.5.40.21.4.1 >diff -p -u -r1.18.2.5.40.21 -r1.18.2.5.40.21.4.1 >--- lustre/obdecho/echo_client.c 20 Dec 2006 23:37:08 -0000 1.18.2.5.40.21 >+++ lustre/obdecho/echo_client.c 30 Jan 2007 09:57:13 -0000 1.18.2.5.40.21.4.1 >@@ -84,17 +84,23 @@ echo_find_object_locked (struct obd_devi > } > > static int >-echo_copyout_lsm (struct lov_stripe_md *lsm, void *ulsm, int ulsm_nob) >+echo_copyout_lsm (struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) > { >- int nob; >+ struct lov_stripe_md *ulsm = _ulsm; >+ int nob, i; > > nob = offsetof (struct lov_stripe_md, lsm_oinfo[lsm->lsm_stripe_count]); > if (nob > ulsm_nob) > return (-EINVAL); > >- if (copy_to_user (ulsm, lsm, nob)) >+ if (copy_to_user (ulsm, lsm, sizeof(ulsm))) > return (-EFAULT); > >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { >+ if (copy_to_user (ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i], >+ sizeof(lsm->lsm_oinfo[0]))) >+ return (-EFAULT); >+ } > return (0); > } > >@@ -103,7 +109,7 @@ echo_copyin_lsm (struct obd_device *obd, > void *ulsm, int ulsm_nob) > { > struct echo_client_obd *ec = &obd->u.echo_client; >- int nob; >+ int i; > > if (ulsm_nob < sizeof (*lsm)) > return (-EINVAL); >@@ -111,18 +117,18 @@ echo_copyin_lsm (struct obd_device *obd, > if (copy_from_user (lsm, ulsm, sizeof (*lsm))) > return (-EFAULT); > >- nob = lsm->lsm_stripe_count * sizeof (lsm->lsm_oinfo[0]); >- >- if (ulsm_nob < nob || >- lsm->lsm_stripe_count > ec->ec_nstripes || >+ if (lsm->lsm_stripe_count > ec->ec_nstripes || > lsm->lsm_magic != LOV_MAGIC || > (lsm->lsm_stripe_size & (PAGE_SIZE - 1)) != 0 || > ((__u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count > ~0UL)) > return (-EINVAL); > >- if (copy_from_user(lsm->lsm_oinfo, >- ((struct lov_stripe_md *)ulsm)->lsm_oinfo, nob)) >- return (-EFAULT); >+ for (i = 0; i < lsm->lsm_stripe_count; i++) { >+ if (copy_from_user(lsm->lsm_oinfo[i], >+ ((struct lov_stripe_md *)ulsm)->lsm_oinfo[i], >+ sizeof(lsm->lsm_oinfo[0]))) >+ return (-EFAULT); >+ } > > return (0); > } >@@ -207,10 +213,10 @@ static int echo_create_object(struct obd > > /* setup stripes: indices + default ids if required */ > for (i = 0; i < lsm->lsm_stripe_count; i++) { >- if (lsm->lsm_oinfo[i].loi_id == 0) >- lsm->lsm_oinfo[i].loi_id = lsm->lsm_object_id; >+ if (lsm->lsm_oinfo[i]->loi_id == 0) >+ lsm->lsm_oinfo[i]->loi_id = lsm->lsm_object_id; > >- lsm->lsm_oinfo[i].loi_ost_idx >+ lsm->lsm_oinfo[i]->loi_ost_idx > (idx + i) % ec->ec_nstripes; > } > } else { >@@ -263,7 +269,7 @@ static int echo_create_object(struct obd > eco, eco->eco_id, > eco->eco_lsm->lsm_stripe_size, > eco->eco_lsm->lsm_stripe_count, >- eco->eco_lsm->lsm_oinfo[0].loi_ost_idx, >+ eco->eco_lsm->lsm_oinfo[0]->loi_ost_idx, > eco->eco_refcount, eco->eco_deleted); > return (0); > >@@ -304,7 +310,7 @@ echo_get_object (struct ec_object **ecop > eco, eco->eco_id, > eco->eco_lsm->lsm_stripe_size, > eco->eco_lsm->lsm_stripe_count, >- eco->eco_lsm->lsm_oinfo[0].loi_ost_idx, >+ eco->eco_lsm->lsm_oinfo[0]->loi_ost_idx, > eco->eco_refcount, eco->eco_deleted); > return (0); > } >@@ -332,7 +338,7 @@ echo_get_object (struct ec_object **ecop > eco, eco->eco_id, > eco->eco_lsm->lsm_stripe_size, > eco->eco_lsm->lsm_stripe_count, >- eco->eco_lsm->lsm_oinfo[0].loi_ost_idx, >+ eco->eco_lsm->lsm_oinfo[0]->loi_ost_idx, > eco->eco_refcount, eco->eco_deleted); > return (0); > } >@@ -349,7 +355,7 @@ echo_get_object (struct ec_object **ecop > eco2, eco2->eco_id, > eco2->eco_lsm->lsm_stripe_size, > eco2->eco_lsm->lsm_stripe_count, >- eco2->eco_lsm->lsm_oinfo[0].loi_ost_idx, >+ eco2->eco_lsm->lsm_oinfo[0]->loi_ost_idx, > eco2->eco_refcount, eco2->eco_deleted); > } > >@@ -378,7 +384,7 @@ echo_put_object (struct ec_object *eco) > eco, eco->eco_id, > eco->eco_lsm->lsm_stripe_size, > eco->eco_lsm->lsm_stripe_count, >- eco->eco_lsm->lsm_oinfo[0].loi_ost_idx, >+ eco->eco_lsm->lsm_oinfo[0]->loi_ost_idx, > eco->eco_refcount, eco->eco_deleted); > > if (eco->eco_refcount != 0 || !eco->eco_deleted) { >@@ -429,7 +435,7 @@ echo_get_stripe_off_id (struct lov_strip > > stripe_index = woffset / stripe_size; > >- *idp = lsm->lsm_oinfo[stripe_index].loi_id; >+ *idp = lsm->lsm_oinfo[stripe_index]->loi_id; > *offp = offset * stripe_size + woffset % stripe_size; > } > >Index: lustre/obdfilter/filter.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/obdfilter/filter.c,v >retrieving revision 1.143.2.21.2.98 >retrieving revision 1.143.2.21.2.98.4.1 >diff -p -u -r1.143.2.21.2.98 -r1.143.2.21.2.98.4.1 >--- lustre/obdfilter/filter.c 18 Jan 2007 21:29:50 -0000 1.143.2.21.2.98 >+++ lustre/obdfilter/filter.c 30 Jan 2007 09:57:13 -0000 1.143.2.21.2.98.4.1 >@@ -2539,6 +2539,7 @@ static int filter_unpackmd(struct obd_ex > RETURN(lsm_size); > > if (*lsmp != NULL && lmm == NULL) { >+ OBD_FREE((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo)); > OBD_FREE(*lsmp, lsm_size); > *lsmp = NULL; > RETURN(0); >@@ -2548,8 +2549,12 @@ static int filter_unpackmd(struct obd_ex > OBD_ALLOC(*lsmp, lsm_size); > if (*lsmp == NULL) > RETURN(-ENOMEM); >- >- loi_init((*lsmp)->lsm_oinfo); >+ OBD_ALLOC((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo)); >+ if ((*lsmp)->lsm_oinfo[0] == NULL) { >+ OBD_FREE(*lsmp, lsm_size); >+ RETURN(-ENOMEM); >+ } >+ loi_init((*lsmp)->lsm_oinfo[0]); > } > > if (lmm != NULL) { >Index: lustre/osc/osc_request.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/osc/osc_request.c,v >retrieving revision 1.191.2.21.2.79 >retrieving revision 1.191.2.21.2.79.4.1 >diff -p -u -r1.191.2.21.2.79 -r1.191.2.21.2.79.4.1 >--- lustre/osc/osc_request.c 26 Dec 2006 08:57:41 -0000 1.191.2.21.2.79 >+++ lustre/osc/osc_request.c 30 Jan 2007 09:57:14 -0000 1.191.2.21.2.79.4.1 >@@ -132,6 +132,7 @@ static int osc_unpackmd(struct obd_expor > RETURN(lsm_size); > > if (*lsmp != NULL && lmm == NULL) { >+ OBD_FREE((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo)); > OBD_FREE(*lsmp, lsm_size); > *lsmp = NULL; > RETURN(0); >@@ -141,7 +142,12 @@ static int osc_unpackmd(struct obd_expor > OBD_ALLOC(*lsmp, lsm_size); > if (*lsmp == NULL) > RETURN(-ENOMEM); >- loi_init((*lsmp)->lsm_oinfo); >+ OBD_ALLOC((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo)); >+ if ((*lsmp)->lsm_oinfo[0] == NULL) { >+ OBD_FREE(*lsmp, lsm_size); >+ RETURN(-ENOMEM); >+ } >+ loi_init((*lsmp)->lsm_oinfo[0]); > } > > if (lmm != NULL) { >@@ -2339,7 +2345,7 @@ static int osc_queue_async_io(struct obd > #endif > > if (loi == NULL) >- loi = &lsm->lsm_oinfo[0]; >+ loi = lsm->lsm_oinfo[0]; > > spin_lock(&cli->cl_loi_list_lock); > >@@ -2401,7 +2407,7 @@ static int osc_set_async_flags(struct ob > RETURN(-EIO); > > if (loi == NULL) >- loi = &lsm->lsm_oinfo[0]; >+ loi = lsm->lsm_oinfo[0]; > > if (oap->oap_cmd & OBD_BRW_WRITE) { > lop = &loi->loi_write_lop; >@@ -2461,7 +2467,7 @@ static int osc_queue_group_io(struct obd > RETURN(-EBUSY); > > if (loi == NULL) >- loi = &lsm->lsm_oinfo[0]; >+ loi = lsm->lsm_oinfo[0]; > > spin_lock(&cli->cl_loi_list_lock); > >@@ -2513,7 +2519,7 @@ static int osc_trigger_group_io(struct o > ENTRY; > > if (loi == NULL) >- loi = &lsm->lsm_oinfo[0]; >+ loi = lsm->lsm_oinfo[0]; > > spin_lock(&cli->cl_loi_list_lock); > >@@ -2541,7 +2547,7 @@ static int osc_teardown_async_page(struc > RETURN(PTR_ERR(oap)); > > if (loi == NULL) >- loi = &lsm->lsm_oinfo[0]; >+ loi = lsm->lsm_oinfo[0]; > > if (oap->oap_cmd & OBD_BRW_WRITE) { > lop = &loi->loi_write_lop; >@@ -2920,9 +2926,9 @@ static int osc_enqueue_fini(struct ptlrp > > if ((intent && rc == ELDLM_LOCK_ABORTED) || !rc) { > CDEBUG(D_INODE,"got kms "LPU64" blocks "LPU64" mtime "LPU64"\n", >- oinfo->oi_md->lsm_oinfo->loi_lvb.lvb_size, >- oinfo->oi_md->lsm_oinfo->loi_lvb.lvb_blocks, >- oinfo->oi_md->lsm_oinfo->loi_lvb.lvb_mtime); >+ oinfo->oi_md->lsm_oinfo[0]->loi_lvb.lvb_size, >+ oinfo->oi_md->lsm_oinfo[0]->loi_lvb.lvb_blocks, >+ oinfo->oi_md->lsm_oinfo[0]->loi_lvb.lvb_mtime); > } > > /* Call the update callback. */ >@@ -2945,8 +2951,8 @@ static int osc_enqueue_interpret(struct > rc = ldlm_cli_enqueue_fini(aa->oa_exp, req, aa->oa_ei->ei_type, 1, > aa->oa_ei->ei_mode, > &aa->oa_ei->ei_flags, >- &lsm->lsm_oinfo->loi_lvb, >- sizeof(lsm->lsm_oinfo->loi_lvb), >+ &lsm->lsm_oinfo[0]->loi_lvb, >+ sizeof(lsm->lsm_oinfo[0]->loi_lvb), > lustre_swab_ost_lvb, > aa->oa_oi->oi_lockh, rc); > >@@ -2987,7 +2993,7 @@ static int osc_enqueue(struct obd_export > oinfo->oi_policy.l_extent.start & ~PAGE_MASK; > oinfo->oi_policy.l_extent.end |= ~PAGE_MASK; > >- if (oinfo->oi_md->lsm_oinfo->loi_kms_valid == 0) >+ if (oinfo->oi_md->lsm_oinfo[0]->loi_kms_valid == 0) > goto no_match; > > /* Next, search for already existing extent locks that will cover us */ >@@ -3048,7 +3054,7 @@ static int osc_enqueue(struct obd_export > no_match: > if (intent) { > int size[2] = {sizeof(struct ldlm_request), >- sizeof(oinfo->oi_md->lsm_oinfo->loi_lvb)}; >+ sizeof(oinfo->oi_md->lsm_oinfo[0]->loi_lvb)}; > > req = ptlrpc_prep_req(class_exp2cliimp(exp), > LUSTRE_DLM_VERSION, LDLM_ENQUEUE, 1, >@@ -3068,8 +3074,8 @@ static int osc_enqueue(struct obd_export > &einfo->ei_flags, einfo->ei_cb_bl, > einfo->ei_cb_cp, einfo->ei_cb_gl, > einfo->ei_cbdata, >- &oinfo->oi_md->lsm_oinfo->loi_lvb, >- sizeof(oinfo->oi_md->lsm_oinfo->loi_lvb), >+ &oinfo->oi_md->lsm_oinfo[0]->loi_lvb, >+ sizeof(oinfo->oi_md->lsm_oinfo[0]->loi_lvb), > lustre_swab_ost_lvb, oinfo->oi_lockh, > einfo->ei_rqset ? 1 : 0); > if (einfo->ei_rqset) { >Index: lustre/utils/obd.c >==================================================================>RCS file: /cvsroot/cfs/lustre-core/utils/obd.c,v >retrieving revision 1.52.6.3.32.20 >retrieving revision 1.52.6.3.32.20.4.1 >diff -p -u -r1.52.6.3.32.20 -r1.52.6.3.32.20.4.1 >--- lustre/utils/obd.c 20 Dec 2006 23:37:11 -0000 1.52.6.3.32.20 >+++ lustre/utils/obd.c 30 Jan 2007 09:57:14 -0000 1.52.6.3.32.20.4.1 >@@ -96,9 +96,13 @@ static int max = sizeof(rawbuf); > > static int cur_device = -1; > >-union lsm_buffer { >- char space [4096]; >+ >+#define MAX_STRIPES 170 >+struct lov_oinfo lov_oinfos[MAX_STRIPES]; >+ >+struct lsm_buffer { > struct lov_stripe_md lsm; >+ struct lov_oinfo *ptrs[MAX_STRIPES]; > } lsm_buffer; > > static int l2_ioctl(int dev_id, int opc, void *buf) >@@ -259,8 +263,8 @@ lsm_string (struct lov_stripe_md *lsm) > > for (i = 0; i < lsm->lsm_stripe_count; i++) { > nob = snprintf (p, space, "@%u:"LPX64, >- lsm->lsm_oinfo[i].loi_ost_idx, >- lsm->lsm_oinfo[i].loi_id); >+ lsm->lsm_oinfo[i]->loi_ost_idx, >+ lsm->lsm_oinfo[i]->loi_id); > p += nob; > space -= nob; > } >@@ -275,14 +279,15 @@ lsm_string (struct lov_stripe_md *lsm) > } > > static void >-reset_lsmb (union lsm_buffer *lsmb) >+reset_lsmb (struct lsm_buffer *lsmb) > { >- memset (lsmb->space, 0, sizeof (lsmb->space)); >+ memset (&lsmb->lsm, 0, sizeof (lsmb->lsm)); >+ memset(lov_oinfos, 0, sizeof(lov_oinfos)); > lsmb->lsm.lsm_magic = LOV_MAGIC; > } > > static int >-parse_lsm (union lsm_buffer *lsmb, char *string) >+parse_lsm (struct lsm_buffer *lsmb, char *string) > { > struct lov_stripe_md *lsm = &lsmb->lsm; > char *end; >@@ -327,11 +332,11 @@ parse_lsm (union lsm_buffer *lsmb, char > if (*string != ''@'') > return (-1); > string++; >- lsm->lsm_oinfo[i].loi_ost_idx = strtoul(string, &end, 0); >+ lsm->lsm_oinfo[i]->loi_ost_idx = strtoul(string, &end, 0); > if (*end != '':'') > return (-1); > string = end + 1; >- lsm->lsm_oinfo[i].loi_id = strtoull(string, &end, 0); >+ lsm->lsm_oinfo[i]->loi_id = strtoull(string, &end, 0); > string = end; > } > >@@ -946,7 +951,8 @@ int jt_obd_get_stripe (int argc, char ** > return (CMD_HELP); > } > >- memset (&lsm_buffer, 0, sizeof (lsm_buffer)); >+ memset (&lsm_buffer.lsm, 0, sizeof (lsm_buffer.lsm)); >+ memset(lov_oinfos, 0, sizeof(lov_oinfos)); > > IOC_INIT (data); > data.ioc_obdo1.o_id = id; >@@ -2297,6 +2303,11 @@ static void signal_server(int sig) > > int obd_initialize(int argc, char **argv) > { >+ int i; >+ >+ for (i = 0; i < MAX_STRIPES; i++) >+ lsm_buffer.lsm.lsm_oinfo[i] = lov_oinfos + i; >+ > shmem_setup(); > register_ioc_dev(OBD_DEV_ID, OBD_DEV_PATH, > OBD_DEV_MAJOR, OBD_DEV_MINOR);