Whamcloud - gitweb
Revert "b=19427 correct lmm_object_id and reserve fids for fid-on-OST."
[fs/lustre-release.git] / lustre / obdclass / linux / linux-obdo.c
index 775f6c0..9126027 100644 (file)
@@ -65,7 +65,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid)
 
         if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
                 CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
-                       valid, LTIME_S(src->i_mtime), 
+                       valid, LTIME_S(src->i_mtime),
                        LTIME_S(src->i_ctime));
 
         if (valid & OBD_MD_FLATIME) {
@@ -182,21 +182,15 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid)
 
         if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(dst->i_atime))
                 LTIME_S(dst->i_atime) = src->o_atime;
-
-        /* mtime is always updated with ctime, but can be set in past.
-           As write and utime(2) may happen within 1 second, and utime's
-           mtime has a priority over write's one, leave mtime from mds 
-           for the same ctimes. */
-        if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(dst->i_ctime)) {
+        if (valid & OBD_MD_FLMTIME && src->o_mtime > LTIME_S(dst->i_mtime))
+                LTIME_S(dst->i_mtime) = src->o_mtime;
+        if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(dst->i_ctime))
                 LTIME_S(dst->i_ctime) = src->o_ctime;
-                if (valid & OBD_MD_FLMTIME)
-                        LTIME_S(dst->i_mtime) = src->o_mtime;
-        }
         if (valid & OBD_MD_FLSIZE)
                 i_size_write(dst, src->o_size);
         /* optimum IO size */
         if (valid & OBD_MD_FLBLKSZ && src->o_blksize > (1 << dst->i_blkbits)) {
-                dst->i_blkbits = ffs(src->o_blksize) - 1;
+                dst->i_blkbits = cfs_ffs(src->o_blksize) - 1;
 #ifdef HAVE_INODE_BLKSIZE
                 dst->i_blksize = src->o_blksize;
 #endif
@@ -211,6 +205,10 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid)
 
         /* allocation of space */
         if (valid & OBD_MD_FLBLOCKS && src->o_blocks > dst->i_blocks)
+                /*
+                 * XXX shouldn't overflow be checked here like in
+                 * obdo_to_inode().
+                 */
                 dst->i_blocks = src->o_blocks;
 }
 EXPORT_SYMBOL(obdo_refresh_inode);
@@ -240,7 +238,7 @@ void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
 
         }
         if (valid & OBD_MD_FLBLKSZ) {
-                dst->i_blkbits = ffs(src->o_blksize)-1;
+                dst->i_blkbits = cfs_ffs(src->o_blksize)-1;
 #ifdef HAVE_INODE_BLKSIZE
                 dst->i_blksize = src->o_blksize;
 #endif