Whamcloud - gitweb
Branch: b_new_cmd
authorwangdi <wangdi>
Wed, 30 Aug 2006 08:01:27 +0000 (08:01 +0000)
committerwangdi <wangdi>
Wed, 30 Aug 2006 08:01:27 +0000 (08:01 +0000)
1)some cleanup and fixes for splitting dir
2)reduce stack size according to nikita's comments

lustre/cmm/cmm_object.c
lustre/include/linux/obd_class.h
lustre/include/lustre_mds.h
lustre/include/md_object.h
lustre/mdd/mdd_handler.c
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_lov.c
lustre/mdt/mdt_handler.c
lustre/obdclass/linux/linux-obdo.c
lustre/osd/osd_handler.c

index d8fdbc7..ea56ed5 100644 (file)
@@ -355,8 +355,16 @@ static int cml_create(const struct lu_context *ctx, struct md_object *mo_p,
 {
         int rc;
         ENTRY;
+
+#ifdef SPLIT_ENABLE
+        rc = cml_try_to_split(ctx, mo_p);
+        if (rc)
+                RETURN(rc);
+#endif
         rc = mdo_create(ctx, md_object_next(mo_p), child_name,
                         md_object_next(mo_c), spec, ma);
+
+
         RETURN(rc);
 }
 
index 3e59fa6..2fee9fa 100644 (file)
@@ -44,6 +44,7 @@
 void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned ia_valid);
 void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid);
 void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid);
+void obdo_from_la(struct obdo *dst, struct lu_attr *la, obd_flag valid);
 void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid);
 void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
 #endif
