* vim:expandtab:shiftwidth=8:tabstop=8:
*
* lustre/cmm/cmm_split.c
- * Lustre splitting dir
+ * Lustre splitting dir
*
* Copyright (c) 2006 Cluster File Systems, Inc.
* Author: Alex thomas <alex@clusterfs.com>
#define CMM_EXPECT_SPLIT 1
#define CMM_NO_SPLITTABLE 2
-#define SPLIT_SIZE 8*1024
+enum {
+ SPLIT_SIZE = 8*1024
+};
static inline struct lu_fid* cmm2_fid(struct cmm_object *obj)
{
if (ma->ma_lmv_size)
GOTO(cleanup, rc = CMM_NO_SPLIT_EXPECTED);
-
+
OBD_ALLOC_PTR(fid);
rc = cmm_root_get(ctx, &cmm->cmm_md_dev, fid);
if (rc)
GOTO(cleanup, rc);
-
+
if (lu_fid_eq(fid, cmm2_fid(md2cmm_obj(mo))))
- GOTO(cleanup, rc = CMM_NO_SPLIT_EXPECTED);
+ GOTO(cleanup, rc = CMM_NO_SPLIT_EXPECTED);
cleanup:
if (fid)
{
struct mdc_device *mc, *tmp;
int rc = 0, i = 0;
-
+
LASSERT(count == cmm->cmm_tgt_count);
- /* FIXME: this spin_lock maybe not proper,
+ /* FIXME: this spin_lock maybe not proper,
* because fid_alloc may need RPC */
spin_lock(&cmm->cmm_tgt_guard);
list_for_each_entry_safe(mc, tmp, &cmm->cmm_targets,
mc_linkage) {
LASSERT(cmm->cmm_local_num != mc->mc_num);
-
+
rc = obd_fid_alloc(mc->mc_desc.cl_exp, &fid[i++], NULL);
if (rc > 0) {
struct lu_site *ls;
lu_object_put(ctxt, &o->cmo_obj.mo_lu);
}
-static int cmm_creat_remote_obj(const struct lu_context *ctx,
+static int cmm_creat_remote_obj(const struct lu_context *ctx,
struct cmm_device *cmm,
struct lu_fid *fid, struct md_attr *ma)
{
RETURN(PTR_ERR(obj));
OBD_ALLOC_PTR(spec);
- spec->u.sp_pfid = fid;
- rc = mo_object_create(ctx, md_object_next(&obj->cmo_obj),
+ spec->u.sp_pfid = fid;
+ rc = mo_object_create(ctx, md_object_next(&obj->cmo_obj),
spec, ma);
OBD_FREE_PTR(spec);
RETURN(rc);
}
-static int cmm_send_split_pages(const struct lu_context *ctx,
- struct md_object *mo, struct lu_rdpg *rdpg,
+static int cmm_send_split_pages(const struct lu_context *ctx,
+ struct md_object *mo, struct lu_rdpg *rdpg,
struct lu_fid *fid, __u32 hash_end)
{
struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
}
static int cmm_split_entries(const struct lu_context *ctx, struct md_object *mo,
- struct lu_rdpg *rdpg, struct lu_fid *lf,
+ struct lu_rdpg *rdpg, struct lu_fid *lf,
__u32 end)
{
int rc, i;
}
rc = mo_readpage(ctx, md_object_next(mo), rdpg);
-
+
/* -E2BIG means it already reach the end of the dir */
- if (rc == -E2BIG)
+ if (rc == -E2BIG)
RETURN(0);
if (rc)
RETURN(rc);
}
#if 0
-static int cmm_remove_entries(const struct lu_context *ctx,
+static int cmm_remove_entries(const struct lu_context *ctx,
struct md_object *mo, struct lu_rdpg *rdpg)
{
struct lu_dirpage *dp;
for (i = 1; i < cmm->cmm_tgt_count; i++) {
struct lu_fid *lf = &ma->ma_lmv->mea_ids[i];
__u32 hash_end;
-
+
rdpg->rp_hash = i * hash_segement;
hash_end = rdpg->rp_hash + hash_segement;
-
+
rc = cmm_split_entries(ctx, mo, rdpg, lf, hash_end);
if (rc)
GOTO(cleanup, rc);
ENTRY;
LASSERT(S_ISDIR(lu_object_attr(&mo->mo_lu)));
-
+
OBD_ALLOC_PTR(ma);
if (ma == NULL)
RETURN(-ENOMEM);
cleanup:
if (ma->ma_lmv_size && ma->ma_lmv)
OBD_FREE(ma->ma_lmv, ma->ma_lmv_size);
-
+
OBD_FREE_PTR(ma);
RETURN(rc);