Whamcloud - gitweb
(1) remove MD_ATTR_FLAGS. this is set by LA_FLAGS;
authorhuanghua <huanghua>
Mon, 14 Aug 2006 10:51:28 +0000 (10:51 +0000)
committerhuanghua <huanghua>
Mon, 14 Aug 2006 10:51:28 +0000 (10:51 +0000)
(2) atime/mtime/ctime typo in OSD;
(3) use our new valid bits in MDD entirely;
(4) some other small fixes;

lustre/include/md_object.h
lustre/mdd/mdd_handler.c
lustre/mdd/mdd_lov.c
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_open.c
lustre/osd/osd_handler.c
lustre/tests/utime.c

index 242993b..8c8b089 100644 (file)
@@ -68,8 +68,7 @@ enum md_attr_flags {
         MD_ATIME_SET      = 1 << 0,
         MD_MTIME_SET      = 1 << 1,
         MD_CTIME_SET      = 1 << 2,
-        MD_ATTR_FLAG      = 1 << 3, 
-        MD_ATTR_RAW       = 1 << 4
+        MD_ATTR_RAW       = 1 << 3
 };
 
 /* additional parameters for create */
index d9dbc50..47c9041 100644 (file)
@@ -604,23 +604,22 @@ static int __mdd_xattr_set(const struct lu_context *ctxt, struct mdd_object *o,
 int mdd_fix_attr(const struct lu_context *ctxt, struct mdd_object *obj,
                  const struct md_attr *ma)
 {
-        time_t now = CURRENT_SECONDS;
-        struct lu_attr *la = (struct lu_attr *)&ma->ma_attr;
-        struct lu_attr *tmp_la = &mdd_ctx_info(ctxt)->mti_la;
+        struct lu_attr   *la = (struct lu_attr*)&ma->ma_attr;
+        struct lu_attr   *tmp_la = &mdd_ctx_info(ctxt)->mti_la;
         struct dt_object *next = mdd_object_child(obj);
-        int rc = 0;
+        time_t            now = CURRENT_SECONDS;
+        int               rc = 0;
         ENTRY;
 
         rc = next->do_ops->do_attr_get(ctxt, next, tmp_la);
         if (rc)
                 RETURN(rc);
 
-        if (!(ma->ma_attr_flags & ATTR_CTIME_SET))
+        if (!(ma->ma_attr_flags & MD_CTIME_SET))
                 la->la_ctime = now;
-        
-        if (!(ma->ma_attr_flags & ATTR_ATIME_SET))
+        if (!(ma->ma_attr_flags & MD_ATIME_SET))
                 la->la_atime = now;
-        if (!(ma->ma_attr_flags & ATTR_MTIME_SET))
+        if (!(ma->ma_attr_flags & MD_MTIME_SET))
                 la->la_mtime = now;
 
         /*XXX Check permission */
@@ -652,7 +651,7 @@ int mdd_fix_attr(const struct lu_context *ctxt, struct mdd_object *obj,
                         la->la_uid = tmp_la->la_uid;
                 if (la->la_gid == (gid_t) -1)
                         la->la_gid = tmp_la->la_gid;
-                if (!(la->la_valid & ATTR_MODE))
+                if (!(la->la_valid & LA_MODE))
                         la->la_mode = tmp_la->la_mode;
                 /*
                  * If the user or group of a non-directory has been
@@ -734,9 +733,7 @@ static int mdd_attr_set(const struct lu_context *ctxt,
         rc = mdd_fix_attr(ctxt, mdd_obj, ma);
         if (rc)
                 GOTO(cleanup, rc);
-        if (ma->ma_attr_flags & MD_ATTR_FLAG) {  /* ioctl */
-                rc = -ENOTSUPP;
-        } else if (ma->ma_attr.la_valid) {            /* setattr */
+        if (ma->ma_attr.la_valid) {            /* setattr */
                 mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
                 rc = mdd_attr_set_internal(ctxt, mdd_obj, &ma->ma_attr, handle);
                 mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
index cc31a5c..4ecdee3 100644 (file)
@@ -387,7 +387,7 @@ int mdd_lov_set_md(const struct lu_context *ctxt, struct mdd_object *pobj,
                        rc = mdd_lov_set_dir_md(ctxt, child, lmmp, lmm_size, handle);
                 }
         }
-        CDEBUG(D_INFO, "Set lov md %p size %d for fid "DFID" rc%d/n",
+        CDEBUG(D_INFO, "Set lov md %p size %d for fid "DFID" rc%d\n",
                         lmmp, lmm_size, PFID(mdo2fid(child)), rc);
         RETURN(rc);
 }
index 8d08e09..821e9f9 100644 (file)
@@ -149,6 +149,8 @@ static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr,
                 out |= LA_MTIME;
         if (in & ATTR_CTIME)
                 out |= LA_CTIME;
+        if (in & ATTR_ATTR_FLAG)
+                out |= LA_FLAGS;
 
         if (in & ATTR_FROM_OPEN)
                 rr->rr_flags |= MRF_SETATTR_LOCKED;
@@ -162,9 +164,6 @@ static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr,
         if (in & ATTR_MTIME_SET)
                 ma->ma_attr_flags |= MD_MTIME_SET;
 
-        if (in & ATTR_ATTR_FLAG)
-                ma->ma_attr_flags |= MD_ATTR_FLAG;
-
         if (in & ATTR_RAW)
                 ma->ma_attr_flags |= MD_ATTR_RAW;
 
index 86ab3a4..19fd034 100644 (file)
@@ -462,8 +462,9 @@ int mdt_reint_open(struct mdt_thread_info *info)
 
 finish_open:
         if (result != 0 && created) {
+                int rc2;
                 ma->ma_need = 0;
-                int rc2 = mdo_unlink(info->mti_ctxt, mdt_object_child(parent),
+                rc2 = mdo_unlink(info->mti_ctxt, mdt_object_child(parent),
                                      mdt_object_child(child), rr->rr_name,
                                      &info->mti_attr);
                 if (rc2 != 0)
index f8508aa..3436bd7 100644 (file)
@@ -645,9 +645,9 @@ static int osd_inode_setattr(const struct lu_context *ctx,
         if (bits & LA_ATIME)
                 inode->i_atime  = *osd_inode_time(ctx, inode, attr->la_atime);
         if (bits & LA_CTIME)
-                inode->i_atime  = *osd_inode_time(ctx, inode, attr->la_ctime);
+                inode->i_ctime  = *osd_inode_time(ctx, inode, attr->la_ctime);
         if (bits & LA_MTIME)
-                inode->i_atime  = *osd_inode_time(ctx, inode, attr->la_mtime);
+                inode->i_mtime  = *osd_inode_time(ctx, inode, attr->la_mtime);
         if (bits & LA_SIZE)
                 inode->i_size   = attr->la_size;
         if (bits & LA_BLOCKS)
index e05090e..be94e55 100644 (file)
@@ -90,9 +90,9 @@ int main(int argc, char *argv[])
        }
 
        if (st.st_atime != utb.actime ) {
-               fprintf(stderr, "%s: bad utime mtime %lu should be  %lu\n",
+               fprintf(stderr, "%s: bad utime atime %lu should be  %lu\n",
                        prog, st.st_atime, utb.actime);
-               return 7;
+               return 8;
        }
 
        printf("%s: good utime mtimes %lu, atime %lu\n",