Whamcloud - gitweb
Branch: b_new_cmd
authorwangdi <wangdi>
Sat, 12 Aug 2006 09:32:01 +0000 (09:32 +0000)
committerwangdi <wangdi>
Sat, 12 Aug 2006 09:32:01 +0000 (09:32 +0000)
1) fix bit in mdd/mdt/osd after separate LA from ATTR.
2) set blksize after create data object
3) some cleanup

lustre/include/lu_object.h
lustre/mdd/mdd_handler.c
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_lov.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_lib.c
lustre/osd/osd_handler.c

index 3a622ad..efc8541 100644 (file)
@@ -334,18 +334,20 @@ enum lu_object_flags {
  */
 /* valid flags */
 enum la_valid {
-        LA_ATIME  = OBD_MD_FLATIME,
-        LA_MTIME  = OBD_MD_FLMTIME,
-        LA_CTIME  = OBD_MD_FLCTIME,
-        LA_SIZE   = OBD_MD_FLSIZE,
-        LA_BLOCKS = OBD_MD_FLBLOCKS,
-        LA_MODE   = OBD_MD_FLMODE,
-        LA_TYPE   = OBD_MD_FLTYPE,
-        LA_UID    = OBD_MD_FLUID,
-        LA_GID    = OBD_MD_FLGID,
-        LA_FLAGS  = OBD_MD_FLFLAGS,
-        LA_NLINK  = OBD_MD_FLNLINK,
-        LA_RDEV   = OBD_MD_FLRDEV,
+        /*mapped ATTR flag*/
+        LA_ATIME = 1 << 0,
+        LA_MTIME = 1 << 1,
+        LA_CTIME = 1 << 2,
+        LA_SIZE  = 1 << 3,
+        LA_MODE  = 1 << 4,
+        LA_UID   = 1 << 5,
+        LA_GID   = 1 << 6,
+        LA_BLOCKS = 1 << 7,
+        LA_TYPE   = 1 << 8,
+        LA_FLAGS  = 1 << 9,
+        LA_NLINK  = 1 << 10,
+        LA_RDEV   = 1 << 11,
+        LA_BLKSIZE = 1 << 12,
 };
 
 struct lu_attr {
@@ -360,6 +362,8 @@ struct lu_attr {
         __u32          la_flags;  /* object flags */
         __u32          la_nlink;  /* number of persistent references to this
                                    * object */
+        __u32          la_blksize; /* blk size of the object*/
+
         __u32          la_rdev;   /* real device */
         __u64          la_valid;  /* valid bits */
 };
index a604112..828352b 100644 (file)
@@ -86,16 +86,16 @@ static struct lu_object *mdd_object_alloc(const struct lu_context *ctxt,
                                           const struct lu_object_header *hdr,
                                           struct lu_device *d)
 {
-        struct mdd_object *mdo;
+        struct mdd_object *mdd_obj;
 
-        OBD_ALLOC_PTR(mdo);
-        if (mdo != NULL) {
+        OBD_ALLOC_PTR(mdd_obj);
+        if (mdd_obj != NULL) {
                 struct lu_object *o;
                
-                o = mdd2lu_obj(mdo);
+                o = mdd2lu_obj(mdd_obj);
                 lu_object_init(o, NULL, d);
-                mdo->mod_obj.mo_ops = &mdd_obj_ops;
-                mdo->mod_obj.mo_dir_ops = &mdd_dir_ops;
+                mdd_obj->mod_obj.mo_ops = &mdd_obj_ops;
+                mdd_obj->mod_obj.mo_dir_ops = &mdd_dir_ops;
                 o->lo_ops = &mdd_lu_obj_ops;
                 return o;
         } else {
@@ -533,7 +533,7 @@ static int __mdd_object_create(const struct lu_context *ctxt,
         RETURN(rc);
 }
 
-static int __mdd_attr_set(const struct lu_context *ctxt, struct mdd_object *o,
+int mdd_attr_set_internal(const struct lu_context *ctxt, struct mdd_object *o,
                           const struct lu_attr *attr, struct thandle *handle)
 {
         struct dt_object *next;
@@ -560,7 +560,7 @@ static int __mdd_xattr_set(const struct lu_context *ctxt, struct mdd_object *o,
 static int mdd_attr_set(const struct lu_context *ctxt,
                         struct md_object *obj, const struct md_attr *ma)
 {
-        struct mdd_object *mdo = md2mdd_obj(obj);
+        struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct mdd_device *mdd = mdo2mdd(obj);
         struct thandle *handle;
         int  rc;
@@ -571,18 +571,18 @@ static int mdd_attr_set(const struct lu_context *ctxt,
         if (IS_ERR(handle))
                 RETURN(PTR_ERR(handle));
 
-        mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
 
-        rc = __mdd_attr_set(ctxt, md2mdd_obj(obj), &ma->ma_attr, handle);
+        rc = mdd_attr_set_internal(ctxt, mdd_obj, &ma->ma_attr, handle);
         if (rc == 0 && (ma->ma_valid & MA_LOV)) {
                 /* set LOV ea now */
-                rc = __mdd_xattr_set(ctxt, md2mdd_obj(obj),
+                rc = __mdd_xattr_set(ctxt, mdd_obj,
                                      ma->ma_lmm, ma->ma_lmm_size,
                                      XATTR_NAME_LOV, 0, handle);
         }
         /* XXX: llog cancel cookie? */
 
-        mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
         mdd_trans_stop(ctxt, mdd, handle);
 
         RETURN(rc);
@@ -592,14 +592,14 @@ int mdd_xattr_set_txn(const struct lu_context *ctxt, struct md_object *obj,
                       const void *buf, int buf_len, const char *name, int fl,
                       struct thandle *handle)
 {
-        struct mdd_object *mdo = md2mdd_obj(obj);
+        struct mdd_object *mdd_obj = md2mdd_obj(obj);
         int  rc;
         ENTRY;
 
-        mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
-        rc = __mdd_xattr_set(ctxt, md2mdd_obj(obj), buf, buf_len, name,
+        mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
+        rc = __mdd_xattr_set(ctxt, mdd_obj, buf, buf_len, name,
                              fl, handle);
-        mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
 
         RETURN(rc);
 }
@@ -638,7 +638,7 @@ static int __mdd_xattr_del(const struct lu_context *ctxt,struct mdd_device *mdd,
 int mdd_xattr_del(const struct lu_context *ctxt, struct md_object *obj,
                   const char *name)
 {
-        struct mdd_object *mdo = md2mdd_obj(obj);
+        struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct mdd_device *mdd = mdo2mdd(obj);
         struct thandle *handle;
         int  rc;
@@ -649,9 +649,9 @@ int mdd_xattr_del(const struct lu_context *ctxt, struct md_object *obj,
         if (IS_ERR(handle))
                 RETURN(PTR_ERR(handle));
 
-        mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
         rc = __mdd_xattr_del(ctxt, mdd, md2mdd_obj(obj), name, handle);
-        mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
 
         mdd_trans_stop(ctxt, mdd, handle);
 
@@ -1049,21 +1049,21 @@ cleanup:
 static int mdd_lookup(const struct lu_context *ctxt, struct md_object *pobj,
                       const char *name, struct lu_fid* fid)
 {
-        struct mdd_object   *mdo = md2mdd_obj(pobj);
-        struct dt_object    *dir = mdd_object_child(mdo);
+        struct mdd_object   *mdd_obj = md2mdd_obj(pobj);
+        struct dt_object    *dir = mdd_object_child(mdd_obj);
         struct dt_rec       *rec    = (struct dt_rec *)fid;
         const struct dt_key *key = (const struct dt_key *)name;
         int rc;
         ENTRY;
 
-        if (mdd_is_dead_obj(mdo))
+        if (mdd_is_dead_obj(mdd_obj))
                 RETURN(-ESTALE);
-        mdd_lock(ctxt, mdo, DT_READ_LOCK);
-        if (S_ISDIR(mdd_object_type(mdo)) && dt_try_as_dir(ctxt, dir))
+        mdd_lock(ctxt, mdd_obj, DT_READ_LOCK);
+        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;
-        mdd_unlock(ctxt, mdo, DT_READ_LOCK);
+        mdd_unlock(ctxt, mdd_obj, DT_READ_LOCK);
         RETURN(rc);
 }
 
@@ -1072,8 +1072,7 @@ static int __mdd_object_initialize(const struct lu_context *ctxt,
                                    struct mdd_object *child,
                                    struct md_attr *ma, struct thandle *handle)
 {
-        struct dt_object *dt_parent = mdd_object_child(parent);
-        struct dt_object *dt_child = mdd_object_child(child);
+        struct lu_attr   *la = &mdd_ctx_info(ctxt)->mti_la;
         int               rc;
         ENTRY;
 
@@ -1082,19 +1081,18 @@ static int __mdd_object_initialize(const struct lu_context *ctxt,
          *  (1) the valid bits should be converted between Lustre and Linux;
          *  (2) maybe, the child attributes should be set in OSD when creation.
          */
-        ma->ma_attr.la_valid = LA_UID|LA_GID|LA_ATIME|LA_MTIME|LA_CTIME;
-        rc = dt_child->do_ops->do_attr_set(ctxt, dt_child,
-                                           &ma->ma_attr, handle);
+       
+        rc = mdd_attr_set_internal(ctxt, child, &ma->ma_attr, handle); 
         if (rc != 0)
                 RETURN(rc);
 
-        ma->ma_attr.la_valid = LA_MTIME|LA_CTIME;
-        rc = dt_parent->do_ops->do_attr_set(ctxt, dt_parent,
-                                            &ma->ma_attr, handle);
+        la->la_valid = LA_MTIME|LA_CTIME;
+        la->la_atime = ma->ma_attr.la_atime;
+        la->la_ctime = ma->ma_attr.la_ctime;
+        rc = mdd_attr_set_internal(ctxt, parent, la, handle);
         if (rc != 0)
                 RETURN(rc);
 
-
         if (S_ISDIR(ma->ma_attr.la_mode)) {
                 /* add . and .. for newly created dir */
                 __mdd_ref_add(ctxt, child, handle);
@@ -1127,7 +1125,7 @@ static int mdd_create_data(const struct lu_context *ctxt,
                            struct md_attr *ma)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
-        struct mdd_object *mdo = md2mdd_obj(pobj);
+        struct mdd_object *mdd_pobj = md2mdd_obj(pobj);
         struct mdd_object *son = md2mdd_obj(cobj);
         struct lu_attr    *attr = &ma->ma_attr;
         struct lov_mds_md *lmm = NULL;
@@ -1141,10 +1139,11 @@ static int mdd_create_data(const struct lu_context *ctxt,
         if (IS_ERR(handle))
                 RETURN(PTR_ERR(handle));
 
-        rc = mdd_lov_create(ctxt, mdd, mdo, son, &lmm, &lmm_size, spec, attr);
+        rc = mdd_lov_create(ctxt, mdd, mdd_pobj, son, &lmm, &lmm_size, spec, 
+                            attr);
         if (rc == 0) {
                 rc = mdd_lov_set_md(ctxt, pobj, cobj, lmm,
-                                    lmm_size, attr->la_mode, handle);
+                                    lmm_size, attr, handle);
                 if (rc == 0)
                         rc = mdd_attr_get(ctxt, cobj, ma);
         }
@@ -1211,7 +1210,7 @@ static int mdd_create(const struct lu_context *ctxt, struct md_object *pobj,
                       struct md_attr* ma)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
-        struct mdd_object *mdo = md2mdd_obj(pobj);
+        struct mdd_object *mdd_pobj = md2mdd_obj(pobj);
         struct mdd_object *son = md2mdd_obj(child);
         struct lu_attr *attr = &ma->ma_attr;
         struct lov_mds_md *lmm = NULL;
@@ -1226,7 +1225,7 @@ static int mdd_create(const struct lu_context *ctxt, struct md_object *pobj,
         /* no RPC inside the transaction, so OST objects should be created at
          * first */
         if (S_ISREG(attr->la_mode)) {
-                rc = mdd_lov_create(ctxt, mdd, mdo, son, &lmm, &lmm_size,
+                rc = mdd_lov_create(ctxt, mdd, mdd_pobj, son, &lmm, &lmm_size,
                                     spec, attr);
                 if (rc)
                         RETURN(rc);
@@ -1237,7 +1236,7 @@ static int mdd_create(const struct lu_context *ctxt, struct md_object *pobj,
         if (IS_ERR(handle))
                 RETURN(PTR_ERR(handle));
 
-        mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_lock(ctxt, mdd_pobj, DT_WRITE_LOCK);
 
         /*
          * XXX check that link can be added to the parent in mkdir case.
@@ -1287,7 +1286,7 @@ static int mdd_create(const struct lu_context *ctxt, struct md_object *pobj,
 
         created = 1;
 
-        rc = __mdd_object_initialize(ctxt, mdo, son, ma, handle);
+        rc = __mdd_object_initialize(ctxt, mdd_pobj, son, ma, handle);
         if (rc)
                 /*
                  * Object has no links, so it will be destroyed when last
@@ -1295,15 +1294,14 @@ static int mdd_create(const struct lu_context *ctxt, struct md_object *pobj,
                  */
                 GOTO(cleanup, rc);
 
-        rc = __mdd_index_insert(ctxt, mdo, lu_object_fid(&child->mo_lu),
+        rc = __mdd_index_insert(ctxt, mdd_pobj, lu_object_fid(&child->mo_lu),
                                 name, handle);
 
         if (rc)
                 GOTO(cleanup, rc);
 
         inserted = 1;
-        rc = mdd_lov_set_md(ctxt, pobj, child, lmm, lmm_size, attr->la_mode,
-                            handle);
+        rc = mdd_lov_set_md(ctxt, pobj, child, lmm, lmm_size, attr, handle);
         if (rc) {
                 CERROR("error on stripe info copy %d \n", rc);
                 GOTO(cleanup, rc);
@@ -1329,7 +1327,7 @@ cleanup:
                 int rc2 = 0;
 
                 if (inserted) {
-                        rc2 = __mdd_index_delete(ctxt, mdo, name, handle);
+                        rc2 = __mdd_index_delete(ctxt, mdd_pobj, name, handle);
                         if (rc2)
                                 CERROR("error can not cleanup destroy %d\n",
                                        rc2);
@@ -1339,7 +1337,7 @@ cleanup:
         }
         if (lmm)
                 OBD_FREE(lmm, lmm_size);
-        mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_unlock(ctxt, mdd_pobj, DT_WRITE_LOCK);
         mdd_trans_stop(ctxt, mdd, handle);
         RETURN(rc);
 }
@@ -1376,7 +1374,7 @@ static int mdd_name_insert(const struct lu_context *ctxt,
                            const char *name, const struct lu_fid *fid)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
-        struct mdd_object *mdo = md2mdd_obj(pobj);
+        struct mdd_object *mdd_obj = md2mdd_obj(pobj);
         struct thandle *handle;
         int rc;
         ENTRY;
@@ -1386,11 +1384,11 @@ static int mdd_name_insert(const struct lu_context *ctxt,
         if (IS_ERR(handle))
                 RETURN(PTR_ERR(handle));
 
-        mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
 
-        rc = __mdd_index_insert(ctxt, mdo, fid, name, handle);
+        rc = __mdd_index_insert(ctxt, mdd_obj, fid, name, handle);
 
-        mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
         mdd_trans_stop(ctxt, mdd, handle);
         RETURN(rc);
 }
@@ -1400,7 +1398,7 @@ static int mdd_name_remove(const struct lu_context *ctxt,
                            const char *name)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
-        struct mdd_object *mdo = md2mdd_obj(pobj);
+        struct mdd_object *mdd_obj = md2mdd_obj(pobj);
         struct thandle *handle;
         int rc;
         ENTRY;
@@ -1410,11 +1408,11 @@ static int mdd_name_remove(const struct lu_context *ctxt,
         if (IS_ERR(handle))
                 RETURN(PTR_ERR(handle));
 
-        mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
 
-        rc = __mdd_index_delete(ctxt, mdo, name, handle);
+        rc = __mdd_index_delete(ctxt, mdd_obj, name, handle);
 
-        mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
+        mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
 
         mdd_trans_stop(ctxt, mdd, handle);
         RETURN(rc);
@@ -1579,18 +1577,18 @@ static int mdd_readpage(const struct lu_context *ctxt, struct md_object *obj,
                         const struct lu_rdpg *rdpg)
 {
         struct dt_object *next;
-        struct mdd_object *mdd = md2mdd_obj(obj);
+        struct mdd_object *mdd_obj = md2mdd_obj(obj);
         int rc;
 
-        LASSERT(lu_object_exists(ctxt, mdd2lu_obj(md2mdd_obj(obj))));
-        next = mdd_object_child(md2mdd_obj(obj));
+        LASSERT(lu_object_exists(ctxt, mdd2lu_obj(mdd_obj)));
+        next = mdd_object_child(mdd_obj);
 
-        mdd_lock(ctxt, mdd, DT_READ_LOCK);
-        if (S_ISDIR(mdd_object_type(mdd)) && dt_try_as_dir(ctxt, next))
+        mdd_lock(ctxt, mdd_obj, DT_READ_LOCK);
+        if (S_ISDIR(mdd_object_type(mdd_obj)) && dt_try_as_dir(ctxt, next))
                 rc = next->do_ops->do_readpage(ctxt, next, rdpg);
         else
                 rc = -ENOTDIR;
-        mdd_unlock(ctxt, mdd, DT_READ_LOCK);
+        mdd_unlock(ctxt, mdd_obj, DT_READ_LOCK);
         return rc;
 }
 
index 8e65eaf..c355615 100644 (file)
@@ -66,7 +66,7 @@ int mdd_xattr_set_txn(const struct lu_context *ctxt, struct md_object *obj,
                       struct thandle *txn);
 int mdd_lov_set_md(const struct lu_context *ctxt, struct md_object *pobj,
                    struct md_object *child, struct lov_mds_md *lmm,
-                   int lmm_size, int mode, struct thandle *handle);
+                   int lmm_size, struct lu_attr *la, struct thandle *handle);
 int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                    struct mdd_object *parent, struct mdd_object *child,
                    struct lov_mds_md **lmm, int *lmm_size,
@@ -76,6 +76,10 @@ int mdd_get_md(const struct lu_context *ctxt, struct md_object *obj,
                void *md, int *md_size);
 int mdd_unlink_log(const struct lu_context *ctxt, struct mdd_device *mdd,
                    struct mdd_object *mdd_cobj, struct md_attr *ma);
+
+int mdd_attr_set_internal(const struct lu_context *ctxt, struct mdd_object *o,
+                          const struct lu_attr *attr, struct thandle *handle);
+
 struct mdd_thread_info *mdd_ctx_info(const struct lu_context *ctx);
 
 extern struct lu_device_operations mdd_lu_ops;
index abbc310..647f881 100644 (file)
@@ -297,18 +297,28 @@ int mdd_get_md(const struct lu_context *ctxt, struct md_object *obj,
 
 int mdd_lov_set_md(const struct lu_context *ctxt, struct md_object *pobj,
                    struct md_object *child, struct lov_mds_md *lmmp,
-                   int lmm_size, int mode, struct thandle *handle)
+                   int lmm_size, struct lu_attr *la, struct thandle *handle)
 {
+        struct lu_attr *tmp_la = &mdd_ctx_info(ctxt)->mti_la;
         int rc = 0;
         ENTRY;
 
-        if (S_ISREG(mode) && lmm_size > 0) {
+        LASSERT(la->la_valid & LA_MODE);
+        if (S_ISREG(la->la_mode) && lmm_size > 0) {
                 LASSERT(lmmp != NULL);
                 rc = mdd_xattr_set_txn(ctxt, child, lmmp, lmm_size,
                                        MDS_LOV_MD_NAME, 0, handle);
-                if (rc)
+                if (rc) {
                         CERROR("error on set stripe info: rc = %d\n", rc);
-        } else  if (S_ISDIR(mode)) {
+                        RETURN(rc);
+                }
+                if (la->la_valid & LA_BLKSIZE) {
+                        tmp_la->la_valid = LA_BLKSIZE;
+                        tmp_la->la_blksize = la->la_blksize;
+                        rc = mdd_attr_set_internal(ctxt, md2mdd_obj(child), tmp_la,
+                                              handle);
+                }
+        } else  if (S_ISDIR(la->la_mode)) {
                 struct lov_mds_md *lmm = &mdd_ctx_info(ctxt)->mti_lmm;
                 int size = sizeof(lmm);
                 rc = mdd_get_md(ctxt, pobj, &lmm, &size);
@@ -460,7 +470,7 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
          *The Nonzero(truncated) size should tell ost. since size 
          *attr is in charged by OST.
          */
-        if (la->la_size) {
+        if (la->la_size && la->la_valid & LA_SIZE) {
                 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);
@@ -484,8 +494,9 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                         GOTO(out_oa, rc);
                 }
         }
-        /*set blksize after create data object*/
-        la->la_valid |= OBD_MD_FLBLKSZ | OBD_MD_FLEASIZE;
+        /*blksize should be changed after create data object*/
+        la->la_valid |= LA_BLKSIZE;
+        la->la_blksize = oa->o_blksize;
 
         rc = obd_packmd(lov_exp, lmm, lsm);
         if (rc < 0) {
index 91a9883..65447f5 100644 (file)
@@ -171,14 +171,14 @@ static int mdt_statfs(struct mdt_thread_info *info)
 void mdt_pack_attr2body(struct mdt_body *b, const struct lu_attr *attr,
                         const struct lu_fid *fid)
 {
+        /*XXX should pack the reply body according to lu_valid*/
         b->valid |= OBD_MD_FLCTIME | OBD_MD_FLUID   |
                     OBD_MD_FLGID   | OBD_MD_FLTYPE  |
                     OBD_MD_FLMODE  | OBD_MD_FLNLINK | OBD_MD_FLFLAGS |
                     OBD_MD_FLATIME | OBD_MD_FLMTIME ; /* added by huanghua */
 
         if (!S_ISREG(attr->la_mode))
-                b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLATIME |
-                            OBD_MD_FLMTIME| OBD_MD_FLRDEV;
+                b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLRDEV;
 
         b->atime      = attr->la_atime;
         b->mtime      = attr->la_mtime;
index 355e670..d0797b0 100644 (file)
@@ -162,7 +162,6 @@ static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr)
                 CERROR("Unknown attr bits: %#llx\n", in);
         return out;
 }
-
 /* unpacking */
 static int mdt_setattr_unpack(struct mdt_thread_info *info)
 {
@@ -228,6 +227,8 @@ static int mdt_create_unpack(struct mdt_thread_info *info)
                 attr->la_ctime = rec->cr_time;
                 attr->la_mtime = rec->cr_time;
                 attr->la_atime = rec->cr_time;
+                attr->la_valid = LA_MODE | LA_RDEV | LA_UID | LA_GID |
+                                 LA_CTIME | LA_MTIME | LA_ATIME; 
                 info->mti_spec.sp_cr_flags = rec->cr_flags;
 
                 rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
@@ -264,7 +265,7 @@ static int mdt_link_unpack(struct mdt_thread_info *info)
                 rr->rr_fid2 = &rec->lk_fid2;
                 attr->la_ctime = rec->lk_time;
                 attr->la_mtime = rec->lk_time;
-
+                attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME;
                 rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
                 if (rr->rr_name == NULL)
                         result = -EFAULT;
@@ -292,6 +293,7 @@ static int mdt_unlink_unpack(struct mdt_thread_info *info)
                 attr->la_mtime = rec->ul_time;
                 attr->la_mode  = rec->ul_mode;
 
+                attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME | LA_MODE;
                 rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
                 if (rr->rr_name == NULL)
                         result = -EFAULT;
@@ -317,7 +319,7 @@ static int mdt_rename_unpack(struct mdt_thread_info *info)
                 rr->rr_fid2 = &rec->rn_fid2;
                 attr->la_ctime = rec->rn_time;
                 attr->la_mtime = rec->rn_time;
-
+                attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME;
                 rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
                 rr->rr_tgt = req_capsule_client_get(pill, &RMF_SYMTGT);
                 if (rr->rr_name == NULL || rr->rr_tgt == NULL)
@@ -347,6 +349,8 @@ static int mdt_open_unpack(struct mdt_thread_info *info)
                 attr->la_ctime = rec->cr_time;
                 attr->la_mtime = rec->cr_time;
                 attr->la_atime = rec->cr_time;
+                attr->la_valid = LA_MODE | LA_RDEV | LA_UID | LA_GID | LA_CTIME
+                                 | LA_MTIME | LA_ATIME;
                 info->mti_spec.sp_cr_flags = rec->cr_flags;
                 rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
                 if (rr->rr_name == NULL)
index e6912b5..eb51eed 100644 (file)
@@ -677,6 +677,9 @@ static int osd_inode_setattr(const struct lu_context *ctx,
                 inode->i_nlink  = attr->la_nlink;
         if (bits & LA_RDEV)
                 inode->i_rdev   = attr->la_rdev;
+        if (bits & LA_BLKSIZE)
+                inode->i_blksize = attr->la_blksize;
+
         if (bits & LA_FLAGS) {
                 /*
                  * Horrible ext3 legacy. Flags are better to be handled in
@@ -1965,6 +1968,10 @@ static int osd_fid_lookup(const struct lu_context *ctx,
 static int osd_inode_getattr(const struct lu_context *ctx,
                              struct inode *inode, struct lu_attr *attr)
 {
+        attr->la_valid      |= LA_ATIME | LA_MTIME | LA_CTIME | LA_MODE |
+                               LA_SIZE | LA_BLOCKS | LA_UID | LA_GID | 
+                               LA_FLAGS | LA_NLINK | LA_RDEV | LA_BLKSIZE;
+        
         attr->la_atime      = LTIME_S(inode->i_atime);
         attr->la_mtime      = LTIME_S(inode->i_mtime);
         attr->la_ctime      = LTIME_S(inode->i_ctime);
@@ -1976,6 +1983,7 @@ static int osd_inode_getattr(const struct lu_context *ctx,
         attr->la_flags      = inode->i_flags;
         attr->la_nlink      = inode->i_nlink;
         attr->la_rdev       = inode->i_rdev;
+        attr->la_blksize    = inode->i_blksize;
         return 0;
 }