index f6328f0..6bba43a 100644 (file)
@@ -98,6 +98,7 @@ int mds_log_op_setattr(struct obd_device *obd, struct inode *inode,
 #define IOC_REQUEST_MAX_NR               35
 
 #define MDS_LOV_MD_NAME "trusted.lov"
+#define MDS_LMV_MD_NAME "trusted.lmv"
 #define MDD_OBD_NAME    "mdd_obd"
 #define MDD_OBD_UUID    "mdd_obd_uuid"
 #define MDD_OBD_TYPE    "mds"
index 23751f2..3cd8723 100644 (file)
@@ -51,7 +51,8 @@ enum ma_valid {
         MA_INODE = (1 << 0),
         MA_LOV   = (1 << 1),
         MA_COOKIE = (1 << 2),
-        MA_FLAGS = (1 << 3)
+        MA_FLAGS = (1 << 3),
+        MA_LMV   = (1 << 4)
 };
 
 struct md_attr {
@@ -61,6 +62,8 @@ struct md_attr {
         struct lu_attr          ma_attr;
         struct lov_mds_md      *ma_lmm;
         int                     ma_lmm_size;
+        struct lmv_mds_md      *ma_lmv;
+        int                     ma_lmv_size;
         struct llog_cookie     *ma_cookie;
         int                     ma_cookie_size;
 };
index ad7a901..b289ae1 100644 (file)
@@ -40,6 +40,7 @@
 #include <lprocfs_status.h>
 
 #include <linux/ldiskfs_fs.h>
+#include <lustre_mds.h>
 #include <lu_object.h>
 #include <md_object.h>
 #include <dt_object.h>
@@ -247,13 +248,13 @@ static int mdd_may_delete(const struct lu_context *ctxt,
                 RETURN(-EPERM);
 
         if (is_dir) {
-                if (!S_ISDIR(mdd_object_type(ctxt, cobj)))
+                if (!S_ISDIR(mdd_object_type(cobj)))
                         RETURN(-ENOTDIR);
 
                 if (lu_fid_eq(mdo2fid(cobj), &mdd->mdd_root_fid))
                         RETURN(-EBUSY);
 
-        } else if (S_ISDIR(mdd_object_type(ctxt, cobj)))
+        } else if (S_ISDIR(mdd_object_type(cobj)))
                         RETURN(-EISDIR);
 
         if (mdd_is_dead_obj(pobj))
@@ -280,7 +281,8 @@ static int __mdd_lmm_get(const struct lu_context *ctxt,
         int rc;
 
         LASSERT(ma->ma_lmm != NULL && ma->ma_lmm_size > 0);
-        rc = mdd_get_md(ctxt, mdd_obj, ma->ma_lmm, &ma->ma_lmm_size, 0);
+        rc = mdd_get_md(ctxt, mdd_obj, ma->ma_lmm, &ma->ma_lmm_size, 0, 
+                        MDS_LOV_MD_NAME);
         if (rc > 0) {
                 ma->ma_valid |= MA_LOV;
                 rc = 0;
@@ -288,6 +290,21 @@ static int __mdd_lmm_get(const struct lu_context *ctxt,
         RETURN(rc);
 }
 
+/* get lmv EA only*/
+static int __mdd_lmv_get(const struct lu_context *ctxt,
+                         struct mdd_object *mdd_obj, struct md_attr *ma)
+{
+        int rc;
+
+        rc = mdd_get_md(ctxt, mdd_obj, ma->ma_lmv, &ma->ma_lmv_size, 0,
+                        MDS_LMV_MD_NAME);
+        if (rc > 0) {
+                ma->ma_valid |= MA_LMV;
+                rc = 0;
+        }
+        RETURN(rc);
+}
+
 static int mdd_attr_get_internal(const struct lu_context *ctxt,
                                  struct mdd_object *mdd_obj,
                                  struct md_attr *ma)
@@ -299,13 +316,15 @@ static int mdd_attr_get_internal(const struct lu_context *ctxt,
                 rc = __mdd_iattr_get(ctxt, mdd_obj, ma);
 
         if (rc == 0 && ma->ma_need & MA_LOV) {
-                __u32 mode;
-
-                mode = lu_object_attr(mdd2lu_obj(mdd_obj));
-                if (S_ISREG(mode) || S_ISDIR(mode))
+                if (S_ISREG(mdd_object_type(mdd_obj)) || 
+                    S_ISDIR(mdd_object_type(mdd_obj)))
                         rc = __mdd_lmm_get(ctxt, mdd_obj, ma);
         }
-
+        if (rc == 0 && ma->ma_need & MA_LMV) {
+                if (S_ISDIR(mdd_object_type(mdd_obj)))
+                        rc = __mdd_lmv_get(ctxt, mdd_obj, ma);
+        }
+        
         CDEBUG(D_INODE, "after getattr rc = %d, ma_valid = "LPX64"\n",
                         rc, ma->ma_valid);
         RETURN(rc);
@@ -828,14 +847,15 @@ static int mdd_attr_set(const struct lu_context *ctxt,
                 RETURN(PTR_ERR(handle));
         /*TODO: add lock here*/
         /* start a log jounal handle if needed */
-        if (S_ISREG(mdd_object_type(ctxt, mdd_obj)) &&
+        if (S_ISREG(mdd_object_type(mdd_obj)) &&
             ma->ma_attr.la_valid & (LA_UID | LA_GID)) {
                 max_size = mdd_lov_mdsize(ctxt, mdd);
                 OBD_ALLOC(lmm, max_size);
                 if (lmm == NULL)
                         GOTO(cleanup, rc = -ENOMEM);
 
-                rc = mdd_get_md(ctxt, mdd_obj, lmm, &lmm_size, 1);
+                rc = mdd_get_md(ctxt, mdd_obj, lmm, &lmm_size, 1, 
+                                MDS_LOV_MD_NAME);
 
                 if (rc < 0)
                         GOTO(cleanup, rc);
@@ -869,7 +889,7 @@ static int mdd_attr_set(const struct lu_context *ctxt,
         if (rc == 0 && ma->ma_valid & MA_LOV) {
                 umode_t mode;
 
-                mode = mdd_object_type(ctxt, mdd_obj);
+                mode = mdd_object_type(mdd_obj);
                 if (S_ISREG(mode) || S_ISDIR(mode)) {
                         /*TODO check permission*/
                         rc = mdd_lov_set_md(ctxt, NULL, mdd_obj, ma->ma_lmm,
@@ -1036,7 +1056,7 @@ static int mdd_link_sanity_check(const struct lu_context *ctxt,
         rc = mdd_may_create(ctxt, tgt_obj, NULL);
         if (rc)
                 RETURN(rc);
-        if (S_ISDIR(mdd_object_type(ctxt, src_obj)))
+        if (S_ISDIR(mdd_object_type(src_obj)))
                 RETURN(-EPERM);
 
         if (mdd_is_immutable(src_obj) || mdd_is_append(src_obj))
@@ -1132,7 +1152,7 @@ static int __mdd_finish_unlink(const struct lu_context *ctxt,
         if (rc == 0 && ma->ma_attr.la_nlink == 0) {
                 if (atomic_read(&obj->mod_count) == 0) {
                         mdd_set_dead_obj(obj);
-                        if (S_ISREG(mdd_object_type(ctxt, obj))) {
+                        if (S_ISREG(mdd_object_type(obj))) {
                                 rc = __mdd_lmm_get(ctxt, obj, ma);
                                 if (ma->ma_valid & MA_LOV)
                                         rc = mdd_unlink_log(ctxt,
@@ -1160,7 +1180,7 @@ static int mdd_unlink_sanity_check(const struct lu_context *ctxt,
         if (rc)
                 RETURN(rc);
 
-        if (S_ISDIR(mdd_object_type(ctxt, cobj)) &&
+        if (S_ISDIR(mdd_object_type(cobj)) &&
             dt_try_as_dir(ctxt, dt_cobj)) {
                 rc = mdd_dir_is_empty(ctxt, cobj);
                 if (rc != 0)
@@ -1307,7 +1327,7 @@ static int mdd_rename_sanity_check(const struct lu_context *ctxt,
         int rc = 0, src_is_dir, tgt_is_dir;
         ENTRY;
 
-        src_is_dir = S_ISDIR(mdd_object_type(ctxt, sobj));
+        src_is_dir = S_ISDIR(mdd_object_type(sobj));
         rc = mdd_may_delete(ctxt, src_pobj, sobj, src_is_dir);
         if (rc)
                 GOTO(out, rc);
@@ -1329,7 +1349,7 @@ static int mdd_rename_sanity_check(const struct lu_context *ctxt,
         if (rc)
                 GOTO(out, rc);
 
-        tgt_is_dir = S_ISDIR(mdd_object_type(ctxt, tobj));
+        tgt_is_dir = S_ISDIR(mdd_object_type(tobj));
         if (tgt_is_dir && mdd_dir_is_empty(ctxt, tobj))
                 GOTO(out, rc = -ENOTEMPTY);
 out:
@@ -1348,7 +1368,7 @@ static int mdd_rename(const struct lu_context *ctxt, struct md_object *src_pobj,
         struct mdd_object *mdd_sobj = mdd_object_find(ctxt, mdd, lf);
         struct mdd_object *mdd_tobj = NULL;
         struct thandle *handle;
-        int is_dir = S_ISDIR(mdd_object_type(ctxt, mdd_sobj));
+        int is_dir = S_ISDIR(mdd_object_type(mdd_sobj));
         int rc;
         ENTRY;
 
@@ -1419,7 +1439,7 @@ static int mdd_lookup(const struct lu_context *ctxt, struct md_object *pobj,
         if (mdd_is_dead_obj(mdd_obj))
                 RETURN(-ESTALE);
         mdd_read_lock(ctxt, mdd_obj);
-        if (S_ISDIR(mdd_object_type(ctxt, mdd_obj)) && dt_try_as_dir(ctxt, dir))
+        if (S_ISDIR(mdd_object_type(mdd_obj)) && dt_try_as_dir(ctxt, dir))
                 rc = dir->do_index_ops->dio_lookup(ctxt, dir, rec, key);
         else
                 rc = -ENOTDIR;
@@ -2004,7 +2024,7 @@ static int mdd_readpage(const struct lu_context *ctxt, struct md_object *obj,
         next = mdd_object_child(mdd_obj);
 
         mdd_read_lock(ctxt, mdd_obj);
-        if (S_ISDIR(mdd_object_type(ctxt, mdd_obj)) &&
+        if (S_ISDIR(mdd_object_type(mdd_obj)) &&
             dt_try_as_dir(ctxt, next))
                 rc = next->do_ops->do_readpage(ctxt, next, rdpg);
         else
index 502b7f0..d5ddd1d 100644 (file)
@@ -64,6 +64,7 @@ struct mdd_thread_info {
         struct lu_attr    mti_la;
         struct lu_attr    mti_la_for_fix;
         struct lov_mds_md mti_lmm;
+        struct obd_info   mti_oi;
 };
 
 int mdd_init_obd(const struct lu_context *ctxt, struct mdd_device *mdd,
@@ -81,7 +82,8 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                    const struct md_create_spec *spec, struct lu_attr *la);
 
 int mdd_get_md(const struct lu_context *ctxt, struct mdd_object *obj,
-               void *md, int *md_size, int need_locked);
+               void *md, int *md_size, int need_locked, const char *name);
+
 int mdd_unlink_log(const struct lu_context *ctxt, struct mdd_device *mdd,
                    struct mdd_object *mdd_cobj, struct md_attr *ma);
 
@@ -158,8 +160,7 @@ static inline const struct lu_fid *mdo2fid(const struct mdd_object *obj)
         return lu_object_fid(&obj->mod_obj.mo_lu);
 }
 
-static inline umode_t mdd_object_type(const struct lu_context *ctxt,
-                                      const struct mdd_object *obj)
+static inline umode_t mdd_object_type(const struct mdd_object *obj)
 {
         return lu_object_attr(&obj->mod_obj.mo_lu);
 }
index 0ba0347..da99d7b 100644 (file)
@@ -73,19 +73,23 @@ static int mdd_lov_update(struct obd_device *host,
 int mdd_init_obd(const struct lu_context *ctxt, struct mdd_device *mdd,
                  char *dev)
 {
-        struct lustre_cfg_bufs bufs;
+        struct lustre_cfg_bufs *bufs;
         struct lustre_cfg      *lcfg;
         struct obd_device      *obd;
         int rc;
         ENTRY;
 
-        lustre_cfg_bufs_reset(&bufs, MDD_OBD_NAME);
-        lustre_cfg_bufs_set_string(&bufs, 1, MDD_OBD_TYPE);
-        lustre_cfg_bufs_set_string(&bufs, 2, MDD_OBD_UUID);
-        lustre_cfg_bufs_set_string(&bufs, 3, (char*)dev/*MDD_OBD_PROFILE*/);
-        lustre_cfg_bufs_set_string(&bufs, 4, (char*)dev);
-
-        lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
+        OBD_ALLOC_PTR(bufs);
+        if (!bufs)
+                RETURN(-ENOMEM);
+        lustre_cfg_bufs_reset(bufs, MDD_OBD_NAME);
+        lustre_cfg_bufs_set_string(bufs, 1, MDD_OBD_TYPE);
+        lustre_cfg_bufs_set_string(bufs, 2, MDD_OBD_UUID);
+        lustre_cfg_bufs_set_string(bufs, 3, (char*)dev/*MDD_OBD_PROFILE*/);
+        lustre_cfg_bufs_set_string(bufs, 4, (char*)dev);
+
+        lcfg = lustre_cfg_new(LCFG_ATTACH, bufs);
+        OBD_FREE_PTR(bufs);
         if (!lcfg)
                 RETURN(-ENOMEM);
 
@@ -118,7 +122,7 @@ lcfg_cleanup:
 
 int mdd_fini_obd(const struct lu_context *ctxt, struct mdd_device *mdd)
 {
-        struct lustre_cfg_bufs bufs;
+        struct lustre_cfg_bufs *bufs;
         struct lustre_cfg      *lcfg;
         struct obd_device      *obd;
         int rc;
@@ -126,9 +130,13 @@ int mdd_fini_obd(const struct lu_context *ctxt, struct mdd_device *mdd)
 
         obd = mdd2obd_dev(mdd);
         LASSERT(obd);
-
-        lustre_cfg_bufs_reset(&bufs, MDD_OBD_NAME);
-        lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
+        
+        OBD_ALLOC_PTR(bufs);
+        if (!bufs)
+                RETURN(-ENOMEM);
+        lustre_cfg_bufs_reset(bufs, MDD_OBD_NAME);
+        lcfg = lustre_cfg_new(LCFG_ATTACH, bufs);
+        OBD_FREE_PTR(bufs);
         if (!lcfg)
                 RETURN(-ENOMEM);
 
@@ -146,7 +154,7 @@ lcfg_cleanup:
 }
 
 int mdd_get_md(const struct lu_context *ctxt, struct mdd_object *obj,
-               void *md, int *md_size, int need_locked)
+               void *md, int *md_size, int need_locked, const char *name)
 {
         struct dt_object *next;
         int rc = 0;
@@ -155,8 +163,7 @@ int mdd_get_md(const struct lu_context *ctxt, struct mdd_object *obj,
         if (need_locked)
                 mdd_read_lock(ctxt, obj);
         next = mdd_object_child(obj);
-        rc = next->do_ops->do_xattr_get(ctxt, next, md, *md_size,
-                                        MDS_LOV_MD_NAME);
+        rc = next->do_ops->do_xattr_get(ctxt, next, md, *md_size, name);
         /*
          * XXX: handling of -ENODATA, the right way is to have ->do_md_get()
          * exported by dt layer.
@@ -188,9 +195,7 @@ static int mdd_lov_set_stripe_md(const struct lu_context *ctxt,
         int rc;
         ENTRY;
 
-        LASSERT(S_ISDIR(mdd_object_type(ctxt, obj)) ||
-                S_ISREG(mdd_object_type(ctxt, obj)));
-
+        LASSERT(S_ISDIR(mdd_object_type(obj)) || S_ISREG(mdd_object_type(obj)));
         rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE, lov_exp, 0, &lsm, lmmp);
         if (rc)
                 RETURN(rc);
@@ -212,7 +217,7 @@ static int mdd_lov_set_dir_md(const struct lu_context *ctxt,
         ENTRY;
 
         /*TODO check permission*/
-        LASSERT(S_ISDIR(mdd_object_type(ctxt, obj)));
+        LASSERT(S_ISDIR(mdd_object_type(obj)));
         lum = (struct lov_user_md*)lmmp;
 
         /* if { size, offset, count } = { 0, -1, 0 } (i.e. all default
@@ -241,7 +246,7 @@ int mdd_lov_set_md(const struct lu_context *ctxt, struct mdd_object *pobj,
         umode_t mode;
         ENTRY;
 
-        mode = mdd_object_type(ctxt, child);
+        mode = mdd_object_type(child);
         if (S_ISREG(mode) && lmm_size > 0) {
                 if (set_stripe) {
                         rc = mdd_lov_set_stripe_md(ctxt, child, lmmp, lmm_size,
@@ -255,7 +260,8 @@ int mdd_lov_set_md(const struct lu_context *ctxt, struct mdd_object *pobj,
                         struct lov_mds_md *lmm = &mdd_ctx_info(ctxt)->mti_lmm;
                         int size = sizeof(lmm);
                         /*Get parent dir stripe and set*/
-                        rc = mdd_get_md(ctxt, pobj, &lmm, &size, 0);
+                        rc = mdd_get_md(ctxt, pobj, &lmm, &size, 0, 
+                                        MDS_LOV_MD_NAME);
                         if (rc > 0) {
                                 rc = mdd_xattr_set_txn(ctxt, child, lmm, size,
                                                MDS_LOV_MD_NAME, 0, handle);
@@ -283,50 +289,6 @@ static obd_id mdd_lov_create_id(const struct lu_fid *fid)
         return ((fid_seq(fid) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(fid));
 }
 
-/*FIXME: it is just the helper function used by mdd lov obd to
- * get attr from obdo, copied from obdo_from_inode*/
-static void obdo_from_la(struct obdo *dst, struct lu_attr *la, obd_flag valid)
-{
-        obd_flag newvalid = 0;
-
-        if (valid & OBD_MD_FLATIME) {
-                dst->o_atime = la->la_atime;
-                newvalid |= OBD_MD_FLATIME;
-        }
-        if (valid & OBD_MD_FLMTIME) {
-                dst->o_mtime = la->la_mtime;
-                newvalid |= OBD_MD_FLMTIME;
-        }
-        if (valid & OBD_MD_FLCTIME) {
-                dst->o_ctime = la->la_ctime;
-                newvalid |= OBD_MD_FLCTIME;
-        }
-        if (valid & OBD_MD_FLSIZE) {
-                dst->o_size = la->la_size;
-                newvalid |= OBD_MD_FLSIZE;
-        }
-        if (valid & OBD_MD_FLBLOCKS) {  /* allocation of space (x512 bytes) */
-                dst->o_blocks = la->la_blocks;
-                newvalid |= OBD_MD_FLBLOCKS;
-        }
-        if (valid & OBD_MD_FLTYPE) {
-                dst->o_mode = (la->la_mode & S_IALLUGO)|(la->la_mode & S_IFMT);
-                newvalid |= OBD_MD_FLTYPE;
-        }
-        if (valid & OBD_MD_FLMODE) {
-                dst->o_mode = (la->la_mode & S_IFMT)|(la->la_mode & S_IALLUGO);
-                newvalid |= OBD_MD_FLMODE;
-        }
-        if (valid & OBD_MD_FLUID) {
-                dst->o_uid = la->la_uid;
-                newvalid |= OBD_MD_FLUID;
-        }
-        if (valid & OBD_MD_FLGID) {
-                dst->o_gid = la->la_gid;
-                newvalid |= OBD_MD_FLGID;
-        }
-        dst->o_valid |= newvalid;
-}
 
 int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                    struct mdd_object *parent, struct mdd_object *child,
@@ -336,7 +298,6 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
         struct obd_device       *obd = mdd2obd_dev(mdd);
         struct obd_export       *lov_exp = obd->u.mds.mds_osc_exp;
         struct obdo             *oa;
-        struct obd_info          oinfo = { { { 0 } } };
         struct lov_stripe_md    *lsm = NULL;
         const void              *eadata = spec->u.sp_ea.eadata;
 /*      int                      eadatasize  = spec->u.sp_ea.eadatalen;*/
@@ -381,7 +342,7 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                                 GOTO(out_oa, rc = -ENOMEM);
 
                         rc = mdd_get_md(ctxt, parent, __lmm,
-                                        &returned_lmm_size, 1);
+                                        &returned_lmm_size, 1, MDS_LOV_MD_NAME);
                         if (rc > 0)
                                 rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE,
                                                    lov_exp, 0, &lsm, __lmm);
@@ -412,6 +373,10 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
          *attr is in charged by OST.
          */
         if (la->la_size && la->la_valid & LA_SIZE) {
+                struct obd_info          *oinfo = &mdd_ctx_info(ctxt)->mti_oi;
+
+                memset(oinfo, 0, sizeof(*oinfo));
+
                 oa->o_size = la->la_size;
                 obdo_from_la(oa, la, OBD_MD_FLTYPE | OBD_MD_FLATIME |
                                 OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLSIZE);
@@ -422,10 +387,10 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                 oa->o_fid = lu_object_fid(mdd2lu_obj(child))->f_seq;
                 oa->o_generation = lu_object_fid(mdd2lu_obj(child))->f_oid;
                 oa->o_valid |= OBD_MD_FLFID | OBD_MD_FLGENER;
-                oinfo.oi_oa = oa;
-                oinfo.oi_md = lsm;
+                oinfo->oi_oa = oa;
+                oinfo->oi_md = lsm;
 
-                rc = obd_setattr(lov_exp, &oinfo, NULL);
+                rc = obd_setattr(lov_exp, oinfo, NULL);
                 if (rc) {
                         CERROR("error setting attrs for "DFID": rc %d\n",
                                PFID(mdo2fid(child)), rc);
index adbb812..bba781a 100644 (file)
@@ -582,6 +582,7 @@ static int mdt_readpage(struct mdt_thread_info *info)
          * reqbody->nlink contains number bytes to read.
          */
         rdpg->rp_hash = reqbody->size;
+        rdpg->rp_hash_end = -1;
         if ((__u64)rdpg->rp_hash != reqbody->size) {
                 CERROR("Invalid hash: %#llx != %#llx\n",
                        (__u64)rdpg->rp_hash, reqbody->size);
index a92977c..d0ec149 100644 (file)
@@ -195,6 +195,51 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid)
 }
 EXPORT_SYMBOL(obdo_from_inode);
 
+/*FIXME: Just copy from obdo_from_inode*/
+void obdo_from_la(struct obdo *dst, struct lu_attr *la, obd_flag valid)
+{
+        obd_flag newvalid = 0;
+
+        if (valid & OBD_MD_FLATIME) {
+                dst->o_atime = la->la_atime;
+                newvalid |= OBD_MD_FLATIME;
+        }
+        if (valid & OBD_MD_FLMTIME) {
+                dst->o_mtime = la->la_mtime;
+                newvalid |= OBD_MD_FLMTIME;
+        }
+        if (valid & OBD_MD_FLCTIME) {
+                dst->o_ctime = la->la_ctime;
+                newvalid |= OBD_MD_FLCTIME;
+        }
+        if (valid & OBD_MD_FLSIZE) {
+                dst->o_size = la->la_size;
+                newvalid |= OBD_MD_FLSIZE;
+        }
+        if (valid & OBD_MD_FLBLOCKS) {  /* allocation of space (x512 bytes) */
+                dst->o_blocks = la->la_blocks;
+                newvalid |= OBD_MD_FLBLOCKS;
+        }
+        if (valid & OBD_MD_FLTYPE) {
+                dst->o_mode = (la->la_mode & S_IALLUGO)|(la->la_mode & S_IFMT);
+                newvalid |= OBD_MD_FLTYPE;
+        }
+        if (valid & OBD_MD_FLMODE) {
+                dst->o_mode = (la->la_mode & S_IFMT)|(la->la_mode & S_IALLUGO);
+                newvalid |= OBD_MD_FLMODE;
+        }
+        if (valid & OBD_MD_FLUID) {
+                dst->o_uid = la->la_uid;
+                newvalid |= OBD_MD_FLUID;
+        }
+        if (valid & OBD_MD_FLGID) {
+                dst->o_gid = la->la_gid;
+                newvalid |= OBD_MD_FLGID;
+        }
+        dst->o_valid |= newvalid;
+}
+EXPORT_SYMBOL(obdo_from_la);
+
 void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid)
 {
         valid &= src->o_valid;
index 3ec5457..8170f86 100644 (file)
@@ -1071,7 +1071,7 @@ static int osd_xattr_del(const struct lu_context *ctxt, struct dt_object *dt,
 static int osd_dir_page_build(const struct lu_context *ctx, int first,
                               void *area, int nob,
                               struct dt_it_ops  *iops, struct dt_it *it,
-                              __u32 *start, __u32 *end,
+                              __u32 *start, __u32 *end, __u32 hash_end,
                               struct lu_dirent **last)
 {
         int result;
@@ -1082,6 +1082,7 @@ static int osd_dir_page_build(const struct lu_context *ctx, int first,
         if (first) {
                 area += sizeof (struct lu_dirpage);
                 nob  -= sizeof (struct lu_dirpage);
+                
         }
 
         LASSERT(nob > sizeof *ent);
@@ -1116,6 +1117,8 @@ static int osd_dir_page_build(const struct lu_context *ctx, int first,
                         *last = ent;
                         ent = (void *)ent + recsize;
                         nob -= recsize;
+                        if (hash >= hash_end)
+                                break;
                         result = iops->next(ctx, it);
                 } else {
                         /*
@@ -1181,7 +1184,8 @@ static int osd_readpage(const struct lu_context *ctxt,
                         rc = osd_dir_page_build(ctxt, !i, kmap(pg),
                                                 min_t(int, nob, CFS_PAGE_SIZE),
                                                 iops, it,
-                                                &hash_start, &hash_end, &last);
+                                                &hash_start, &hash_end, 
+                                                rdpg->rp_hash_end, &last);
                         if (rc != 0 || i == rdpg->rp_npages - 1)
                                 last->lde_reclen = 0;
                         kunmap(pg);
@@ -1374,8 +1378,6 @@ static int osd_index_lookup(const struct lu_context *ctxt, struct dt_object *dt,
                             struct dt_rec *rec, const struct dt_key *key)
 {
         struct osd_object *obj = osd_dt_obj(dt);
-
-
         int rc;
 
         ENTRY;