diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/lov')
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_cl_internal.h | 14 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_dev.c | 1 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_ea.c | 17 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_internal.h | 9 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_io.c | 25 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_merge.c | 39 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_obd.c | 349 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_object.c | 50 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_pack.c | 60 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_page.c | 12 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_pool.c | 18 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lov_request.c | 78 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lov/lovsub_object.c | 6 |
13 files changed, 157 insertions, 521 deletions
diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 9740568d9521..4d2b7d303fea 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -289,8 +289,8 @@ struct lov_lock { }; struct lov_page { - struct cl_page_slice lps_cl; - int lps_invalid; + struct cl_page_slice lps_cl; + unsigned int lps_stripe; /* stripe index */ }; /* @@ -556,6 +556,8 @@ struct lov_lock_link *lov_lock_link_find(const struct lu_env *env, struct lovsub_lock *sub); struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio, const struct cl_page_slice *slice); + +struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov); int lov_page_stripe(const struct cl_page *page); #define lov_foreach_target(lov, var) \ @@ -742,11 +744,15 @@ static inline struct lov_thread_info *lov_env_info(const struct lu_env *env) static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov) { LASSERT(lov->lo_type == LLT_RAID0); - LASSERT(lov->lo_lsm->lsm_wire.lw_magic == LOV_MAGIC || - lov->lo_lsm->lsm_wire.lw_magic == LOV_MAGIC_V3); + LASSERT(lov->lo_lsm->lsm_magic == LOV_MAGIC || + lov->lo_lsm->lsm_magic == LOV_MAGIC_V3); return &lov->u.raid0; } +/* lov_pack.c */ +int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, + struct lov_user_md __user *lump); + /** @} lov */ #endif diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index b1f260d43bc7..056ae2ed88e8 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -516,6 +516,5 @@ struct lu_device_type lov_device_type = { .ldt_ops = &lov_device_type_ops, .ldt_ctx_tags = LCT_CL_THREAD }; -EXPORT_SYMBOL(lov_device_type); /** @} lov */ diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 5053dead17bb..214c561767e0 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -66,7 +66,8 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, } if (lmm->lmm_stripe_size == 0 || - (le32_to_cpu(lmm->lmm_stripe_size)&(LOV_MIN_STRIPE_SIZE-1)) != 0) { + (le32_to_cpu(lmm->lmm_stripe_size) & + (LOV_MIN_STRIPE_SIZE - 1)) != 0) { CERROR("bad stripe size %u\n", le32_to_cpu(lmm->lmm_stripe_size)); lov_dump_lmm_common(D_WARNING, lmm); @@ -146,21 +147,15 @@ lsm_stripe_by_offset_plain(struct lov_stripe_md *lsm, int *stripeno, *swidth = (u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count; } -static int lsm_destroy_plain(struct lov_stripe_md *lsm, struct obdo *oa, - struct obd_export *md_exp) -{ - return 0; -} - /* Find minimum stripe maxbytes value. For inactive or - * reconnecting targets use LUSTRE_STRIPE_MAXBYTES. + * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. */ static void lov_tgt_maxbytes(struct lov_tgt_desc *tgt, __u64 *stripe_maxbytes) { struct obd_import *imp = tgt->ltd_obd->u.cli.cl_import; if (!imp || !tgt->ltd_active) { - *stripe_maxbytes = LUSTRE_STRIPE_MAXBYTES; + *stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; return; } @@ -171,7 +166,7 @@ static void lov_tgt_maxbytes(struct lov_tgt_desc *tgt, __u64 *stripe_maxbytes) if (*stripe_maxbytes > imp->imp_connect_data.ocd_maxbytes) *stripe_maxbytes = imp->imp_connect_data.ocd_maxbytes; } else { - *stripe_maxbytes = LUSTRE_STRIPE_MAXBYTES; + *stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; } spin_unlock(&imp->imp_lock); } @@ -245,7 +240,6 @@ static int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, const struct lsm_operations lsm_v1_ops = { .lsm_free = lsm_free_plain, - .lsm_destroy = lsm_destroy_plain, .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_lmm_verify = lsm_lmm_verify_v1, @@ -335,7 +329,6 @@ static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, const struct lsm_operations lsm_v3_ops = { .lsm_free = lsm_free_plain, - .lsm_destroy = lsm_destroy_plain, .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_lmm_verify = lsm_lmm_verify_v3, diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 12bd511e8988..07e5ede3e952 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -134,8 +134,6 @@ static inline void lov_put_reqset(struct lov_request_set *set) /* lov_merge.c */ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid, struct lov_stripe_md *lsm, int stripeno, int *set); -int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, - u64 size, int shrink); int lov_merge_lvb_kms(struct lov_stripe_md *lsm, struct ost_lvb *lvb, __u64 *kms_place); @@ -157,11 +155,6 @@ int lov_update_common_set(struct lov_request_set *set, int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, struct lov_request_set **reqset); int lov_fini_getattr_set(struct lov_request_set *set); -int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, - struct obdo *src_oa, struct lov_stripe_md *lsm, - struct obd_trans_info *oti, - struct lov_request_set **reqset); -int lov_fini_destroy_set(struct lov_request_set *set); int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti, struct lov_request_set **reqset); @@ -197,8 +190,6 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmm, struct lov_stripe_md *lsm); int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, struct lov_mds_md *lmm, int lmm_bytes); -int lov_getstripe(struct obd_export *exp, - struct lov_stripe_md *lsm, struct lov_user_md __user *lump); int lov_alloc_memmd(struct lov_stripe_md **lsmp, __u16 stripe_count, int pattern, int magic); int lov_free_memmd(struct lov_stripe_md **lsmp); diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 84032a510254..d10157985ed9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -87,6 +87,9 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, case CIT_SETATTR: { io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr; io->u.ci_setattr.sa_valid = parent->u.ci_setattr.sa_valid; + io->u.ci_setattr.sa_stripe_index = stripe; + io->u.ci_setattr.sa_parent_fid = + parent->u.ci_setattr.sa_parent_fid; if (cl_io_is_trunc(io)) { loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size; @@ -244,14 +247,12 @@ void lov_sub_put(struct lov_io_sub *sub) int lov_page_stripe(const struct cl_page *page) { - struct lovsub_object *subobj; const struct cl_page_slice *slice; - slice = cl_page_at(page, &lovsub_device_type); + slice = cl_page_at(page, &lov_device_type); LASSERT(slice->cpl_obj); - subobj = cl2lovsub(slice->cpl_obj); - return subobj->lso_index; + return cl2lov_page(slice)->lps_stripe; } struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio, @@ -298,8 +299,8 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, return result; } -static void lov_io_slice_init(struct lov_io *lio, - struct lov_object *obj, struct cl_io *io) +static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj, + struct cl_io *io) { io->ci_result = 0; lio->lis_object = obj; @@ -314,6 +315,15 @@ static void lov_io_slice_init(struct lov_io *lio, lio->lis_io_endpos = lio->lis_endpos; if (cl_io_is_append(io)) { LASSERT(io->ci_type == CIT_WRITE); + + /* + * If there is LOV EA hole, then we may cannot locate + * the current file-tail exactly. + */ + if (unlikely(obj->lo_lsm->lsm_pattern & + LOV_PATTERN_F_HOLE)) + return -EIO; + lio->lis_pos = 0; lio->lis_endpos = OBD_OBJECT_EOF; } @@ -349,6 +359,7 @@ static void lov_io_slice_init(struct lov_io *lio, default: LBUG(); } + return 0; } static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) @@ -870,7 +881,7 @@ int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj, struct lov_object *lov = cl2lov(obj); INIT_LIST_HEAD(&lio->lis_active); - lov_io_slice_init(lio, lov, io); + io->ci_result = lov_io_slice_init(lio, lov, io); if (io->ci_result == 0) { io->ci_result = lov_io_subio_init(env, lio, io); if (io->ci_result == 0) { diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index b9c90865fdfc..674af106b50b 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -105,45 +105,6 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, return rc; } -/* Must be called under the lov_stripe_lock() */ -int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, - u64 size, int shrink) -{ - struct lov_oinfo *loi; - int stripe = 0; - __u64 kms; - - assert_spin_locked(&lsm->lsm_lock); - LASSERT(lsm->lsm_lock_owner == current_pid()); - - if (shrink) { - for (; stripe < lsm->lsm_stripe_count; stripe++) { - struct lov_oinfo *loi = lsm->lsm_oinfo[stripe]; - - kms = lov_size_to_stripe(lsm, size, stripe); - CDEBUG(D_INODE, - "stripe %d KMS %sing %llu->%llu\n", - stripe, kms > loi->loi_kms ? "increase":"shrink", - loi->loi_kms, kms); - loi->loi_lvb.lvb_size = kms; - loi_kms_set(loi, loi->loi_lvb.lvb_size); - } - return 0; - } - - if (size > 0) - stripe = lov_stripe_number(lsm, size - 1); - kms = lov_size_to_stripe(lsm, size, stripe); - loi = lsm->lsm_oinfo[stripe]; - - CDEBUG(D_INODE, "stripe %d KMS %sincreasing %llu->%llu\n", - stripe, kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms); - if (kms > loi->loi_kms) - loi_kms_set(loi, kms); - - return 0; -} - void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid, struct lov_stripe_md *lsm, int stripeno, int *set) { diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 9b92d5522edb..b23016f7ec26 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -41,6 +41,7 @@ #include "../../include/linux/libcfs/libcfs.h" #include "../include/obd_support.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_lib.h" #include "../include/lustre_net.h" #include "../include/lustre/lustre_idl.h" @@ -940,7 +941,7 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, } case LCFG_PARAM: { struct lprocfs_static_vars lvars = { NULL }; - struct lov_desc *desc = &(obd->u.lov.desc); + struct lov_desc *desc = &obd->u.lov.desc; if (!desc) { rc = -EINVAL; @@ -971,92 +972,6 @@ out: return rc; } -static int lov_recreate(struct obd_export *exp, struct obdo *src_oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti) -{ - struct lov_stripe_md *obj_mdp, *lsm; - struct lov_obd *lov = &exp->exp_obd->u.lov; - unsigned ost_idx; - int rc, i; - - LASSERT(src_oa->o_valid & OBD_MD_FLFLAGS && - src_oa->o_flags & OBD_FL_RECREATE_OBJS); - - obj_mdp = kzalloc(sizeof(*obj_mdp), GFP_NOFS); - if (!obj_mdp) - return -ENOMEM; - - ost_idx = src_oa->o_nlink; - lsm = *ea; - if (!lsm) { - rc = -EINVAL; - goto out; - } - if (ost_idx >= lov->desc.ld_tgt_count || - !lov->lov_tgts[ost_idx]) { - rc = -EINVAL; - goto out; - } - - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_oinfo *loi = lsm->lsm_oinfo[i]; - - if (lov_oinfo_is_dummy(loi)) - continue; - - if (loi->loi_ost_idx == ost_idx) { - if (ostid_id(&loi->loi_oi) != ostid_id(&src_oa->o_oi)) { - rc = -EINVAL; - goto out; - } - break; - } - } - if (i == lsm->lsm_stripe_count) { - rc = -EINVAL; - goto out; - } - - rc = obd_create(NULL, lov->lov_tgts[ost_idx]->ltd_exp, - src_oa, &obj_mdp, oti); -out: - kfree(obj_mdp); - return rc; -} - -/* the LOV expects oa->o_id to be set to the LOV object id */ -static int lov_create(const struct lu_env *env, struct obd_export *exp, - struct obdo *src_oa, struct lov_stripe_md **ea, - struct obd_trans_info *oti) -{ - struct lov_obd *lov; - int rc = 0; - - LASSERT(ea); - if (!exp) - return -EINVAL; - - if ((src_oa->o_valid & OBD_MD_FLFLAGS) && - src_oa->o_flags == OBD_FL_DELORPHAN) { - /* should be used with LOV anymore */ - LBUG(); - } - - lov = &exp->exp_obd->u.lov; - if (!lov->desc.ld_active_tgt_count) - return -EIO; - - obd_getref(exp->exp_obd); - /* Recreate a specific object id at the given OST index */ - if ((src_oa->o_valid & OBD_MD_FLFLAGS) && - (src_oa->o_flags & OBD_FL_RECREATE_OBJS)) { - rc = lov_recreate(exp, src_oa, ea, oti); - } - - obd_putref(exp->exp_obd); - return rc; -} - #define ASSERT_LSM_MAGIC(lsmp) \ do { \ LASSERT((lsmp)); \ @@ -1065,59 +980,6 @@ do { \ "%p->lsm_magic=%x\n", (lsmp), (lsmp)->lsm_magic); \ } while (0) -static int lov_destroy(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *lsm, - struct obd_trans_info *oti, struct obd_export *md_exp) -{ - struct lov_request_set *set; - struct obd_info oinfo; - struct lov_request *req; - struct lov_obd *lov; - int rc = 0, err = 0; - - ASSERT_LSM_MAGIC(lsm); - - if (!exp || !exp->exp_obd) - return -ENODEV; - - if (oa->o_valid & OBD_MD_FLCOOKIE) { - LASSERT(oti); - LASSERT(oti->oti_logcookies); - } - - lov = &exp->exp_obd->u.lov; - obd_getref(exp->exp_obd); - rc = lov_prep_destroy_set(exp, &oinfo, oa, lsm, oti, &set); - if (rc) - goto out; - - list_for_each_entry(req, &set->set_list, rq_link) { - if (oa->o_valid & OBD_MD_FLCOOKIE) - oti->oti_logcookies = set->set_cookies + req->rq_stripe; - - err = obd_destroy(env, lov->lov_tgts[req->rq_idx]->ltd_exp, - req->rq_oi.oi_oa, NULL, oti, NULL); - err = lov_update_common_set(set, req, err); - if (err) { - CERROR("%s: destroying objid "DOSTID" subobj " - DOSTID" on OST idx %d: rc = %d\n", - exp->exp_obd->obd_name, POSTID(&oa->o_oi), - POSTID(&req->rq_oi.oi_oa->o_oi), - req->rq_idx, err); - if (!rc) - rc = err; - } - } - - if (rc == 0) - rc = lsm_op_find(lsm->lsm_magic)->lsm_destroy(lsm, oa, md_exp); - - err = lov_fini_destroy_set(set); -out: - obd_putref(exp->exp_obd); - return rc ? rc : err; -} - static int lov_getattr_interpret(struct ptlrpc_request_set *rqset, void *data, int rc) { @@ -1267,46 +1129,6 @@ static int lov_setattr_async(struct obd_export *exp, struct obd_info *oinfo, return 0; } -/* find any ldlm lock of the inode in lov - * return 0 not find - * 1 find one - * < 0 error - */ -static int lov_find_cbdata(struct obd_export *exp, - struct lov_stripe_md *lsm, ldlm_iterator_t it, - void *data) -{ - struct lov_obd *lov; - int rc = 0, i; - - ASSERT_LSM_MAGIC(lsm); - - if (!exp || !exp->exp_obd) - return -ENODEV; - - lov = &exp->exp_obd->u.lov; - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_stripe_md submd; - struct lov_oinfo *loi = lsm->lsm_oinfo[i]; - - if (lov_oinfo_is_dummy(loi)) - continue; - - if (!lov->lov_tgts[loi->loi_ost_idx]) { - CDEBUG(D_HA, "lov idx %d NULL\n", loi->loi_ost_idx); - continue; - } - - submd.lsm_oi = loi->loi_oi; - submd.lsm_stripe_count = 0; - rc = obd_find_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp, - &submd, it, data); - if (rc != 0) - return rc; - } - return rc; -} - int lov_statfs_interpret(struct ptlrpc_request_set *rqset, void *data, int rc) { struct lov_request_set *lovset = (struct lov_request_set *)data; @@ -1460,7 +1282,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, } desc = (struct lov_desc *)data->ioc_inlbuf1; - memcpy(desc, &(lov->desc), sizeof(*desc)); + memcpy(desc, &lov->desc, sizeof(*desc)); uuidp = (struct obd_uuid *)data->ioc_inlbuf2; genp = (__u32 *)data->ioc_inlbuf3; @@ -1477,9 +1299,6 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, obd_ioctl_freedata(buf, len); break; } - case LL_IOC_LOV_GETSTRIPE: - rc = lov_getstripe(exp, karg, uarg); - break; case OBD_IOC_QUOTACTL: { struct if_quotactl *qctl = karg; struct lov_tgt_desc *tgt = NULL; @@ -1726,6 +1545,8 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, u64 fm_start, fm_end, fm_length, fm_end_offset; u64 curr_loc; int current_extent = 0, rc = 0, i; + /* Whether have we collected enough extents */ + bool enough = false; int ost_eof = 0; /* EOF for object */ int ost_done = 0; /* done with required mapping for this OST? */ int last_stripe; @@ -1860,7 +1681,7 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, lun_start += len_mapped_single_call; fm_local->fm_length = req_fm_len - len_mapped_single_call; req_fm_len = fm_local->fm_length; - fm_local->fm_extent_count = count_local; + fm_local->fm_extent_count = enough ? 1 : count_local; fm_local->fm_mapped_extents = 0; fm_local->fm_flags = fiemap->fm_flags; @@ -1908,6 +1729,12 @@ inactive_tgt: goto finish; } break; + } else if (enough) { + /* + * We've collected enough extents and there are + * more extents after it. + */ + goto finish; } /* If we just need num of extents then go to next device */ @@ -1916,8 +1743,9 @@ inactive_tgt: break; } - len_mapped_single_call = lcl_fm_ext[ext_count-1].fe_logical - - lun_start + lcl_fm_ext[ext_count - 1].fe_length; + len_mapped_single_call = + lcl_fm_ext[ext_count - 1].fe_logical - + lun_start + lcl_fm_ext[ext_count - 1].fe_length; /* Have we finished mapping on this device? */ if (req_fm_len <= len_mapped_single_call) @@ -1926,14 +1754,15 @@ inactive_tgt: /* Clear the EXTENT_LAST flag which can be present on * last extent */ - if (lcl_fm_ext[ext_count-1].fe_flags & FIEMAP_EXTENT_LAST) + if (lcl_fm_ext[ext_count - 1].fe_flags & + FIEMAP_EXTENT_LAST) lcl_fm_ext[ext_count - 1].fe_flags &= ~FIEMAP_EXTENT_LAST; curr_loc = lov_stripe_size(lsm, - lcl_fm_ext[ext_count - 1].fe_logical+ - lcl_fm_ext[ext_count - 1].fe_length, - cur_stripe); + lcl_fm_ext[ext_count - 1].fe_logical + + lcl_fm_ext[ext_count - 1].fe_length, + cur_stripe); if (curr_loc >= fm_key->oa.o_size) ost_eof = 1; @@ -1945,7 +1774,7 @@ inactive_tgt: /* Ran out of available extents? */ if (current_extent >= fiemap->fm_extent_count) - goto finish; + enough = true; } while (ost_done == 0 && ost_eof == 0); if (cur_stripe_wrap == last_stripe) @@ -1985,73 +1814,14 @@ static int lov_get_info(const struct lu_env *env, struct obd_export *exp, { struct obd_device *obddev = class_exp2obd(exp); struct lov_obd *lov = &obddev->u.lov; - int i, rc; + int rc; if (!vallen || !val) return -EFAULT; obd_getref(obddev); - if (KEY_IS(KEY_LOCK_TO_STRIPE)) { - struct { - char name[16]; - struct ldlm_lock *lock; - } *data = key; - struct ldlm_res_id *res_id = &data->lock->l_resource->lr_name; - struct lov_oinfo *loi; - __u32 *stripe = val; - - if (*vallen < sizeof(*stripe)) { - rc = -EFAULT; - goto out; - } - *vallen = sizeof(*stripe); - - /* XXX This is another one of those bits that will need to - * change if we ever actually support nested LOVs. It uses - * the lock's export to find out which stripe it is. - */ - /* 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; i < lsm->lsm_stripe_count; i++) { - loi = lsm->lsm_oinfo[i]; - if (lov_oinfo_is_dummy(loi)) - continue; - - if (!lov->lov_tgts[loi->loi_ost_idx]) - continue; - if (lov->lov_tgts[loi->loi_ost_idx]->ltd_exp == - data->lock->l_conn_export && - ostid_res_name_eq(&loi->loi_oi, res_id)) { - *stripe = i; - rc = 0; - goto out; - } - } - LDLM_ERROR(data->lock, "lock on inode without such object"); - dump_lsm(D_ERROR, lsm); - rc = -ENXIO; - goto out; - } else if (KEY_IS(KEY_LAST_ID)) { - struct obd_id_info *info = val; - __u32 size = sizeof(u64); - struct lov_tgt_desc *tgt; - - LASSERT(*vallen == sizeof(struct obd_id_info)); - tgt = lov->lov_tgts[info->idx]; - - if (!tgt || !tgt->ltd_active) { - rc = -ESRCH; - goto out; - } - - rc = obd_get_info(env, tgt->ltd_exp, keylen, key, - &size, info->data, NULL); - rc = 0; - goto out; - } else if (KEY_IS(KEY_LOVDESC)) { + if (KEY_IS(KEY_LOVDESC)) { struct lov_desc *desc_ret = val; *desc_ret = lov->desc; @@ -2060,22 +1830,6 @@ static int lov_get_info(const struct lu_env *env, struct obd_export *exp, } else if (KEY_IS(KEY_FIEMAP)) { rc = lov_fiemap(lov, keylen, key, vallen, val, lsm); goto out; - } else if (KEY_IS(KEY_CONNECT_FLAG)) { - struct lov_tgt_desc *tgt; - __u64 ost_idx = *((__u64 *)val); - - LASSERT(*vallen == sizeof(__u64)); - LASSERT(ost_idx < lov->desc.ld_tgt_count); - tgt = lov->lov_tgts[ost_idx]; - - if (!tgt || !tgt->ltd_exp) { - rc = -ESRCH; - goto out; - } - - *((__u64 *)val) = exp_connect_flags(tgt->ltd_exp); - rc = 0; - goto out; } else if (KEY_IS(KEY_TGT_COUNT)) { *((int *)val) = lov->desc.ld_tgt_count; rc = 0; @@ -2098,8 +1852,7 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp, u32 count; int i, rc = 0, err; struct lov_tgt_desc *tgt; - unsigned int incr = 0, check_uuid = 0, do_inactive = 0, no_set = 0; - unsigned int next_id = 0, mds_con = 0; + int do_inactive = 0, no_set = 0; if (!set) { no_set = 1; @@ -2111,18 +1864,8 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp, obd_getref(obddev); count = lov->desc.ld_tgt_count; - if (KEY_IS(KEY_NEXT_ID)) { - count = vallen / sizeof(struct obd_id_info); - vallen = sizeof(u64); - incr = sizeof(struct obd_id_info); - do_inactive = 1; - next_id = 1; - } else if (KEY_IS(KEY_CHECKSUM)) { + if (KEY_IS(KEY_CHECKSUM)) { do_inactive = 1; - } else if (KEY_IS(KEY_EVICT_BY_NID)) { - /* use defaults: do_inactive = incr = 0; */ - } else if (KEY_IS(KEY_MDS_CONN)) { - mds_con = 1; } else if (KEY_IS(KEY_CACHE_SET)) { LASSERT(!lov->lov_cache); lov->lov_cache = val; @@ -2130,11 +1873,9 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp, cl_cache_incref(lov->lov_cache); } - for (i = 0; i < count; i++, val = (char *)val + incr) { - if (next_id) - tgt = lov->lov_tgts[((struct obd_id_info *)val)->idx]; - else - tgt = lov->lov_tgts[i]; + for (i = 0; i < count; i++) { + tgt = lov->lov_tgts[i]; + /* OST was disconnected */ if (!tgt || !tgt->ltd_exp) continue; @@ -2143,34 +1884,8 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp, if (!tgt->ltd_active && !do_inactive) continue; - if (mds_con) { - struct mds_group_info *mgi; - - LASSERT(vallen == sizeof(*mgi)); - mgi = (struct mds_group_info *)val; - - /* Only want a specific OSC */ - if (mgi->uuid && !obd_uuid_equals(mgi->uuid, - &tgt->ltd_uuid)) - continue; - - err = obd_set_info_async(env, tgt->ltd_exp, - keylen, key, sizeof(int), - &mgi->group, set); - } else if (next_id) { - err = obd_set_info_async(env, tgt->ltd_exp, - keylen, key, vallen, - ((struct obd_id_info *)val)->data, set); - } else { - /* Only want a specific OSC */ - if (check_uuid && - !obd_uuid_equals(val, &tgt->ltd_uuid)) - continue; - - err = obd_set_info_async(env, tgt->ltd_exp, - keylen, key, vallen, val, set); - } - + err = obd_set_info_async(env, tgt->ltd_exp, keylen, key, + vallen, val, set); if (!rc) rc = err; } @@ -2318,12 +2033,8 @@ static struct obd_ops lov_obd_ops = { .statfs_async = lov_statfs_async, .packmd = lov_packmd, .unpackmd = lov_unpackmd, - .create = lov_create, - .destroy = lov_destroy, .getattr_async = lov_getattr_async, .setattr_async = lov_setattr_async, - .adjust_kms = lov_adjust_kms, - .find_cbdata = lov_find_cbdata, .iocontrol = lov_iocontrol, .get_info = lov_get_info, .set_info_async = lov_set_info_async, diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index f9621b0fd469..52f736338887 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -75,6 +75,13 @@ struct lov_layout_operations { static int lov_layout_wait(const struct lu_env *env, struct lov_object *lov); +void lov_lsm_put(struct cl_object *unused, struct lov_stripe_md *lsm) +{ + if (lsm) + lov_free_memmd(&lsm); +} +EXPORT_SYMBOL(lov_lsm_put); + /***************************************************************************** * * Lov object layout operations. @@ -195,6 +202,10 @@ static int lov_page_slice_fixup(struct lov_object *lov, struct cl_object_header *hdr = cl_object_header(&lov->lo_cl); struct cl_object *o; + if (!stripe) + return hdr->coh_page_bufsize - lov->lo_cl.co_slice_off - + cfs_size_round(sizeof(struct lov_page)); + cl_object_for_each(o, stripe) o->co_slice_off += hdr->coh_page_bufsize; @@ -224,6 +235,7 @@ static int lov_init_raid0(const struct lu_env *env, LASSERT(!lov->lo_lsm); lov->lo_lsm = lsm_addref(lsm); + lov->lo_layout_invalid = true; r0->lo_nr = lsm->lsm_stripe_count; LASSERT(r0->lo_nr <= lov_targets_nr(dev)); @@ -719,6 +731,10 @@ static int lov_layout_change(const struct lu_env *unused, LASSERT(atomic_read(&lov->lo_active_ios) == 0); lov->lo_type = LLT_EMPTY; + /* page bufsize fixup */ + cl_object_header(&lov->lo_cl)->coh_page_bufsize -= + lov_page_slice_fixup(lov, NULL); + result = new_ops->llo_init(env, lu2lov_dev(lov->lo_cl.co_lu.lo_dev), lov, conf, state); @@ -878,8 +894,8 @@ static int lov_attr_get(const struct lu_env *env, struct cl_object *obj, return LOV_2DISPATCH_NOLOCK(cl2lov(obj), llo_getattr, env, obj, attr); } -static int lov_attr_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_attr *attr, unsigned valid) +static int lov_attr_update(const struct lu_env *env, struct cl_object *obj, + const struct cl_attr *attr, unsigned int valid) { /* * No dispatch is required here, as no layout implements this. @@ -895,13 +911,30 @@ int lov_lock_init(const struct lu_env *env, struct cl_object *obj, io); } +static int lov_object_getstripe(const struct lu_env *env, struct cl_object *obj, + struct lov_user_md __user *lum) +{ + struct lov_object *lov = cl2lov(obj); + struct lov_stripe_md *lsm; + int rc = 0; + + lsm = lov_lsm_addref(lov); + if (!lsm) + return -ENODATA; + + rc = lov_getstripe(cl2lov(obj), lsm, lum); + lov_lsm_put(obj, lsm); + return rc; +} + static const struct cl_object_operations lov_ops = { .coo_page_init = lov_page_init, .coo_lock_init = lov_lock_init, .coo_io_init = lov_io_init, .coo_attr_get = lov_attr_get, - .coo_attr_set = lov_attr_set, - .coo_conf_set = lov_conf_set + .coo_attr_update = lov_attr_update, + .coo_conf_set = lov_conf_set, + .coo_getstripe = lov_object_getstripe }; static const struct lu_object_operations lov_lu_obj_ops = { @@ -938,7 +971,7 @@ struct lu_object *lov_object_alloc(const struct lu_env *env, return obj; } -static struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov) +struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov) { struct lov_stripe_md *lsm = NULL; @@ -969,13 +1002,6 @@ struct lov_stripe_md *lov_lsm_get(struct cl_object *clobj) } EXPORT_SYMBOL(lov_lsm_get); -void lov_lsm_put(struct cl_object *unused, struct lov_stripe_md *lsm) -{ - if (lsm) - lov_free_memmd(&lsm); -} -EXPORT_SYMBOL(lov_lsm_put); - int lov_read_and_clear_async_rc(struct cl_object *clob) { struct lu_object *luobj; diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 869ef41b13ca..be6e9857ce2a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -45,6 +45,7 @@ #include "../include/lustre/lustre_user.h" #include "lov_internal.h" +#include "lov_cl_internal.h" void lov_dump_lmm_common(int level, void *lmmp) { @@ -104,11 +105,9 @@ void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm) * LOVs properly. For now lov_mds_md_size() just assumes one u64 * per stripe. */ -int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, - struct lov_stripe_md *lsm) +int lov_obd_packmd(struct lov_obd *lov, struct lov_mds_md **lmmp, + struct lov_stripe_md *lsm) { - struct obd_device *obd = class_exp2obd(exp); - struct lov_obd *lov = &obd->u.lov; struct lov_mds_md_v1 *lmmv1; struct lov_mds_md_v3 *lmmv3; __u16 stripe_count; @@ -148,16 +147,11 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, stripe_count = 0; } } else { - /* No need to allocate more than maximum supported stripes. - * Anyway, this is pretty inaccurate since ld_tgt_count now - * represents max index and we should rely on the actual number - * of OSTs instead + /* + * To calculate maximum easize by active targets at present, + * which is exactly the maximum easize to be seen by LOV */ - stripe_count = lov_mds_md_max_stripe_count( - lov->lov_ocd.ocd_max_easize, lmm_magic); - - if (stripe_count > lov->desc.ld_tgt_count) - stripe_count = lov->desc.ld_tgt_count; + stripe_count = lov->desc.ld_active_tgt_count; } /* XXX LOV STACKING call into osc for sizes */ @@ -225,6 +219,15 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, return lmm_size; } +int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, + struct lov_stripe_md *lsm) +{ + struct obd_device *obd = class_exp2obd(exp); + struct lov_obd *lov = &obd->u.lov; + + return lov_obd_packmd(lov, lmmp, lsm); +} + /* Find the max stripecount we should use */ __u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count) { @@ -284,7 +287,7 @@ int lov_alloc_memmd(struct lov_stripe_md **lsmp, __u16 stripe_count, spin_lock_init(&(*lsmp)->lsm_lock); (*lsmp)->lsm_magic = magic; (*lsmp)->lsm_stripe_count = stripe_count; - (*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES * stripe_count; + (*lsmp)->lsm_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES * stripe_count; (*lsmp)->lsm_pattern = pattern; (*lsmp)->lsm_pool_name[0] = '\0'; (*lsmp)->lsm_layout_gen = 0; @@ -372,16 +375,17 @@ int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, * the maximum number of OST indices which will fit in the user buffer. * lmm_magic must be LOV_USER_MAGIC. */ -int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, +int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, struct lov_user_md __user *lump) { /* * XXX huge struct allocated on stack. */ /* we use lov_user_md_v3 because it is larger than lov_user_md_v1 */ + struct lov_obd *lov; struct lov_user_md_v3 lum; struct lov_mds_md *lmmk = NULL; - int rc, lmm_size; + int rc, lmmk_size, lmm_size; int lum_size; mm_segment_t seg; @@ -401,12 +405,13 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, lum_size = sizeof(struct lov_user_md_v1); if (copy_from_user(&lum, lump, lum_size)) { rc = -EFAULT; - goto out_set; + goto out; } - if ((lum.lmm_magic != LOV_USER_MAGIC) && - (lum.lmm_magic != LOV_USER_MAGIC_V3)) { + if (lum.lmm_magic != LOV_USER_MAGIC_V1 && + lum.lmm_magic != LOV_USER_MAGIC_V3 && + lum.lmm_magic != LOV_USER_MAGIC_SPECIFIC) { rc = -EINVAL; - goto out_set; + goto out; } if (lum.lmm_stripe_count && @@ -415,11 +420,13 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, lum.lmm_stripe_count = lsm->lsm_stripe_count; rc = copy_to_user(lump, &lum, lum_size); rc = -EOVERFLOW; - goto out_set; + goto out; } - rc = lov_packmd(exp, &lmmk, lsm); + lov = lu2lov_dev(obj->lo_cl.co_lu.lo_dev)->ld_lov; + rc = lov_obd_packmd(lov, &lmmk, lsm); if (rc < 0) - goto out_set; + goto out; + lmmk_size = rc; lmm_size = rc; rc = 0; @@ -455,7 +462,7 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, lmm_size = lum_size; } else if (lum.lmm_stripe_count < lmmk->lmm_stripe_count) { rc = -EOVERFLOW; - goto out_set; + goto out_free; } /* * Have a difference between lov_mds_md & lov_user_md. @@ -468,8 +475,9 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, if (copy_to_user(lump, lmmk, lmm_size)) rc = -EFAULT; - obd_free_diskmd(exp, &lmmk); -out_set: +out_free: + kfree(lmmk); +out: set_fs(seg); return rc; } diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index c17026f14896..00bfabad78eb 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -65,7 +65,9 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env, pgoff_t index = *max_index; unsigned int pps; /* pages per stripe */ - CDEBUG(D_READA, "*max_index = %lu, nr = %d\n", index, r0->lo_nr); + CDEBUG(D_READA, DFID "*max_index = %lu, nr = %d\n", + PFID(lu_object_fid(lov2lu(loo))), index, r0->lo_nr); + if (index == 0) /* the page is not covered by any lock */ return 0; @@ -80,7 +82,12 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env, /* calculate the end of current stripe */ pps = loo->lo_lsm->lsm_stripe_size >> PAGE_SHIFT; - index = ((slice->cpl_index + pps) & ~(pps - 1)) - 1; + index = slice->cpl_index + pps - slice->cpl_index % pps - 1; + + CDEBUG(D_READA, DFID "*max_index = %lu, index = %lu, pps = %u, stripe_size = %u, stripe no = %u, page index = %lu\n", + PFID(lu_object_fid(lov2lu(loo))), *max_index, index, pps, + loo->lo_lsm->lsm_stripe_size, lov_page_stripe(slice->cpl_page), + slice->cpl_index); /* never exceed the end of the stripe */ *max_index = min_t(pgoff_t, *max_index, index); @@ -122,6 +129,7 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj, rc = lov_stripe_offset(loo->lo_lsm, offset, stripe, &suboff); LASSERT(rc == 0); + lpg->lps_stripe = stripe; cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_raid0_page_ops); sub = lov_sub_get(env, lio, stripe); diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 4c2d21729589..f8c8a361ef79 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -61,7 +61,7 @@ void lov_pool_putref(struct pool_desc *pool) LASSERT(hlist_unhashed(&pool->pool_hash)); LASSERT(list_empty(&pool->pool_list)); LASSERT(!pool->pool_debugfs_entry); - lov_ost_pool_free(&(pool->pool_obds)); + lov_ost_pool_free(&pool->pool_obds); kfree(pool); } } @@ -92,7 +92,7 @@ static __u32 pool_hashfn(struct cfs_hash *hash_body, const void *key, unsigned m for (i = 0; i < LOV_MAXPOOLNAME; i++) { if (poolname[i] == '\0') break; - result = (result << 4)^(result >> 28) ^ poolname[i]; + result = (result << 4) ^ (result >> 28) ^ poolname[i]; } return (result % mask); } @@ -260,7 +260,7 @@ static int pool_proc_show(struct seq_file *s, void *v) tgt = pool_tgt(iter->pool, iter->idx); up_read(&pool_tgt_rw_sem(iter->pool)); if (tgt) - seq_printf(s, "%s\n", obd_uuid2str(&(tgt->ltd_uuid))); + seq_printf(s, "%s\n", obd_uuid2str(&tgt->ltd_uuid)); return 0; } @@ -400,7 +400,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname) struct pool_desc *new_pool; int rc; - lov = &(obd->u.lov); + lov = &obd->u.lov; if (strlen(poolname) > LOV_MAXPOOLNAME) return -ENAMETOOLONG; @@ -471,7 +471,7 @@ int lov_pool_del(struct obd_device *obd, char *poolname) struct lov_obd *lov; struct pool_desc *pool; - lov = &(obd->u.lov); + lov = &obd->u.lov; /* lookup and kill hash reference */ pool = cfs_hash_del_key(lov->lov_pools_hash_body, poolname); @@ -503,7 +503,7 @@ int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname) unsigned int lov_idx; int rc; - lov = &(obd->u.lov); + lov = &obd->u.lov; pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname); if (!pool) @@ -517,7 +517,7 @@ int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname) if (!lov->lov_tgts[lov_idx]) continue; if (obd_uuid_equals(&ost_uuid, - &(lov->lov_tgts[lov_idx]->ltd_uuid))) + &lov->lov_tgts[lov_idx]->ltd_uuid)) break; } /* test if ost found in lov */ @@ -547,7 +547,7 @@ int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname) unsigned int lov_idx; int rc = 0; - lov = &(obd->u.lov); + lov = &obd->u.lov; pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname); if (!pool) @@ -562,7 +562,7 @@ int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname) continue; if (obd_uuid_equals(&ost_uuid, - &(lov->lov_tgts[lov_idx]->ltd_uuid))) + &lov->lov_tgts[lov_idx]->ltd_uuid)) break; } diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 4099b51f826e..09dcaf484c89 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -325,84 +325,6 @@ out_set: return rc; } -int lov_fini_destroy_set(struct lov_request_set *set) -{ - if (!set) - return 0; - LASSERT(set->set_exp); - if (atomic_read(&set->set_completes)) { - /* FIXME update qos data here */ - } - - lov_put_reqset(set); - - return 0; -} - -int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, - struct obdo *src_oa, struct lov_stripe_md *lsm, - struct obd_trans_info *oti, - struct lov_request_set **reqset) -{ - struct lov_request_set *set; - struct lov_obd *lov = &exp->exp_obd->u.lov; - int rc = 0, i; - - set = kzalloc(sizeof(*set), GFP_NOFS); - if (!set) - return -ENOMEM; - lov_init_set(set); - - set->set_exp = exp; - set->set_oi = oinfo; - set->set_oi->oi_md = lsm; - set->set_oi->oi_oa = src_oa; - if (oti && src_oa->o_valid & OBD_MD_FLCOOKIE) - set->set_cookies = oti->oti_logcookies; - - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_oinfo *loi; - struct lov_request *req; - - loi = lsm->lsm_oinfo[i]; - if (lov_oinfo_is_dummy(loi)) - continue; - - if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) { - CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); - continue; - } - - req = kzalloc(sizeof(*req), GFP_NOFS); - if (!req) { - rc = -ENOMEM; - goto out_set; - } - - req->rq_stripe = i; - req->rq_idx = loi->loi_ost_idx; - - req->rq_oi.oi_oa = kmem_cache_zalloc(obdo_cachep, GFP_NOFS); - if (!req->rq_oi.oi_oa) { - kfree(req); - rc = -ENOMEM; - goto out_set; - } - memcpy(req->rq_oi.oi_oa, src_oa, sizeof(*req->rq_oi.oi_oa)); - req->rq_oi.oi_oa->o_oi = loi->loi_oi; - lov_set_add_req(req, set); - } - if (!set->set_count) { - rc = -EIO; - goto out_set; - } - *reqset = set; - return rc; -out_set: - lov_fini_destroy_set(set); - return rc; -} - int lov_fini_setattr_set(struct lov_request_set *set) { int rc = 0; diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index fb2f2660b3e9..a2bac7a3b71b 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -98,8 +98,8 @@ static int lovsub_object_print(const struct lu_env *env, void *cookie, return (*p)(env, cookie, "[%d]", los->lso_index); } -static int lovsub_attr_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_attr *attr, unsigned valid) +static int lovsub_attr_update(const struct lu_env *env, struct cl_object *obj, + const struct cl_attr *attr, unsigned int valid) { struct lov_object *lov = cl2lovsub(obj)->lso_super; @@ -119,7 +119,7 @@ static int lovsub_object_glimpse(const struct lu_env *env, static const struct cl_object_operations lovsub_ops = { .coo_page_init = lovsub_page_init, .coo_lock_init = lovsub_lock_init, - .coo_attr_set = lovsub_attr_set, + .coo_attr_update = lovsub_attr_update, .coo_glimpse = lovsub_object_glimpse }; |